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
4
votes
2 answers

What parameters should be used for AbstractDeclarativeValidator.warning and error?

I have a working grammar on xtext, and am starting the validation of the code. For this, I added a method in the validator xtext created for me. Of course, when an expression isn't valid, I want to be able to give a warning on the given AST node. I…
Clement Bellot
  • 841
  • 1
  • 7
  • 19
4
votes
2 answers

Including a grammar into another grammar

I would like to reuse grammar definitions. I have a grammar like this: Person: 'contact' name=ID '{' 'phone' phone=INT '}' ; I would like to have another grammar like this: include "uri/to/other/project/to/other/grammar/definitions" Call: …
bline
  • 227
  • 3
  • 15
4
votes
1 answer

Xtext Integration with GMF

I see xtex can be integrated with gmf, but I can't find any tutorial, explanation or example code. Is there any explanation about how to do this? And I want to ask... Can I create an xtext project and then with same metamodel (ecore) can I create a…
gezgin
  • 207
  • 4
  • 10
4
votes
1 answer

Grammar errors in Xtext

I have a grammar rule factoid: Element Place ; That depends on another rule: Place: name = ('sea' | 'air') ; The factoid rule seems to contain identify errors associated with Place: Multiple markers at this line - Cannot change type twice…
Factor Three
  • 2,094
  • 5
  • 35
  • 51
4
votes
1 answer

providing automization with Xtext and Java program

In my current project, I am using xText editor for writing my dsl specifications (i.e., voc.mydsl, arch.mydsl, and network.mydsl). I like the xText editor because of its code-completion and other functionalities. However, I have a separate Java…
user-517752
  • 1,188
  • 5
  • 21
  • 54
4
votes
1 answer

Xtext DSL grammar scoping customization

I know there is a simple solution for this but I have no idea how to implement it. I'm looking for how to implement the answer rather than what I need to do. Half the answer is already on this page: Xtext cross referencing and scoping My problem is…
Charles Henry
  • 353
  • 3
  • 16
4
votes
3 answers

Matching a "text" in line by line file with XText

I try to write the Xtext BNF for Configuration files (known with the .ini extension) For instance, I'd like to successfully parse [Section1] a = Easy123 b = This *is* valid too [Section_2] c = Voilà # inline comments are ignored My problem is…
rds
  • 26,253
  • 19
  • 107
  • 134
4
votes
2 answers

Use Xtext or XTend to build code generator for existing EMF Model

I have a transformation sequence of models that eventually outputs an EMF model, instance of some EMF Meta model (the meta model I defined myself). I am looking for a good way to generate code from this. Of course, there is XPand, I used to use…
Marten Sytema
  • 1,906
  • 3
  • 21
  • 29
4
votes
1 answer

Linking Xtext with StringTemplate code generator

In my current project, I am trying to link the DSL specification written in xtext and code generator written in StringTemplate. for instance, the syntax of my DSL specification is as follows. I am entering this information through nice editor…
user-517752
  • 1,188
  • 5
  • 21
  • 54
4
votes
1 answer

Error while building an xtext project with ant: Generation of the Grammar classes fails

I am developing an xtext plug-in project for an eclipse application for my Bachelor thesis. I want to do the 'Generate Xtext Artifacts' at runtime with an ant script executing the Mwe2Launcher class and do the generation in an temp folder. I wrote…
pekayde
  • 118
  • 10
4
votes
1 answer

Combining two Iterables using standard library -- or -- map with multiple Iterables

When given two Iterables val keys = newLinkedList('foo', 'bar', 'bla') val vals = newLinkedList(42, 43, 44) I want to correlate each item in both lists like this: val Iterable> expected = newLinkedList('foo'->42,…
A.H.
  • 63,967
  • 15
  • 92
  • 126
3
votes
2 answers

How do I access the project's preferences from my Xtext validator?

I want to make my Xtext validator configurable via a couple of preferences but I couldn't find a way to do it. Is there an example somewhere how I can do that?
Aaron Digulla
  • 321,842
  • 108
  • 597
  • 820
3
votes
2 answers

EDIFACT grammar, parsers and libraries (Java)

I am wondering if we can define EDIFACT grammar in ANTLR/xText and then generate parser. If so, are these grammars defined already that we can leverage (open source preferably)? Are there any open source libraries that can read and write EDIFACT…
Aravind Yarram
  • 78,777
  • 46
  • 231
  • 327
3
votes
1 answer

How to generate AST using Xtext and Xtend?

So I have the default example of a xtext grammar. grammar org.xtext.example.mydsl.MyDsl with org.eclipse.xtext.common.Terminals generate myDsl "http://www.xtext.org/example/mydsl/MyDsl" Model: greetings+=Greeting*; Greeting: 'Hello'…
Joe
  • 4,367
  • 7
  • 33
  • 52
3
votes
1 answer

Trigger Eclipse's code formatter programmatically from a new file wizard

I'm writing an Eclipse plugin with a wizard (org.eclipse.jface.wizard.Wizard) which creates a new file with a basic code template. To simplify the "piecing together" of the file contents, I plan to stuff everything into one long string, inject it…
John J. Camilleri
  • 4,171
  • 5
  • 31
  • 41