mismatch between a grammar expression and its corresponding model [message #1750299] |
Mon, 19 December 2016 17:20  |
Aran A Messages: 30 Registered: January 2011 |
Member |
|
|
Hi,
I've made some work with this simple grammar:
Model:
'model' href=STRING
;
.. and I've problems with the model related to expressions conformant to this grammar.
I have coded a program that taking an expression conformant to the grammar (e.g. example.sedsl), it gets the *.xmi file with the model corresponding to that expression.
The content of example.sedsl is: model "http://amazon.com"
And the content of the corresponding xmi model is:
<?xml version="1.0" encoding="ASCII"?>
<selEvDsl:Model xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:selEvDsl="..." href="http://amazon.com"/>
That is the content, if I open the *.xmi file with the Text Editor, everything seems ok, but if I open it with the "Sample Reflective Ecore Model Editor", the value of href attribute is null.
If I try to read the model with a Java program, I get the same, the null value for the href.
But, if I try to do same testing, with this xtend code
def void testCorrectParsing() {
val model = '''
model "http://amazon.com"
'''.parse
val name = model.href
Assert::assertEquals("http://amazon.com", name)
System.out.println(name)
System.out.println(model.getHref())
}
The assert goes well, and besides I see the "http://amazon.com" value in the console.
I can't see why sometimes I get the string value and other times null. I got stuck, and I would appreciate any help.
Best regards,
Aran
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.01987 seconds