Accessing downstream annotations of a node in Rasc

2019-09-01 10:26发布

Simple question: in Rascal how does one access annotations of descendants of a node? GetTraversalContextNodes() returns upstream nodes -- "myContext[-1]" doesn't work. getChildren() returns a list of children, but the list is a list of values. The Name@Annotation syntax requires that "Name" be a node. What magic do you do on "Name" to get it to refer to a node?

标签: rascal
1条回答
forever°为你锁心
2楼-- · 2019-09-01 11:02

If you just want the children that are themselves nodes, you could use code like the following:

list[node] nl = [ n | node n <- getChildren(currentNode)];

This would get back all the children, filtering out any that are not of type node.

查看更多
登录 后发表回答