|
|
|
## How do I output comments?
|
|
|
|
|
|
|
|
Comments in a rule macro or inside a `#{...}` template should "just work". If you want to create comment strings programmatically you can use a token's `leadingComments` property.
|
|
|
|
|
|
|
|
```js
|
|
|
|
macro m {
|
|
|
|
case {_ () } => {
|
|
|
|
var x = makeValue(42, #{here});
|
|
|
|
x.token.leadingComments = [{
|
|
|
|
type: "Line",
|
|
|
|
value: "hello, world"
|
|
|
|
}];
|
|
|
|
return withSyntax ($x = [x]) #{
|
|
|
|
$x
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
m()
|
|
|
|
```
|
|
|
|
will expand to
|
|
|
|
```js
|
|
|
|
//hello, world
|
|
|
|
42;
|
|
|
|
```
|
|
|
|
|