lua-users home
lua-l archive

Re: Proposal for lpeg

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


It was thus said that the Great albertmcchan once stated:
> lpeg.P always match at beginning of string, maybe an efficient matching anywhere function ?
 You do realize that all LPeg functions take an optional starting position. 
> Example:
> keywords = P'while' + 'repeat' + 'for'
> 
> to search keywords anywhere efficiently, skip all bad head chars
> 
> skip = 1 - S"wrf" -- set of skipped chars
 Have you timed the above vs
	skip = P(1) - keywords
 -spc

AltStyle によって変換されたページ (->オリジナル) /