diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2015-08-12 20:35:04 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2015-08-12 20:35:04 -0700 |
commit | 80023f287c52876b82af43027dd4605ab939d006 (patch) | |
tree | 74fba3604b31bd2c80541503ed698257515630c0 /parser.y | |
parent | b29e871f63bb13278220ade37209c9b11a3d64d6 (diff) | |
download | txr-80023f287c52876b82af43027dd4605ab939d006.tar.gz txr-80023f287c52876b82af43027dd4605ab939d006.tar.bz2 txr-80023f287c52876b82af43027dd4605ab939d006.zip |
Use new pushback token priming for single regex parse.
* parser.h (enum prime_parser): New enum.
(prime_parser, prime_scanner, parse): Declarations updated with new
argument.
* parser.c (prime_parser): New argument of enum prime_parser type
Select appropriate secret token for regex and Lisp case. Pass prime
selector down to prime_scanner.
(regex_parse): Do not prepend secret escape to string. Do not use
parse_once function; instead do the parser init and cleanup here and
use the parse function.
(lisp_parse): Pass new argument to parse, configuring the parser to be
primed for Lisp parsing.
* parser.l (grammar): Rule producing SECRET_ESCAPE_R removed.
(prime_scanner): New argument. Pop the scanner state down to INITIAL.
Then unconditionally switch to appopriate state based on priming
configuration.
* parser.y (parse): New argument for priming selection, passed down to
prime parser.
Diffstat (limited to 'parser.y')
-rw-r--r-- | parser.y | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -1478,14 +1478,14 @@ int parse_once(val stream, val name, parser_t *parser) return res; } -int parse(parser_t *parser, val name) +int parse(parser_t *parser, val name, enum prime_parser prim) { int res; parser->errors = 0; parser->prepared_msg = nil; parser->syntax_tree = nil; - prime_parser(parser, name); + prime_parser(parser, name, prim); res = yyparse(parser->scanner, parser); |