Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何在 Rascal 中获得(子)分析树的产量,即与子树关联的文本?例如,在访问期间,我遇到了一个声明(使用 Java/M3),现在我想获取该声明的文本。我试过“unparse”,但这给出了“不匹配任何声明的(重载)签名模式:unparse(Tree)”,我猜它只适用于顶级排序/起始符号。
最简单的解决方案之一是使用字符串模板并在其中插入您的子树——假设您的子树是d:
d
"<d>"
这将自动 unparse d。目前缺少更复杂的漂亮打印,但在我们的待办事项列表中。