|
|
|
|
|
|
|
|
|
|
|
|
|
Re: Debugging non-deterministic serialization failure [message #1746544 is a reply to message #1746543] |
Mon, 31 October 2016 19:54   |
|
p.s.
for testing purposes i used this grammar
Root:
prototype=Prototype
model=Model
;
Prototype:
name=FQN
;
Model:
"a"
(
(
annotations+=DslAnnotation* incomplete?='incomplete'?
| incomplete?='incomplete'? usingDeprecatedAtSyntax?='@'
)
name=ID
prototype=[Prototype|FQN]?
entity=FQN?
attributeDefinitions+=AttributeDefinition*
|
(
annotations+=DslAnnotation*
inherit='inherited'
incomplete?='incomplete'?
prototype=[Prototype|ID]
|
inherit='specialized'
prototype=[Prototype|ID]
(
attributeDefinitions+=AttributeDefinitionAbbrev
| attributeDefinitions+=AttributeDefinitionPlain
)
)
|
annotations+=DslAnnotation*
inherit='specialized'
incomplete?='incomplete'?
prototype=[Prototype|ID]
entity=FQN? "#"
attributeDefinitions+=AttributeDefinition*
)
"b";
DslAnnotation:
"@" name=ID "("")"
;
FQN: ID ("."ID)*;
AttributeDefinition:
"attr" name=ID
;
AttributeDefinitionAbbrev:
"a" name=ID
;
AttributeDefinitionPlain:
"ax" name=ID
;
and test
class Main {
def static void main(String[] args) {
val Injector i = new MyDslStandaloneSetup().createInjectorAndDoEMFRegistration
val ISerializer s = i.getInstance(ISerializer)
val p = MyDslFactory.eINSTANCE.createPrototype => [
name = "a.b.c"
]
val m = MyDslFactory.eINSTANCE.createRoot => [
prototype = p
model = MyDslFactory.eINSTANCE.createModel => [
inherit = "inherited"
prototype = p
incomplete = false
]
]
val rs = i.getInstance(ResourceSet)
val r = rs.createResource(URI.createURI("dummy.mydsl1"))
r.contents += m
println(s.serialize(
m
))
}
}
Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Re: Debugging non-deterministic serialization failure [message #1746557 is a reply to message #1746555] |
Mon, 31 October 2016 21:11   |
|
youre welcome. maybe you can backport the current 2.10 code
protected Set<AbstractElement> findValidValueAssignments(EObject semanticObj,
Iterable<AbstractElement> assignedElements, Object value) {
Set<AbstractElement> result = Sets.newLinkedHashSet();
for (AbstractElement ass : assignedElements) {
if (ass instanceof Keyword && keywordSerializer.isValid(semanticObj, (Keyword) ass, value, null))
result.add(ass);
else if (ass instanceof RuleCall) {
RuleCall rc = (RuleCall) ass;
if (rc.getRule() instanceof EnumRule) {
if (enumLiteralSerializer.isValid(semanticObj, rc, value, null))
result.add(ass);
} else if (valueSerializer.isValid(semanticObj, rc, value, null))
result.add(ass);
}
}
return result;
}
Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03315 seconds