diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2015-06-07 20:08:22 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2015-06-07 20:08:22 -0700 |
commit | 76927b80247a348ea92732e0cf15e6beb2d56826 (patch) | |
tree | d928c16fcc8525313d4268784d91f7082b7102a7 /parser.h | |
parent | de547e4ec4e375531ac3d797c3e82ff2544f9464 (diff) | |
download | txr-76927b80247a348ea92732e0cf15e6beb2d56826.tar.gz txr-76927b80247a348ea92732e0cf15e6beb2d56826.tar.bz2 txr-76927b80247a348ea92732e0cf15e6beb2d56826.zip |
* parser.c (stream_parser_hash): New static variable.
(parser_mark): Mark parser and primer members.
(parser, ensure_parser): new argument: primer.
(get_parser_impl, ensure_parser): New static
functions.
(prime_parser): New function.
(lisp_parse): Multiple calls to this function on the same stream
now logically continue the parse, not resetting the line
number to 1.
(parse_init): Initialize and gc-protect stream_parser_hash.
* parser.h (parser_t): New members, primer and parser.
(prime_parser): Declared.
(parser): Declaration updated.
* parser.y (parse): Now responsible for calling prime_parser.
Diffstat (limited to 'parser.h')
-rw-r--r-- | parser.h | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -27,12 +27,14 @@ typedef struct yyguts_t scanner_t; typedef struct { + val parser; cnum lineno; int errors; val stream; val name; val prepared_msg; val syntax_tree; + val primer; scanner_t *scanner; } parser_t; @@ -56,6 +58,7 @@ parser_t *yyget_extra(yyscan_t scanner); void yyset_extra(parser_t *, yyscan_t); void parser_l_init(void); void open_txr_file(val spec_file, val *name, val *stream); +val prime_parser(val parser); int parse_once(val stream, val name, parser_t *parser); int parse(parser_t *parser); val source_loc(val form); @@ -68,5 +71,5 @@ INLINE val rlcp(val to, val from) val rlcp_tree(val to, val from); val regex_parse(val string, val error_stream); val lisp_parse(val source, val error_stream, val error_return_val, val name); -val parser(val stream, val lineno); +val parser(val stream, val lineno, val primer); void parse_init(void); |