Title:
Imported parser grammar importing another grammar produces unsuspected
errors
Description:
The original example from the article about the import introduction:
A combined grammar imports a parser grammar importing an other parser
grammar. (without overriding)
Software:
antlrworks-1.3.1.jar
-------
lexer grammar lex;
LETTER : 'a'..'z' ;
SPACE : ' ' ;
--------
parser grammar par1;
letter : LETTER ;
spaces : SPACE+ ;
---------
parser grammar par2;
import par1;
letters : letter+ ;
---------
grammar gram;
import lex, par2;
stuff : ( letters spaces )+ ;
--------
Generated java code produces follow errors :
D:\local\mib\Compiler\de.fraunhofer.fokus.ttcn3.compiler\grammar\gram_pa
r2_par1.java:22: cannot find symbol
symbol : variable ggramgpar2
location: class gram_par2_par1
public int getRuleLevel() { return ggramgpar2.getRuleLevel(); }
^
D:\local\mib\Compiler\de.fraunhofer.fokus.ttcn3.compiler\grammar\gram_pa
r2_par1.java:23: cannot find symbol
symbol : variable ggramgpar2
location: class gram_par2_par1
public void incRuleLevel() { ggramgpar2.incRuleLevel(); }
^
D:\local\mib\Compiler\de.fraunhofer.fokus.ttcn3.compiler\grammar\gram_pa
r2_par1.java:24: cannot find symbol
symbol : variable ggramgpar2
location: class gram_par2_par1
public void decRuleLevel() { ggramgpar2.decRuleLevel(); }
^
D:\local\mib\Compiler\de.fraunhofer.fokus.ttcn3.compiler\grammar\gram_pa
r2.java:28: cannot find symbol
symbol : constructor
gram_par2_par1(org.antlr.runtime.TokenStream,gram_par2,org.antlr.runtime
.RecognizerSharedState,gramParser)
location: class gram_par2_par1
gpar1 = new gram_par2_par1(input, this, this.state, ggram);
--------
the generated constructor in class gram_par2_par1:
public gram_par2_par1(TokenStream input, DebugEventListener dbg,
RecognizerSharedState state, gramParser ggram, gram_par2 gpar2) {
super(input, dbg, state);
this.ggram = ggram;
this.gpar2 = gpar2;
}
best regards,
Michael Berger
Fraunhofer FOKUS
Kaiserin-Augusta-Allee 31
10589 Berlin
Tel: +49-30-3463-7176
List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe:
http://www.antlr.org/mailman/options/antlr-interest/your-email-address
--
You received this message because you are subscribed to the Google Groups
"il-antlr-interest" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/il-antlr-interest?hl=en.