lua-users home
lua-l archive

Re: Possible enhancements for Lua 5.2

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


> 2) A new string pattern %i, that matches all legal identifiers. It'd
> be a little more readable than writing [%w_] (if that's even
> correct?).
Ignoring locales for a moment, AFAIK identifiers are matched with the
Lua pattern [A-Za-z_][A-Za-z_0-9]* to make sure identifiers can contain
digits but shouldn't start with a digit. This means that adding %i would
contradict the following bit from the Lua reference manual (5.1 as well
as 5.2):
 A pattern item can be:
 - a single character class, which matches any single character
 in the class;
 - ...
So the proposed %i pattern would be "special" compared to the other
predefined patterns (ignoring %bxy). I'm not saying I don't like the
suggestion though :-)
 - Peter

AltStyle によって変換されたページ (->オリジナル) /