Parse XExpressions [message #1697063] |
Mon, 01 June 2015 09:47 |
Daniel Kraus Messages: 5 Registered: June 2015 |
Junior Member |
|
|
As part of my thesis I wrote a small DSL which describes special flowcharts. The decision nodes of those charts use the following parser rule:
Decision:
'decision' name=ValidID '{'
expression=XExpression
'}'
;
In my IJvmModelInferrer I map each decision to a method and set the XExpression as its body. Most of the time those expressions contain a simple if clause (sometimes switch statements) to evaluate one or more system properties and to decide which node or leaf comes next.
In order to visualize a flowchart I have to analyze the given XExpressions (and therefore parts of the AST) to draw links between nodes. A short example for this (in DSL syntax):
decision myDecision {
if (foo)
return anotherDecision
else
return MY_LEAF
}
So what I want to do is show myDecision (which I already accomplished) and have outgoing links to anotherDecision and MY_LEAF, ideally with a label "if (foo)" and "else".
What is the best or easiest way to parse my XExpressions to achieve this? I'm new to the world of EMF/Xtext/Xbase and thankful for any help or advice.
[Updated on: Tue, 02 June 2015 08:34] Report message to a moderator
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03083 seconds