[antlr-interest] Re: multilexer - almost, but no cigar.
micheal_jor <open.zone at virgin.net>
open.zone at virgin.net
Wed Feb 5 06:53:57 PST 2003
> Hi All,
>
> I have got this basic embedded language thing working.
> My question is why is foreach encountered twice - what am I missing.
1. You defined the strings "if" and "foreach" as tokens in XGenLexer.
You then define them again as literals in XGenParser. That is
SmellyANTLRCode IMO.
Try this instead in XGenParser:
ifstatement
: W_IF { std::cout << "{ifstatement encountered}" << std::endl; }
;
forstatement
: W_FOREACH { std::cout << "{foreach encountered}" << std::endl; }
;
2. Unless your entire grammar is all in a single file, you need to
set exportVocab correctly on all four grammars. Pragmatic coders set
them explicitly regardless.
Cheers!,
Micheal
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
More information about the antlr-interest
mailing list