[prev in list] [next in list] [prev in thread] [next in thread]
List: antlr-interest
Subject: Re: [antlr-interest] Antlr 4 grammar options
From: Terence Parr <parrt () cs ! usfca ! edu>
Date: 2011-12-29 17:23:28
Message-ID: 9221D0DF-C228-4B87-B070-0A9B4FDA1694 () cs ! usfca ! edu
[Download RAW message or body]
Hi Mat. .* is nongreedy by default in v4.
Ter
On Dec 28, 2011, at 9:47 PM, mat dodgson wrote:
> Hi folks!
>
> First let me say that I've been using Antlr for a short time but it's
> great! I'm particularly excited about the new Java listener mechanism - it
> makes life much simpler in certain scenarios!
>
> I downloaded the latest antlr4 and stringtemplate4 today from github and
> compiled them. I'm having a problem with an options block for a multi line
> comment. Has the syntax for options changed in antlr v4 grammars?
>
> Here's the comment rule from my grammar:
>
> COMMENT
> : '//' ~('\n'|'\r')* '\r'? '\n' {$channel=HIDDEN;}
> | '/*' ( options {greedy=false;} : . )* '*/' {$channel=HIDDEN;}
> ;
>
> The COMMENT rule was auto generated by antlrworks. The error I'm getting is
> related to the options block on the multiline comment. It just looks like
> it's not expecting the options block at that point:
>
> error(15): LTM_ParseTree.g:43:15: required (...)+ loop did not match
> anything at input 'options {' while looking for lexer rule element
> error(15): LTM_ParseTree.g:43:37: '}' came as a complete surprise to me
>
> line 43 is the multiline comment.
>
> If I remove the options block and the colon the grammar works however I
> don't want a greedy comment block in my grammar.
>
> I know antlr v4 hasn't been released yet: have options like this been
> implemented yet? Can anyone suggest anything?
>
> Thanks
>
> Mat Dodgson
>
> 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
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic