lua-users home
lua-l archive

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


Please correct me if I am wrong, but my inspection of lpeg.c
(the documentation is not very specific) persuades me that if pattern:match(text) fails then it returns nil. Would it not be
more useful if an error object could be returned as well?
In writing a grammar one wants to be able to create context-bearing
error messages sometimes:

grammar = lpeg.P { ...
  [NonTerminal] = Pattern_if_OK + Fail(grammar.name,Name[NonTerminal]);
  .... }

-- 
Gavin Wraith (gavin@wra1th.plus.com)
Home page: http://www.wra1th.plus.com/