[antlr-interest] how to implement this string rule?

Xiaohua Guo X.Guo at 4c.ucc.ie
Thu Jun 4 09:45:02 PDT 2009


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
 



More information about the antlr-interest mailing list