robrix / Madness

Recursive Descent Into Madness
MIT License
291 stars 17 forks source link

Make it easier to syntactically wrap another combinator. #49

Closed robrix closed 8 years ago

robrix commented 9 years ago

For example parenthesized expressions. The parens are syntactically important but don’t contribute to the tree; the wrapped combinator’s result should therefore be passed through, and the wrapping terms should be dropped.

robrix commented 9 years ago

Equivalent to ignore(opening) ++ body ++ ignore(closing) I suppose.

neilpa commented 9 years ago

I didn't realize this equivalence and wrote a custom bookend operator. Although it was slightly different since it assumed body* which it then flattened the elements for.

robrix commented 9 years ago

bookend is a nice name for this!

neilpa commented 9 years ago

I probably spent far too much time thinking about it after iterating through wrap, quote, etc.

bencochran commented 8 years ago

Is this still necessary given #91? (namely opening *> body <* closing being now possible)

robrix commented 8 years ago

Probably not; closing.