diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2010-01-15 16:33:51 -0800 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2010-01-15 16:33:51 -0800 |
commit | 9d24c8a35c07201d3d947332a66cb148af4c24c9 (patch) | |
tree | 6f644109e45b68cad73ed1a8db8710c837243b0a /parser.y | |
parent | 5eab77fcd428e89303521df2830cdc0951672348 (diff) | |
download | txr-9d24c8a35c07201d3d947332a66cb148af4c24c9.tar.gz txr-9d24c8a35c07201d3d947332a66cb148af4c24c9.tar.bz2 txr-9d24c8a35c07201d3d947332a66cb148af4c24c9.zip |
Implemented non-greedy operator.
Diffstat (limited to 'parser.y')
-rw-r--r-- | parser.y | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -80,8 +80,8 @@ static val parsed_spec; %right IDENT TEXT NUMBER %left '^' %left '|' '/' -%left '&' -%right '~' '*' '?' '+' +%left '&' +%right '~' '*' '?' '+' '%' %right '.' '\\' REGCHAR LITCHAR %% @@ -477,6 +477,7 @@ 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 '%' regexpr { $$ = list(nongreedy_s, $1, $3, nao); } | REGCHAR { $$ = chr($1); } | '(' regexpr ')' { $$ = $2; } | '(' error { $$ = nil; @@ -505,6 +506,9 @@ regchar : '?' { $$ = '?'; } | ')' { $$ = ')'; } | '^' { $$ = '^'; } | '|' { $$ = '|'; } + | '~' { $$ = '~'; } + | '&' { $$ = '&'; } + | '%' { $$ = '%'; } | '/' { $$ = '/'; } | REGCHAR { $$ = $1; } ; |