Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » How to access fields of rules within a grammar
How to access fields of rules within a grammar [message #1740907] Fri, 19 August 2016 16:53 Go to next message
Karsten Wilken is currently offline Karsten WilkenFriend
Messages: 59
Registered: August 2016
Member
until now I couldn't find a related topic via google or topics in this forum. (maybe I haven't found the right keywords yet)

Ok,
my goal is to declare a method body within the grammar and to use other "rules" or rather classes and access fields but somehow I can't figure out how to make it work.

I need to create a "combinedAttribute" where the combination of the value depends on a combination of other "attributes".
Therefor I need access to the fields of attribute within the grammar itself. As far as I saw examples most of the time real access and "java stuff" isn't done within the grammar.

Attribute:
'attribute' name = ID '(' minValue = INT ',' maxValue = INT ')'
value = INT

CombinedAttribute:
'combinedAttribute' name = ID '(' minValue = INT ',' maxValue = INT ')'
<< missing stuff to calculate the value >>

My first instinct went to "Attribute.value" but didn't work or maybe I just don't get the correct syntax for it.

My second attempt was a params list of attributes that are combinated and I only specify that within the math expression I want the leafs to be of the type Attribute.
No good idea and xtext was mad because thanks to the recursion Attribute could be a supertype in that expression.

Nevermind my attempts. Any idea how I can get it to work? My idea in Java is pretty clear:

getValue(Attribute a, Attribute b, Attribute c) {
return (a.value + b.value / c.value);
}

The math expression should be any combination of basic math terms (+ , - , * , / ).
That part is easy and well explained in tutorials.

I can't figure out how to access fields within the grammar and how to reference them.

Secondary: The web editor i created seems to not notice the types or references at all. I'm not sure if it is a related issue or subject for a new topic.
To state an example for this issue:
I tried to provide a list of attributes that are part of the combinate attribute.
something like attribute agitity [...]
within the combinate attribute the attribute named "agility" could be choosen from the suggestions but the grammar or rather the editor couldn't solve the type.
But this part is not as important as the first part.

Thanks for your help and suggestions.
Re: How to access fields of rules within a grammar [message #1740923 is a reply to message #1740907] Fri, 19 August 2016 18:39 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
well i dont really get both of your question

(1) why dont so simply hard code this in your grammar i a first step?

e.g. by having a

enum AttributeValuePart: minValue | maxValue | value

and inside your expression hierarchy a

AttributeValuePartLiteral: value=AttributeValuePart

???

(2) make sure this is not https://github.com/eclipse/xtext-web/issues/5
having a complete example grammar and model would help


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: How to access fields of rules within a grammar [message #1740931 is a reply to message #1740923] Fri, 19 August 2016 20:00 Go to previous messageGo to next message
Karsten Wilken is currently offline Karsten WilkenFriend
Messages: 59
Registered: August 2016
Member
Thanks for your reply. The min and max values are not the issue. Maybe I souldn't have included them.

The focus is on the "value" only.

getValue(Attribute a, Attribute b, Attribute c) { // (or rather a list of Attributes that differs in size and combination of the values)
return (a.value + b.value / c.value);
}

This part is the problem. In all examples you only get params for a method and the examples of the expression are not based on these params.
I need to access a field of that rule. (Attribute.value) within the grammar.

I'm not even sure about the needed syntax to access the fields in the grammar. I tried to access the fields by for example [Attribute].value and other combinations.
Re: How to access fields of rules within a grammar [message #1740932 is a reply to message #1740931] Fri, 19 August 2016 20:12 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
Hi,

i still cannot follow you

	attributes+=AbstractAttribute*;
AbstractAttribute:
	Attribute | CombinedAttribute;
Attribute:
	'attribute' name=ID '(' minValue=INT ',' maxValue=INT ')'
	value=INT;
CombinedAttribute:
	'combinedAttribute' name=ID '(' minValue=INT ',' maxValue=INT ')'
	value=Expression;
Expression:
	Addition;
Addition returns Expression:
	Multiplication ({Addition.left=current} '+' right=Multiplication)*;
Multiplication returns Expression:
	Primary ({Multiplication.left=current} '*' right=Primary)*;
Primary returns Expression:
	NumberLiteral |
	AttributeRef |
	'(' Addition ')';
AttributeRef:
	attribute=[Attribute] "." part=AttributePart; //if you can reference value only why not simply leave off the .xxx part
enum AttributePart:
	maxValu | minValue | value;
NumberLiteral:
	value=INT;


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: How to access fields of rules within a grammar [message #1741052 is a reply to message #1740931] Sat, 20 August 2016 07:41 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

I think that you are trying to make the grammar far too 'clever' which
is very hard, often impossible and ultimately confusing to the user
since error reporting / content assist are suspect.

It is much better to have a grammar that expresses general structure
assisted by lookup/validation that checks/enforces detailed semantics.
For instance a Java grammar cannot know about every possible field name
and type.

Regards

Ed Willink


On 19/08/2016 21:00, Karsten Wilken wrote:
> Thanks for your reply. The min and max values are not the issue. Maybe I
> souldn't have included them.
>
> The focus is on the "value" only.
>
> getValue(Attribute a, Attribute b, Attribute c) { // (or rather a list
> of Attributes that differs in size and combination of the values)
> return (a.value + b.value / c.value);
> }
>
> This part is the problem. In all examples you only get params for a
> method and the examples of the expression are not based on these params.
> I need to access a field of that rule. (Attribute.value) within the
> grammar.
> I'm not even sure about the needed syntax to access the fields in the
> grammar. I tried to access the fields by for example [Attribute].value
> and other combinations.


---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus
Re: How to access fields of rules within a grammar [message #1741224 is a reply to message #1741052] Tue, 23 August 2016 21:39 Go to previous messageGo to next message
Karsten Wilken is currently offline Karsten WilkenFriend
Messages: 59
Registered: August 2016
Member
Thanks Christian for the suggestion. I'll try if that works.

@Ed: I really didn't think that referencing a variable declared on a Rule/Class within the grammar would be difficult at all. In my opinion this mihgt be a very common use case within the grammars. I thought I only was missing the correct syntax to connecting them.

The grammar isn't intended ti be that smart at all. How else would you produce a connection in the combinated attribute between the defined attributes and their combinated version?
Re: How to access fields of rules within a grammar [message #1741235 is a reply to message #1741224] Wed, 24 August 2016 04:59 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
References are in 99,99 % of the time done on meta type level ( you reference a thing) not on (static) property of a meta type level

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: How to access fields of rules within a grammar [message #1746948 is a reply to message #1740907] Tue, 08 November 2016 00:24 Go to previous messageGo to next message
Karsten Wilken is currently offline Karsten WilkenFriend
Messages: 59
Registered: August 2016
Member
Hello again,

if I use

AttributeRef:
attribute=[Attribute] "." part=AttributePart;

I get a "Couldn't resolve reference to Entity xyz".

Could you give me a hint to the possible reasons?
The relevant parts of the dsl are the following:
'game' name = QualifiedName '('
		elements+=Entity*
	')';
Entity:
	Character | Attribute | //others-not relevant for the example
;
Character:
	'character' name = QualifiedName '('
		properties += Property*
	')'
;
Property:
	'attributeProperty' value = [Attribute] | //others not relevant
;
AttributeRef:
	attribute=[Attribute] '.' part=AttributePart
;
enum AttributePart:
	attrName | attrValue | attrMinValue | attrMaxValue
;


The example DSL in orion web editor:
game testGame (
	attribute  agility ( range[0, 20] )

	character goblin (
		attributeProperty testGame.agility <-- last entered part with auto suggestion
	)
)


The editor responds with the following error message: "Couldn't resolve reference to Entity 'testGame'.

Am I overlooking some mistake in the DSL or is it something i messed up or forgot in the setup/config?

[Updated on: Tue, 08 November 2016 00:25]

Report message to a moderator

Re: How to access fields of rules within a grammar [message #1746955 is a reply to message #1746948] Tue, 08 November 2016 03:38 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
Please share al relevant code

Complete reproducible grammar
Name provider
Scope provider

I assume you don't use qualifiednameconverter at some point


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: How to access fields of rules within a grammar [message #1746957 is a reply to message #1746955] Tue, 08 November 2016 03:41 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
Ps can you try

attribute=[Attribute|QualifiedName]

As well

(Don't know if your grammar is ambiguous regarding this though


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: How to access fields of rules within a grammar [message #1746966 is a reply to message #1746955] Tue, 08 November 2016 07:20 Go to previous messageGo to next message
Karsten Wilken is currently offline Karsten WilkenFriend
Messages: 59
Registered: August 2016
Member
Christian Dietrich wrote on Tue, 08 November 2016 03:38
Please share al relevant code

Complete reproducible grammar
Name provider
Scope provider

I assume you don't use qualifiednameconverter at some point


Hi Christian,

I haven't created any custom name or scope providers yet.

Regarding the grammar:
grammar de.wilkenk.ba.Create with org.eclipse.xtext.xbase.Xbase

generate create "http://www.wilkenk.de/ba/Create"

Domainmodel:
	importSection=XImportSection?
	'game' name = QualifiedName '('
		elements+=Entity*
	')';
Entity:
	Character | Attribute | CombinedAttribute
;
Character:
	'character' name = QualifiedName '('
		properties += Property*
	')'
;
Property:
	'attributeProperty' value = [Attribute] | 
	'combinedAttributeProperty' value = [CombinedAttribute] 
;
Attribute:
	'attribute' name = QualifiedName  '('
	('range[' minValue = INT ',' maxValue = INT ']')?
	(value=INT)?
	('description:' description = ID )?')'
;
AttributeRef:
	attribute=[Attribute] '.' part=AttributePart
;
enum AttributePart:
	attrName | attrValue | attrMinValue | attrMaxValue
;
CombinedAttribute:
	'combinedAttribute' name = QualifiedName '('
	'range[' minValue = INT ',' maxValue = INT ']' 
	(value=INT)?
	('description:' description = ID )?')'
;
CombinedAttributeRef:
	combinedAttribute=[CombinedAttribute] '.' part=CombinedAttributePart
;
enum CombinedAttributePart:
	combAttrName | combAttrValue | combAttrMinValue | combAttrMaxValue
;


I hope this is enough to reproduce it.
Re: How to access fields of rules within a grammar [message #1746989 is a reply to message #1746966] Tue, 08 November 2016 11:29 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
is there a reason you are using xbase?

game testGame (
attribute agility ( range[0, 20] )

character goblin (
attributeProperty agility
)
)


works fine for me


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: How to access fields of rules within a grammar [message #1747190 is a reply to message #1746989] Thu, 10 November 2016 15:35 Go to previous messageGo to next message
Karsten Wilken is currently offline Karsten WilkenFriend
Messages: 59
Registered: August 2016
Member
No particular reason. Back when I started to create the DSL I thought it might be a good idea if I can use the java types. Most likely back then I also just followed the tutorial. Wink

[Updated on: Thu, 10 November 2016 15:43]

Report message to a moderator

Re: How to access fields of rules within a grammar [message #1747194 is a reply to message #1747190] Thu, 10 November 2016 15:41 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
any hints on reproducabilty?

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: How to access fields of rules within a grammar [message #1747195 is a reply to message #1747194] Thu, 10 November 2016 15:43 Go to previous messageGo to next message
Karsten Wilken is currently offline Karsten WilkenFriend
Messages: 59
Registered: August 2016
Member
It still doesn't work with my setup. Maybe I did something stupid with the workflow?

Workflow {
	
	component = XtextGenerator {
		configuration = {
			project = StandardProjectConfig {
				baseName = "de.wilkenk.ba"
				rootPath = rootPath
				runtimeTest = {
					enabled = true
				}
				web = {
					enabled = true
				}
				mavenLayout = true
			}
			code = {
				encoding = "UTF-8"
				fileHeader = "/*\n * generated by Xtext \${version}\n */"
			}
		}
		language = StandardLanguage {
			name = "de.wilkenk.ba.Create"
			fileExtensions = "create"

			serializer = {
				generateStub = true
			}
			validator = {
				// composedCheck = "org.eclipse.xtext.validation.NamesAreUniqueValidator"
			}
			webSupport = {
				generateHtmlExample = true
				framework = "ORION"
			}
			
			fragment = formatting.Formatter2Fragment2 {}
			fragment = validation.ValidatorFragment2 {}
			fragment = scoping.ImportNamespacesScopingFragment2 {}
			fragment = exporting.QualifiedNamesFragment2 {}
			fragment = ui.labeling.LabelProviderFragment2 {}
			fragment = ui.outline.QuickOutlineFragment2 {}
			fragment = ui.outline.OutlineTreeProviderFragment2 {}
			fragment = ui.quickfix.QuickfixProviderFragment2 {}
		    
			fragment = ui.contentAssist.ContentAssistFragment2 {}
			fragment = types.TypesGeneratorFragment2 {}
			fragment = xbase.XtypeGeneratorFragment2 {}	    
		}
	}
}
Re: How to access fields of rules within a grammar [message #1747198 is a reply to message #1747195] Thu, 10 November 2016 16:00 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
can you leave out all the fragments. and did you do any customizations?

and which is the model you are testing with?

and what do you do step by step when testing it.

did you try my test model?


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: How to access fields of rules within a grammar [message #1747225 is a reply to message #1747198] Fri, 11 November 2016 01:12 Go to previous messageGo to next message
Karsten Wilken is currently offline Karsten WilkenFriend
Messages: 59
Registered: August 2016
Member
Hi,

I did no other customizations besides the workflow changes posted above and I only added them because I run into errors without them.
Yes, I tried it with the "goblin model" Wink

I use the webEditor with ORION.

Without the fragments I get multiple of this error:
[qtp1267032364-17] WARN org.eclipse.jetty.servlet.ServletHandler - /create/xtext-service/update
com.google.inject.ConfigurationException: Guice configuration errors:

1) No implementation for org.eclipse.xtext.preferences.IPreferenceValuesProvider annotated with @org.eclipse.xtext.formatting2.FormatterPreferences() was bound.
  while locating org.eclipse.xtext.preferences.IPreferenceValuesProvider annotated with @org.eclipse.xtext.formatting2.FormatterPreferences()
    for field at org.eclipse.xtext.web.server.XtextServiceDispatcher.formatterPreferencesProvider(XtextServiceDispatcher.java:98)
  while locating org.eclipse.xtext.web.server.XtextServiceDispatcher

1 error
	at com.google.inject.internal.InjectorImpl.getProvider(InjectorImpl.java:1004)
	at com.google.inject.internal.InjectorImpl.getProvider(InjectorImpl.java:961)
	at com.google.inject.internal.InjectorImpl.getInstance(InjectorImpl.java:1013)
	at org.eclipse.xtext.web.servlet.XtextServlet.getService(XtextServlet.java:162)
	at org.eclipse.xtext.web.servlet.XtextServlet.doPut(XtextServlet.java:122)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
	at org.eclipse.xtext.web.servlet.XtextServlet.service(XtextServlet.java:62)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
	at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:837)
	at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:583)
	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
	at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:548)
	at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:226)
	at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1160)
	at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:511)
	at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185)
	at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1092)
	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:134)
	at org.eclipse.jetty.server.Server.handle(Server.java:518)
	at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:308)
	at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:244)
	at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:273)
	at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:95)
	at org.eclipse.jetty.io.SelectChannelEndPoint$2.run(SelectChannelEndPoint.java:93)
	at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.produceAndRun(ExecuteProduceConsume.java:246)
	at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.run(ExecuteProduceConsume.java:156)
	at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:654)
	at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:572)
	at java.lang.Thread.run(Thread.java:745)
Re: How to access fields of rules within a grammar [message #1747231 is a reply to message #1747225] Fri, 11 November 2016 05:21 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
well these (using web, how you solved the prefs problem) are important informations you missed so far. the actual solution for that would be a simple binding https://github.com/eclipse/xtext-web/issues/5

def void configureIPreferenceValuesProvider(Binder binder) {
binder.bind(IPreferenceValuesProvider).annotatedWith(FormatterPreferences).to(FormatterPreferenceValuesProvider)
}


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: How to access fields of rules within a grammar [message #1747322 is a reply to message #1747231] Sat, 12 November 2016 04:52 Go to previous messageGo to next message
Karsten Wilken is currently offline Karsten WilkenFriend
Messages: 59
Registered: August 2016
Member
Ok. The formatting part worked. But I don't get the difference? I thought that those fragments are ment to set this up? How or when should I use the fragments and when e.g. a PreferenceValueProvider?

The goblin test works if you type in just the word "agility". If you use the Strg+Space autocomplete it provides you with the suggestion to use "testGame.agility" (and the other possibilites) and then these errors occur if i choose "testGame.agility". Only today I noticed that this only happens with the completion tool.
`Multiple annotations:
testGame cannot be resolved.
mismatched input '.' expecting ')'
Re: How to access fields of rules within a grammar [message #1747326 is a reply to message #1747322] Sat, 12 November 2016 07:52 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
well the bindings may "destroy" the play together of xtext name providers. especially regarding xbase.

and well xbase has another problem which the content assist in the web currently does not check

the name "xxx.yyy" is not serializable as in ID but as FQN only thus it should be filtered by content assist but seems not to be done in web.

xxx=[YYY] is short for xxx=[YYY|ID] which means "parse an ID for the cross ref to a YYY" so testGame.something will not be parseable by that

i have created https://github.com/eclipse/xtext-core/issues/175

as a workaround

package org.xtext.example.mydsl4.web

import com.google.common.base.Predicate
import com.google.inject.Inject
import org.eclipse.emf.ecore.EClass
import org.eclipse.xtext.CrossReference
import org.eclipse.xtext.GrammarUtil
import org.eclipse.xtext.ide.editor.contentassist.ContentAssistContext
import org.eclipse.xtext.ide.editor.contentassist.IdeContentProposalProvider
import org.eclipse.xtext.resource.IEObjectDescription
import org.eclipse.xtext.xtext.CurrentTypeFinder
import org.xtext.example.mydsl4.myDsl.MyDslPackage

class MyDslIdeContentProposalProvider extends XbaseIdeContentProposalProvider {
	
	@Inject extension CurrentTypeFinder
	
	static val FILTER = new MyFilter
	
	override protected getCrossrefFilter(CrossReference reference, ContentAssistContext context) {
		val type = findCurrentTypeAfter(reference)
		val ereference = GrammarUtil.getReference(reference, type as EClass)
		if (MyDslPackage.Literals.PROPERTY__VALUE == ereference) {
			println("xxxx")
			return FILTER
		}
		super.getCrossrefFilter(reference, context)
	}
	
}

class MyFilter implements Predicate<IEObjectDescription> {
	
	override apply(IEObjectDescription input) {
		return input.name.segmentCount == 1
	}
	
}


	override Class<? extends IdeContentProposalProvider> bindIdeContentProposalProvider() {
		MyDslIdeContentProposalProvider
	}


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: How to access fields of rules within a grammar [message #1747332 is a reply to message #1747326] Sat, 12 November 2016 13:24 Go to previous messageGo to next message
Karsten Wilken is currently offline Karsten WilkenFriend
Messages: 59
Registered: August 2016
Member
So basicly if I change back to common.Terminals this shouldn't happen?
Re: How to access fields of rules within a grammar [message #1747333 is a reply to message #1747332] Sat, 12 November 2016 13:28 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
No it will happen as well

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: How to access fields of rules within a grammar [message #1747336 is a reply to message #1747333] Sat, 12 November 2016 13:53 Go to previous messageGo to next message
Karsten Wilken is currently offline Karsten WilkenFriend
Messages: 59
Registered: August 2016
Member
Ok, where do I need to implement it? Simply by putting a "MyDslIdeContentProposalProvider" class in the web project? Within the dsl project there is at least a suggestion through folders. At least in other frameworks the "placement" is important too.
Re: How to access fields of rules within a grammar [message #1747338 is a reply to message #1747336] Sat, 12 November 2016 14:54 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
You can put it there or to the ide project or ...
for easiness just put it in the web project


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: How to access fields of rules within a grammar [message #1747348 is a reply to message #1747338] Sun, 13 November 2016 01:06 Go to previous messageGo to next message
Karsten Wilken is currently offline Karsten WilkenFriend
Messages: 59
Registered: August 2016
Member
Ok that works. Thanks. A last question related with the suggestions. With Strg+Space the editor is suggesting agility and goblin. Even if I use "goblin" (the name of the character instance) I don't get errors or even a hint that this is a missmatch of types? Shouldn't "[Attribute]" limit it to that class? I would have guessed that the type would be checked automaticly?
Re: How to access fields of rules within a grammar [message #1747350 is a reply to message #1747348] Sun, 13 November 2016 07:15 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
This here


Property:
'attributeProperty' value = [Attribute] |
'combinedAttributeProperty' value = [CombinedAttribute]
;


Destroys the metamodel inference

Don't use value as name for both references


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: How to access fields of rules within a grammar [message #1747357 is a reply to message #1747350] Sun, 13 November 2016 15:53 Go to previous messageGo to next message
Karsten Wilken is currently offline Karsten WilkenFriend
Messages: 59
Registered: August 2016
Member
Bause it can't decide or distinguish? Since it would be only one field I thought that would be "good"?
Re: How to access fields of rules within a grammar [message #1747362 is a reply to message #1747357] Sun, 13 November 2016 20:08 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
Well yes but the type of that field will be the criteria of how to fill the scope (and not the grammar as you might to expect)

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Previous Topic:Import File
Next Topic:Another problem with left recursion
Goto Forum:
  


Current Time: Thu Mar 28 18:00:09 GMT 2024

Powered by FUDForum. Page generated in 0.04561 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top