how to use macro definition in sweet.js?

201 Views Asked by At

I'm new to sweet.js. I'm able to run example in official tutorial, but not in this tutorial because it uses macro definition:

macro foo {
  rule { $x } => { $x + 'rule1' }
}

I'm not sure whether this code is supposed to be processed by sjs or some other tools. sjs gave me:

Error: not a valid expression
__=>__ $x + rule1

What am I doing wrong?

sweet.js v2.2.1 on node v6.9.4

1

There are 1 best solutions below

0
On

Got it myself. It's the method in v0.7. From v1.0 it only allows definition using syntax.