[antlr-interest] Re: SL_COMMENT in java.g
Terence Parr
parrt at cs.usfca.edu
Mon Oct 20 12:51:21 PDT 2003
On Monday, October 20, 2003, at 12:45 PM, Matt Benson wrote:
> I get:
>
> java.g:1099:22: warning:Being nongreedy only makes
> sense for (...)+ and (...)*
> java.g:1099: warning:lexical nondeterminism upon
> java.g:1099: k==1:'\n','\r'
> java.g:1099: k==2:'\n'
> java.g:1099: k==3:<end-of-token>
> java.g:1099: k==4:<end-of-token>
> java.g:1099: between alt 1 and exit branch of
> block
>
yeah, ooops... put a * on the overall
: "//" ( options {greedy=false;} : . )* ... ;
see if that works.
Ter
> -Matt
>
> :(
>
> --- Terence Parr <parrt at cs.usfca.edu> wrote:
>> Will
>>
>> SL_COMMENT
>> : "//" ( options {greedy=false;} : (.)* )
>> ('\n'|'\r' ('\n')?)
>> ;
>>
>> work?
>>
>> Ter
>>
>> On Monday, October 20, 2003, at 01:20 AM, rodrigo
>> reyes wrote:
>>
>>> Hi Terence,
>>>
>>>> On Friday, October 17, 2003, at 05:15 AM, rodrigo
>> reyes wrote:
>>>>> SL_COMMENT
>>>>> : "//"
>>>>> (~('\n'|'\r')
>>>>> {
>>>>> if (LA(1) == EOF_CHAR)
>>>>> break;
>>>>> }
>>>>> )*
>>>>> ;
>>>>
>>>> Hi guys...i'm not sure I like the "break" in
>> there as it is
>>>> not part of
>>>> the grammar analysis; or rather it can screw you
>> up.
>>>> Hmm...i'll take a peek.
>>>
>>> I don't like it either, as it refers to something
>> out of the grammar,
>>> that's why I am looking for an alternative
>> solution.
>>>
>>> However, I have plenty of files with ending
>> SL_COMMENT which are not
>>> matched by the current grammar. So I need at least
>> a temporary
>>> solution.
>>>
>>> If you have any advice on how to fix it properly,
>> I'll gladly take it
>>> ;-)
>>>
>>> Bests,
>>> Rodrigo
>>>
>>>
>>>
>>> Your use of Yahoo! Groups is subject to
>>> http://docs.yahoo.com/info/terms/
>>>
>>>
>>>
>> --
>> Professor Comp. Sci., University of San Francisco
>> Creator, ANTLR Parser Generator,
>> http://www.antlr.org
>> Co-founder, http://www.jguru.com
>> Co-founder, http://www.knowspam.net enjoy email
>> again!
>> Co-founder, http://www.peerscope.com pure link
>> sharing
>>
>>
>>
>>
>>
>>
>> Your use of Yahoo! Groups is subject to
>> http://docs.yahoo.com/info/terms/
>>
>>
>
>
> __________________________________
> Do you Yahoo!?
> The New Yahoo! Shopping - with improved product search
> http://shopping.yahoo.com
>
>
>
> Your use of Yahoo! Groups is subject to
> http://docs.yahoo.com/info/terms/
>
>
>
--
Professor Comp. Sci., University of San Francisco
Creator, ANTLR Parser Generator, http://www.antlr.org
Co-founder, http://www.jguru.com
Co-founder, http://www.knowspam.net enjoy email again!
Co-founder, http://www.peerscope.com pure link sharing
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
More information about the antlr-interest
mailing list