Questions tagged [xtext]

Use this tag to ask about Eclipse Xtext which is a framework for developing domain specific or general purpose programming languages.

The Xtext framework, which is part of the Eclipse project, is used to develop domain specific or general purpose languages. It provides rich capabilities for integrating a DSL with the Java programming language and the Eclipse IDE.

Using the Xbase expression language in a DSL, it can directly be mapped to Java types. Also accessing Java types in a DSL is easy with Xbase.

For any Xtext language Eclipse's IDE capabilities can be adapted easily by generating class stubs for automatic formatting patterns, scopes and cross references, static validation, content proposals, the outline view or providing quick fixes. Once a stub is implemented it is automatically used by the DSL editor in Eclipse.

1374 questions
0
votes
1 answer

Xtext, Xbase: infer questions

I'm going to write an inferrer for my dsl and I have some questions that I could not solve with only the help of documentation. First one: I need to create static void main() from a feature: how can I add static with .toMethod()? Second one: Suppose…
Tommaso DS
  • 211
  • 2
  • 14
0
votes
1 answer

Transformation of security model written in own DSL-xtext

I've a security engineering model of business processes written in own DSL using xtext editor. For example, I've a security model for Activiti which has security controls e.g. securing transmission channel, encrypt message among processes, user…
nommyravian
  • 1,316
  • 2
  • 12
  • 30
0
votes
1 answer

Xtext: Scope method not execute?

I've got this IScope method: IScope scope_Assignment(AssignmentOrFBCall a, EReference ref){ System.out.println(a.toString()); return IScope.NULLSCOPE; } but it doesn't produce any results. Nothing in output with println and content…
Tommaso DS
  • 211
  • 2
  • 14
0
votes
3 answers

working with xtext not as plugin

In general I have my dsl as plugin and I want to create a new app that use my dsl so i tried to write this code: JsonParser p = new JsonParser(); IParseResult r = p.parse(new StringReader("{}")); //once that work it will be the file data instead of…
Dana Klein
  • 159
  • 1
  • 12
0
votes
1 answer

xtext injected parser

@Inject protected void setInjectedParser(IParser parser) { this.parser = parser; } I want to manually run the xtext engine and i'm not sure when and where the setInjectedParser is being called. thanks,
Dana Klein
  • 159
  • 1
  • 12
0
votes
2 answers

Xtext: combine tests and validation

I'm newbie in the world of Xtend and Unit Test. I'm testing my grammar, and I want to write a test which test the validation of it. Here a simple example: MyGrammar: Domainmodel: entities+=Entity* ; Entity: 'ENTITY' name=ID 'END_ENTITY'; Now…
Tommaso DS
  • 211
  • 2
  • 14
0
votes
1 answer

XText: split tokens on brackets

I use XText with a grammer like this: Element: element '[' name=ID ']' '{' content+=Content+ '}' Content: STRING Now, the following is valid: element[blub] { "Text" } but this is not: element[blub]{ "Text" } Error: mismatched input: ']{'…
ipsec
  • 680
  • 4
  • 11
0
votes
1 answer

XText: 7 languages tutorial can't resolve reference to JvmIdentifiableElement in example 1 scripting

I'm following 7 languages tutoiral from XText homepage (http://www.eclipse.org/Xtext/7languages.html) In the first example "scripting" I've managed to get almost everything running, but there seems to be a problem with identifiers scoping. I have…
stmi
  • 733
  • 4
  • 13
0
votes
1 answer

How can I solve this error when I´m writing a model based on a previous metamodel using xText?

I have written this metamodel in a xText project: Screen: "Screen name: " name = ID "Level: " level = STRING "End: " end = INT background = [Background] character = [Character] (enemies+=Enemy)* …
Barbara PM
  • 512
  • 2
  • 8
  • 29
0
votes
1 answer

Xtext runtime compilation

I'm trying to understand Xtext and to find out if it fits my needs. I'm looking for a tool which allows me to create a DSL which can be compiled and evaluated in my application during execution. Xtext seems like a really good tool because it…
NagyI
  • 5,907
  • 8
  • 55
  • 83
0
votes
2 answers

Xtext/EMF how to do model-to-model transform?

I have a DSL in Xtext, and I would like to reuse the rules, terminals, etc. defined in my .xtext file to generate a configuration file for some other tool involved in the project. The config file uses syntax similar to BNF, so it is very similar to…
mirosval
  • 6,671
  • 3
  • 32
  • 46
0
votes
1 answer

Avoid Custom Terminals Hiding (Suppressing) Derived Ones

I started playing around with xtext a few days ago and just went through the tutorials. Maybe the solution has been covered in the reference somewhere but I cannot get it right quickly. My problem is this. I tried to write a simple grammar which…
abel
  • 519
  • 1
  • 5
  • 15
0
votes
1 answer

Xtext assign values during parsing

I'm trying to build a parser that can take a human language expression like twenty five percent and transform it into a number like 25%. Essentially I have a rule like this: Number: (T1 | T2 | T3 T1) 'percent'? ; terminal T1: 'zero' | 'one' |…
mirosval
  • 6,671
  • 3
  • 32
  • 46
0
votes
1 answer

Generating static objects in xtext

continue to the example of generating a field such as: def handle (EClass c) { val attr = EcoreFactory::eINSTANCE.createEAttribute attr.name = "test" attr.EType = EcorePackage::eINSTANCE.EString c.EStructuralFeatures += attr } can I…
Dana Klein
  • 159
  • 1
  • 12
0
votes
1 answer

code generate with xtend in xtext project

I'm working on xtext project and I'm generating objects through .xtext file. I want to add new attribute to one of the generated object. I saw in…
Dana Klein
  • 159
  • 1
  • 12