Hi All,
I'm trying to add some basic NLP to my web-based reporting application and PEG looks like the best way to go. I've come up with the following syntactical tree for requesting reports, but I'm not great with RegEx and wondered about the best way to accept date/times in the following formats:-
yyyy-dd-mm
yy-dd-mm
dd/mm/yyyy hh:mm:ss
dd/mm/yyyy hh:mm
dd/mm/yyyy
hh:mm
Any help greatly appreciated....
Cheers,
Paul
start
= item+
item
= action object target date
action
= action:('find'/'report'/'compare'/'stdev') ? __ { return {action:action}; }
object
= object:('extn'/'extension'/'trunk'/'console') _ { return {object:object}; }
target
= exp:[a-zA-Z0-9]+ __ ? { return {target:exp.join('')}; }
date
= date:('today'/'yesterday'/'last week'/'this week'/'last month'/'this month') __ ? { return {date:date}; }
// optional whitespace
_ = [ \t\r\n]*
// mandatory whitespace or delimitation
__ = [ \t\r\n,;"or"]+