[antlr-interest] Q: move from v2 to v3 parser grammar. Rewrite tree rule
Jim Idle
jimi at temporal-wave.com
Tue Mar 22 14:27:47 PDT 2011
> -----Original Message-----
> From: Ruslan Zasukhin [mailto:ruslan_zasukhin at valentina-db.com]
> Sent: Tuesday, March 22, 2011 2:21 PM
> > However, using lower case literals in your parser directly is not a
> > good idea. Use real tokens so that you error messages are better
>
> Simple example, please?
Instead of:
rule : 'join' somerule;
Use:
rule : JOIN somerule;
// Lexer rule to match:
//
JOIN : 'join';
And for case insensitivity I specify the token specs all in UPPPER rather
than lower and then override the input stream as per:
http://www.antlr.org/wiki/pages/viewpage.action?pageId=1782
Although someone has added instructions for generating the slowest case
insensitive lexers in the world with individual letter rules. Use the
input stream override method in general.
>
>
> > and remember
> > that SQL is generally case insensitive so you will need a [trivial]
> > custom input stream.
>
> Of course we do remember this :)
>
> And after grammar start to breath, we will yet work on
> * case-insensitive of SQL text
> * UTF-16 for input -- clarify ..
UTF-16 input encoding is just a matter of telling the Java input stream to
open the file in that encoding.
Jim
More information about the antlr-interest
mailing list