0
macro m {
  rule {
    $a: $b
  } => {
    $a($b)
  }
}

m 1: 2

I think sweetjs is interpreting the colon as a marker for match class. If so, how do I escape that make make sweetjs match it as it is?

This seems to work just fine though

macro m {
  rule {
    :$b
  } => {
    $b
  }
}

m :1
Tomasz Kowalczyk
  • 10,472
  • 6
  • 52
  • 68
ming_codes
  • 2,870
  • 25
  • 24

1 Answers1

1

You can use $[:] to match a literal.

timdisney
  • 5,287
  • 9
  • 35
  • 31