The Treetop website gives the following explanation that I don't understand
Ellipsis An empty string matches at any position and consumes no input. It's useful when you wish to treat a single symbol as part of a sequence, for example when an alternate rule will be processed using shared code.
rule alts ( foo bar / baz '' ) { def value elements.map{|e| e.text_value } end } end
when is useful to treat a symbol as a part of sequence? Can anybody provide a meaningful example of that?
I am not familiar with Treetop. From the example it would seem that
( foo bar / baz '' )would either produce['foo', 'bar']or['baz', ''].If you remove the ellipsis, you would get either
['foo', 'bar']or just'baz'(no sequence/list/array).