我一直在关注 JetBrains MPS Shapes 教程: https ://confluence.jetbrains.com/display/MPSD32/Shapes+-+an+introductory+MPS+tutorial
在教程部分“更强大的 Squares 生成”中有以下定义:
template reduce_Square
input Square
parameters
<< ... >>
content node:
{
Graphics g = null;
<TF {
->$g.setColor(Color.->$red);
->$g.drawRect($10, $10, $10, $10);
} TF>
}
g 的参考宏(如果您将光标放在 ->$g 上,您可以在编辑器的 Inspector 部分中看到)是:
(outputNode, genContext, operationContext, node)->join(node<VariableDeclaration> | string) {
genContext.get output graphicParam for (node.parent : Canvas);
}
然而,当尝试重建“Shapes”语言时,我收到以下错误消息(4 次,每个 ->$g 两次):
type node<> is not a subtype of node<VariableDeclaration>