[antlr-interest] Language Independence
Ric Klaren
klaren at cs.utwente.nl
Thu Mar 6 06:24:55 PST 2003
Hi,
On Thu, Mar 06, 2003 at 01:38:26PM -0000, Anthony W. Youngman wrote:
> (replied with grammar off-list)
Thanks!
> Actually, having investigated/remembered what happened, firstly it should
> read "doesn't *always* work", and secondly, I think it is "$setType( xxx )"
> doesn't work either for certain values of xxx, or certain locations of
> $setType.
Basically it boils down to the fact that the action parser of antlr is a
bit too simple for some uses. For C++ mode I had to extend it a bit.
The only thing that needed a workaround was this one:
_ttype = testLiteralsTable($getText.toUpperCase(), _ttype);
Initial attempt:
$setType(testLiteralsTable($getText.toUpperCase(), _ttype));
What works:
String t = $getText;
$setType(testLiteralsTable(t.toUpperCase(), _ttype));
Kinda weird there's no $getType in ANTLR actually...
Fixing that kind of use could be tricky.. The action parser is basically
only a sed type replacement on the provided action text. It does the trick
quite often but sometimes it just doesn't cope :(
Cheers,
Ric
--
-----+++++*****************************************************+++++++++-------
---- Ric Klaren ----- j.klaren at utwente.nl ----- +31 53 4893722 ----
-----+++++*****************************************************+++++++++-------
Chaos always defeats order because it is better organized.
--- Terry Pratchet
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
More information about the antlr-interest
mailing list