diff options
| -rw-r--r-- | src/yue.cpp | 13 | ||||
| -rw-r--r-- | src/yuescript/yue_compiler.cpp | 2 |
2 files changed, 8 insertions, 7 deletions
diff --git a/src/yue.cpp b/src/yue.cpp index 4f5be8d..d6f1bc1 100644 --- a/src/yue.cpp +++ b/src/yue.cpp | |||
| @@ -9,6 +9,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI | |||
| 9 | #include "yuescript/yue_compiler.h" | 9 | #include "yuescript/yue_compiler.h" |
| 10 | #include "yuescript/yue_parser.h" | 10 | #include "yuescript/yue_parser.h" |
| 11 | 11 | ||
| 12 | #include <chrono> | ||
| 12 | #include <cstdlib> | 13 | #include <cstdlib> |
| 13 | #include <fstream> | 14 | #include <fstream> |
| 14 | #include <future> | 15 | #include <future> |
| @@ -18,15 +19,14 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI | |||
| 18 | #include <memory> | 19 | #include <memory> |
| 19 | #include <sstream> | 20 | #include <sstream> |
| 20 | #include <string_view> | 21 | #include <string_view> |
| 21 | #include <tuple> | ||
| 22 | #include <chrono> | ||
| 23 | #include <thread> | 22 | #include <thread> |
| 23 | #include <tuple> | ||
| 24 | using namespace std::string_view_literals; | 24 | using namespace std::string_view_literals; |
| 25 | using namespace std::string_literals; | 25 | using namespace std::string_literals; |
| 26 | using namespace std::chrono_literals; | 26 | using namespace std::chrono_literals; |
| 27 | #include "efsw/efsw.hpp" | ||
| 27 | #include "ghc/fs_std.hpp" | 28 | #include "ghc/fs_std.hpp" |
| 28 | #include "linenoise.hpp" | 29 | #include "linenoise.hpp" |
| 29 | #include "efsw/efsw.hpp" | ||
| 30 | 30 | ||
| 31 | #if not(defined YUE_NO_MACRO && defined YUE_COMPILER_ONLY) | 31 | #if not(defined YUE_NO_MACRO && defined YUE_COMPILER_ONLY) |
| 32 | #define _DEFER(code, line) std::shared_ptr<void> _defer_##line(nullptr, [&](auto) { code; }) | 32 | #define _DEFER(code, line) std::shared_ptr<void> _defer_##line(nullptr, [&](auto) { code; }) |
| @@ -92,8 +92,9 @@ void pushOptions(lua_State* L, int lineOffset) { | |||
| 92 | #ifndef YUE_COMPILER_ONLY | 92 | #ifndef YUE_COMPILER_ONLY |
| 93 | static const char luaminifyCodes[] = | 93 | static const char luaminifyCodes[] = |
| 94 | #include "LuaMinify.h" | 94 | #include "LuaMinify.h" |
| 95 | // | 95 | ; |
| 96 | static void pushLuaminify(lua_State * L) { | 96 | |
| 97 | static void pushLuaminify(lua_State* L) { | ||
| 97 | if (luaL_loadbuffer(L, luaminifyCodes, sizeof(luaminifyCodes) / sizeof(luaminifyCodes[0]) - 1, "=(luaminify)") != 0) { | 98 | if (luaL_loadbuffer(L, luaminifyCodes, sizeof(luaminifyCodes) / sizeof(luaminifyCodes[0]) - 1, "=(luaminify)") != 0) { |
| 98 | std::string err = "failed to load luaminify module.\n"s + lua_tostring(L, -1); | 99 | std::string err = "failed to load luaminify module.\n"s + lua_tostring(L, -1); |
| 99 | luaL_error(L, err.c_str()); | 100 | luaL_error(L, err.c_str()); |
| @@ -197,7 +198,7 @@ static std::string compileFile(const fs::path& srcFile, yue::YueConfig conf, con | |||
| 197 | class UpdateListener : public efsw::FileWatchListener { | 198 | class UpdateListener : public efsw::FileWatchListener { |
| 198 | public: | 199 | public: |
| 199 | void handleFileAction(efsw::WatchID, const std::string& dir, const std::string& filename, efsw::Action action, std::string) override { | 200 | void handleFileAction(efsw::WatchID, const std::string& dir, const std::string& filename, efsw::Action action, std::string) override { |
| 200 | switch(action) { | 201 | switch (action) { |
| 201 | case efsw::Actions::Add: | 202 | case efsw::Actions::Add: |
| 202 | if (auto res = compileFile(fs::path(dir) / filename, config, workPath); !res.empty()) { | 203 | if (auto res = compileFile(fs::path(dir) / filename, config, workPath); !res.empty()) { |
| 203 | std::cout << res; | 204 | std::cout << res; |
diff --git a/src/yuescript/yue_compiler.cpp b/src/yuescript/yue_compiler.cpp index 9d84f43..066a661 100644 --- a/src/yuescript/yue_compiler.cpp +++ b/src/yuescript/yue_compiler.cpp | |||
| @@ -60,7 +60,7 @@ namespace yue { | |||
| 60 | 60 | ||
| 61 | typedef std::list<std::string> str_list; | 61 | typedef std::list<std::string> str_list; |
| 62 | 62 | ||
| 63 | const std::string_view version = "0.15.13"sv; | 63 | const std::string_view version = "0.15.14"sv; |
| 64 | const std::string_view extension = "yue"sv; | 64 | const std::string_view extension = "yue"sv; |
| 65 | 65 | ||
| 66 | class YueCompilerImpl { | 66 | class YueCompilerImpl { |
