lua-users home
lua-l archive

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


I have (re)read attentively the new doc. and find it very good, except for some points below.

1) Maybe it is worth indicating explicitly that lpeg.P(0) matches the empty string. I don't know if it is useful (or even true...), but I see epsilon in the slides made by Brian Ford and no equivalence in the doc. (unlike the other notations).
BTW, did you used recursive-descent parsing or packrat parsing?

2) Minor quibble:
"On the one hand, the result is usually much more verbose than the typical encoding of patterns using the so called regular expressions (which usually are not regular expressions in the formal sense)."

Two "usually", maybe change the second one with "most of the time".

3) I find the lpeg.Cs and patt / string capture description very hard to understand, even after several readings. Perhaps that's just me being thick...
The CSV example helped understand those, though.
I will have to play with the constructs to better understand them.

4) In patt / string, you refer to 'repl' which isn't defined. Perhaps you wanted to write 'string' instead.

5) Is there any difference (efficiency?) between the given methods to search a pattern anywhere in a string?

6) Do I understand correctly that now, the library is no longer able to return key/value pairs in tables? Only numerical indices? Andreas Stenius gave an example of parsing XML-like attributes, pushing name and value keys for each part of the pair. I rewrote it for LPeg-0.4 but I lost these keys. Not a big problem, but I found it convenient.

7) Well, you implemented Mike's suggestion of improvement to the lpeg.R syntax... Do I have any chance of having my lpeg.Rep(patt, n) function, ideally implemented at VM level (ie. without duplicating the pattern n times)?

As you see, no big problems, thank you for this wonderful library and the great doc./examples!

--
Philippe Lhoste
--  (near) Paris -- France
--  http://Phi.Lho.free.fr
--  --  --  --  --  --  --  --  --  --  --  --  --  --