[antlr-interest] sql keyword issue
Min Zhou
coderplay at gmail.com
Sat Sep 26 22:14:53 PDT 2009
Hi all,
I am a newbie, using antlr to parse sql language. we have a statement
CREATE USER, where USER is not a keyword, so that
CREATE TABLE TBL(USER int) is acceptable. But my parser came across a
problem:
mydb> create table tbl(user int);
FAILED: Parse Error: line 1:17 mismatched input 'user' expecting Identifier
in column specification
here is grammar snippets
createUserStatement
@init { msgs.push("create user statement"); }
@after { msgs.pop(); }
: KW_CREATE USER userItem (COMMA userItem)*
-> ^(TOK_CREATEUSER userItem+)
;
userItem
@init { msgs.push("user item"); }
@after { msgs.pop(); }
: (Identifier (KW_IDENTIFIED KW_BY StringLiteral)?)
-> ^(TOK_USER Identifier StringLiteral?)
;
USER: 'USER'
Identifier
:
(Letter | Digit) (Letter | Digit | '_')*
| '`' RegexComponent+ '`'
;
anyone help me on this?
Thanks in advance!
Min
--
My research interests are distributed systems, parallel computing and
bytecode based virtual machine.
My profile:
http://www.linkedin.com/in/coderplay
My blog:
http://coderplay.javaeye.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20090927/a434f920/attachment.html
More information about the antlr-interest
mailing list