Hi Sam,
> The best way to handle this is add a lexer rule ANSI_QUOTED_ID_OPEN (or
> similar) which matches the quoted string when it’s missing the final
> character.
Thanks for the idea. I added a new lexer rule like this:
ANSI_QUOTED_ID_OPEN:
DOUBLE_QUOTE
(
ESCAPE_SEQUENCE
| ~(DOUBLE_QUOTE | '\\')
)*
;
and my identifier parser rule is now:
identifier:
IDENTIFIER
| BACK_TICK_QUOTED_ID
| ANSI_QUOTED_ID
| ANSI_QUOTED_ID_OPEN
;
but unfortunately this works only for very few cases.
select 1 from " gives no tree at all (just an error node) + error
(extraneous input at "from")
select 1 from "a works almost as I want it (except I don't get
an error)
select 1 from "a"" AST + error saying everything starting with
"from" is extraneous input
select 1 from "a" " is the only case which really does what I need
(AST + open id + error)
In case this matters: I have backtracking active for the entire grammar (I'll
work later to get rid of this but for now I need it).
Mike
--
www.soft-gems.net
_______________________________________________
antlr-dev mailing list
[email protected]
http://www.antlr.org/mailman/listinfo/antlr-dev