summaryrefslogtreecommitdiffstats
path: root/parser.y
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2019-08-18 22:12:48 -0700
committerKaz Kylheku <kaz@kylheku.com>2019-08-18 22:12:48 -0700
commitc38f93bc7f763ae776c7e68de120faea169d7f05 (patch)
tree7ccbd05c64a9a6f21562be107c8c8935f2dd6430 /parser.y
parent564fd080c753f20ce16c321c6ff94ae28a468df4 (diff)
downloadtxr-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.y5
1 files changed, 3 insertions, 2 deletions
diff --git a/parser.y b/parser.y
index 1cf2d30a..bc3488f5 100644
--- a/parser.y
+++ b/parser.y
@@ -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; }