grammars-v4
grammars-v4 copied to clipboard
Error parsing scala file of object definitions (object body was not parsed without any error messages)
When parsing a Scala program: source file, only the first 4 lines were parsed and no error messages were outputted.
It seems like, in line 483 of Scala.g4 the non-terminator templateBody was not matched.
classTemplate
: earlyDefs? classParents templateBody?
;
ANTLR Version: 4.9.3
The Scala grammar is missing an EOF-augmented start rule. That's why it fails and prints nothing. Every grammar should have at least one and we've been over this before.
Unclear why it fails. Maybe because the grammar is out of date?
line 4:28 mismatched input '{' expecting <EOF>
The Scala grammar is missing an EOF-augmented start rule. That's why it fails and prints nothing. Every grammar should have at least one and we've been over this before.
Unclear why it fails. Maybe because the grammar is out of date?
line 4:28 mismatched input '{' expecting <EOF>
I used Scala.g4 in commit id ff60c13, which is newer than Scala.g4's last modification in the master branch.
I tested it more and found that a simple object definition statement with the 'extends' keywords can be parsed correctly. But still don't know which unsupported syntax caused the error (might be tuples or sth) because there were no error messages from the generated Scala parser, only the parse tree below was output.
(compilationUnit (topStatSeq (topStat (import_ import (importExpr (stableId (stableId (stableId java) . text) . NumberFormat)))) (topStat (import_ import (importExpr (stableId (stableId (stableId java) . util) . Locale)))) (topStat (tmplDef object (objectDef SizeMeUp (classTemplateOpt extends (classTemplate (classParents (constr (annotType (simpleType (stableId App))))))))))))