From f5006f449a7be1a2f655f1b178ecf1d2f0569dd5 Mon Sep 17 00:00:00 2001 From: Li Jin Date: Fri, 23 Jan 2026 12:24:49 +0800 Subject: Cleanup. --- makefile | 20 ++++++++++---------- src/yue.cpp | 6 +++--- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/makefile b/makefile index 047718a..5cd1de2 100644 --- a/makefile +++ b/makefile @@ -432,11 +432,11 @@ test: debug @$(START_TIME) @./$(BIN_NAME) $(TEST_INPUT) -t $(TEST_OUTPUT) --tl_enabled @./$(BIN_NAME) $(TEST_INPUT)/teal_lang.yue -o $(TEST_OUTPUT)/teal_lang.lua - @./$(BIN_NAME) $(TEST_INPUT)/loops.yue -o $(TEST_OUTPUT)/5.1/loops.lua --target=5.1 - @./$(BIN_NAME) $(TEST_INPUT)/try_catch.yue -o $(TEST_OUTPUT)/5.1/try_catch.lua --target=5.1 - @./$(BIN_NAME) $(TEST_INPUT)/attrib.yue -o $(TEST_OUTPUT)/5.1/attrib.lua --target=5.1 - @./$(BIN_NAME) $(TEST_INPUT)/import_global.yue -o $(TEST_OUTPUT)/5.1/import_global.lua --target=5.1 - @./$(BIN_NAME) $(TEST_INPUT)/test/loops_spec.yue -o $(TEST_OUTPUT)/5.1/test/loops_spec.lua --target=5.1 + @./$(BIN_NAME) $(TEST_INPUT)/loops.yue -o $(TEST_OUTPUT)/5.1/loops.lua --target 5.1 + @./$(BIN_NAME) $(TEST_INPUT)/try_catch.yue -o $(TEST_OUTPUT)/5.1/try_catch.lua --target 5.1 + @./$(BIN_NAME) $(TEST_INPUT)/attrib.yue -o $(TEST_OUTPUT)/5.1/attrib.lua --target 5.1 + @./$(BIN_NAME) $(TEST_INPUT)/import_global.yue -o $(TEST_OUTPUT)/5.1/import_global.lua --target 5.1 + @./$(BIN_NAME) $(TEST_INPUT)/test/loops_spec.yue -o $(TEST_OUTPUT)/5.1/test/loops_spec.lua --target 5.1 @./$(BIN_NAME) -e spec/inputs/compile_doc.yue $(TEST_OUTPUT) @echo -en "Compile time: " @$(END_TIME) @@ -452,11 +452,11 @@ gen: release @$(START_TIME) @./$(BIN_NAME) $(TEST_INPUT) -t $(GEN_OUTPUT) --tl_enabled @./$(BIN_NAME) $(TEST_INPUT)/teal_lang.yue -o $(GEN_OUTPUT)/teal_lang.lua - @./$(BIN_NAME) $(TEST_INPUT)/loops.yue -o $(GEN_OUTPUT)/5.1/loops.lua --target=5.1 - @./$(BIN_NAME) $(TEST_INPUT)/try_catch.yue -o $(GEN_OUTPUT)/5.1/try_catch.lua --target=5.1 - @./$(BIN_NAME) $(TEST_INPUT)/attrib.yue -o $(GEN_OUTPUT)/5.1/attrib.lua --target=5.1 - @./$(BIN_NAME) $(TEST_INPUT)/import_global.yue -o $(GEN_OUTPUT)/5.1/import_global.lua --target=5.1 - @./$(BIN_NAME) $(TEST_INPUT)/test/loops_spec.yue -o $(GEN_OUTPUT)/5.1/test/loops_spec.lua --target=5.1 + @./$(BIN_NAME) $(TEST_INPUT)/loops.yue -o $(GEN_OUTPUT)/5.1/loops.lua --target 5.1 + @./$(BIN_NAME) $(TEST_INPUT)/try_catch.yue -o $(GEN_OUTPUT)/5.1/try_catch.lua --target 5.1 + @./$(BIN_NAME) $(TEST_INPUT)/attrib.yue -o $(GEN_OUTPUT)/5.1/attrib.lua --target 5.1 + @./$(BIN_NAME) $(TEST_INPUT)/import_global.yue -o $(GEN_OUTPUT)/5.1/import_global.lua --target 5.1 + @./$(BIN_NAME) $(TEST_INPUT)/test/loops_spec.yue -o $(GEN_OUTPUT)/5.1/test/loops_spec.lua --target 5.1 @./$(BIN_NAME) -e spec/inputs/compile_doc.yue $(GEN_OUTPUT) @echo -en "Compile time: " @$(END_TIME) diff --git a/src/yue.cpp b/src/yue.cpp index 7e39367..f48d14b 100644 --- a/src/yue.cpp +++ b/src/yue.cpp @@ -520,9 +520,6 @@ int main(int narg, const char** args) { std::string workPath; std::list> files; - auto isOptionToken = [](std::string_view s) { - return !s.empty() && (s[0] == '-' || (s.size() >= 2 && s.substr(0, 2) == "--"sv)); - }; auto takeValue = [&](int& i, std::string_view arg, std::string_view optName) -> std::string { // supports: --opt=value, --opt value, -o value, -t value, etc. if (auto eq = arg.find('='); eq != std::string_view::npos) { @@ -697,6 +694,9 @@ int main(int narg, const char** args) { if (resultFile.empty()) return 1; } else if (arg == "-w"sv || arg == "--watch"sv || arg.rfind("--watch="sv, 0) == 0) { #ifndef YUE_NO_WATCHER + auto isOptionToken = [](std::string_view s) { + return !s.empty() && (s[0] == '-' || (s.size() >= 2 && s.substr(0, 2) == "--"sv)); + }; watchFiles = true; // accept optional directory value: -w / --watch / --watch= if (arg != "-w"sv) { -- cgit v1.2.3-55-g6feb