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

How access local filesystem in Xtext validator?

I'm building a DSL using Xtext and I would like when a user writes a statement like that: import "someFile.txt" to be able to validate and check if that file already exists. If the import is defined like above, then the file should be in the same…
Alex Ntousias
  • 8,962
  • 8
  • 39
  • 47
3
votes
2 answers

string constants causing unexpected type collisions in xtext

I've boiled down the problem to a very simple grammar. Model: (greetings+=Greeting* | greetings+=FrGreeting*); Greeting: 'Hello' person=ID '!'; FrGreeting: 'Bonjour' person=('jacques' | 'philippe') '!'; In a file you can greet people…
user833970
  • 2,729
  • 3
  • 26
  • 41
3
votes
2 answers

I am planning to develop a domain specific language editor, which tool is easily plugged to eclipse and use it

I am planning to create a domain specific language editor Using Xtext. I want to know is there any tool better than xtext to develop. if yes please provide me the inputs Thanks in advance...
raj
  • 743
  • 6
  • 21
3
votes
1 answer

xtext how to tolerate parsing error?

I am write an SQL-like language. Assume the correct syntax is USE foo; SELECT * FROM bar; but I type it to US foo; SELECT * FROM bar; Default behavior is Antlr will stop parsing and I lost syntax hightlighting and outline view. The error message…
Ray Wu
  • 993
  • 16
  • 34
3
votes
1 answer

Xtend lambda expression overloading for Xtext QuickFix API

I am using Xtend to write custom QuickFixes for the Eclipse UI plugin of my Xtext language. The idea is to extend org.eclipse.xtext.ui.editor.quickfix.DefaultQuickfixProvider and use call the accept method of an…
marinabilles
  • 78
  • 1
  • 6
3
votes
2 answers

terminal/datatype/parser rules in xtext

I'm using xtext 2.4. What I want to do is a SQL-like syntax. The things confuse me are I'm not sure which things should be treated as terminal/datatype/parser rules. So far my grammar related to MyTerm is: Model: (terms += MyTerm…
Ray Wu
  • 993
  • 16
  • 34
3
votes
1 answer

XText cross-referencing: How to establish references between locally unique IDs, using their context as a qualifier?

I have a problem with cross-referencing terminals that are only locally unique (in their block/scope), but not globally. I found tutorials that describe, how I can use fully qualified names or package declarations, but my case is syntactically a…
Max Hohenegger
  • 1,609
  • 15
  • 19
3
votes
1 answer

Xtext and GMF integration

First of all, I have seen many links on stackoverflow of integrating XText with GMF. The most consistent tutorial I've seen so far was: http://www.eclipse.org/forums/index.php/mv/msg/472225/1036564/#msg_1036564 ..But not even generate a textual…
Joer Sakt
  • 31
  • 2
3
votes
1 answer

Xtext (DSL file) to Ecore

I have an Xtext project and a couple of sample DSL files. I can open these files with "Sample Ecore Model Editor" and validate that it conforms to the metamodel generated by Xtext. However, I cannot create an "EMF Project" or an "EMF Generator…
Pavlos
  • 73
  • 1
  • 7
3
votes
1 answer

xtext: Relation between AST, Metamodel and parse tree

Can someone explain me the relationship between a parse tree, AST and metamodel. I know so far that xtext derive an EMF Ecore metamodel out of the grammar and generate a parser with antlr. But how will it then be parsed: An input goes first trough…
ph09
  • 1,052
  • 2
  • 20
  • 31
3
votes
1 answer

Execute code on xtext startup?

I am working on a project where we use ATL to transform one ECore model instance to another. We have an XText editor set up to work with the target model, and would like to load the transformed model directly into the editor when it is…
tdidriksen
  • 31
  • 1
3
votes
1 answer

XText multiple file extensions

I'd like to define a language with different elements that shall be contained into different kind of files though linked (i.e. similarly to C++ with .cpp and .h files). Is grammar mixin the right way to do that? If so how should I proceed?
Andrea Sindico
  • 7,358
  • 6
  • 47
  • 84
3
votes
1 answer

Accessing Xtext's runtime EMF model

I created a DSL via Xtext and now I need to transform the models created in the editor into another model(s). I suppose the most straightforward way is to employ some kind of M2M transformation framework, but i need to access the model behind the…
yeti
  • 144
  • 7
3
votes
2 answers

How to add multiple outlets for generated XText DSL

By default the generated XText artifacts generate code from my DSL to the default outlet (which defaults to src-gen folder). I know that you can explicitly pass the outlet configuration name in fsa.generateFile("myfile.txt", "MY_OUTLET_NAME", "Some…
rehos
  • 168
  • 8
3
votes
2 answers

Xtext cross reference using custom terminal rule

I'm trying to get cross-references to work in my DSL. Here's a stripped down version of the grammar (a modified version of the standard example DSL): grammar org.xtext.example.mydsl.MyDsl with org.eclipse.xtext.common.Terminals generate myDsl…
JesperE
  • 63,317
  • 21
  • 138
  • 197