lua-users home
lua-l archive

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


> I also reduced the test case further.
> 
> 
> #!/usr/bin/env lua
> lpeg = require "lpeg"
> 
> p = lpeg.P{
>   "Line";
>   P = lpeg.P"a",
>   Q = lpeg.V"P",
>   Line = lpeg.P"x" * lpeg.C(lpeg.V"P"),
> }
> 
> p:ptree()
> p:match("xx")
> 
> [...]
> 
> I think the rule ordering is different because of string (key) hash
> randomization.

We can simplify a little more that grammar, using numeric indices:

p = lpeg.P{
  (lpeg.P"x" * lpeg.C(1-lpeg.V(2))),
  lpeg.P"a",
  lpeg.V(2),
}

The use of numeric indices avoids the string hash randomization; as
a result, at least in my machine, we get a consistent seg. fault in
every run.

-- Roberto