Accessing downstream annotations of a node in Rascal

人盡茶涼 提交于 2020-01-17 11:34:17

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/28120046/accessing-downstream-annotations-of-a-node-in-rascal

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!