summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2021-05-04 07:35:44 -0700
committerKaz Kylheku <kaz@kylheku.com>2021-05-04 07:35:44 -0700
commitead648be4fb522068ced1b8e574b371b55e078a5 (patch)
tree0d9a26ddd0314f589127fd74837348ab6b1cdd54
parent4028588f456a2ffcfc6904d63795aa6606daebb5 (diff)
downloadtxr-ead648be4fb522068ced1b8e574b371b55e078a5.tar.gz
txr-ead648be4fb522068ced1b8e574b371b55e078a5.tar.bz2
txr-ead648be4fb522068ced1b8e574b371b55e078a5.zip
parser: fix regression in #; syntax.
A crash has showed up when processing commented-out objects. This is due to the most recent gc fix to the parser. * parser.y (set_syntax_tree): Avoid the set macro when tree has the special value nao (not an object). * y.tab.c.shipped: Regenerated. * y.tab.h.shipped: Likewise.
-rw-r--r--parser.y5
-rw-r--r--y.tab.c.shipped5
-rw-r--r--y.tab.h.shipped2
3 files changed, 9 insertions, 3 deletions
diff --git a/parser.y b/parser.y
index 3c51b69d..875a808e 100644
--- a/parser.y
+++ b/parser.y
@@ -1400,7 +1400,10 @@ void yydebug_onoff(int val)
static void set_syntax_tree(parser_t *parser, val tree)
{
- set(mkloc(parser->syntax_tree, parser->parser), tree);
+ if (tree == nao)
+ parser->syntax_tree = tree;
+ else
+ set(mkloc(parser->syntax_tree, parser->parser), tree);
}
static val sym_helper(parser_t *parser, wchar_t *lexeme, val meta_allowed)
diff --git a/y.tab.c.shipped b/y.tab.c.shipped
index 2df3bdb9..526f2eef 100644
--- a/y.tab.c.shipped
+++ b/y.tab.c.shipped
@@ -6743,7 +6743,10 @@ void yydebug_onoff(int val)
static void set_syntax_tree(parser_t *parser, val tree)
{
- set(mkloc(parser->syntax_tree, parser->parser), tree);
+ if (tree == nao)
+ parser->syntax_tree = tree;
+ else
+ set(mkloc(parser->syntax_tree, parser->parser), tree);
}
static val sym_helper(parser_t *parser, wchar_t *lexeme, val meta_allowed)
diff --git a/y.tab.h.shipped b/y.tab.h.shipped
index 19ec4906..82de207d 100644
--- a/y.tab.h.shipped
+++ b/y.tab.h.shipped
@@ -154,7 +154,7 @@ typedef union YYSTYPE
{
/* Line 2068 of yacc.c */
-#line 106 "parser.y"
+#line 107 "parser.y"
wchar_t *lexeme;
union obj *val;