From 410f630b1af21c6c45ece581f0a52c90919b924b Mon Sep 17 00:00:00 2001 From: pd3v Date: Mon, 29 Jul 2024 17:34:31 +0100 Subject: [PATCH] .lua file loading testing --- line.cpp | 11 +++++++---- lineparser.lua | 1 - 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/line.cpp b/line.cpp index c2db24d..9f7363b 100755 --- a/line.cpp +++ b/line.cpp @@ -137,9 +137,8 @@ class Parser { std::ifstream input (parserFile.c_str()); textBuffer << input.rdbuf(); parserCode = textBuffer.str(); - - // std::cout << "parserCode->" << parserCode << std::endl; } + ~Parser() {lua_close(L);}; void reportLuaErrorsOnExit(lua_State *L, int status) { @@ -171,12 +170,16 @@ class Parser { // auto p = parserCode + " phrs_matching = lpeg.match(phraseG, \"" + _phrase + // "\"); t = phrs_matching and phrs_matching or NO_MATCH"; - auto p = parserCode; + auto p = parserCode + " phrs_matching = lpeg.match(phraseG, \"" + "(c3 e3 g3)~.1 (c4 cs4 d4)" + + "\"); t = phrs_matching and phrs_matching or NO_MATCH"; + // r = phraseG:match("(c1 e1 g1)~.1 (c4 cs4 d4)") + // auto p = parserCode; + std::cout << p << '\n'; if (int luaError = luaL_dostring(L, p.c_str()) == LUA_OK) { lua_getglobal(L, "t"); - std::cout << "lua parser loaded\n"; + std::cout << "<<>>\n"; // 3D Lua table to c++ vector if (lua_istable(L,-1)) { diff --git a/lineparser.lua b/lineparser.lua index bc3269e..73a0d64 100644 --- a/lineparser.lua +++ b/lineparser.lua @@ -3,7 +3,6 @@ package.cpath = 'externals/?/lib?.dylib;externals/?/lib?.so;lib/lib?.dylib;lib/l local lpeg = require 'lpeg' local write = io.write lpeg.locale(lpeg) -print(lpeg, "loaded?!") local AMP_SYMBOL = "~" local NO_MATCH = {{'e', {{255,0}}}}