Antlr 4.2.2 console warning output (157)

I downloaded the latest version of ANTLR - 4.2.2 (antlr-4.2.2-complete.jar) When I use it to generate parsers for a Java.g4 grammar file, it prints me some warnings like: "Java.g4: 525: 16: the expression "rule" contains the terminal parameter "assoc" in an unrecognized location "

Files were generated but not compiled

The previous version works fine.

What's wrong?

+4
source share
1 answer

Now <assoc>should be moved to the left of the "expression".

It should always be located to the right of the environment |:

: https://theantlrguy.atlassian.net/wiki/display/ANTLR4/Left-recursive+rules

 ...
 |   expression '&&' expression
    |   expression '||' expression
    |   expression '?' expression ':' expression
    |<assoc=right>   expression
        (   '='
        |   '+='
        |   '-='
        |   '*='
        |   '/='
        |   '&='
        |   '|='
        |   '^='
        |   '>>='
        |   '>>>='
        |   '<<='
        |   '%='
        )
        expression
+11

Source: https://habr.com/ru/post/1538538/


All Articles