Skip to main content



      Home
Home » Modeling » TMF (Xtext) » one file extension, multiple sub-grammars(or grammars w/o root element)
one file extension, multiple sub-grammars [message #1355860] Wed, 14 May 2014 18:45
Eclipse UserFriend
A question somewhat similar to stackoverflow.com/questions/16831139/xtext-multiple-files-language

The problem is that DSL sub-dialect is specified using folder/file name, there is no root element, i.e:

recipes/recipe1.txt
borsch = {
some stuff
ingredients = { apple }
}

fruits/fruit1.txt
apple = {
color = { green yellow red }
}

There is no root element to use --> folder/file name is the root element

Is there any way to somehow make xtext pass folder or file name to grammar? So I could write something like:

Model: [if parent_folder="recipes"] Recipe | [if parent_folder="fruits"] Fruit;
Recipe: ...;
Fruit: ...;

Thanks
Previous Topic:Cross Referencing Problem
Next Topic:xtext builder hangs eclipse on unrelated changes
Goto Forum:
  


Current Time: Sat Jul 19 23:19:33 EDT 2025

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

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

Back to the top