lua-users home
lua-l archive

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


Thanks ! We can now asset the following:  

1 - P'and' == -P'and' * 1 == re.compile "! 'and' ."

--> lua pattern "(.*)and(.*)" == re.compile "{(!'and' .)*} 'and' {.*}"


On Jan 20, 2018, at 5:54 PM, Sean Conner <sean@conman.org> wrote:
> That was weird.  I would expect
> 
>    C((P(1) - 'and')^1) * 'and' * C(P(1)^0)
> 
> to map to:
> 
>    { ( . ! 'and' )+ } 'and' { .* }
> 
> but it didn't.  I went so far as to recompile LPeg with debugging so I could
> dump the parse tree.
> 

lpeg re pattern: " { ( . ! 'and' )+ } 'and' { .* } "

should be translate to C( (1 * -P'and')^1) * 'and' * C(P(1)^0)

note the extra * after 1