Just use code in an action.

xxx: TOKEN
        { while (input.LA(1) != NL) { /* process input.LT(1).toString() */
}
    NL
;

Jim

> -----Original Message-----
> From: [email protected] [mailto:antlr-interest-
> [email protected]] On Behalf Of Robert J. Hansen
> Sent: Friday, January 28, 2011 6:33 AM
> To: Pop Qvarnström
> Cc: [email protected]
> Subject: Re: [antlr-interest] Greedy matching to end of line
>
> > Just a thought: depending on what you do with the things after a
> 'Comment:', you could just match .+ :
>
> Well, I need to pull data out of what comes after the 'Comment:'.  If I
> can find some way to match .+ out to the first newline, and then
> extract the contents into $value, I'd be a happy camper.
>
> (The grammar I posted has no return values.  The actual grammar I use
> does, since I hook up actions to various rules.)
>
>
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-
> email-address

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