name feature not assigned with string. [message #1012535] |
Thu, 21 February 2013 13:48  |
Eclipse User |
|
|
|
I have this simple json grammar, note the Generic member that has a key and a name feature:
grammar com.nuance.voconhint.Json with org.eclipse.xtext.common.Terminals
generate json "http://example.com"
Object:
{Object} '{'
(members+=Member)?
(',' members+=Member)*
'}';
Member:
Generic | Name;
Generic:
key=STRING ':' name=Value;
Name:
key='\"name\"' ':' name=STRING;
Value:
Object | STRING | Array | Boolean | Null | NUMBER;
Array:
{Array} '[' (values+=Value)? (',' values+=Value)* ']';
Boolean:
'true' | 'false';
Null:
'null';
terminal NUMBER:
'-'? INT? '.' INT (('E'|'e') '-'? INT)?;
If I test my model with a simple json example the value of the name key for version is null:
val jsonText1 = "{
\"version\": \"1.0\",
\"logger\": [\"log1\", \"log2\", \"log3\"]
}"
val model = parser.parse(jsonText1)
I looked up the name feature in the debugger and it is assigned to null, I would expect that the xtext parser creates the name value based on the string, why isn't it doing that? How can I force it to assign "1.0" to the name feaure of the value member?
Regards
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04612 seconds