Where are all the grammar options in Antlr3?

Antlr2 had many grammar options that could be set ( link ). Now in Antlr3 we have 1/3 of the volume of options ( link ).

So, I have two questions:

  • Does anyone know why so many options were taken out and any of them came back?
  • Does Antlr3 have the ability to do what Antlr2 could do, even without all of these options?

To be more specific in my second question, I want to be able to do a few things. Firstly, I want to change the visibility of the generated lexer and parser classes (i.e. the Antlr2 parameter is "classHeaderPrefix").

Secondly, I want to be able to ignore any tokens in some keywords, for example, "& keyword &" and "& k ey wo rd &" both match (i.e., the option to ignore Antlr2, I think?).

Finally, I want certain keywords to be case insensitive (that is, the Antlr2 parameter "caseSensitive").

+3
source share
1 answer

BluePlateSpecial wrote:

To be more specific in my second question, I want to be able to do a few things. First, I want to change the visibility of the generated lexer and parser classes (ie, the Antlr2 parameter is "classHeaderPrefix").

There is no way to do this in v3.

BluePlateSpecial wrote:

-, , , "& keyword &" "& k ey w o rd &" (.. Antlr2 "", ?).

, LL (*) lexer , , v2. , :

FOO
  :  '&' (' ' | 'a'..'z')+ '&'
  ;

BluePlateSpecial ():

, , ( Antlr2 "caseSensitive" ).

v3, "" :

BAR
  :  ('b' | 'B') ('a' | 'A') ('r' | 'R')
  ;
+2

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


All Articles