Accessing properties through JVM model [message #1721903] |
Mon, 01 February 2016 10:13  |
Eclipse User |
|
|
|
Hello Christian,
As a follow-up of last week's discussions, I have decided to augment my DSL to support property access like in your post : https://christiandietrich.wordpress.com/2013/05/18/xtext-and-dot-expressions/
The approach presented there is quite straightforward and understandable, but I don't think it can apply to my case for 2 reasons. The first is that I need to access the referenced properties through specific methods (so no direct Model/EMF representation) and also because a large part of the model will be shipped as a Java library with no model to generate from / link to.
As you may recall, my properties generate instances of Property containers that have different attributes (PropertyAttribute). I would like to write a DSL that allows me to chain access as such:
top.child.subchild = literalvalue
that generates code like:
top.value.get.child.value.get.subchild.value = literalvalue
The "value" returns an optional, thus the added call at each step.
How do you think I should do this? There is some issues of typing, auto completion etc.
It doesn't seem to me like the scoping as you have done on your blog post is a good strategy, as a large part of the model is not available and thus needs to go through JVM class analysis.
Any suggestion will be greatly appreciated.
Daniel
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.07576 seconds