You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In issue #1113@jimidle pointed out the flaw as being an EOF used in a rule which was called from elsewhere. This was a simple oversight by me, not a misunderstanding of how to use EOF.
Perhaps antlr can check for this? Suggestion:
ensure EOF occurs in exactly one rule
that rule is not called recursively (it can be called by other rules as this is reasonable parse: getheader getbody getpostscript ; where getpostscript can contain the EOF).
Maybe this will prove too constraining, I don't know.
The text was updated successfully, but these errors were encountered:
The specific analysis of interest would be detecting cases where a non-EOF transition can appear after an EOF transition (in the follow set). However, even if detected this is not necessarily an error (see below).
Note to potential implementers: I've noticed some anomalies in the LL(1) static analysis so I'm not sure the existing code can be used as-is for this purpose.
Interesting additional things to note:
EOF can occur in more than one rule
EOF can appear in the middle of certain rules, and does not have to be the last item in a rule in all cases, such as the following (from TemplateLexer.g4):
Note: The previous rule is actually not what was intended in that grammar. The use of EOF was intended to allow the rule to end with '"'? for improved error recovery, although and even better approach using multiple rules can be seen here (and throughout that grammar).
In issue #1113 @jimidle pointed out the flaw as being an EOF used in a rule which was called from elsewhere. This was a simple oversight by me, not a misunderstanding of how to use EOF.
Perhaps antlr can check for this? Suggestion:
parse: getheader getbody getpostscript ;
wheregetpostscript
can contain the EOF).Maybe this will prove too constraining, I don't know.
The text was updated successfully, but these errors were encountered: