Skip to content

Commit

Permalink
Fixed handling of empty lists when rendering the Python3 generated files
Browse files Browse the repository at this point in the history
  • Loading branch information
pelson committed Oct 30, 2024
1 parent 7a89e15 commit 30218cd
Showing 1 changed file with 10 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ def exit<lname; format="cap">(self, ctx: <file.parserName>.<lname; format="cap">
}; separator="\n">

del <file.parserName>

>>


Expand All @@ -108,6 +109,7 @@ def visit<lname; format="cap">(self, ctx: <file.parserName>.<lname; format="cap"
}; separator="\n">

del <file.parserName>

>>


Expand Down Expand Up @@ -141,19 +143,19 @@ class <parser.name>(<if(superClass)><superClass><else>Parser<endif>):
sharedContextCache = PredictionContextCache()

literalNames = [
<parser.literalNames:{t | <t>}; null="\"\<INVALID>\"", separator=",\n", anchor>,
<parser.literalNames:{t | <t>}; null="\"\<INVALID>\"", separator=",\n", anchor><if(parser.literalNames)>,<endif>
]

symbolicNames = [
<parser.symbolicNames:{t | <t>}; null="\"\<INVALID>\"", separator=",\n", anchor>,
<parser.symbolicNames:{t | <t>}; null="\"\<INVALID>\"", separator=",\n", anchor><if(parser.symbolicNames)>,<endif>
]

<if(parser.rules)>
<parser.rules:{r | RULE_<r.name> = <r.index>}; separator="\n", wrap, anchor>
<endif>

ruleNames = [
<parser.ruleNames:{r | "<r>"}; separator=",\n", wrap, anchor>,
<parser.ruleNames:{r | "<r>"}; separator=",\n", wrap, anchor><if(parser.ruleNames)>,<endif>
]

EOF = <TokenLabelType()>.EOF
Expand Down Expand Up @@ -825,22 +827,21 @@ class <lexer.name>(<if(superClass)><superClass><else>Lexer<endif>):
channelNames = [
"DEFAULT_TOKEN_CHANNEL",
"HIDDEN"<if (lexer.channelNames)>,
<lexer.channelNames:{c| "<c>"}; separator=",\n", anchor>
<endif>,
<lexer.channelNames:{c| "<c>"}; separator=",\n", anchor><endif>,
]

modeNames = [
<lexer.modes:{m| "<m>"}; separator=",\n", anchor>,
]

literalNames = [
"\<INVALID>",
<lexer.literalNames:{t | <t>}; separator=",\n", anchor>,
"\<INVALID>"<if (lexer.literalNames)>,
<lexer.literalNames:{t | <t>}; separator=",\n", anchor><endif>,
]

symbolicNames = [
"\<INVALID>",
<lexer.symbolicNames:{t | <t>}; separator=",\n", anchor>,
"\<INVALID>"<if (lexer.symbolicNames)>,
<lexer.symbolicNames:{t | <t>}; separator=",\n", anchor><endif>,
]

ruleNames = [
Expand Down

0 comments on commit 30218cd

Please sign in to comment.