robrix / Madness

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

Provide the parsed range to reductions #75

Closed robrix closed 9 years ago

robrix commented 9 years ago

--> can now accept a function taking the parse index.

Fixes #61.

robrix commented 9 years ago

/cc @jspahrsummers

robrix commented 9 years ago

In hindsight, this should actually be the parsed range, i.e. the range starting at the index which --> started at, and ending at the index which its parser ended at.

robrix commented 9 years ago

It also needs to receive the source collection if it’s going to do anything useful with the indices in arbitrary collections. String indices don’t translate from one String to another, IIRC; and it’s certainly not the case that indices in general do.

robrix commented 9 years ago

Additionally, the parse tree should be the final parameter to make it easier to ignore the index and collection with implicit closure args if Swift for some reason infers the wrong -->.

robrix commented 9 years ago

Alright, this is looking pretty good :sparkles: