If I have something like this in my grammar:
grammar G {
token tab-indent(Int $level) {
# Using just ** $level would require <!before \t> to have the same effect, so use a code block for simplicity.
\t+ <?{ $/.chars == $level }>
}
}
is there some way to directly get the value of $level in the corresponding action method tab-indent($/)?
Right now I redo $/.chars there too, which works, but doesn't seem ideal, especially in more complex situations, where the value of the parameter can be less easy to deduce from the matching text.
Does anyone know of a better way to do this? Thanks in advance!