[antlr-interest] languages without reserved words

Michael Brade brade at informatik.uni-muenchen.de
Wed Mar 8 02:14:08 PST 2006

On Tuesday 07 March 2006 22:45, Martin Probst wrote:
> The problem is that every parser would first need to know if an NCNAME
> comes up to decide to enter the identifier rules. That's always a
> problem with state switching in the parser - lookahead stops working
> predictably. There is no way around that - you can't decide to enter the
> identifier rule before you know there's an identifier coming up, for
> which you need to know whether you're in the identifier rule ...
Not quite. There's a line "if (LA(1)==NCNAME)" in the code "to know if an 
NCNAME comes up". The trick I would need is simply a 
lexer.testLiterals=false; call right before it. That's all. I could modify 
the generated code by hand, but that's something I'd rather avoid for now.

Michael Brade;                 KDE Developer, Student of Computer Science
  |-mail: echo brade !#|tr -d "c oh"|s\e\d 's/e/\@/2;s/$/.org/;s/bra/k/2'
  °--web: http://www.kde.org/people/michaelb.html

KDE 4: Beyond Your Expectations
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://www.antlr.org/pipermail/antlr-interest/attachments/20060308/aa4d64e2/attachment.bin

More information about the antlr-interest mailing list