On 4/18/11 8:25 PM, "Jim Idle" <[email protected]> wrote:
> ???
Okay, let me copy paste here SQL standard :-)
<character string literal> ::=
<quote> [ <character representation>... ] <quote>
<character representation> ::=
<nonquote character> | <quote symbol>
<nonquote character> ::= !! See the Syntax Rules.
<quote symbol> ::= <quote><quote>
so:
SQL standard escape in literal must looks as:
literal: 'som''e literal'
Common escape with backslash \ (e.g. C++ Java)
literal: 'som\'e literal'
================================
Problem (for me :-) is how to skip one of quotes INSIDE of literal,
using ANTLR v3 ...
In ANTLR v2 this was veeeeeery easy:
STRING_LITERAL
: QUOTE! << WRAPPER quote... Easy enough in v3
( ESCAPE_SEQUENCE
| ~('\'' | '\\')
| QUOTE QUOTE! << can be inside of LITERAL many times
)*
QUOTE! << WRAPPER quote... Easy enough in v3
Just three '!' and task was solved in v2...
Yes, you (Jim) have to show effective solution for v3 (C) to remove
WRAPPER-quotes.
But above rule for LITERAL is more hard. Because it can have quotes INSIDE.
You see problem?
================================
Also I have check few SQL grammars from ANTLR site.
E.g. This is mySQL lexer.
TEXT_STRING:
('\''
(
options{greedy=true;}: ~('\'' | '\r' | '\n' ) | '\'' '\''
)*
'\'' )
Here author even do not care about QUOTE QUOTE.
So lexer will send to parser Token ( 'aaa''bbb''ccc' )
But should sent Token ( aaa'bbb'ccc )
Or I do smoke wrong staff??? :-)
--
Best regards,
Ruslan Zasukhin
VP Engineering and New Technology
Paradigma Software, Inc
Valentina - Joining Worlds of Information
http://www.paradigmasoft.com
[I feel the need: the need for speed]
List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe:
http://www.antlr.org/mailman/options/antlr-interest/your-email-address
--
You received this message because you are subscribed to the Google Groups
"il-antlr-interest" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/il-antlr-interest?hl=en.