Various changes to bring pm.lua test closer to passing:
* New and complete character class support * string.gsub implemented * rawset implemented * lua_call added (based on lua_pcall) * lua_pop added * newCall removed; luaGetTable and luaSetTable in LFunction updated to use lua_call instead. * StandardTest changed to avoid an ArrayIndexOutOfBoundsException Unfortunately I discovered a problem where execute() will loop around too many times and call exec() with a call frame that has already completed. This might be due to the lack of the "tailcalls" field in our CallInfo class that the C version maintains?
This commit is contained in:
@@ -1,3 +1,7 @@
|
||||
print( string.find( 'alo alx 123 b\0o b\0o', '(..*) %1' ) )
|
||||
print( string.find( 'aloALO', '%l*' ) )
|
||||
print( string.find( ' \n isto <20> assim', '%S%S*' ) )
|
||||
|
||||
print( string.find( "", "" ) )
|
||||
print( string.find( "ababaabbaba", "abb" ) )
|
||||
print( string.find( "ababaabbaba", "abb", 7 ) )
|
||||
@@ -19,3 +23,23 @@ print( string.byte("hi", -3) )
|
||||
print( tostring(1234567890123) )
|
||||
print( tostring(1234567890124) )
|
||||
print( tostring(1234567890125) )
|
||||
|
||||
function f1(s, p)
|
||||
print(p)
|
||||
p = string.gsub(p, "%%([0-9])", function (s) return "%" .. (s+1) end)
|
||||
print(p)
|
||||
p = string.gsub(p, "^(^?)", "%1()", 1)
|
||||
print(p)
|
||||
p = string.gsub(p, "($?)$", "()%1", 1)
|
||||
print(p)
|
||||
local t = {string.match(s, p)}
|
||||
return string.sub(s, t[1], t[#t] - 1)
|
||||
end
|
||||
|
||||
print( f1('alo alx 123 b\0o b\0o', '(..*) %1') )
|
||||
|
||||
local function badpat()
|
||||
print( string.gsub( "alo", "(.)", "%2" ) )
|
||||
end
|
||||
|
||||
print( pcall( badpat ) )
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user