Hello!

I'm having a few issues with the new antlr parser.

1. In the grammar, IDENT is restricted to ( 'a' .. 'z' | '_' ) ( 'a' .. 'z' | '0' .. '9' | '_' | '$' )*, which I believe is too limited. Since we are dealing with Java, this should be expanded to the full range of valid Java identifiers. Se attached patch for a closer look at what I mean.

2. From what I can tell the older syntax (from foo in class bar.Foo) is not supported. If this is by design, I think it would be a good idea to mention this in the upgrade notes, and update the documentation (it is still used in at least two places).

3. A few of our existing queries are creating invalid sql (inserting an extra comma), something like "... from foo as foo1_, inner join ...". Is this a known problem? Otherwise I'll try to have a closer look at what's causing this.

All of the above works great with the classic parser.

/4
Index: grammar/hql.g
===================================================================
RCS file: /cvsroot/hibernate/Hibernate3/grammar/hql.g,v
retrieving revision 1.51
diff -u -r1.51 hql.g
--- grammar/hql.g       2 Mar 2005 16:57:17 -0000       1.51
+++ grammar/hql.g       17 Mar 2005 08:54:09 -0000
@@ -680,7 +680,18 @@
 
 IDENT options { testLiterals=true; }
        :
-               ( 'a' .. 'z' | '_' ) ( 'a' .. 'z' | '0' .. '9' | '_' | '$' )*
+               ('\u0024' | '\u005f' | 
+               '\u0061' .. '\u007a' | '\u00c0' .. '\u00d6' | 
+               '\u00d8' .. '\u00f6' | '\u00f8' .. '\u00ff' | 
+               '\u0100' .. '\u1fff' | '\u3040' .. '\u318f' | 
+               '\u3300' .. '\u337f' | '\u3400' .. '\u3d2d' | 
+               '\u4e00' .. '\u9fff' | '\uf900' .. '\ufaff')
+               ('\u0024' | '\u0030' .. '\u0039' | '\u005f' | 
+               '\u0061' .. '\u007a' | '\u00c0' .. '\u00d6' | 
+               '\u00d8' .. '\u00f6' | '\u00f8' .. '\u00ff' | 
+               '\u0100' .. '\u1fff' | '\u3040' .. '\u318f' | 
+               '\u3300' .. '\u337f' | '\u3400' .. '\u3d2d' | 
+               '\u4e00' .. '\u9fff' | '\uf900' .. '\ufaff')*
                // Setting this flag allows the grammar to use keywords as 
identifiers, if necessary.
                {
                        setPossibleID(true);

Reply via email to