diff options
Diffstat (limited to 'src/moonp.cpp')
| -rw-r--r-- | src/moonp.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/moonp.cpp b/src/moonp.cpp index ca5265f..7410994 100644 --- a/src/moonp.cpp +++ b/src/moonp.cpp | |||
| @@ -63,6 +63,9 @@ void pushOptions(lua_State* L, int lineOffset) { | |||
| 63 | lua_pushliteral(L, "reserve_line_number"); | 63 | lua_pushliteral(L, "reserve_line_number"); |
| 64 | lua_pushboolean(L, 1); | 64 | lua_pushboolean(L, 1); |
| 65 | lua_rawset(L, -3); | 65 | lua_rawset(L, -3); |
| 66 | lua_pushliteral(L, "space_over_tab"); | ||
| 67 | lua_pushboolean(L, 0); | ||
| 68 | lua_rawset(L, -3); | ||
| 66 | lua_pushliteral(L, "same_module"); | 69 | lua_pushliteral(L, "same_module"); |
| 67 | lua_pushboolean(L, 1); | 70 | lua_pushboolean(L, 1); |
| 68 | lua_rawset(L, -3); | 71 | lua_rawset(L, -3); |
| @@ -78,6 +81,7 @@ int main(int narg, const char** args) { | |||
| 78 | " -e str Execute a file or raw codes\n" | 81 | " -e str Execute a file or raw codes\n" |
| 79 | " -t path Specify where to place compiled files\n" | 82 | " -t path Specify where to place compiled files\n" |
| 80 | " -o file Write output to file\n" | 83 | " -o file Write output to file\n" |
| 84 | " -s Use space in generated codes instead of tabs\n" | ||
| 81 | " -p Write output to standard out\n" | 85 | " -p Write output to standard out\n" |
| 82 | " -b Dump compile time (doesn't write output)\n" | 86 | " -b Dump compile time (doesn't write output)\n" |
| 83 | " -l Write line numbers from source codes\n" | 87 | " -l Write line numbers from source codes\n" |
| @@ -220,7 +224,10 @@ int main(int narg, const char** args) { | |||
| 220 | return 0; | 224 | return 0; |
| 221 | } | 225 | } |
| 222 | MoonP::MoonConfig config; | 226 | MoonP::MoonConfig config; |
| 227 | config.implicitReturnRoot = true; | ||
| 228 | config.lintGlobalVariable = false; | ||
| 223 | config.reserveLineNumber = false; | 229 | config.reserveLineNumber = false; |
| 230 | config.useSpaceOverTab = false; | ||
| 224 | bool writeToFile = true; | 231 | bool writeToFile = true; |
| 225 | bool dumpCompileTime = false; | 232 | bool dumpCompileTime = false; |
| 226 | std::string targetPath; | 233 | std::string targetPath; |
| @@ -242,6 +249,7 @@ int main(int narg, const char** args) { | |||
| 242 | conf.implicitReturnRoot = true; | 249 | conf.implicitReturnRoot = true; |
| 243 | conf.lintGlobalVariable = false; | 250 | conf.lintGlobalVariable = false; |
| 244 | conf.reserveLineNumber = false; | 251 | conf.reserveLineNumber = false; |
| 252 | conf.useSpaceOverTab = true; | ||
| 245 | auto result = MoonP::MoonCompiler{nullptr, openlibs}.compile(codes, conf); | 253 | auto result = MoonP::MoonCompiler{nullptr, openlibs}.compile(codes, conf); |
| 246 | if (std::get<1>(result).empty()) { | 254 | if (std::get<1>(result).empty()) { |
| 247 | std::cout << std::get<0>(result); | 255 | std::cout << std::get<0>(result); |
| @@ -307,6 +315,8 @@ int main(int narg, const char** args) { | |||
| 307 | std::cout << help; | 315 | std::cout << help; |
| 308 | return 1; | 316 | return 1; |
| 309 | } | 317 | } |
| 318 | } else if (arg == "-s"sv) { | ||
| 319 | config.useSpaceOverTab = true; | ||
| 310 | } else if (arg == "-l"sv) { | 320 | } else if (arg == "-l"sv) { |
| 311 | config.reserveLineNumber = true; | 321 | config.reserveLineNumber = true; |
| 312 | } else if (arg == "-p"sv) { | 322 | } else if (arg == "-p"sv) { |
