[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Documentation problem in lpeg.html
- From: Kristofer Karlsson <kristofer.karlsson@...>
- Date: Mon, 23 Feb 2009 22:42:48 +0100
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 <firstname.lastname@example.org>
A minor issue in the documentation of lpeg.S:
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:
or rewording to "if the argument is a single character".