xtext

How to invoke Xtext parser/JvmModelInferrer from a Java project

梦想的初衷 提交于 2019-12-03 23:37:41
问题 I have implemented a simple little DSL that generates classes from input files, by using the JvmModelInferrer approach. I am trying to figure out how I can invoke the parser and the code genarator within the code of a regular java project. So at some point in the main class of my non-Xtext project I can just create a file, pass it to the Xtext parser/codeGenerator for my DSL, and the result will be that class files are generated to a folder of my choice (within my java project). This case is

Xtext example of a scoped object

五迷三道 提交于 2019-12-03 12:57:24
问题 I'm looking for an example (in XText) of how to implement code completion on an user defined objects members. As far as I can see I need to use IScope, but how all this wires together is unclear. Given that trait is a user defined type, how do I go about building a grammar to code complete / validate the methods contained within String when I type name. ? trait String { def toLowerCase(): String def toUpperCase(): String } val name = new String() name.toLowerCase() Thanks 回答1: It highly

How can I use Eclipse's new Xtend language in my Android project?

◇◆丶佛笑我妖孽 提交于 2019-12-03 07:08:03
问题 I'd like to write Java classes in the Xtend language (simply because its way more terse), and have it compile back down into Java classes of which I can use in my Java project. Just like coffeescript. How can I do this? I tried creating an Xtend file just as I would do with a new class, however I get this error: Mandatory library bundle 'org.eclipse.xtext.xbase.lib' not found on the classpath. This disables intellisense (autocompletion). Also, even if I do get that working, how can I have it

Xtext example of a scoped object

纵然是瞬间 提交于 2019-12-03 03:15:17
I'm looking for an example (in XText) of how to implement code completion on an user defined objects members. As far as I can see I need to use IScope, but how all this wires together is unclear. Given that trait is a user defined type, how do I go about building a grammar to code complete / validate the methods contained within String when I type name. ? trait String { def toLowerCase(): String def toUpperCase(): String } val name = new String() name.toLowerCase() Thanks Christian Dietrich It highly depends on your grammar what you have to do to adopt scoping. Let us say you have a grammar

How can I use Eclipse's new Xtend language in my Android project?

故事扮演 提交于 2019-12-02 20:41:05
I'd like to write Java classes in the Xtend language (simply because its way more terse), and have it compile back down into Java classes of which I can use in my Java project. Just like coffeescript. How can I do this? I tried creating an Xtend file just as I would do with a new class, however I get this error: Mandatory library bundle 'org.eclipse.xtext.xbase.lib' not found on the classpath. This disables intellisense (autocompletion). Also, even if I do get that working, how can I have it compile to a Java class? Having tried the same thing, I can confirm that enabling the Xtend Nature and

What are the main differences between Jetbrains' MPS and Eclipse Xtext?

北战南征 提交于 2019-12-02 15:24:16
I have used Eclipse Xtext in several projects. I loved the ease of defining a grammar over an Ecore (meta)model and letting everything generated for you including awesome Eclipse plugin editor, but I was quite uncomfortable with the underlying EMF framework with everything hard-wired in static fields. Lately I came across Jetbrains' MPS (Meta Programming System) . It's based on completely different philosophy. While Xtext is for creating text-based DSLs generating a parser for you (and instantiating those EObjects), in MPS-created language one edits directly underlying model structure. So far

Xtext Bundle org.eclipse.emf.mwe.utils cannot be resolved

旧巷老猫 提交于 2019-12-02 15:01:36
问题 I'm trying to learn to use Xtext. I was unable to create an Xtext project when I installed Xtext in an existing Eclipse Neon installation using either the marketplace or using Install New Software (see Can't Create Xtext Project in Eclipse). I then tried installing a new Eclipse DSL Tools with the Eclipse installer. Now I can create a project, but the default project already has errors in it; I haven't even tried to edit the default project. Here are the errors: In build.properties, Bundle

Xtext Bundle org.eclipse.emf.mwe.utils cannot be resolved

与世无争的帅哥 提交于 2019-12-02 12:24:40
I'm trying to learn to use Xtext. I was unable to create an Xtext project when I installed Xtext in an existing Eclipse Neon installation using either the marketplace or using Install New Software (see Can't Create Xtext Project in Eclipse ). I then tried installing a new Eclipse DSL Tools with the Eclipse installer. Now I can create a project, but the default project already has errors in it; I haven't even tried to edit the default project. Here are the errors: In build.properties, Bundle org.eclipse.emf.mwe.utils cannot be resolved. In GenerateMyDsl.mwe2, A value of type 'org.eclipse.xtext

Can't Create Xtext Project in Eclipse

China☆狼群 提交于 2019-12-02 10:45:40
I installed Xtext 2.12 from the Eclipse Marketplace. I'm using Eclipse Neon.3 Release (4.6.3). Following the directions in the Bettini book, I tried to create a new Xtext project, but the wizard does not appear in the New>Other... dialog. What did I miss and why doesn't stuff just work? 来源: https://stackoverflow.com/questions/46458903/cant-create-xtext-project-in-eclipse

How to define different indentation levels in the same document with Xtext formatter

时光怂恿深爱的人放手 提交于 2019-12-01 13:14:09
问题 Is it possible to format a document as follows, using Xtext formatting? As you can see, Test children are indented with 4 spaces while External children are indented with 2 spaces only. I am using Xtext 2.12.0. Test my_prog { Device = "my_device"; Param = 0; } External { Path = "my_path"; File = "my_file"; } 回答1: you could try to work with custom replacers, dont know if this will work with nested block though def dispatch void format(External model, extension IFormattableDocument document) {