diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2010-01-19 15:16:28 -0800 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2010-01-19 15:16:28 -0800 |
commit | 7c6391bb10adc88d156ec88148184bc3eb8681ce (patch) | |
tree | 45752f1a9de6da1ab2584c5cb10d1044e0e82ce4 /parser.y | |
parent | 1b29c92e9c0e92f73aab633d59d3417a1f6c405b (diff) | |
download | txr-7c6391bb10adc88d156ec88148184bc3eb8681ce.tar.gz txr-7c6391bb10adc88d156ec88148184bc3eb8681ce.tar.bz2 txr-7c6391bb10adc88d156ec88148184bc3eb8681ce.zip |
More regex grammar work.
Diffstat (limited to 'parser.y')
-rw-r--r-- | parser.y | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -451,7 +451,6 @@ expr : IDENT { $$ = intern(string_own($1), nil); } ; regex : '/' regexpr '/' { $$ = $2; end_of_regex(); } - | '/' '/' { $$ = nil; end_of_regex(); } | '/' error { $$ = nil; yybadtoken(yychar, lit("regex")); end_of_regex(); } @@ -463,10 +462,12 @@ regexpr : regbranch { $$ = if3(cdr($1), | regexpr '|' regexpr { $$ = list(or_s, $1, $3, nao); } | regexpr '&' regexpr { $$ = list(and_s, $1, $3, nao); } | '~' regexpr { $$ = list(compl_s, $2, nao); } + | /* empty */ %prec LOW { $$ = nil; } ; regbranch : regterm %prec LOW { $$ = cons($1, nil); } | regterm regbranch { $$ = cons($1, $2); } + | regterm '~' regexpr { $$ = list($1, list(compl_s, $3, nao), nao); } ; regterm : regterm '*' { $$ = list(zeroplus_s, $1, nao); } |