diff options
author | John Wiegley <johnw@newartisans.com> | 2007-04-19 14:47:33 +0000 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2008-04-13 03:38:27 -0400 |
commit | c5214c87594e0de68111a9160dba5dc1aceb9a43 (patch) | |
tree | 41419220704bb48e79d506cee4d12cb3e35fdc69 /scantime.ll | |
parent | 53c132ad98caf765eaba51fe4c5a85e4a69ddf06 (diff) | |
download | fork-ledger-c5214c87594e0de68111a9160dba5dc1aceb9a43.tar.gz fork-ledger-c5214c87594e0de68111a9160dba5dc1aceb9a43.tar.bz2 fork-ledger-c5214c87594e0de68111a9160dba5dc1aceb9a43.zip |
Changed date parser to use lex/yacc.
Diffstat (limited to 'scantime.ll')
-rw-r--r-- | scantime.ll | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/scantime.ll b/scantime.ll new file mode 100644 index 00000000..02d00d78 --- /dev/null +++ b/scantime.ll @@ -0,0 +1,29 @@ +%option c++ 8bit + +%{ +#define YYSTYPE struct ledger::intorchar + +extern int yywrap(); + +#include "times.h" +#include "parsetime.h" + +extern YYSTYPE yylval; +%} + +shortmon (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) +longmon (January|February|March|April|May|June|July|August|September|October|November|December) + +%% + +[ \t] return TOK_SPACE; +[\r\n] ; + +[0-9]{4} yylval = ledger::intorchar(std::atoi(yytext)); return TOK_FOURNUM; +[0-9]{2} yylval = ledger::intorchar(std::atoi(yytext)); return TOK_TWONUM; +[0-9]{1} yylval = ledger::intorchar(std::atoi(yytext)); return TOK_ONENUM; + +{shortmon} yylval = ledger::intorchar(yytext); return TOK_MONTH; +{longmon} yylval = ledger::intorchar(yytext); return TOK_MONTH; + +. return (int) yytext[0]; |