summaryrefslogtreecommitdiffstats
path: root/parser.y
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2010-01-19 15:16:28 -0800
committerKaz Kylheku <kaz@kylheku.com>2010-01-19 15:16:28 -0800
commit7c6391bb10adc88d156ec88148184bc3eb8681ce (patch)
tree45752f1a9de6da1ab2584c5cb10d1044e0e82ce4 /parser.y
parent1b29c92e9c0e92f73aab633d59d3417a1f6c405b (diff)
downloadtxr-7c6391bb10adc88d156ec88148184bc3eb8681ce.tar.gz
txr-7c6391bb10adc88d156ec88148184bc3eb8681ce.tar.bz2
txr-7c6391bb10adc88d156ec88148184bc3eb8681ce.zip
More regex grammar work.
Diffstat (limited to 'parser.y')
-rw-r--r--parser.y3
1 files changed, 2 insertions, 1 deletions
diff --git a/parser.y b/parser.y
index cb9d320f..b2745c2f 100644
--- a/parser.y
+++ b/parser.y
@@ -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); }