diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2019-08-18 22:12:48 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2019-08-18 22:12:48 -0700 |
commit | c38f93bc7f763ae776c7e68de120faea169d7f05 (patch) | |
tree | 7ccbd05c64a9a6f21562be107c8c8935f2dd6430 /parser.y | |
parent | 564fd080c753f20ce16c321c6ff94ae28a468df4 (diff) | |
download | txr-c38f93bc7f763ae776c7e68de120faea169d7f05.tar.gz txr-c38f93bc7f763ae776c7e68de120faea169d7f05.tar.bz2 txr-c38f93bc7f763ae776c7e68de120faea169d7f05.zip |
parser: #; notation shouldn't intern symbols.
When #; is used to ignore an object, parsing that object
shouldn't cause symbols to be interned, nor errors about
unknown packages.
* parser.y (ifnign): New macro.
(i_expr, n_expr): For SYMTOK, don't call symhlpr when parsing
under ignore flag. Just yield nil as the semantic value.
Diffstat (limited to 'parser.y')
-rw-r--r-- | parser.y | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -81,6 +81,7 @@ int yyparse(scanner_t *, parser_t *); #define symhlpr(lexeme, meta_allowed) sym_helper(parser, lexeme, meta_allowed) #define yyerr(msg) yyerror(scnr, parser, msg) #define yybadtok(tok, context) yybadtoken(parser, tok, context) +#define ifnign(expr) (parser->ignore ? nil : (expr)) INLINE val expand_forms_ver(val forms, int ver) { @@ -950,7 +951,7 @@ r_exprs : n_expr { val exprs = cons($1, nil); $$ = term_atom_cons; } ; -i_expr : SYMTOK { $$ = symhlpr($1, t); } +i_expr : SYMTOK { $$ = ifnign(symhlpr($1, t)); } | METANUM { $$ = cons(var_s, cons($1, nil)); rl($$, num(parser->lineno)); } | NUMBER { $$ = $1; } @@ -989,7 +990,7 @@ i_expr : SYMTOK { $$ = symhlpr($1, t); } i_dot_expr : '.' i_expr { $$ = uref_helper(parser, $2); } | i_expr %prec LOW { $$ = $1; } ; -n_expr : SYMTOK { $$ = symhlpr($1, t); } +n_expr : SYMTOK { $$ = ifnign(symhlpr($1, t)); } | METANUM { $$ = cons(var_s, cons($1, nil)); rl($$, num(parser->lineno)); } | NUMBER { $$ = $1; } |