Hi Xiaohua,
Try this one:
STRING :
'"' (~('"'|'\n'|'\r'))* '"';
It says the string starts with " and ends with " while an between
those there can be any character but ",\n or \r
This was taken from the templates used in the ANTLRIDE editor.
HTH
Tilman Bender
Student des Software Engineering
Hochschule Heilbronn
[email protected]
Am 04.06.2009 um 18:45 schrieb Xiaohua Guo:
> Hi,
> I have a description of the string like this in my problem
> description:
>
> String = arbitrary string of letters, digits and symbols, starting and
> ending with '"'
>
> As I understand, the requirement said the string can include any
> kind of
> symbols but I really don't know how to implement it. I wrote as the
> following but it doesn't work. I would be grateful if someone could
> give me
> some advice. Thanks a million!
>
> STRING : ('a'..'z'|'A'..'Z'
> |','
> |'='
> |'|'
> |'/'
> |'!'
> |'*'
> |')'
> |']'
> |'}'
> |':'
> |'-'
> |'\'
> |'"'
> |'?'
> |'('
> |'['
> |'{'
> |';'
> |'.'
> |' '
> |':'
> |'+'
> |'_'
> |'%'
> |'@'
> |'&'
> |'#'
> |'$'
> |'<'
> |'>'
> |'\^'
> |'''
> |'~')*;
>
>
> Grace
>
>
>
> 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
-~----------~----~----~----~------~----~------~--~---
List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe:
http://www.antlr.org/mailman/options/antlr-interest/your-email-address