Hi, thank You for answer. Book "The definitive ANTLR Reference" , page 101, states, that ANTLR automatically makes .' and .+ non-greedy. Also adding non-greedi option does nothing.
Georg Oliver Zeigermann <[email protected]> wrote on 3 Jun 2010, 12:09 PM: Subject: Re: [antlr-interest] .* consuming all input >Hi, I am pretty sure wildcards are *greedy* by default and you have to >switch on non-greediness. I seem to remember this should look like: > >(options {greedy=false;}:.)* > >- Oliver > >2010/6/3 George Soom <[email protected]>: >> >> Hi, >> according to documentation wildcards are non-greedy in ANTLR, so rule ' >> comment: '//' a+=.* NEWLINE -> comment(a={a}) ' should match anything >until >> newline, construct list 'a' and send it to template 'comment'. >> Somehow .* will consume everything up to the end of input file so I get >> error 'line 0:-1 mismatched input '<EOF>' expecting NEWLINE'. NEWLINE is >> defined as NEWLINE: ('\r'? '\n')+; and is not sent to hidden channel or >> skipped. Where is the problem? I need to send everything to template >> comment, so I can not send comments to trashbin through lexer rule. >> Thank You >> Georg >> >> >> >> 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.
