Skip to content

Commit 0a6d76f

Browse files
committed
1 parent 1d7c9a3 commit 0a6d76f

File tree

3 files changed

+10
-5
lines changed

3 files changed

+10
-5
lines changed

runtime/C/src/antlr3commontree.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -528,7 +528,7 @@ getParent (pANTLR3_BASE_TREE tree)
528528
static void
529529
setParent (pANTLR3_BASE_TREE tree, pANTLR3_BASE_TREE parent)
530530
{
531-
((pANTLR3_COMMON_TREE)(tree->super))->parent = parent == NULL ? NULL : ((pANTLR3_COMMON_TREE)(parent->super))->parent;
531+
((pANTLR3_COMMON_TREE)(tree->super))->parent = parent == NULL ? NULL : ((pANTLR3_COMMON_TREE)(parent->super));
532532
}
533533

534534
static void

tool/src/main/resources/org/antlr/codegen/templates/C/ASTTreeParser.stg

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ ADAPTOR->addChild(ADAPTOR, root_<treeLevel>, <label>_tree);
209209

210210
matchRuleBlockSet(s,label,terminalOptions,elementIndex,postmatchCode,treeLevel="0") ::= <<
211211
<matchSet(...)>
212-
<noRewrite()> <! set return tree !>
212+
<noRewrite(...)> <! set return tree !>
213213
>>
214214

215215
matchSetBang(s,label,terminalOptions,elementIndex,postmatchCode) ::= <<
@@ -319,7 +319,7 @@ if ( <actions.(actionScope).synpredgate> ) {<\n>
319319
}
320320
<endif>
321321
<ruleDescriptor.allTokenRefsInAltsWithRewrites
322-
:{if (stream_<it> != NULL) stream_<it>->free(stream_<it>);}; separator="\n">
322+
:{it | if (stream_<it> != NULL) stream_<it>->free(stream_<it>);}; separator="\n">
323323
<ruleDescriptor.allRuleRefsInAltsWithRewrites
324-
:{if (stream_<it> != NULL) stream_<it>->free(stream_<it>);}; separator="\n">
324+
:{it | if (stream_<it> != NULL) stream_<it>->free(stream_<it>);}; separator="\n">
325325
>>

tool/src/main/resources/org/antlr/codegen/templates/C/C.stg

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2132,7 +2132,9 @@ else
21322132
<if(LEXER)>
21332133
LRECOVER();
21342134
<else>
2135+
<! use following code to make it recover inline;
21352136
RECOVERFROMMISMATCHEDSET(&FOLLOW_set_in_<ruleName><elementIndex>);
2137+
!>
21362138
<endif>
21372139
goto rule<ruleDescriptor.name>Ex;
21382140
}<\n>
@@ -2143,7 +2145,10 @@ CONSTRUCTEX();
21432145
EXCEPTION->type = ANTLR3_MISMATCHED_SET_EXCEPTION;
21442146
EXCEPTION->name = (void *)ANTLR3_MISMATCHED_SET_NAME;
21452147
<if(PARSER)>
2148+
EXCEPTION->expectingSet = NULL;
2149+
<! use following code to make it recover inline;
21462150
EXCEPTION->expectingSet = &FOLLOW_set_in_<ruleName><elementIndex>;
2151+
!>
21472152
<endif>
21482153
>>
21492154

@@ -2510,7 +2515,7 @@ static const ANTLR3_INT32 dfa<dfa.decisionNumber>_T<i0>[] =
25102515
*/
25112516
static const ANTLR3_INT32 * const dfa<dfa.decisionNumber>_transitions[] =
25122517
{
2513-
<dfa.transitionEdgeTables:{xref|dfa<dfa.decisionNumber>_T<xref>}; separator=", ", wrap="\n", null="_empty">
2518+
<dfa.transitionEdgeTables:{xref|dfa<dfa.decisionNumber>_T<xref>}; separator=", ", wrap="\n", null="NULL">
25142519
};
25152520

25162521
<if(dfa.specialStateSTs)>

0 commit comments

Comments
 (0)