dcsimg
Bug in ANTLRWorks Wizard?
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Sebastian_Wain
Posted On:   Saturday, February 19, 2011 08:33 PM

Hi, I was trying last version of ANTLRWorks, and just creating a simple lexical analysis with STRING fails. I read in stackoverflow that there is a bug (and tried in previous versions without success). Trying to parse: 'aaaa' came up with MismatchedTokenException(97!=39) and the issues seems to be in ESC_SEQ: grammar testbug; STRING : '\'' ( ESC_SEQ | ~('\\'|'\'') )* '\'' ; fragment HEX_DIGIT : ('0'..'9'|'a'..'f'|'A'..'F') ; fragment ESC_SEQ : '\\' ('b'|'t'|'n'|'f'|'r'|'"'|'\''|'\\') | UNICODE_ESC | OCTAL_ESC ; fragment OCTAL_ESC : '\\' ('0'..'3') ('0'..'7') ('0'..'7') |   More>>

Hi,

I was trying last version of ANTLRWorks, and just creating a simple lexical analysis with STRING fails. I read in stackoverflow that there is a bug (and tried in previous versions without success).

Trying to parse: 'aaaa' came up with MismatchedTokenException(97!=39) and the issues seems to be in ESC_SEQ:


grammar testbug;

STRING
: '\'' ( ESC_SEQ | ~('\\'|'\'') )* '\''
;

fragment
HEX_DIGIT : ('0'..'9'|'a'..'f'|'A'..'F') ;

fragment
ESC_SEQ
: '\\' ('b'|'t'|'n'|'f'|'r'|'"'|'\''|'\\')
| UNICODE_ESC
| OCTAL_ESC
;

fragment
OCTAL_ESC
: '\\' ('0'..'3') ('0'..'7') ('0'..'7')
| '\\' ('0'..'7') ('0'..'7')
| '\\' ('0'..'7')
;

fragment
UNICODE_ESC
: '\\' 'u' HEX_DIGIT HEX_DIGIT HEX_DIGIT HEX_DIGIT
;


Thanks,
Sebastian

   <<Less
About | Sitemap | Contact