[antlr-interest] Catch all else rule

Des Hartman des at deshartman.com
Sun Mar 15 23:11:47 PDT 2009


Terrence

Thanks for the reply. Had a look at it, but it is for lexers only, so not
really going to help me. I need to walk through the parser and check all
known calculations. this is your typical nested formula precedence.

When I get to literal and nothing has match, I would like to return a String
of what the parser has so far consumed.

Hopefully there is a way to do this. At the moment I am thinking of relying
on No match errors to bubble up and then take the input as the string.

Thanks
Des



2009/3/16 Terence Parr <parrt at cs.usfca.edu>

> Hi Des, see filter mode for lexers.
> Ter
>
> On Mar 15, 2009, at 5:42 PM, Des Hartman wrote:
>
>  Is there a way to set up a rule that catches all other matches if none of
>> the parsing matches? My thinking here is I match all the parser rules that I
>> know of such as:
>>
>> multiplication
>> adding
>> power
>> operand
>> literal
>> etc
>>
>> and if none of these are matched, then the entered text is a string.
>>
>> Thanks
>> Des
>>
>>
>> List: http://www.antlr.org/mailman/listinfo/antlr-interest
>> Unsubscribe:
>> http://www.antlr.org/mailman/options/antlr-interest/your-email-address
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20090316/9c9a254b/attachment.html 


More information about the antlr-interest mailing list