Hi all,

I am beginning to appreciate the power of grammars and the Match class. This is truly a major asset within Perl6.

I have a question on an edge case. I was hoping to use a grammar for an input that has meaningful indented blocks.
I was trying something like this:

token element { <.lm> [ <linetail> | $<ind>=[ ' '+ ] <level($<ind>)> ] }
  token lm { ^^ ' '**{$cur-indent} } # skip up to current indent level

My grammar has a method called within the level rule that maintains a stack of indentations and sets a $cur-indent. I can imagine that the inner workings of the parser (i.e. optimization) frustrate this approach.
Is there a way to make something like this work?

Thanks,
Theo

--
Theo van den Heuvel
Van den Heuvel HLT Consultancy

Reply via email to