Am Tuesday 12 May 2009 09:42:25 schrieb Tobias Wunner:
> Hello,
>
> still new ANTLR I ran into a simple return value problem. I would like
> to parse a token sequence and return the matched string.

often it's simpler to let the lexer do the token foo and the parser do the 
checking of the syntax of the tokens.
You can also skip whitespace in the lexer.

That's my idea (not tested):

fragment
CHAR    :       'a'..'z';
fragment
DIGIT   :       '0'..'9';
fragment
DELIM           (' '|'\t'|'\n')+;

TOKEN: (CHAR|DIGIT)+ ;


in: typeExpression EOF { print(...) };

typeExpression: '@' v=TOKEN ':' DELIM? param (',' DELIM? param)*  { type = 
$v.text; };

param: TOKEN DELIM? { list.add($TOKEN.text); } ;


 Michael


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
-~----------~----~----~----~------~----~------~--~---

Reply via email to