At 22:32 9/02/2009, Steve Flasby wrote:
>I have the classic String rule:
>
>STRING_LITERAL
> : '"'!
> ( '"' '"'!
> | ~('"'|'\n'|'\r')
> )*
> ( '"'!
> | // nothing -- write error message
> )
> ;
>
>The presence of the '!' in this code causes the grammar checking
to
>fail with the message 'Illegal output option' is there an
>alternative I should be using instead?
The use of ! in lexer rules is a v2ism, and doesn't work in
v3. (! is still supported in parser rules to indicate tokens that
shouldn't be included in the AST.)
See also:
http://www.antlr.org/wiki/pages/viewpage.action?pageId=1461
>Also (but I am less sure about this) I think the '~' is not
being
>correctly recognized as any string in my test input which I
expect
>to match this fails. Has this been reported by anyone else?
~ does work (but only when used on sets, not sequences; what you
have above should be ok though). Possibly the !s are confusing
it; try taking them out and see if it behaves better.
There might also be an issue with your 'unterminated string'
clause. I'm not entirely certain, but I suspect that it could
cause something weird to happen. Try changing it to just a simple
'"' with no alternative and see if that helps.
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
-~----------~----~----~----~------~----~------~--~---