summaryrefslogtreecommitdiffstats
path: root/parser.y
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2010-01-06 15:34:36 -0800
committerKaz Kylheku <kaz@kylheku.com>2010-01-06 15:34:36 -0800
commit18fa11c511ba1b600b43b7196d72f732e4f3ccf5 (patch)
treef428b32e259b9981c1ab6472d90edbb57947d85a /parser.y
parentf70f76d6e8ada0e386c3708673eafa2e8abb8ca8 (diff)
downloadtxr-18fa11c511ba1b600b43b7196d72f732e4f3ccf5.tar.gz
txr-18fa11c511ba1b600b43b7196d72f732e4f3ccf5.tar.bz2
txr-18fa11c511ba1b600b43b7196d72f732e4f3ccf5.zip
Some fine tuning in regex grammar.
Diffstat (limited to 'parser.y')
-rw-r--r--parser.y4
1 files changed, 2 insertions, 2 deletions
diff --git a/parser.y b/parser.y
index 51386217..cc0815c8 100644
--- a/parser.y
+++ b/parser.y
@@ -449,7 +449,6 @@ expr : IDENT { $$ = intern(string_own($1), nil); }
;
regex : '/' regexpr '/' { $$ = $2; }
- | '/' '/' { $$ = nil; }
| '/' error { $$ = nil;
yybadtoken(yychar, lit("regex")); }
;
@@ -459,10 +458,12 @@ regexpr : regbranch { $$ = $1; }
$3, nao), nao); }
| regexpr '&' regexpr { $$ = list(list(and_s, $1,
$3, nao), nao); }
+ | /* empty */ { $$ = nil; }
;
regbranch : regterm { $$ = cons($1, nil); }
| regterm regbranch { $$ = cons($1, $2); }
+ | '~' regbranch { $$ = cons(cons(compl_s, $2), nil); }
;
regterm : '[' regclass ']' { $$ = cons(set_s, $2); }
@@ -474,7 +475,6 @@ regterm : '[' regclass ']' { $$ = cons(set_s, $2); }
| regterm '*' { $$ = list(zeroplus_s, $1, nao); }
| regterm '+' { $$ = list(oneplus_s, $1, nao); }
| regterm '?' { $$ = list(optional_s, $1, nao); }
- | '~' regterm { $$ = list(compl_s, $2, nao); }
| REGCHAR { $$ = chr($1); }
| '(' regexpr ')' { $$ = cons(compound_s, $2); }
| '(' error { $$ = nil;