[antlr-interest] Catch all else rule

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


Doh!

Just saw that I can do it with Tree grammar. I'll give that a go.

I was reading your book and that only talks about filter=true for lexers.
The Web site also has it for Trees. Any updates coming soon?

http://www.antlr.org/wiki/display/~admin/2008/10/23/tree+pattern+matching+grammars

Thanks
Des



2009/3/16 Des Hartman <des at deshartman.com>

> 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/7630e563/attachment.html 


More information about the antlr-interest mailing list