[antlr-interest] ANTLR4 options ignored in imported grammar

Terence Parr parrt at cs.usfca.edu
Fri Oct 26 10:20:01 PDT 2012


hm… good question. options don't generally make sense to import. that one is more of an action.

i don't see a good solution here.  why import anyway if already separate?  are you combining multiple lexers?

Ter
On Oct 26, 2012, at 3:50 AM, <cd.barth at t-online.de> <cd.barth at t-online.de> wrote:

> ANTLR4 (v 4.0b2) works fine when I'm using separated lexer and parser
> grammars 
> 
> 
> 
> lexer grammar CommonLexerRules;;
> 
> options {   superClass=LexerExtension; } .
> 
> 
> 
> parser grammar PLiParser;
> 
> options {   superClass=ParserExtension; }.
> 
> 
> 
> and generates accurate the lines
> 
> .public class PLiLexer extends LexerExtension {.
> 
> .public class PLiParser extends ParserExtension {.
> 
> 
> 
> But when I'm using the new cool feature for importing grammars like
> 
> 
> 
> grammar CombindedPLiGrammar;
> 
> import PLiLexer;
> 
> .
> 
> 
> 
> I get the warning : options ignored in imported grammar
> 
> 
> 
> The generated java file contains
> 
> .public class PLiLexer extends Lexer {.      instead of : extends
> LexerExtension
> 
> 
> 
> My questions: 
> 
> Is there any way to set an LexerExtension in an imported grammar?
> 
> Any idea to fix Java.stg ?
> 
> 
> 
> Claus-Dieter
> 
> 
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address



More information about the antlr-interest mailing list