diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2013-12-06 08:47:36 -0800 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2013-12-06 08:47:36 -0800 |
commit | b55fa7a69f286149092cd25902871019c6795b9d (patch) | |
tree | 7022e5b7b5221194c2c06aa86a74a693e079ad3e /parser.y | |
parent | b26f98511a911537fef73a1925df6d91a7829b6e (diff) | |
download | txr-b55fa7a69f286149092cd25902871019c6795b9d.tar.gz txr-b55fa7a69f286149092cd25902871019c6795b9d.tar.bz2 txr-b55fa7a69f286149092cd25902871019c6795b9d.zip |
* eval.c (eval_init): Update registration of regex-compile
to reflect that it has two arguments now.
* parser.y (grammar): Update calls to regex_compile to
pass two arguments. Since we don't expect regex_compile to
parse, we specify the error stream as nil.
(spec): The "secret syntax" for a regex is simplified
not to include the slashes. This provides better diagnostics for
unterminated syntax and requires less string processing to generate.
Also, the form returned doesn't have the regex symbol
consed onto it, which parse_regex just throws away.
* regex.c (regex_compile): Now takes a stream argument.
* regex.h (regex_compile): Declaration updated.
* txr.1: Updated
Diffstat (limited to 'parser.y')
-rw-r--r-- | parser.y | 10 |
1 files changed, 5 insertions, 5 deletions
@@ -114,7 +114,7 @@ static val parsed_spec; spec : clauses { parsed_spec = $1; } | /* empty */ { parsed_spec = nil; } - | SECRET_ESCAPE_R regex { parsed_spec = $2; } + | SECRET_ESCAPE_R regexpr { parsed_spec = $2; end_of_regex(); } | error '\n' { parsed_spec = nil; if (errors >= 8) YYABORT; @@ -320,12 +320,12 @@ text : TEXT { $$ = rl(string_own($1), num(lineno)); } | SPACE { if ($1[0] == ' ' && $1[1] == 0) { val spaces = list(oneplus_s, chr(' '), nao); - $$ = cons(regex_compile(spaces), spaces); + $$ = cons(regex_compile(spaces, nil), spaces); rl($$, num(lineno)); free($1); } else { $$ = rl(string_own($1), num(lineno)); }} - | regex { $$ = cons(regex_compile(rest($1)), + | regex { $$ = cons(regex_compile(rest($1), nil), rest($1)); rl($$, num(lineno)); } ; @@ -652,7 +652,7 @@ var_op : '*' { $$ = list(t, nao); } ; modifiers : NUMBER { $$ = cons($1, nil); } - | regex { $$ = cons(cons(regex_compile(rest($1)), + | regex { $$ = cons(cons(regex_compile(rest($1), nil), rest($1)), nil); rlcp($$, $1); } | list { $$ = cons($1, nil); } @@ -742,7 +742,7 @@ expr : IDENT { $$ = rl(intern(string_own($1), nil), | vector { $$ = $1; } | hash { $$ = $1; } | meta_expr { $$ = $1; } - | lisp_regex { $$ = cons(regex_compile(rest($1)), + | lisp_regex { $$ = cons(regex_compile(rest($1), nil), rest($1)); rlcp($$, $1); } | chrlit { $$ = rl($1, num(lineno)); } |