[antlr-interest] Is it possible to tell whether the source or header is being generated?
Terence Parr
parrt at cs.usfca.edu
Sat May 26 11:39:58 PDT 2007
Hi, here you have the recognizerFile:
> <if(LEXER)>
> package body <recognizer.grammar.name>_Lexer is
> <recognizer>
> end <recognizer.grammar.name>_Lexer;
> <endif>
but you repeat that in the headerFile template. most likely you want
only the list of names etc... to make the method declarations etc...
Look at the C headerFile template. You'll see that it doesn't use
recognizer. It does some stuff like:
<if(LEXER)>
<rules:{r | <if(!r.ruleDescriptor.isSynPred)><headerReturnType
(ruleDescriptor=r.ruleDescriptor)> (*m<r.ruleDescriptor.name>)
(struct <name>_Ctx_struct * ctx<if(r.ruleDescriptor.parameterScope)>,
<endif><r.ruleDescriptor.parameterScope:parameterScope(scope=it)
>);<endif>}; separator="\n";>
<endif>
which plays with the list of rules.
Ter
More information about the antlr-interest
mailing list