lua-users home
lua-l archive

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


Hi!

I triggered an assertion failure using LPeg 0.10.2 installed via apt-get for Lua 5.2.1 on 64bit Linux, as well as installed via luarocks for Lua 5.1.4 on 32bit Linux:

lua: lpeg.c:793: checkrule: Assertion `op[start - 1].i.code == IChoice && ((start - 1) + ((op)+(start - 1))->i.offset) == target(op, i + 1)' failed.

Test script is attached.

Thanks,
Philipp

#!/usr/bin/lua

local L = require( "lpeg" )

local id = L.R"az" * (L.R"az" + L.R"09")^0
local rel_path = id * (L.P"/" * id)^0
local abs_path = L.P"/" * rel_path
local path1 = L.C( L.P"/"^-1 * rel_path )
local path2 = L.C( abs_path + rel_path )
print( L.match( path1, "hello/world" ) )
print( L.match( path1, "/hello/world" ) )
print( L.match( path2, "hello/world" ) )
print( L.match( path2, "/hello/world" ) )
local g1 = { path1 }
print( L.match( g1, "hello/world" ) )
print( L.match( g1, "/hello/world" ) )
local g2 = { path2 }
print( L.match( g2, "hello/world" ) )    --> bombs
print( L.match( g2, "/hello/world" ) )