lua-users home
lua-l archive

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

> This is an appeal for help with pattern matching. I appreciate
> that one can ask too much of the pattern matching provided
> in stringlib, and that for things like syntax colouring one
> really needs a full-blooded parser. However, maybe there are
> some wizards out there who can save me a lot of mental effort.
> How do I specify a pattern for a Lua keyword?
> How do I say that either the keyword begins a line or is
> preceded by a character matching [^%w_], and that either
> it ends a line or is followed by a character matching [^%w_],
> for example?

To do this neatly you need alternation, so use my rexlib (URL below) rather
than Lua's built-in patterns. (I've ported the underlying library to RISC OS
and EPOC.)

-- | Slow Pedestrian Crossing