lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


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.  

> Guess 
> 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 = '%'
		print(x:match"[a-%%]"))

fails.  But if you do:

		x = '%'
		print(x:match"[%%-a]"))

it works.  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 ... )