DSL
DSL copied to clipboard
update for latest lua version
Would you consider updating and testing this very interesting software to run on the latest version of Lua? I am using Lua 5.3 on Linux, and I tried to replace the 3 usages of 'loadstring' in 'Parser.lua' with
if _VERSION == "Lua 5.1" then setfenv(loadstring(code), env)() else load(code,code,'bt',env)() end
but perhaps this is not sufficient--there still seem to be problems.
Thanks
Can you give me a test case? I'm happy to merge this when any know issues are fixed.
I am a beginner at Lua and Lpeg and I am trying to learn them, as well as learn about making a DSL. So I apologize if I am missing something obvious. I believe you have 3 test cases:
/DSL-master/test/test.expr.lua
test.json.lua
and
test.lust.json.lua
I am using Linux Mint, Lua 5.3.2, and Lpeg 1.0.0-1 to run these tests (although the third requires LuaAV, which I am skipping for now).
I believe your module was tested with earlier software, perhaps Lua 5.1 and an Lpeg before 0.12, right?.
Your module mentions "loadstring" and "setfenv", which I think have been removed from Lua 5.3. Also, a check for "empty loop in rule" was apparently added to Lpeg at about version 0.12 (see http://lua-users.org/lists/lua-l/2013-06/msg00086.html ) because when I run "test.expr.lua" I get "Parser.lua:183: empty loop in rule 'statement_list' ". Because of changes mentioned in my original post, line 183 holds the statement
self.patt = ignore * peg.P(grammar) * ignore * peg.P(-1)
in
function M:create_grammar(ignore)
I was hoping you might be able to get these three tests working with the latest Lua and Lpeg software.
Thanks again
By the way, for what its worth, the
Lua Version Manager - luavm https://dhavalkapil.com/luaver/
is a Command line tool to manage and switch between different versions of lua, LuaJIT and luarocks.
For example, I did
luavm install 5.3.2
to install Lua 5.3.2
Thanks. I'll take a look and fix. It has been a while since I used Lua.