Single label sequence #4

merged 1 commit into from May 29, 2013


None yet

2 participants


The current metagrammar parser forbits a sequence with only a single labeled element, as noted by @jbrains in issue 4 of @nathansobo 's branch of treetop. Digging in, it looked like this is because labels are only supported in sequences, and a sequence is distinguished by the presence of at least two expressions. This patch distinguishes a sequence consisting of a single expression with a mandatory label.

Riley Lynch Support for sequence of single labeled expression
Resolves issue 4 in nathansobo / treetop
@cjheath cjheath merged commit 7ba87fb into cjheath:master May 29, 2013
cjheath commented May 29, 2013

Not sure I understand why it's more complicated than I expected, but you provided a test so I'm assuming it's ok...



I think it might be possible to simplify the logic by allowing a "primary" to be labeled instead of of supporting the special case of a single labeled element sequence, but I worried that modifying primaries to support labels might be disruptive.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment