[antlr-interest] Very weird SQL parser failures - look-ahead?

Bharath Sundararaman bharath at starthis.com
Tue Jun 1 10:15:49 PDT 2004


Hi,

Where is the grammar for the statement? If you had a grammar rule which
expects a CLOSE_PAREN right after the IDENTIFIER (abc), it should give the
error. It would be nice if you copy-paste the rule for this SQL statement. 

Bharath.
~Give me the tool and I shall move the earth~

-----Original Message-----
From: anatoli_krassavine [mailto:toly at intellidos.com] 
Sent: Tuesday, June 01, 2004 10:47 AM
To: antlr-interest at yahoogroups.com
Subject: [antlr-interest] Very weird SQL parser failures - look-ahead?


  Hello,

I tried to use Oracle 7 SQL grammar in anger. It works great for very 
complex SQL statements, but I suddenly stumbled on an unexpected 
issues with what I consider to be a very simple SQL. Could someone 
please advice.

The following statement fails with 
Exception in thread "main" line 10:2: expecting CLOSE_PAREN, 
found 'null'

------------
SELECT *
FROM
    c.abcd
WHERE
    cr.no IN 
(
SELECT cr.no FROM c.cr cr
union
SELECT a FROM abc where a=b
)
------------
On the other hand this works fine (note that "where a=b" was removed)

SELECT *
FROM
    c.abcd
WHERE
    cr.no IN 
(
SELECT cr.no FROM c.cr cr
union
SELECT a FROM abc
)
------------

AFAICC, it is not a problem with syntax, but a problem with a look- ahead,
but I do not understand how to fix this.

Any help or pointing in the right direction will be greatly 
appreciated.

Details:
Oracle 7 SQL grammar from  /grammar/ORACLE-7-SQL
No changes, conventional lexer/parser generated




 
Yahoo! Groups Links



 




 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
     http://groups.yahoo.com/group/antlr-interest/

<*> To unsubscribe from this group, send an email to:
     antlr-interest-unsubscribe at yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:
     http://docs.yahoo.com/info/terms/
 



More information about the antlr-interest mailing list