robin/laufey

tiny neovim fork for cozy coding

git clone https://git.robinwobin.dev/robin/laufey

robinmerge: 9a29622b3b00ddb601

master
1.2 KiB34 linesraw

LPeg - Parsing Expression Grammars For Lua

For more information, see Lpeg.

Vendored @ v1.1.0 with patch to prevent conflict with LuaJIT extensions:

diff --git a/src/lpeg/lptree.c b/src/lpeg/lptree.c
index 475b0c36bf..94a3171d5a 100644
--- a/src/lpeg/lptree.c
+++ b/src/lpeg/lptree.c
@@ -1388,7 +1388,7 @@ int luaopen_lpeg (lua_State *L) {
   lua_pushnumber(L, MAXBACK);  /* initialize maximum backtracking */
   lua_setfield(L, LUA_REGISTRYINDEX, MAXSTACKIDX);
   luaL_setfuncs(L, metareg, 0);
-  luaL_newlib(L, pattreg);
+  luaL_register(L, "lpeg", pattreg); // Nvim: inline conflicting luaL_newlib macro
   lua_pushvalue(L, -1);
   lua_setfield(L, -3, "__index");
   lua_pushliteral(L, "LPeg " VERSION);
diff --git a/src/lpeg/lptypes.h b/src/lpeg/lptypes.h
index 3f860b973f..98974e1b88 100644
--- a/src/lpeg/lptypes.h
+++ b/src/lpeg/lptypes.h
@@ -35,7 +35,7 @@
 #define lua_rawlen		lua_objlen
 
 #define luaL_setfuncs(L,f,n)	luaL_register(L,NULL,f)
-#define luaL_newlib(L,f)	luaL_register(L,"lpeg",f)
+// #define luaL_newlib(L,f)	luaL_register(L,"lpeg",f) // Nvim: conflicts with LuaJIT
 
 typedef size_t lua_Unsigned;
 
1# LPeg - Parsing Expression Grammars For Lua
2
3For more information,
4see [Lpeg](//www.inf.puc-rio.br/~roberto/lpeg/).
5
6Vendored @ v1.1.0 with patch to prevent conflict with LuaJIT extensions:
7```diff
8diff --git a/src/lpeg/lptree.c b/src/lpeg/lptree.c
9index 475b0c36bf..94a3171d5a 100644
10--- a/src/lpeg/lptree.c
11+++ b/src/lpeg/lptree.c
12@@ -1388,7 +1388,7 @@ int luaopen_lpeg (lua_State *L) {
13   lua_pushnumber(L, MAXBACK);  /* initialize maximum backtracking */
14   lua_setfield(L, LUA_REGISTRYINDEX, MAXSTACKIDX);
15   luaL_setfuncs(L, metareg, 0);
16-  luaL_newlib(L, pattreg);
17+  luaL_register(L, "lpeg", pattreg); // Nvim: inline conflicting luaL_newlib macro
18   lua_pushvalue(L, -1);
19   lua_setfield(L, -3, "__index");
20   lua_pushliteral(L, "LPeg " VERSION);
21diff --git a/src/lpeg/lptypes.h b/src/lpeg/lptypes.h
22index 3f860b973f..98974e1b88 100644
23--- a/src/lpeg/lptypes.h
24+++ b/src/lpeg/lptypes.h
25@@ -35,7 +35,7 @@
26 #define lua_rawlen		lua_objlen
27 
28 #define luaL_setfuncs(L,f,n)	luaL_register(L,NULL,f)
29-#define luaL_newlib(L,f)	luaL_register(L,"lpeg",f)
30+// #define luaL_newlib(L,f)	luaL_register(L,"lpeg",f) // Nvim: conflicts with LuaJIT
31 
32 typedef size_t lua_Unsigned;
33 
34```