[antlr-interest] gathering any character until specified char

Ben Corne ben.corne at gmail.com
Sun Aug 14 06:22:34 PDT 2011


HI all

I'm trying to create a list of any characters but trailing whitespaces
separated by comma's.
Here are the rules for a specific case where I need this kind of list:

authors
: (auth+=(.*)) WS* (',' WS* auth+=(.*) WS*)
 -> ^(AGAUTHORS $auth)
;
WS  :   ( ' '
        | '\t'
        | '\r'
        | '\n'
        )
    ;

Input: Ben Corne ,  An antlr FAN
Parse tree should look like this:
authors
|------------ 'Ben Corne'
|------------ WS
|------------ ','
|------------ WS
|------------ 'An antlr FAN'

Instead I get one that doesn't seem to gather any character but the ','
(tested in debugger)
Anyone know what I'm doing wrong here?

Kind regards
Ben Corne


More information about the antlr-interest mailing list