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.
是否可以使用 Sweet.Js 进行扩展
{ "foo": "bar" }
到
{ "bar": "foo" }
例如?
我在这里的幼稚尝试不起作用,我在文档中没有看到示例。
谢谢。
诀窍是它:在模式中具有特殊含义,因此您需要使用$[:]
:
$[:]
macro bar { rule { {$x $[:] $y} } => { {$y: $x} } } var o = bar { "bax": "quux" }