> My first thoughts are to do thusly:
> 
> ``` diff
> - rule(:expressions) { expression.repeat.maybe.as(:expressions) >> eol? }
> - root(:expressions)
> + rule(:expressions) { expression.repeat.maybe.as(:expressions) >> eol? }
> + rule(:line) { expressions.repeat.as :line }
> + root(:line)
> ```
> 
> However this results in an infinite loop. I'm not sure I can figure
> out what's going wrong here.
> 
> Anyone with any ideas?
> 

Shooting from my hip: something.repeat.repeat will loop forever, since
the inner repeat accepts no chars matched (0 repetitions) and the outer
loop will keep repeating that (since it works so nicely).

You should assert that you really consume input, then the parser will work.

kaspar


Reply via email to