[antlr-interest] Antlr 3 Lexer problem

Geoffrey Zhu gzhu at peak6.com
Tue Jun 26 11:59:00 PDT 2007


Thanks a lot. Yes, tokenizing the whole SQL statement is exactly what I
am trying to do. 

-----Original Message-----
From: antlr-interest-bounces at antlr.org
[mailto:antlr-interest-bounces at antlr.org] On Behalf Of Jim Idle
Sent: Tuesday, June 26, 2007 1:52 PM
To: antlr-interest at antlr.org
Subject: Re: [antlr-interest] Antlr 3 Lexer problem



> -----Original Message-----
> From: antlr-interest-bounces at antlr.org [mailto:antlr-interest- 
> bounces at antlr.org] On Behalf Of Geoffrey Zhu
> Sent: Tuesday, June 26, 2007 11:44 AM
> To: antlr-interest at antlr.org
> Subject: Re: [antlr-interest] Antlr 3 Lexer problem
> 
> I can't do this. I am constructing complicated lexer rules because in 
> my input there are code blocks within which the grammar is totally 
> different from the rest of the file. My file is a custom
mini-language.
> Embeded in it there are some SQL statements with surrounding 
> parentheses. My program does not need to deal with full SQL syntax. I 
> only need to correctly recognize the beginning and ending of the SQL 
> statements.

OK:

fragment WS : ' ' | '\t' ;
fragment LSELECT : '(' WS* 'select' ;
LPAREN    : '(' ;
LP_SELECT : (LSELECT)=3D> LSELECT;


Should do it. ANTLR
Perhaps you can tokenize the whole SQL statement to one token, unless
you need to look in it for host variables or something?

Jim




_______________________________________________________=0A=
=0A=
The  information in this email or in any file attached=0A=
hereto is intended only for the personal and confiden-=0A=
tial  use  of  the individual or entity to which it is=0A=
addressed and may contain information that is  propri-=0A=
etary  and  confidential.  If you are not the intended=0A=
recipient of this message you are hereby notified that=0A=
any  review, dissemination, distribution or copying of=0A=
this message is strictly prohibited.  This  communica-=0A=
tion  is  for information purposes only and should not=0A=
be regarded as an offer to sell or as  a  solicitation=0A=
of an offer to buy any financial product. Email trans-=0A=
mission cannot be guaranteed to be  secure  or  error-=0A=
free. P6070214


More information about the antlr-interest mailing list