[antlr-interest] Antlr 3 Lexer problem
Geoffrey Zhu
gzhu at peak6.com
Tue Jun 26 12:17:11 PDT 2007
This doesn't seem to work. The lexer is choking at the same place.
-----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)=> 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
_______________________________________________________
The information in this email or in any file attached hereto is
intended only for the personal and confiden- tial use of the
individual or entity to which it is addressed and may contain
information that is propri- etary and confidential. If you are not
the intended recipient of this message you are hereby notified that any
review, dissemination, distribution or copying of this message is
strictly prohibited. This communica- tion is for information
purposes only and should not be regarded as an offer to sell or as a
solicitation of an offer to buy any financial product. Email trans-
mission cannot be guaranteed to be secure or error- free. P6070214
More information about the antlr-interest
mailing list