kschiess / parslet

A small PEG based parser library. See the Hacking page in the Wiki as well.
kschiess.github.com/parslet
MIT License
805 stars 95 forks source link

ε #156

Closed igravious closed 7 years ago

igravious commented 8 years ago

Can't find this in the docs anywhere.

I don't mean the ability to match EOF, I mean the ability to match the empty string anywhere.

Most useful for specifying things like, str('⊢') >> space? >> (foo | ε) >> str(':') >> space? >> (foo | ε) for instance. This would match either, str('⊢') >> space? >> str(':') >> space? or str('⊢') >> space? >> foo >> str(':') >> space? or str('⊢') >> space? >> str(':') >> space? >> foo or str('⊢') >> space? >> foo >> str(':') >> space? >> foo

Have I overlooked something?

Thanks for an amazing tool, am having great fun with it and I have a possibly very interesting feature suggestion (or two)!

deathbeam commented 8 years ago
foo.maybe

maybe? :smile:

kschiess commented 8 years ago

Yeah, that would be foo.maybe.

igravious commented 8 years ago

Will I submit a PR for | ε as syntactic sugar and also to nudge it into line with standard notation?

kschiess commented 8 years ago

I would welcome that.