Hello!

I have the following rather simple grammar (which is probable not  
context-free).
The input 'X0110000063{...' is (naturally) matched as a LITERAL  
'X0110000063', whereas I need it to be X01 followed by the literal/ 
entity_id '10000063'. I am sure this can be achieved by using a  
(syntactic/semantic) predicate, but I just don't know how.

Any help is highly appreciated.

Thanks,
Horst


transaction: X01 (update_type)+ EOF;
update_type: entity_id '{' (basic_update)+ '}';
basic_update: '{' field ('|' field)* '}';
field: (description)?;
entity_id returns [String value]: LITERAL { $value = $LITERAL.text; };
description returns [String value]: LITERAL { $value = $LITERAL.text; };

fragment ESCAPE_CHARACTER: '`';
fragment SPECIAL_CHARACTER: ESCAPE_CHARACTER | '|' | '{' | '}';
ESCAPE: ESCAPE_CHARACTER SPECIAL_CHARACTER;

X01: 'X01';

LITERAL
   : ( ESCAPE |
       '\u0009'..'\u000A' |
       '\u000D' |
       '\u0020'..'\u005F' |
       '\u0061'..'\u007A' |
       '\u007E'
     )+
   ;

--

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

Reply via email to