-
Notifications
You must be signed in to change notification settings - Fork 31
Description
hi!
nice gem! and a really good blog post (which is how i found it).
would you be interested in using regexp_parser for the parsing part?
i know you've probably invested a lot of love into the parsing functions.
on the other hand, more people might be able to benefit from the knowledge you've aquired along the way if you're interested in contributing to regexp_parser -- and perhaps some other gems that can be used on their own.
this could also improve regexp-examples a bit. i had a quick look around, and here are just a few things that regexp_parser handles more correctly or would allow to implement more easily:
/\u{10FFFF}/.examples # => NoMethodError; should be ["\u{10FFFF}"]
/\u{61 62}/.examples # => NoMethodError; should be ["ab"]
/[[:^ascii]]/.examples # => []; should be ["\u0080", "\u0081", ...] or so
/\X/.examples # => ["X"]; should be all kinds of stuff [1]
/(a)\g<1>/.examples # => easy with regexp_parser's #referenced_expression
/(a)(?(1)b|c)/.examples # => NoMethodError; doable but complicated [2]
/\0/.examples # => []; should be ["\u0000"]
/[a-&&]/.examples # => ["a", "&"]; should be []
/(?u:\w)/.examples # => NoMethodError; should be unicode word chars
/(?a)[[:word:]]/.examples # => NoMethodError; should be ascii word charsthen there are some other gems (cough by me cough) that might be helpful and would benefit from contributors:
regexp_property_values reads out the codepoints matched by property or posix expressions directly from Ruby via a C API. might allow getting rid of the versioned codepoint databases in this gem. also works with old Rubies.
character_set calculates matched codepoints, e.g. of bracket expressions, in C. could be a performance boost or at least abstract away that part.
all three of these gems can be seen in use in js_regex.
i'll understand if you want to keep regexp-examples without dependencies, but feel free to take a look around this stuff.