[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Patterns: Why are anchors not character classes?
- From: "Soni L." <fakedme@...>
- Date: Sun, 19 Jul 2015 01:36:08 -0300
On 18/07/15 10:38 PM, Sean Conner wrote:
It was thus said that the Great Soni L. once stated:
On 18/07/15 07:43 PM, Rena wrote:
Alternation would be great, but I think it's been discussed before and
it would add too much complexity to the implementation.
Why not add the whole patterns to... everything?
Why not? You have Lua. You have the source code. You probably even have
LPeg if you want.
what [a-%%] would do? It would match anything from 'a' to the '%' sign!
(which you can't currently do, because %% is a character class!)
It can't do that now because 'a' to '%' isn't a range. '%' is 37, 'a' is
97, so of course:
x = '%'
fails. But if you do:
x = '%'
Actually the manual says it's undefined.
You could argue that Lua should work if you specify a reverse
range, but that's a separate argument.
Way more powerful than Lua patterns and not that hard to write if you
have access to tail calls. I'd take it over Lua patterns anytime, even
if it is clunkier. We also wouldn't need "0-or-more" modifiers as you
would be able to just x?<mod>!
I can't wait to see your code!
-spc (No one's stopping you ... )
Disclaimer: these emails are public and can be accessed from <TODO: get a non-DHCP IP and put it here>. If you do not agree with this, DO NOT REPLY.