I want to ask some questions about how to accomplish some syntax sugar I
would like.
1. For example,
In boost spirit qi in C++ there was a % operator which would allow
a % str(',')
instead of
a << (str(',') >> a).repeat(0)
2. Also, it had two modes, one where all atoms could have optional
whitespace between them and a way to get out of that mode temporarily.
I was wondering whether we could use operator > instead of >> to simplify
a >> space? >> b
to a > b
I see in the examples that most of the time you just add optional
whitespace eaters to base atoms
I had trouble understanding the code for >> or I would just implement these
locally.
Maybe if you don't like the idea of adding any of this sugar, you could
help me understand this code:
18
19
20
# File 'lib/parslet/atoms/sequence.rb', line 18
def >>(parslet)
self.class.new(* @parslets+[parslet])end