[antlr-interest] Error in 2.7.2

Terence Parr parrt at jguru.com
Mon Jun 2 16:01:02 PDT 2003


Hi.  I was thinking subrule not another rule (though the word seems to 
work for either case) ;)

Try this:

SCARF : ( WS | a:. ) {if (a!=null) {output.print(a);}} ;

Ter

On Monday, June 2, 2003, at 03:50  PM, Matthew Ford wrote:

> Hi Ter,
> Could you provide the actual fix please.
>
> I tried the following but got the same error (Note: WS does it own 
> printing)
>
> protected
> SCARF
>   :( WS // track line numbers while you scarf
>  | a:ALL_THE_REST
>  ) {if (a!=null) {output.print(a);}}
>  ;
>
> protected
> ALL_THE_REST
>  : .
>  ;
>
> ----- Original Message -----
> From: "Terence Parr" <parrt at jguru.com>
> To: <antlr-interest at yahoogroups.com>
> Sent: Tuesday, June 03, 2003 2:52 AM
> Subject: Re: [antlr-interest] Error in 2.7.2
>
>
>>
>> On Friday, May 30, 2003, at 06:06  PM, Matthew Ford wrote:
>>
>>> I downloaded 2.7.2 final.  There is an error in the ANTLR Parser
>>>
>>> I am getting the following error
>>>     [antlr] ANTLR Parser Generator   Version 2.7.2   1989-2003
>>> jGuru.com
>>>     [antlr] C:\temp\antlrTest\links.g:107: warning:lexical
>>> nondeterminism
>>> between alts 1 and 2 of block upon
>>>     [antlr] C:\temp\antlrTest\links.g:107:
>>> k==1:'\t','\n','\u000c','\r',' '
>>>     [antlr] C:\temp\antlrTest\links.g:107:     k==2:<end-of-token>
>>>
>>> with (full code below)
>>>
>>> protected
>>> SCARF
>>>  : WS // track line numbers while you scarf
>>>  | . {}
>>>  ;
>>>
>>> while
>>> protected
>>> SCARF
>>>  : WS // track line numbers while you scarf
>>>  | .
>>>  ;
>>>
>>> gives no errors
>>
>> Ah.  Yes, i use "is wildcard alone in the alt" rather than a more
>> intelligent but more difficult version that ignores actions.  Sorry
>> about that. :(  You can just put into a subrule and then put action at
>> the end.
>>
>> Ter
>> --
>> Co-founder, http://www.jguru.com
>> Creator, ANTLR Parser Generator: http://www.antlr.org
>> Co-founder, http://www.peerscope.com link sharing, pure-n-simple
>> Lecturer in Comp. Sci., University of San Francisco
>>
>>
>>
>>
>> Your use of Yahoo! Groups is subject to 
>> http://docs.yahoo.com/info/terms/
>>
>>
>
>
>
>
> Your use of Yahoo! Groups is subject to 
> http://docs.yahoo.com/info/terms/
>
>
>
--
Co-founder, http://www.jguru.com
Creator, ANTLR Parser Generator: http://www.antlr.org
Co-founder, http://www.peerscope.com link sharing, pure-n-simple
Lecturer in Comp. Sci., University of San Francisco


 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 




More information about the antlr-interest mailing list