pyga / parsley

Other
288 stars 50 forks source link

Support custom rule functions #61

Open mcclure opened 8 years ago

mcclure commented 8 years ago

I just filed #60 where I outline some Unicode-related features Parsley is missing. I notice however I could have easily added these features in my own code, without modifying Parsley, if I could somehow define new rules. Parsley rules appear to all be functions that accept or reject a character. If I could define my own such functions I could define, for example, a function that brings in the Regex module and matches on the regex \p{XID_Continue}.

A friend mentioned they had hacked additional rules into Parsley in the past by calling undocumented functions, and it actually looks like I could possibly get what I want by extending OMetaBase. However, I would not trust such things unless they are to some extent documented because if they are undocumented I expect they could stop working suddenly in a future version.