mirror of
https://github.com/vxcontrol/lualibs-lrexlib.git
synced 2026-07-01 09:25:08 -04:00
Oniguruma binding: add function internal_test (not to be documented).
This commit is contained in:
@@ -319,6 +319,26 @@ static int LOnig_version (lua_State *L) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int LOnig_internal_test (lua_State *L) {
|
||||
unsigned int i;
|
||||
for (i=1; i<sizeof(Encodings)/sizeof(Encodings[0]); i++) {
|
||||
if (fcmp(&Encodings[i-1], &Encodings[i]) >= 0) {
|
||||
lua_pushboolean(L, 0);
|
||||
lua_pushstring(L, "Array 'Encodings' is not properly sorted.");
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
for (i=1; i<sizeof(Syntaxes)/sizeof(Syntaxes[0]); i++) {
|
||||
if (fcmp(&Syntaxes[i-1], &Syntaxes[i]) >= 0) {
|
||||
lua_pushboolean(L, 0);
|
||||
lua_pushstring(L, "Array 'Syntaxes' is not properly sorted.");
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
lua_pushboolean(L, 1);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static const luaL_Reg r_methods[] = {
|
||||
{ "exec", algm_exec },
|
||||
{ "tfind", algm_tfind }, /* old name: match */
|
||||
@@ -341,6 +361,7 @@ static const luaL_Reg r_functions[] = {
|
||||
{ "flags", LOnig_get_flags },
|
||||
{ "version", LOnig_version },
|
||||
{ "setdefaultsyntax", LOnig_setdefaultsyntax },
|
||||
{ "internal_test", LOnig_internal_test },
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
|
||||
@@ -110,6 +110,15 @@ local function set_f_split (lib, flg)
|
||||
}
|
||||
end
|
||||
|
||||
local function set_f_internal_test (lib, flg)
|
||||
return {
|
||||
Name = "Function internal_test",
|
||||
Func = lib.internal_test,
|
||||
--{ params results }
|
||||
{ {""}, {true} },
|
||||
}
|
||||
end
|
||||
|
||||
local function set_m_exec (lib, flg)
|
||||
return {
|
||||
Name = "Method exec",
|
||||
@@ -151,6 +160,7 @@ return function (libname)
|
||||
local lib = require (libname)
|
||||
local flags = lib.flags ()
|
||||
local sets = {
|
||||
set_f_internal_test (lib, flags),
|
||||
set_f_match (lib, flags),
|
||||
set_f_find (lib, flags),
|
||||
set_f_gmatch (lib, flags),
|
||||
|
||||
Reference in New Issue
Block a user