diff options
| author | Li Jin <dragon-fly@qq.com> | 2026-01-23 12:24:49 +0800 |
|---|---|---|
| committer | Li Jin <dragon-fly@qq.com> | 2026-01-23 12:24:49 +0800 |
| commit | f5006f449a7be1a2f655f1b178ecf1d2f0569dd5 (patch) | |
| tree | 46f509402cb7bb5681f8747dc160914b03010444 | |
| parent | 02910188fc07492b8b31b2701fe1987025196f85 (diff) | |
| download | yuescript-0.32.4.tar.gz yuescript-0.32.4.tar.bz2 yuescript-0.32.4.zip | |
| -rw-r--r-- | makefile | 20 | ||||
| -rw-r--r-- | src/yue.cpp | 6 |
2 files changed, 13 insertions, 13 deletions
| @@ -432,11 +432,11 @@ test: debug | |||
| 432 | @$(START_TIME) | 432 | @$(START_TIME) |
| 433 | @./$(BIN_NAME) $(TEST_INPUT) -t $(TEST_OUTPUT) --tl_enabled | 433 | @./$(BIN_NAME) $(TEST_INPUT) -t $(TEST_OUTPUT) --tl_enabled |
| 434 | @./$(BIN_NAME) $(TEST_INPUT)/teal_lang.yue -o $(TEST_OUTPUT)/teal_lang.lua | 434 | @./$(BIN_NAME) $(TEST_INPUT)/teal_lang.yue -o $(TEST_OUTPUT)/teal_lang.lua |
| 435 | @./$(BIN_NAME) $(TEST_INPUT)/loops.yue -o $(TEST_OUTPUT)/5.1/loops.lua --target=5.1 | 435 | @./$(BIN_NAME) $(TEST_INPUT)/loops.yue -o $(TEST_OUTPUT)/5.1/loops.lua --target 5.1 |
| 436 | @./$(BIN_NAME) $(TEST_INPUT)/try_catch.yue -o $(TEST_OUTPUT)/5.1/try_catch.lua --target=5.1 | 436 | @./$(BIN_NAME) $(TEST_INPUT)/try_catch.yue -o $(TEST_OUTPUT)/5.1/try_catch.lua --target 5.1 |
| 437 | @./$(BIN_NAME) $(TEST_INPUT)/attrib.yue -o $(TEST_OUTPUT)/5.1/attrib.lua --target=5.1 | 437 | @./$(BIN_NAME) $(TEST_INPUT)/attrib.yue -o $(TEST_OUTPUT)/5.1/attrib.lua --target 5.1 |
| 438 | @./$(BIN_NAME) $(TEST_INPUT)/import_global.yue -o $(TEST_OUTPUT)/5.1/import_global.lua --target=5.1 | 438 | @./$(BIN_NAME) $(TEST_INPUT)/import_global.yue -o $(TEST_OUTPUT)/5.1/import_global.lua --target 5.1 |
| 439 | @./$(BIN_NAME) $(TEST_INPUT)/test/loops_spec.yue -o $(TEST_OUTPUT)/5.1/test/loops_spec.lua --target=5.1 | 439 | @./$(BIN_NAME) $(TEST_INPUT)/test/loops_spec.yue -o $(TEST_OUTPUT)/5.1/test/loops_spec.lua --target 5.1 |
| 440 | @./$(BIN_NAME) -e spec/inputs/compile_doc.yue $(TEST_OUTPUT) | 440 | @./$(BIN_NAME) -e spec/inputs/compile_doc.yue $(TEST_OUTPUT) |
| 441 | @echo -en "Compile time: " | 441 | @echo -en "Compile time: " |
| 442 | @$(END_TIME) | 442 | @$(END_TIME) |
| @@ -452,11 +452,11 @@ gen: release | |||
| 452 | @$(START_TIME) | 452 | @$(START_TIME) |
| 453 | @./$(BIN_NAME) $(TEST_INPUT) -t $(GEN_OUTPUT) --tl_enabled | 453 | @./$(BIN_NAME) $(TEST_INPUT) -t $(GEN_OUTPUT) --tl_enabled |
| 454 | @./$(BIN_NAME) $(TEST_INPUT)/teal_lang.yue -o $(GEN_OUTPUT)/teal_lang.lua | 454 | @./$(BIN_NAME) $(TEST_INPUT)/teal_lang.yue -o $(GEN_OUTPUT)/teal_lang.lua |
| 455 | @./$(BIN_NAME) $(TEST_INPUT)/loops.yue -o $(GEN_OUTPUT)/5.1/loops.lua --target=5.1 | 455 | @./$(BIN_NAME) $(TEST_INPUT)/loops.yue -o $(GEN_OUTPUT)/5.1/loops.lua --target 5.1 |
| 456 | @./$(BIN_NAME) $(TEST_INPUT)/try_catch.yue -o $(GEN_OUTPUT)/5.1/try_catch.lua --target=5.1 | 456 | @./$(BIN_NAME) $(TEST_INPUT)/try_catch.yue -o $(GEN_OUTPUT)/5.1/try_catch.lua --target 5.1 |
| 457 | @./$(BIN_NAME) $(TEST_INPUT)/attrib.yue -o $(GEN_OUTPUT)/5.1/attrib.lua --target=5.1 | 457 | @./$(BIN_NAME) $(TEST_INPUT)/attrib.yue -o $(GEN_OUTPUT)/5.1/attrib.lua --target 5.1 |
| 458 | @./$(BIN_NAME) $(TEST_INPUT)/import_global.yue -o $(GEN_OUTPUT)/5.1/import_global.lua --target=5.1 | 458 | @./$(BIN_NAME) $(TEST_INPUT)/import_global.yue -o $(GEN_OUTPUT)/5.1/import_global.lua --target 5.1 |
| 459 | @./$(BIN_NAME) $(TEST_INPUT)/test/loops_spec.yue -o $(GEN_OUTPUT)/5.1/test/loops_spec.lua --target=5.1 | 459 | @./$(BIN_NAME) $(TEST_INPUT)/test/loops_spec.yue -o $(GEN_OUTPUT)/5.1/test/loops_spec.lua --target 5.1 |
| 460 | @./$(BIN_NAME) -e spec/inputs/compile_doc.yue $(GEN_OUTPUT) | 460 | @./$(BIN_NAME) -e spec/inputs/compile_doc.yue $(GEN_OUTPUT) |
| 461 | @echo -en "Compile time: " | 461 | @echo -en "Compile time: " |
| 462 | @$(END_TIME) | 462 | @$(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) { | |||
| 520 | std::string workPath; | 520 | std::string workPath; |
| 521 | std::list<std::pair<std::string, std::string>> files; | 521 | std::list<std::pair<std::string, std::string>> files; |
| 522 | 522 | ||
| 523 | auto isOptionToken = [](std::string_view s) { | ||
| 524 | return !s.empty() && (s[0] == '-' || (s.size() >= 2 && s.substr(0, 2) == "--"sv)); | ||
| 525 | }; | ||
| 526 | auto takeValue = [&](int& i, std::string_view arg, std::string_view optName) -> std::string { | 523 | auto takeValue = [&](int& i, std::string_view arg, std::string_view optName) -> std::string { |
| 527 | // supports: --opt=value, --opt value, -o value, -t value, etc. | 524 | // supports: --opt=value, --opt value, -o value, -t value, etc. |
| 528 | if (auto eq = arg.find('='); eq != std::string_view::npos) { | 525 | if (auto eq = arg.find('='); eq != std::string_view::npos) { |
| @@ -697,6 +694,9 @@ int main(int narg, const char** args) { | |||
| 697 | if (resultFile.empty()) return 1; | 694 | if (resultFile.empty()) return 1; |
| 698 | } else if (arg == "-w"sv || arg == "--watch"sv || arg.rfind("--watch="sv, 0) == 0) { | 695 | } else if (arg == "-w"sv || arg == "--watch"sv || arg.rfind("--watch="sv, 0) == 0) { |
| 699 | #ifndef YUE_NO_WATCHER | 696 | #ifndef YUE_NO_WATCHER |
| 697 | auto isOptionToken = [](std::string_view s) { | ||
| 698 | return !s.empty() && (s[0] == '-' || (s.size() >= 2 && s.substr(0, 2) == "--"sv)); | ||
| 699 | }; | ||
| 700 | watchFiles = true; | 700 | watchFiles = true; |
| 701 | // accept optional directory value: -w <dir> / --watch <dir> / --watch=<dir> | 701 | // accept optional directory value: -w <dir> / --watch <dir> / --watch=<dir> |
| 702 | if (arg != "-w"sv) { | 702 | if (arg != "-w"sv) { |
