Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Prioritizing rules in Xtext(Prioritizing rules in Xtext)
icon5.gif  Prioritizing rules in Xtext [message #1176551] Fri, 08 November 2013 12:00 Go to next message
Arshad Adavani is currently offline Arshad AdavaniFriend
Messages: 163
Registered: July 2013
Location: Bangalore
Senior Member
Hi all,
Is prioritization of rules in Xtext possible?

I mean, say that I have a rule:

SomeRule:
(ID | Rule) ;

Rule:
"_"INT
;

So, here SomeRule allows either a ID or Rule. When I type in the editor I want this SomeRule to look first for "ID" and then for "Rule". Can I prioritize like this ?

Well, here Rule is also a part of ID as "_"INT is compatible with ID, but, situation for me is a little complex and I just wanted to know whether it can be done.


Thanks in advance Smile


Arshad
Re: Prioritizing rules in Xtext [message #1180948 is a reply to message #1176551] Mon, 11 November 2013 09:08 Go to previous message
Jan Koehnlein is currently offline Jan KoehnleinFriend
Messages: 760
Registered: July 2009
Location: Hamburg
Senior Member
Usually that is a usecase for semantic predicates, but they are on the
parser level and your example must resolve a lexer ambiguity.



Am 08.11.13 13:00, schrieb Arshad Adavani:
> Hi all,
> Is prioritization of rules in Xtext possible?
>
> I mean, say that I have a rule:
>
> SomeRule:
> (ID | Rule) ;
>
> Rule:
> "_"INT
> ;
>
> So, here SomeRule allows either a ID or Rule. When I type in the editor
> I want this SomeRule to look first for "ID" and then for "Rule". Can I
> prioritize like this ?
>
> Well, here Rule is also a part of ID as "_"INT is compatible with ID,
> but, situation for me is a little complex and I just wanted to know
> whether it can be done.
>
>
> Thanks in advance :)


--
Need professional support for Eclipse Modeling?
Go visit: http://xtext.itemis.com


---
Get professional support from the Xtext committers at www.typefox.io
Previous Topic:Error when trying to Export to Eclipse product
Next Topic:Best practices for defining custom terminals in a dedicated grammar file
Goto Forum:
  


Current Time: Fri Dec 04 08:57:29 GMT 2020

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

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

Back to the top