xtext

how to declare an array in xtext

可紊 提交于 2020-01-16 19:18:06
问题 I need to declare an integer array in a domain specific language using xtext. PolyLine: 'polyline' color = Color '{' Line1 'points number' n = INT Line2 'x points' Line3 'y ponts' Line4 '}'; In above rule declaration, I need to get several x and y points which indicate some coordination (theirs number is equal to n property in line2). But I can't find any document that help me to answer my question "How I can declare a array in xtext"? Can somebody help please? 回答1: I am not quite sure what

how to declare an array in xtext

匆匆过客 提交于 2020-01-16 19:18:01
问题 I need to declare an integer array in a domain specific language using xtext. PolyLine: 'polyline' color = Color '{' Line1 'points number' n = INT Line2 'x points' Line3 'y ponts' Line4 '}'; In above rule declaration, I need to get several x and y points which indicate some coordination (theirs number is equal to n property in line2). But I can't find any document that help me to answer my question "How I can declare a array in xtext"? Can somebody help please? 回答1: I am not quite sure what

How to include Java Code Block in Xtext DSL?

陌路散爱 提交于 2020-01-13 19:12:11
问题 In an Xtext grammar I can include an Xbase code block using the XExpression / XBlockExpression types. How would I go to do the same with a Java code block? The included java should later be included in the Java generated from the DSL constructs. 回答1: You can do this now with JBase (https://github.com/LorenzoBettini/jbase). JBase was created specifically for the use case you described (see https://dl.acm.org/citation.cfm?id=2972217) and can be incorporated with minor changes by extending JBase

How to include Java Code Block in Xtext DSL?

我们两清 提交于 2020-01-13 19:12:06
问题 In an Xtext grammar I can include an Xbase code block using the XExpression / XBlockExpression types. How would I go to do the same with a Java code block? The included java should later be included in the Java generated from the DSL constructs. 回答1: You can do this now with JBase (https://github.com/LorenzoBettini/jbase). JBase was created specifically for the use case you described (see https://dl.acm.org/citation.cfm?id=2972217) and can be incorporated with minor changes by extending JBase

Access of Project Files in custom class extending IdeContentProposalProvider

回眸只為那壹抹淺笑 提交于 2020-01-06 15:32:27
问题 For creating custom content Provider in Xtext, I need to understand all project context. I need to access all other files present in the project/folder. More Information: Our Xtext based language have custom completion proposal, error markers. All these components require doing a custom build. For building, we need access to all files and folders present inside our project. ( They have cross-references) For completion proposal, I have created my own Xtend class in IDE module as:

Extending XFeatureCall scope

六眼飞鱼酱① 提交于 2020-01-06 06:41:07
问题 This has been puzzling me for a while... I have done research, tried lots of things but failed miserably. The time has come to ask here. My grammar has this rule to define types: MyTypeDeclaration returns XExpression: =>({MyTypeDeclaration} type=JvmTypeReference name=ValidID '(') (params+=FullJvmFormalParameter (',' params+=FullJvmFormalParameter)*)? ')' block=XBlockExpression ; Of course, in the inferrer, I map it to a class (with a supertype MySupertype to differentiate from other Java

What's the relationshiop between Xtext and ANTLR?

拥有回忆 提交于 2020-01-03 08:09:05
问题 I heard that Xtext ultimately uses ANTLR but their grammar specification files have somewhat different formats. So what's the relationship between the two? 回答1: Xtext relies on the Antlr parser generator for the parsing of input files. On top of that the framework provides lot's of added value such as strongly typed ASTs, abstractions for linking and static analysis as well as IDE integration for Eclipse. For that purpose, Xtext generates two Antlr grammars. One for the production parsing

Xtext cross referencing and scoping

╄→尐↘猪︶ㄣ 提交于 2020-01-02 19:13:10
问题 I have some problems with xtext cross referencing Here is a very simple grammer: grammar org.xtext.example.mydsl1.Test with org.eclipse.xtext.common.Terminals generate test "http://www.xtext.org/example/mydsl1/Test" Model: block=Block? cs+=Company* ; Block: '{' g=[Employee] '}'; Company: 'Company' name=ID '{' es+= Employee* '}'; Employee: 'Employee' name=ID ';' ; and it is my dsl : { Pooyan } Company Sony{ Employee Pooyan; Employee John; } It always shown that "Couldn't resolve reference to

Xtext cross referencing and scoping

廉价感情. 提交于 2020-01-02 19:13:06
问题 I have some problems with xtext cross referencing Here is a very simple grammer: grammar org.xtext.example.mydsl1.Test with org.eclipse.xtext.common.Terminals generate test "http://www.xtext.org/example/mydsl1/Test" Model: block=Block? cs+=Company* ; Block: '{' g=[Employee] '}'; Company: 'Company' name=ID '{' es+= Employee* '}'; Employee: 'Employee' name=ID ';' ; and it is my dsl : { Pooyan } Company Sony{ Employee Pooyan; Employee John; } It always shown that "Couldn't resolve reference to

Xtext, multi-file Cross-reference

谁都会走 提交于 2019-12-25 18:39:40
问题 I want to call variables declared in another file. The include of the file is done using cross referencing. and the call of the declared too. this is the grammar: Script: includes+=(Include)* assignments+=(Assignment)* g=GetLog? clock=Clock? tests+=Test* ; Assignment: Config |Cosem ; Include: 'INCLUDE' includedScript=[Script|STRING]; Cosem: name=ID '=' 'COSEM' '(' classid=INT ',' version=INT ',' obis=STRING ')' ; AttributeRef: name=[Cosem] "." attributeRef =IDValue ; the declaration is the