Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Xtext option greedy
Xtext option greedy [message #350082] Tue, 28 July 2009 09:11 Go to next message
Hauke Fuhrmann is currently offline Hauke FuhrmannFriend
Messages: 333
Registered: July 2009
Senior Member
Hey Xtext folks,

in some Xtext example I found this line:

RULE_ML_COMMENT : '{*' ( options {greedy=false;} : . )*'*}';

What is that options part and greedy=false? Is that documented somewhere?

If I could myself influence where the parsing is greedy or not that
might help a lot. Hence I'm interested in this feature.

Cheers,
Hauke
Re: Xtext option greedy [message #352794 is a reply to message #350082] Tue, 28 July 2009 10:23 Go to previous messageGo to next message
Sebastian Zarnekow is currently offline Sebastian ZarnekowFriend
Messages: 3107
Registered: July 2009
Senior Member
Hi Hauke,

greedy=false is hopefully documented in the ANTLR docs. It says, that
the parser should not consume the wildcard '.' before it had a look at
the character at matched it with the following '*}' keyword.
This option will be generated if you use the until-operator '->' in a
terminal rule.

Hope that helps,
Sebastian
--
Need professional support for Eclipse Modeling?
Go visit: http://xtext.itemis.com

Am 28.07.2009 11:11 Uhr, schrieb Hauke Fuhrmann:
> Hey Xtext folks,
>
> in some Xtext example I found this line:
>
> RULE_ML_COMMENT : '{*' ( options {greedy=false;} : . )*'*}';
>
> What is that options part and greedy=false? Is that documented somewhere?
>
> If I could myself influence where the parsing is greedy or not that
> might help a lot. Hence I'm interested in this feature.
>
> Cheers,
> Hauke
Re: Xtext option greedy [message #360249 is a reply to message #352794] Tue, 28 July 2009 13:41 Go to previous messageGo to next message
Hauke Fuhrmann is currently offline Hauke FuhrmannFriend
Messages: 333
Registered: July 2009
Senior Member
Sebastian Zarnekow schrieb:
> greedy=false is hopefully documented in the ANTLR docs. It says, that
> the parser should not consume the wildcard '.' before it had a look at
> the character at matched it with the following '*}' keyword.
> This option will be generated if you use the until-operator '->' in a
> terminal rule.

Ok, thanks for that information. I was just wondering that this was set
directly in an Xtext grammar and the possibility of setting such kind of
direct ANTLR options from within the Xtext grammar seems to be not
documented in the Xtext docs. At least I did not find it there.


Hauke
Re: Xtext option greedy [message #798745 is a reply to message #360249] Wed, 15 February 2012 02:49 Go to previous messageGo to next message
Sebastian Krueger is currently offline Sebastian KruegerFriend
Messages: 7
Registered: July 2011
Junior Member
Hi.

Did you get your greedy option resolved? We have the same problem and are wondering if anyone knows how to make the ANTLR greedy option true.

Regards, Sebastian.
Re: Xtext option greedy [message #799602 is a reply to message #798745] Thu, 16 February 2012 04:22 Go to previous message
Sebastian Krueger is currently offline Sebastian KruegerFriend
Messages: 7
Registered: July 2011
Junior Member
Possible solution might be to read the whole token as one complete string and then parse (with greedy turned on) it in some custom Java.
Previous Topic:JvmModelInferrer and super-constructor
Next Topic:Standalone compilation of xbase based grammar
Goto Forum:
  


Current Time: Thu Apr 02 16:52:05 GMT 2020

Powered by FUDForum. Page generated in 0.01909 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top