summaryrefslogtreecommitdiffstats
path: root/parser.y
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2021-05-01 05:15:44 -0700
committerKaz Kylheku <kaz@kylheku.com>2021-05-01 05:15:44 -0700
commit42339b4608afc933ba87de057f22a1dffe15354e (patch)
tree45b19425066fb4a1bbd3c7299e41f72d60f3b863 /parser.y
parent56b399c523ee9066b09b056396c16315903ae559 (diff)
downloadtxr-42339b4608afc933ba87de057f22a1dffe15354e.tar.gz
txr-42339b4608afc933ba87de057f22a1dffe15354e.tar.bz2
txr-42339b4608afc933ba87de057f22a1dffe15354e.zip
parser: gc bug.
* parser.y (set_syntax_tree): New static function. Uses GC-correct assignment via set macro. (spec): Call set_syntax_tree instead of raw assignments to parser->syntax_tree, which violate GC rules. * y.tab.c.shipped: Regenerated.
Diffstat (limited to 'parser.y')
-rw-r--r--parser.y15
1 files changed, 11 insertions, 4 deletions
diff --git a/parser.y b/parser.y
index 98c2aa5c..3c51b69d 100644
--- a/parser.y
+++ b/parser.y
@@ -52,6 +52,7 @@
#include "buf.h"
#include "parser.h"
+static void set_syntax_tree(parser_t *parser, val tree);
static val sym_helper(parser_t *parser, wchar_t *lexeme, val meta_allowed);
static val repeat_rep_helper(val sym, val args, val main, val parts);
static void process_catch_exprs(val exprs);
@@ -170,13 +171,14 @@ INLINE val expand_form_ver(val form, int ver)
%%
-spec : clauses_opt { parser->syntax_tree = $1; }
- | SECRET_ESCAPE_R regexpr { parser->syntax_tree = $2; end_of_regex(scnr); }
+spec : clauses_opt { set_syntax_tree(parser, $1); }
+ | SECRET_ESCAPE_R regexpr { set_syntax_tree(parser, $2);
+ end_of_regex(scnr); }
| SECRET_ESCAPE_E hash_semi_or_n_expr
- { parser->syntax_tree = $2; YYACCEPT; }
+ { set_syntax_tree(parser, $2); YYACCEPT; }
byacc_fool { internal_error("notreached"); }
| SECRET_ESCAPE_I hash_semi_or_i_expr
- { parser->syntax_tree = $2; YYACCEPT; }
+ { set_syntax_tree(parser, $2); YYACCEPT; }
byacc_fool { internal_error("notreached"); }
| SECRET_ESCAPE_E { if (yychar == YYEOF) {
parser->syntax_tree = nao;
@@ -1396,6 +1398,11 @@ void yydebug_onoff(int val)
#endif
}
+static void set_syntax_tree(parser_t *parser, val tree)
+{
+ set(mkloc(parser->syntax_tree, parser->parser), tree);
+}
+
static val sym_helper(parser_t *parser, wchar_t *lexeme, val meta_allowed)
{
scanner_t *scnr = parser->scanner;