Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Xtext 2.11 has the option to switch parser entry rule from outside(Looking for more info on this topic)
Xtext 2.11 has the option to switch parser entry rule from outside [message #1769865] Fri, 04 August 2017 10:02 Go to next message
Krzysztof Drozd is currently offline Krzysztof DrozdFriend
Messages: 12
Registered: July 2017
Location: Amsterdam
Junior Member
HI,

Christian Dietrich mentioned this
Quote:
(c) xtext 2.11 has the option to switch parser entry rule from outside, maybe you can leverage this from your use case as well (e.g. adoption XtextResourceFactory)
on this post: https://www.eclipse.org/forums/index.php?t=msg&th=1085705&goto=1760005&#msg_1760005

I think it may work for my case... but I can't find more info about it.

@Christian (and another as well :) ) can some one point me to place where I can find more on this topic, please.


Thanks in advance
Krzysiek


Thanks
Krzysiek
Re: Xtext 2.11 has the option to switch parser entry rule from outside [message #1769866 is a reply to message #1769865] Fri, 04 August 2017 10:04 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
@Krzysiek can you give more on what you want to achieve

you can do something like

XtextResource.setEntryPoint(myGrammarAccess.getMyRule())

i dont know if there are any tutorials or docs on that


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Xtext 2.11 has the option to switch parser entry rule from outside [message #1769868 is a reply to message #1769866] Fri, 04 August 2017 10:13 Go to previous messageGo to next message
Krzysztof Drozd is currently offline Krzysztof DrozdFriend
Messages: 12
Registered: July 2017
Location: Amsterdam
Junior Member
I would like to use some thing like this:
MyModel:
langElements+=LangElements* ;

LangElements:
LangElementsVersion1 |
LangElementsVersion2;


So If a user puts some kind of keyword in grammar (#VAERSION=2.0) will consider a file as LangElementsVersion2 and use rules defined over there. As they are a bit different but not that much to create separate grammar and language project.

Or there is maybe another way to dealing with languages that are changing over time?


Thanks
Krzysiek
Re: Xtext 2.11 has the option to switch parser entry rule from outside [message #1769869 is a reply to message #1769868] Fri, 04 August 2017 10:18 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
i think it highly depends on the usecase and the kind of grammar changes.
and a "keyword in grammar" wont really help since you need upfront what the rule is that should be used
(you can have a look at how xtext supports content types, but i am not sure they will work 100%)


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Previous Topic:Define an int array return type
Next Topic:Changing the Qualified name based on reference
Goto Forum:
  


Current Time: Fri Mar 29 10:21:17 GMT 2024

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

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

Back to the top