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
1 answer

xtext custom scoping: parameters of function

I am trying to custom scoping, such that if I have something like function in my language that get parameters, I want that those parameters will be visible only until there is semicolon, and out of this scope, I want it to not be visible. I tried…
RoG
  • 411
  • 4
  • 20
3
votes
2 answers

How to embed C++ code in a xtext DSL?

What is the proper way of handling C++ code blocks in Xtext/ANTLR? We are writing an Xtext-based eclipse plugin for a DSL that supports adding C++ function-level code within well-defined scopes (mostly serial { /* ... */ } blocks) such as…
3
votes
1 answer

Xtext & Xtend - Adding more parameters to RequestMapping

I have been trying to generate Java spring code like the following. @RequestMapping(method=RequestMethod.DELETE, value="/message/{id}") public void reject(@PathVariable final Long id) { return; } I have provided the following code in the xtend…
Philip John
  • 5,275
  • 10
  • 43
  • 68
3
votes
1 answer

Xtext: Inferring type in variable declaration not working in interface generation

I am writing my DSL's Model inferrer, which extends from AbstractModelInferrer. Until now, I have successfully generated classes for some grammar constructs, however when I try to generate an interface the type inferrer does not work and I get the…
Miguel Jiménez
  • 1,276
  • 1
  • 16
  • 24
3
votes
1 answer

XTEXT: Controlling when whitespace is allowed

I have a custom scripting language, that I am attempting to use XTEXT for syntax checking. It boils down to single line commands in the format COMMAND:PARAMETERS For the most part, xtext is working great. The only problem I have currently run…
Jeff Clare
  • 185
  • 1
  • 1
  • 8
3
votes
1 answer

XText cross-reference to an non-DSL resource

Please consider this minimal Xtext grammar. Model: "As a" stackeholder=Stakeholder "I want" want=Want; Stakeholder: 'client' | 'developer' | 'manager'; Want: 'everything' | 'cookies' | 'fame'; Now what I need to do, is to move the…
agschaid
  • 173
  • 8
3
votes
1 answer

Xtext: Cannot resolve reference

I have the following Xtext grammar: grammar dsl.miniproject.Question2.EclipsePluginLanguage with org.eclipse.xtext.common.Terminals import "platform:/resource/Question2/model/EclipsePluginModel.ecore" import "http://www.eclipse.org/emf/2002/Ecore"…
Jonny
  • 2,787
  • 10
  • 40
  • 62
3
votes
2 answers

Xtext serializing model with references

I have a hard time figuring out, what am I doing wrong. A simplified example, of what I'm trying to do: The DSL: Model: elements += ModelElement*; ModelElement: Greeting | Person; Person: 'person' name = ID; Greeting: 'hello' person = [Person]; The…
Balázs Édes
  • 13,452
  • 6
  • 54
  • 89
3
votes
1 answer

How to change the default package generation location in xtext?

How to change the default location of the generated packages in xtext? For example: src-gen package and xtend-gen. Inside these packages there are various sub packages are generated.So how one can change the default generation location.
3
votes
1 answer

org.eclipse.xtext.resource.FileNotFoundOnClasspathException: Couldn't find resource on classpath. URI was 'classpath:/../Less.xtext'

While trying to mavenize Eclipse plugin for LESS run into issue #210 In #208 added commit https://github.com/PaulVI/ow/commit/7c9db5373fcc09278e3314a7ceea616a3cd2d35a
Paul Verest
  • 60,022
  • 51
  • 208
  • 332
3
votes
1 answer

How to import an Xtext Project from git in Eclipse?

I have an Xtext project in a git repository. I tried various ways to import it into a blank workspace. I didn't succeed so far. I search google for at least two hours. I found various tutorials how to setup a new Xtext project in Eclipse, but not…
Thomas Solti
  • 861
  • 8
  • 17
3
votes
1 answer

How to use XBaseInterpreter in Xtext?

can someone tell me, how i can use "xbaseinterpreter"? I have no idea :( I have written a DSL used to define simple protocol-structure for a sensornet, the goal of the work is to check if a data-message(as Instance) belongs to any user-defined…
Wendsja
  • 31
  • 1
3
votes
1 answer

How can I add xText editor to Eclipse (e4) RCP Application?

I've already made a xtext editor (2.5). I try to use this editor in a part in my RCP application. I use this code: Injector injector = MyDslActivator.getInstance().getInjector(MyDslActivator.XTEXT_DSL_MYDSL); EmbeddedEditorFactory factory =…
SergSW
  • 238
  • 2
  • 10
3
votes
2 answers

Xtext Xtype: What's the difference between JvmType and JvmTypeReference?

The Xtype grammar contains two ways to refer to Java types: JvmType and JvmTypeReference. I don't understand: why there are two; how they are different; when I should use which.
Aaron Digulla
  • 321,842
  • 108
  • 597
  • 820
3
votes
2 answers

Xtext grammar error "Decision can match input ... using multiple alternatives: 1, 3, 4, 5"

I got stuck with my xtext grammar definition. Basically I like to define multiple parameters for a component. The component should contain at least one parameter definition paramA OR paramB OR paramC OR (paramA AND paramB) OR (paramB AND paramC) OR…
Michael
  • 3,982
  • 4
  • 30
  • 46