Cross-referencing challenges [message #1831165] |
Wed, 12 August 2020 14:52  |
Eclipse User |
|
|
|
Hi,
I worked on a DSL (devicetree) some while ago and I am returning back to it after quite some time to add new capabilities. Below are some of the challenges I am facing, and hoping to validate my findings. I have quite a few questions, so I will start with one first, and rest in later posts.
Example tree:
/{
aa: x {
p = "1";
y {
};
};
};
&{/x/y} {
p2 = "2";
};
&aa {
p3 = "3";
}
Problem 1:
This language allows referencing other nodes via a node path (as &{/x/y} above) and "label" (as aa: above). How can I define the grammar for these paths like behavior with references. The label thing is easy but can this work with paths as a cross-reference? Does below grammar make sense?
Label:
name=ID ':'
;
Node:
(lb=Label)? name=ID
'{'
//....
'}' ';'
;
Reference:
'&' ( label=[Label|REFERENCE_ID] | path=[Node|REFERENCE_PATH ])
;
ExtensionNode:
reference=Reference
'{'
//....
'}' ';'
;
A few challenges here, that I am using JFlex so I am not fully flexible on terminal tokens above. So I need to ensure that whenever "path" is being matched with anything I strip the "&{ }" ... Is the value converter the proper way to do this?
Also I need to ensure that qualified names are calculated using "/", for matching with references, so I think I need a custom IQualifiedNameConverter through bindIQualifiedNameProvider in my module. Correct? Because it seems like the existing scoping logic depends on qualified names to find references.
More questions later....
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Re: Cross-referencing challenges [message #1831355 is a reply to message #1831348] |
Mon, 17 August 2020 21:56  |
Eclipse User |
|
|
|
Thanks for the suggestion Ed. I wanted to make sure that I am not missing some obvious way of doing things before trying to a lot of customizations myself. Thanks for the confirmation.
And Thanks a lot Christian Dietrich for all the help. As always your quick and helpful answers have guided me to the objectives I needed to meet.
By the way, for reference, I bound my own IResourceUIValidatorExtension in the UI module to avoid creating markers on the eclipse workspace resources.
|
|
|
Powered by
FUDForum. Page generated in 0.47621 seconds