lua-users home
lua-l archive

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


IMO, it's valid and meaningful text.

s is defined where it is first used, i.e. "s is a character", and only used for the particular paragraph, not forr the entire description of lpeg.S. I interpreter it is as the mathematical and logical notation: "for all s such as s is a character (that is a string of length 1) the following holds true: lpeg.P(s) === lpeg.S(s) === lpeg.R(s..s)".


On Mon, Feb 23, 2009 at 9:55 PM, Nick Gammon <nick@gammon.com.au> wrote:
Hello,

A minor issue in the documentation of lpeg.S:

lpeg.S (string)
Returns a pattern that matches any single character that appears in the given string. (The S stands for Set.)

As an example, the pattern lpeg.S("+-*/") matches any arithmetic operator.

Note that, if s is a character (that is, a string of length 1), then lpeg.P(s) is equivalent to lpeg.S(s) which is equivalent to lpeg.R(s..s). Note also that both lpeg.S("") and lpeg.R() are patterns that always fail.


The reference to "if s is a character" does not make sense as "s" is not defined.

Suggest either changing the heading to:

lpeg.S (s)

or rewording to "if the argument is a single character".

- Nick