antlr4: Matched tokens being marked as error

I found a case where the parser is marking matched tokens found inside error nodes as an error. For instance, given the malformed expression 1 * 2 +++, this is the resulting tree:

antlr4_parse_tree

However, it’s the expected tree:

image

Notice that the operators + are being marked as an error in the first tree, although they have being recognized as operators.

It worth noting that the former tree was generated using the TestRig, while the latter is a screenshot of the tree generated in the IntelliJ plugin. This issue is most likely related to antlr/intellij-plugin-v4#180.

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 23 (23 by maintainers)

Commits related to this issue

Most upvoted comments

As soon as I get home I’ll provide small grammar that shows up this bug and then we discuss the best way to fix it.