aboutsummaryrefslogtreecommitdiff
path: root/src/moonc.cpp
diff options
context:
space:
mode:
authorLi Jin <dragon-fly@qq.com>2020-01-18 18:15:24 +0800
committerLi Jin <dragon-fly@qq.com>2020-01-18 18:15:24 +0800
commit8d1af508f4173e4af6a4ea98584c1a86619f6a20 (patch)
tree0264c4b01f1152d8114cf46aea6fd773276c0b01 /src/moonc.cpp
parentf53ccb373efbf6f6f40284111df309e351c2c18f (diff)
downloadyuescript-8d1af508f4173e4af6a4ea98584c1a86619f6a20.tar.gz
yuescript-8d1af508f4173e4af6a4ea98584c1a86619f6a20.tar.bz2
yuescript-8d1af508f4173e4af6a4ea98584c1a86619f6a20.zip
fix Moonscript issue 122, add support for ? operator.
Diffstat (limited to 'src/moonc.cpp')
-rw-r--r--src/moonc.cpp12
1 files changed, 1 insertions, 11 deletions
diff --git a/src/moonc.cpp b/src/moonc.cpp
index 02d5275..4498bee 100644
--- a/src/moonc.cpp
+++ b/src/moonc.cpp
@@ -22,14 +22,13 @@ int main(int narg, const char** args) {
22" -p Write output to standard out\n" 22" -p Write output to standard out\n"
23" -b Dump compile time (doesn't write output)\n" 23" -b Dump compile time (doesn't write output)\n"
24" -l Write line numbers from source codes\n" 24" -l Write line numbers from source codes\n"
25" -a Allow expression list not in the end of body block\n"
26" -s Use space over tab\n"
27" -v Print version\n"; 25" -v Print version\n";
28 if (narg == 0) { 26 if (narg == 0) {
29 std::cout << help; 27 std::cout << help;
30 return 0; 28 return 0;
31 } 29 }
32 MoonP::MoonConfig config; 30 MoonP::MoonConfig config;
31 config.reserveLineNumber = false;
33 bool writeToFile = true; 32 bool writeToFile = true;
34 bool dumpCompileTime = false; 33 bool dumpCompileTime = false;
35 std::string targetPath; 34 std::string targetPath;
@@ -37,18 +36,9 @@ int main(int narg, const char** args) {
37 std::list<std::string> files; 36 std::list<std::string> files;
38 for (int i = 1; i < narg; ++i) { 37 for (int i = 1; i < narg; ++i) {
39 switch (hash(args[i])) { 38 switch (hash(args[i])) {
40 case "-a"_id:
41 config.allowExprNotInTheEndOfBody = true;
42 break;
43 case "-s"_id:
44 config.spaceOverTab = true;
45 break;
46 case "-l"_id: 39 case "-l"_id:
47 config.reserveLineNumber = true; 40 config.reserveLineNumber = true;
48 break; 41 break;
49 case "-r"_id:
50 config.reuseVariable = true;
51 break;
52 case "-p"_id: 42 case "-p"_id:
53 writeToFile = false; 43 writeToFile = false;
54 break; 44 break;