[antlr-interest] Inappropriate fragment rules
Cameron Esfahani
dirty at apple.com
Tue Jun 5 19:18:00 PDT 2007
I had a fragment rule which was eventually used by a non-lexer rule.
I had forgotten to remove the "fragment" keyword until all crap went
wrong.
Was:
fragment SIZE_QUALIFIER
: '.' ( 'u' | 'U' )? ( 'b' | 'B' )
| '.' ( 'u' | 'U' )? ( 'w' | 'W' )
| '.' ( 'u' | 'U' )? ( 'l' | 'L' )
| '.' ( 'u' | 'U' )? ( 'q' | 'Q' )
;
NUMBER
: BINARY_LITERAL SIZE_QUALIFIER?
| DECIMAL_LITERAL SIZE_QUALIFIER?
| HEX_LITERAL SIZE_QUALIFIER?
;
value
: NUMBER -> ^( NUM NUMBER )
Became:
SIZE_QUALIFIER
: '.' ( 'u' | 'U' )? ( 'b' | 'B' )
| '.' ( 'u' | 'U' )? ( 'w' | 'W' )
| '.' ( 'u' | 'U' )? ( 'l' | 'L' )
| '.' ( 'u' | 'U' )? ( 'q' | 'Q' )
;
NUMBER
: BINARY_LITERAL
| DECIMAL_LITERAL
| HEX_LITERAL
;
number_size
: NUMBER SIZE_QUALIFIER? -> ^( SIZE NUMBER )
;
value
: number_size -> ^( NUM number_size )
It seems to me that ANTLR should give an error if it detects this...
Cameron Esfahani
dirty at apple.com
"In the elder days of Art, Builders wrought with greatest care each
minute and unseen part; For the gods see everywhere."
"The Builders", H. W. Longfellow
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20070605/18bd2c84/attachment.html
More information about the antlr-interest
mailing list