我在玩sweetjs,我一生都无法弄清楚为什么这个无参数多行细箭头语法的规则不匹配
代码:
macro -> {
rule infix { () | { $body ... $last:expr } } => {
function( ) {
$body ...;
return $last
}
}
}
var fn = () -> {
var a = 1;
a + 2;
};
expect(fn()).to.equal(3);
结果是
SyntaxError: [macro] Macro `-` could not be matched with `> {} ; expect ()...`
10: var fn = () -> {
^