maybe is this what you want?
in : cname*;
cname : '@' CHAR* ':' NL param*;
param : (CHAR|':')+ NL+;
CHAR : ~(NewLineChars|'@'|':')+ ;
NL : NewLineChars+;
fragment NewLineChars
: '\n'
| '\r'
;
Nukiti
>> Hello,
>>
>> new to ANTLR I wondered if it is possible to match ".*" expressions.
>> So I do not have to explicitly define the tokens to be matched and
>> capture all kinds of tokens including UTF-8 characters. My input
>> format I would like to process looks like:
>>
>> @<CLASS-IDENTIFIER1>:
>> record1
>> record2
>> ...
>> recordn
>> @<CLASS-IDENTIFIER2>
>> ...
>>
>> as for instance
>>
>> @class1:
>> .*cat
>> @class3:
>> bob
>> jack
>> @class6:
>> df2
>> dfe4
>>
>> Now wrote the following grammar
>>
>> in : cname*;
>> cname : '@' CHAR* '\n' (param '\n')*;
>> param : CHAR*;
>> CHAR : 'a'..'z';
>>
>> The problem her is that I could only detect records with 'a'..'b'.
>> Could I replace this with ".*" to match any token?
>>
>> Another idea was to match any token but '@' with [^'@']* as known from
>> regular expressions - somehow I did not get this work with ANTLR?
>>
>> Regards,
>> Toby
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
-~----------~----~----~----~------~----~------~--~---