diff options
author | Li Jin <dragon-fly@qq.com> | 2020-10-08 13:01:18 +0800 |
---|---|---|
committer | Li Jin <dragon-fly@qq.com> | 2020-10-08 13:01:18 +0800 |
commit | 97bbe98289fb74c7cf2d9793b80a1a27b4146045 (patch) | |
tree | 4bee0dded55bad28f6822b6e2dd3ea5251c66ae2 | |
parent | 5b656d2913e4f9f0017698ec835ce4ddda1dc81f (diff) | |
download | yuescript-97bbe98289fb74c7cf2d9793b80a1a27b4146045.tar.gz yuescript-97bbe98289fb74c7cf2d9793b80a1a27b4146045.tar.bz2 yuescript-97bbe98289fb74c7cf2d9793b80a1a27b4146045.zip |
change file extension moonp.
-rw-r--r-- | spec/inputs/ambiguous.mp (renamed from spec/inputs/ambiguous.moon) | 0 | ||||
-rw-r--r-- | spec/inputs/assign.mp (renamed from spec/inputs/assign.moon) | 0 | ||||
-rw-r--r-- | spec/inputs/attrib.mp (renamed from spec/inputs/attrib.moon) | 0 | ||||
-rw-r--r-- | spec/inputs/backcall.mp (renamed from spec/inputs/backcall.moon) | 0 | ||||
-rw-r--r-- | spec/inputs/bubbling.mp (renamed from spec/inputs/bubbling.moon) | 0 | ||||
-rw-r--r-- | spec/inputs/class.mp (renamed from spec/inputs/class.moon) | 0 | ||||
-rw-r--r-- | spec/inputs/comprehension.mp (renamed from spec/inputs/comprehension.moon) | 0 | ||||
-rw-r--r-- | spec/inputs/cond.mp (renamed from spec/inputs/cond.moon) | 0 | ||||
-rw-r--r-- | spec/inputs/destructure.mp (renamed from spec/inputs/destructure.moon) | 0 | ||||
-rw-r--r-- | spec/inputs/do.mp (renamed from spec/inputs/do.moon) | 0 | ||||
-rw-r--r-- | spec/inputs/existential.mp (renamed from spec/inputs/existential.moon) | 0 | ||||
-rw-r--r-- | spec/inputs/export.mp (renamed from spec/inputs/export.moon) | 0 | ||||
-rw-r--r-- | spec/inputs/export_default.mp (renamed from spec/inputs/export_default.moon) | 0 | ||||
-rw-r--r-- | spec/inputs/funcs.mp (renamed from spec/inputs/funcs.moon) | 0 | ||||
-rw-r--r-- | spec/inputs/global.mp (renamed from spec/inputs/global.moon) | 0 | ||||
-rw-r--r-- | spec/inputs/goto.mp (renamed from spec/inputs/goto.moon) | 0 | ||||
-rw-r--r-- | spec/inputs/import.mp (renamed from spec/inputs/import.moon) | 0 | ||||
-rw-r--r-- | spec/inputs/lists.mp (renamed from spec/inputs/lists.moon) | 0 | ||||
-rw-r--r-- | spec/inputs/literals.mp (renamed from spec/inputs/literals.moon) | 0 | ||||
-rw-r--r-- | spec/inputs/local.mp (renamed from spec/inputs/local.moon) | 0 | ||||
-rw-r--r-- | spec/inputs/loops.mp (renamed from spec/inputs/loops.moon) | 0 | ||||
-rw-r--r-- | spec/inputs/macro.mp (renamed from spec/inputs/macro.moon) | 16 | ||||
-rw-r--r-- | spec/inputs/macro_export.mp (renamed from spec/inputs/macro_export.moon) | 0 | ||||
-rw-r--r-- | spec/inputs/operators.mp (renamed from spec/inputs/operators.moon) | 0 | ||||
-rw-r--r-- | spec/inputs/plus.mp (renamed from spec/inputs/plus.moon) | 0 | ||||
-rw-r--r-- | spec/inputs/return.mp (renamed from spec/inputs/return.moon) | 0 | ||||
-rw-r--r-- | spec/inputs/string.mp (renamed from spec/inputs/string.moon) | 0 | ||||
-rw-r--r-- | spec/inputs/stub.mp (renamed from spec/inputs/stub.moon) | 0 | ||||
-rw-r--r-- | spec/inputs/switch.mp (renamed from spec/inputs/switch.moon) | 0 | ||||
-rw-r--r-- | spec/inputs/syntax.mp (renamed from spec/inputs/syntax.moon) | 8 | ||||
-rw-r--r-- | spec/inputs/tables.mp (renamed from spec/inputs/tables.moon) | 0 | ||||
-rw-r--r-- | spec/inputs/unless_else.mp (renamed from spec/inputs/unless_else.moon) | 0 | ||||
-rw-r--r-- | spec/inputs/using.mp (renamed from spec/inputs/using.moon) | 0 | ||||
-rw-r--r-- | spec/inputs/whitespace.mp (renamed from spec/inputs/whitespace.moon) | 0 | ||||
-rw-r--r-- | spec/inputs/with.mp (renamed from spec/inputs/with.moon) | 0 | ||||
-rw-r--r-- | src/MoonP/moon_compiler.cpp | 7 | ||||
-rw-r--r-- | src/MoonP/moon_compiler.h | 3 | ||||
-rw-r--r-- | src/MoonP/moonplus.cpp | 6 | ||||
-rw-r--r-- | src/MoonP/moonplus.h | 11 | ||||
-rw-r--r-- | src/MoonP/stacktraceplus.h | 2 | ||||
-rw-r--r-- | src/moonp.cpp | 8 |
41 files changed, 34 insertions, 27 deletions
diff --git a/spec/inputs/ambiguous.moon b/spec/inputs/ambiguous.mp index a5980db..a5980db 100644 --- a/spec/inputs/ambiguous.moon +++ b/spec/inputs/ambiguous.mp | |||
diff --git a/spec/inputs/assign.moon b/spec/inputs/assign.mp index dac2ba3..dac2ba3 100644 --- a/spec/inputs/assign.moon +++ b/spec/inputs/assign.mp | |||
diff --git a/spec/inputs/attrib.moon b/spec/inputs/attrib.mp index bc1e67e..bc1e67e 100644 --- a/spec/inputs/attrib.moon +++ b/spec/inputs/attrib.mp | |||
diff --git a/spec/inputs/backcall.moon b/spec/inputs/backcall.mp index a648b16..a648b16 100644 --- a/spec/inputs/backcall.moon +++ b/spec/inputs/backcall.mp | |||
diff --git a/spec/inputs/bubbling.moon b/spec/inputs/bubbling.mp index 23a85d4..23a85d4 100644 --- a/spec/inputs/bubbling.moon +++ b/spec/inputs/bubbling.mp | |||
diff --git a/spec/inputs/class.moon b/spec/inputs/class.mp index ca8b58c..ca8b58c 100644 --- a/spec/inputs/class.moon +++ b/spec/inputs/class.mp | |||
diff --git a/spec/inputs/comprehension.moon b/spec/inputs/comprehension.mp index b6adb94..b6adb94 100644 --- a/spec/inputs/comprehension.moon +++ b/spec/inputs/comprehension.mp | |||
diff --git a/spec/inputs/cond.moon b/spec/inputs/cond.mp index 3dee99b..3dee99b 100644 --- a/spec/inputs/cond.moon +++ b/spec/inputs/cond.mp | |||
diff --git a/spec/inputs/destructure.moon b/spec/inputs/destructure.mp index 49e6393..49e6393 100644 --- a/spec/inputs/destructure.moon +++ b/spec/inputs/destructure.mp | |||
diff --git a/spec/inputs/do.moon b/spec/inputs/do.mp index 2fbcbb9..2fbcbb9 100644 --- a/spec/inputs/do.moon +++ b/spec/inputs/do.mp | |||
diff --git a/spec/inputs/existential.moon b/spec/inputs/existential.mp index 3055705..3055705 100644 --- a/spec/inputs/existential.moon +++ b/spec/inputs/existential.mp | |||
diff --git a/spec/inputs/export.moon b/spec/inputs/export.mp index 9a494d9..9a494d9 100644 --- a/spec/inputs/export.moon +++ b/spec/inputs/export.mp | |||
diff --git a/spec/inputs/export_default.moon b/spec/inputs/export_default.mp index 73f43ac..73f43ac 100644 --- a/spec/inputs/export_default.moon +++ b/spec/inputs/export_default.mp | |||
diff --git a/spec/inputs/funcs.moon b/spec/inputs/funcs.mp index 4176e33..4176e33 100644 --- a/spec/inputs/funcs.moon +++ b/spec/inputs/funcs.mp | |||
diff --git a/spec/inputs/global.moon b/spec/inputs/global.mp index 7d6cfde..7d6cfde 100644 --- a/spec/inputs/global.moon +++ b/spec/inputs/global.mp | |||
diff --git a/spec/inputs/goto.moon b/spec/inputs/goto.mp index 3410ca3..3410ca3 100644 --- a/spec/inputs/goto.moon +++ b/spec/inputs/goto.mp | |||
diff --git a/spec/inputs/import.moon b/spec/inputs/import.mp index 99981f8..99981f8 100644 --- a/spec/inputs/import.moon +++ b/spec/inputs/import.mp | |||
diff --git a/spec/inputs/lists.moon b/spec/inputs/lists.mp index 15eb9ab..15eb9ab 100644 --- a/spec/inputs/lists.moon +++ b/spec/inputs/lists.mp | |||
diff --git a/spec/inputs/literals.moon b/spec/inputs/literals.mp index d4b0326..d4b0326 100644 --- a/spec/inputs/literals.moon +++ b/spec/inputs/literals.mp | |||
diff --git a/spec/inputs/local.moon b/spec/inputs/local.mp index 33251a9..33251a9 100644 --- a/spec/inputs/local.moon +++ b/spec/inputs/local.mp | |||
diff --git a/spec/inputs/loops.moon b/spec/inputs/loops.mp index 24d960f..24d960f 100644 --- a/spec/inputs/loops.moon +++ b/spec/inputs/loops.mp | |||
diff --git a/spec/inputs/macro.moon b/spec/inputs/macro.mp index aa8356c..c7ec79c 100644 --- a/spec/inputs/macro.moon +++ b/spec/inputs/macro.mp | |||
@@ -1,6 +1,6 @@ | |||
1 | macro block init = -> | 1 | macro block init = -> |
2 | with require "moonp" | 2 | with require "moonp" |
3 | package.moonpath = "?.moon;./spec/inputs/?.moon" | 3 | package.moonpath = "?.mp;./spec/inputs/?.mp" |
4 | "" | 4 | "" |
5 | 5 | ||
6 | $init! | 6 | $init! |
@@ -25,7 +25,7 @@ if $and f1!, f2!, f3! | |||
25 | 25 | ||
26 | macro expr in = (target, ...)-> | 26 | macro expr in = (target, ...)-> |
27 | values = [value for value in *{...}] | 27 | values = [value for value in *{...}] |
28 | $showMacro "in", "#{ table.concat ["#{target} == #{item}" for item in *values], " or " }" | 28 | $showMacro "in", table.concat ["#{target} == #{item}" for item in *values], " or " |
29 | 29 | ||
30 | if x |> $in "Apple", "Pig", "Dog" | 30 | if x |> $in "Apple", "Pig", "Dog" |
31 | print "exist" | 31 | print "exist" |
@@ -55,7 +55,7 @@ macro expr pipe = (...)-> | |||
55 | when 1 then return ... | 55 | when 1 then return ... |
56 | ops = {...} | 56 | ops = {...} |
57 | last = ops[1] | 57 | last = ops[1] |
58 | stmts = for i = 2,#ops | 58 | stmts = for i = 2, #ops |
59 | stmt = "\tlocal _#{i} = #{last} |> #{ops[i]}" | 59 | stmt = "\tlocal _#{i} = #{last} |> #{ops[i]}" |
60 | last = "_#{i}" | 60 | last = "_#{i}" |
61 | stmt | 61 | stmt |
@@ -164,15 +164,17 @@ macro block chainB = (...)-> | |||
164 | last = nil | 164 | last = nil |
165 | stmts = for i = 1,#items | 165 | stmts = for i = 1,#items |
166 | stmt = if i == #items | 166 | stmt = if i == #items |
167 | "\t#{last and "#{last}\\" or ""}#{items[i]}" | 167 | lastStr = last and "#{last}\\" or "" |
168 | "\t#{lastStr}#{items[i]}" | ||
168 | else | 169 | else |
169 | "\tlocal _#{i} = #{last and "#{last}\\" or ""}#{items[i]}" | 170 | lastStr = last and "#{last}\\" or "" |
171 | "\tlocal _#{i} = #{lastStr}#{items[i]}" | ||
170 | last = "_#{i}" | 172 | last = "_#{i}" |
171 | stmt | 173 | stmt |
172 | res = "do | 174 | res = "do |
173 | #{table.concat stmts, "\n"} | 175 | #{table.concat stmts, '\n'} |
174 | " | 176 | " |
175 | $showMacro "chainB",res | 177 | $showMacro "chainB", res |
176 | 178 | ||
177 | $chainB( | 179 | $chainB( |
178 | _{1, 2, 3, 4, -2, 3} | 180 | _{1, 2, 3, 4, -2, 3} |
diff --git a/spec/inputs/macro_export.moon b/spec/inputs/macro_export.mp index 759c6d1..759c6d1 100644 --- a/spec/inputs/macro_export.moon +++ b/spec/inputs/macro_export.mp | |||
diff --git a/spec/inputs/operators.moon b/spec/inputs/operators.mp index 57e58d6..57e58d6 100644 --- a/spec/inputs/operators.moon +++ b/spec/inputs/operators.mp | |||
diff --git a/spec/inputs/plus.moon b/spec/inputs/plus.mp index ca03499..ca03499 100644 --- a/spec/inputs/plus.moon +++ b/spec/inputs/plus.mp | |||
diff --git a/spec/inputs/return.moon b/spec/inputs/return.mp index f170ffd..f170ffd 100644 --- a/spec/inputs/return.moon +++ b/spec/inputs/return.mp | |||
diff --git a/spec/inputs/string.moon b/spec/inputs/string.mp index 5d8f772..5d8f772 100644 --- a/spec/inputs/string.moon +++ b/spec/inputs/string.mp | |||
diff --git a/spec/inputs/stub.moon b/spec/inputs/stub.mp index 60347e7..60347e7 100644 --- a/spec/inputs/stub.moon +++ b/spec/inputs/stub.mp | |||
diff --git a/spec/inputs/switch.moon b/spec/inputs/switch.mp index ac3dbea..ac3dbea 100644 --- a/spec/inputs/switch.moon +++ b/spec/inputs/switch.mp | |||
diff --git a/spec/inputs/syntax.moon b/spec/inputs/syntax.mp index af72f73..1bb962f 100644 --- a/spec/inputs/syntax.moon +++ b/spec/inputs/syntax.mp | |||
@@ -233,12 +233,12 @@ yeah | |||
233 | sure: sir | 233 | sure: sir |
234 | 234 | ||
235 | hello "no comma" | 235 | hello "no comma" |
236 | yeah: dada | 236 | yeah: dada |
237 | another: world | 237 | another: world |
238 | 238 | ||
239 | hello "comma", | 239 | hello "comma", |
240 | something: hello_world | 240 | something: hello_world |
241 | frick: you | 241 | frick: you |
242 | 242 | ||
243 | -- creates one table | 243 | -- creates one table |
244 | another hello, one, | 244 | another hello, one, |
diff --git a/spec/inputs/tables.moon b/spec/inputs/tables.mp index e816003..e816003 100644 --- a/spec/inputs/tables.moon +++ b/spec/inputs/tables.mp | |||
diff --git a/spec/inputs/unless_else.moon b/spec/inputs/unless_else.mp index b421d4d..b421d4d 100644 --- a/spec/inputs/unless_else.moon +++ b/spec/inputs/unless_else.mp | |||
diff --git a/spec/inputs/using.moon b/spec/inputs/using.mp index fe0a433..fe0a433 100644 --- a/spec/inputs/using.moon +++ b/spec/inputs/using.mp | |||
diff --git a/spec/inputs/whitespace.moon b/spec/inputs/whitespace.mp index 329280f..329280f 100644 --- a/spec/inputs/whitespace.moon +++ b/spec/inputs/whitespace.mp | |||
diff --git a/spec/inputs/with.moon b/spec/inputs/with.mp index 704c494..704c494 100644 --- a/spec/inputs/with.moon +++ b/spec/inputs/with.mp | |||
diff --git a/src/MoonP/moon_compiler.cpp b/src/MoonP/moon_compiler.cpp index 8c0746f..6e7db2c 100644 --- a/src/MoonP/moon_compiler.cpp +++ b/src/MoonP/moon_compiler.cpp | |||
@@ -53,9 +53,8 @@ inline std::string s(std::string_view sv) { | |||
53 | return std::string(sv); | 53 | return std::string(sv); |
54 | } | 54 | } |
55 | 55 | ||
56 | const std::string_view version() { | 56 | const std::string_view version = "0.4.16"sv; |
57 | return "0.4.15"sv; | 57 | const std::string_view extension = "mp"sv; |
58 | } | ||
59 | 58 | ||
60 | class MoonCompilerImpl { | 59 | class MoonCompilerImpl { |
61 | public: | 60 | public: |
@@ -4926,7 +4925,7 @@ private: | |||
4926 | } | 4925 | } |
4927 | case id<macro_name_pair_t>(): { | 4926 | case id<macro_name_pair_t>(): { |
4928 | auto pair = static_cast<macro_name_pair_t*>(item); | 4927 | auto pair = static_cast<macro_name_pair_t*>(item); |
4929 | macroPairs.emplace_back(_parser.toString(pair->value->name), _parser.toString(pair->key->name)); | 4928 | macroPairs.emplace_back(_parser.toString(pair->value->name), _parser.toString(pair->key->name)); |
4930 | break; | 4929 | break; |
4931 | } | 4930 | } |
4932 | default: | 4931 | default: |
diff --git a/src/MoonP/moon_compiler.h b/src/MoonP/moon_compiler.h index 37a79bf..cb57d57 100644 --- a/src/MoonP/moon_compiler.h +++ b/src/MoonP/moon_compiler.h | |||
@@ -17,7 +17,8 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI | |||
17 | 17 | ||
18 | namespace MoonP { | 18 | namespace MoonP { |
19 | 19 | ||
20 | const std::string_view version(); | 20 | extern const std::string_view version; |
21 | extern const std::string_view extension; | ||
21 | 22 | ||
22 | struct MoonConfig { | 23 | struct MoonConfig { |
23 | bool lintGlobalVariable = false; | 24 | bool lintGlobalVariable = false; |
diff --git a/src/MoonP/moonplus.cpp b/src/MoonP/moonplus.cpp index cb6d3ec..c775d75 100644 --- a/src/MoonP/moonplus.cpp +++ b/src/MoonP/moonplus.cpp | |||
@@ -122,7 +122,11 @@ int luaopen_moonp(lua_State* L) { | |||
122 | lua_getfield(L, -1, "loaded"); // package loaded | 122 | lua_getfield(L, -1, "loaded"); // package loaded |
123 | lua_createtable(L, 0, 0); // package loaded moonp | 123 | lua_createtable(L, 0, 0); // package loaded moonp |
124 | lua_pushcfunction(L, moontolua); // package loaded moonp func | 124 | lua_pushcfunction(L, moontolua); // package loaded moonp func |
125 | lua_setfield(L, -2, "to_lua"); // moonp["to_lua"] = func, package loaded tb | 125 | lua_setfield(L, -2, "to_lua"); // moonp["to_lua"] = func, package loaded moonp |
126 | lua_pushlstring(L, &MoonP::version.front(), MoonP::version.size()); // package loaded moonp version | ||
127 | lua_setfield(L, -2, "version"); // loaded["version"] = version, package loaded moonp | ||
128 | lua_pushlstring(L, &MoonP::extension.front(), MoonP::extension.size()); // package loaded moonp ext | ||
129 | lua_setfield(L, -2, "extension"); // loaded["extension"] = ext, package loaded moonp | ||
126 | lua_pushcfunction(L, init_stacktraceplus); // package loaded moonp func1 | 130 | lua_pushcfunction(L, init_stacktraceplus); // package loaded moonp func1 |
127 | lua_setfield(L, -2, "load_stacktraceplus"); // moonp["load_stacktraceplus"] = func1, package loaded moonp | 131 | lua_setfield(L, -2, "load_stacktraceplus"); // moonp["load_stacktraceplus"] = func1, package loaded moonp |
128 | lua_setfield(L, -2, "moonp"); // loaded["moonp"] = moonp, package loaded | 132 | lua_setfield(L, -2, "moonp"); // loaded["moonp"] = moonp, package loaded |
diff --git a/src/MoonP/moonplus.h b/src/MoonP/moonplus.h index 83d4c75..b18ab64 100644 --- a/src/MoonP/moonplus.h +++ b/src/MoonP/moonplus.h | |||
@@ -1,4 +1,4 @@ | |||
1 | R"moonscript_codes( | 1 | R"moonplus_codes( |
2 | --[[ | 2 | --[[ |
3 | Copyright (C) 2020 by Leaf Corcoran, modified by Li Jin | 3 | Copyright (C) 2020 by Leaf Corcoran, modified by Li Jin |
4 | 4 | ||
@@ -73,6 +73,7 @@ get_options = function(...) | |||
73 | end | 73 | end |
74 | end | 74 | end |
75 | create_moonpath = function(package_path) | 75 | create_moonpath = function(package_path) |
76 | local extension = moonp.extension | ||
76 | local moonpaths | 77 | local moonpaths |
77 | do | 78 | do |
78 | local _accum_0 = { } | 79 | local _accum_0 = { } |
@@ -87,7 +88,7 @@ create_moonpath = function(package_path) | |||
87 | _continue_0 = true | 88 | _continue_0 = true |
88 | break | 89 | break |
89 | end | 90 | end |
90 | _accum_0[_len_0] = prefix .. ".moon" | 91 | _accum_0[_len_0] = prefix .. "." .. extension |
91 | _len_0 = _len_0 + 1 | 92 | _len_0 = _len_0 + 1 |
92 | _continue_0 = true | 93 | _continue_0 = true |
93 | until true | 94 | until true |
@@ -134,7 +135,7 @@ moon_loader = function(name) | |||
134 | end | 135 | end |
135 | return res | 136 | return res |
136 | end | 137 | end |
137 | return nil, "Could not find moon file" | 138 | return nil, "Could not find moonp file" |
138 | end | 139 | end |
139 | moon_call = function(f, ...) | 140 | moon_call = function(f, ...) |
140 | local args = { | 141 | local args = { |
@@ -148,7 +149,7 @@ moon_call = function(f, ...) | |||
148 | end | 149 | end |
149 | loadstring = function(...) | 150 | loadstring = function(...) |
150 | local options, str, chunk_name, mode, env = get_options(...) | 151 | local options, str, chunk_name, mode, env = get_options(...) |
151 | chunk_name = chunk_name or "=(moonscript.loadstring)" | 152 | chunk_name = chunk_name or "=(moonplus.loadstring)" |
152 | local code, err = moonp.to_lua(str, options) | 153 | local code, err = moonp.to_lua(str, options) |
153 | if not code then | 154 | if not code then |
154 | return nil, err | 155 | return nil, err |
@@ -247,4 +248,4 @@ for k, v in pairs({ | |||
247 | }) do | 248 | }) do |
248 | moonp[k] = v | 249 | moonp[k] = v |
249 | end | 250 | end |
250 | )moonscript_codes"; | 251 | )moonplus_codes"; |
diff --git a/src/MoonP/stacktraceplus.h b/src/MoonP/stacktraceplus.h index d658c5c..e884a2c 100644 --- a/src/MoonP/stacktraceplus.h +++ b/src/MoonP/stacktraceplus.h | |||
@@ -335,7 +335,7 @@ local function getMoonLineNumber(fname, line) | |||
335 | end | 335 | end |
336 | if file_exist then | 336 | if file_exist then |
337 | local codes = moonp.read_file(file_path) | 337 | local codes = moonp.read_file(file_path) |
338 | local moonFile = codes:match("^%s*--%s*%[moon%]:%s*([^\n]*)") | 338 | local moonFile = codes:match("^%s*--%s*%[moonp%]:%s*([^\n]*)") |
339 | if moonFile then | 339 | if moonFile then |
340 | fname = moonFile:gsub("^%s*(.-)%s*$", "%1") | 340 | fname = moonFile:gsub("^%s*(.-)%s*$", "%1") |
341 | source = codes | 341 | source = codes |
diff --git a/src/moonp.cpp b/src/moonp.cpp index 68f7b10..25be015 100644 --- a/src/moonp.cpp +++ b/src/moonp.cpp | |||
@@ -174,7 +174,7 @@ int main(int narg, const char** args) { | |||
174 | break; | 174 | break; |
175 | } | 175 | } |
176 | }); | 176 | }); |
177 | std::cout << "Moonscript+ "sv << MoonP::version() << '\n'; | 177 | std::cout << "Moonscript+ "sv << MoonP::version << '\n'; |
178 | while (true) { | 178 | while (true) { |
179 | count++; | 179 | count++; |
180 | std::string codes; | 180 | std::string codes; |
@@ -366,7 +366,7 @@ int main(int narg, const char** args) { | |||
366 | std::cout << help; | 366 | std::cout << help; |
367 | return 0; | 367 | return 0; |
368 | } else if (arg == "-v"sv) { | 368 | } else if (arg == "-v"sv) { |
369 | std::cout << "Moonscript+ version: "sv << MoonP::version() << '\n'; | 369 | std::cout << "Moonscript+ version: "sv << MoonP::version << '\n'; |
370 | return 0; | 370 | return 0; |
371 | } else if (arg == "-o"sv) { | 371 | } else if (arg == "-o"sv) { |
372 | ++i; | 372 | ++i; |
@@ -382,7 +382,7 @@ int main(int narg, const char** args) { | |||
382 | if (!item.is_directory()) { | 382 | if (!item.is_directory()) { |
383 | auto ext = item.path().extension().string(); | 383 | auto ext = item.path().extension().string(); |
384 | for (char& ch : ext) ch = std::tolower(ch); | 384 | for (char& ch : ext) ch = std::tolower(ch); |
385 | if (ext == ".moon"sv) { | 385 | if (!ext.empty() && ext.substr(1) == MoonP::extension) { |
386 | files.emplace_back(item.path().string(), item.path().lexically_relative(arg).string()); | 386 | files.emplace_back(item.path().string(), item.path().lexically_relative(arg).string()); |
387 | } | 387 | } |
388 | } | 388 | } |
@@ -453,7 +453,7 @@ int main(int narg, const char** args) { | |||
453 | if (output) { | 453 | if (output) { |
454 | const auto& codes = std::get<0>(result); | 454 | const auto& codes = std::get<0>(result); |
455 | if (config.reserveLineNumber) { | 455 | if (config.reserveLineNumber) { |
456 | auto head = std::string("-- [moon]: "sv) + file.first + '\n'; | 456 | auto head = std::string("-- [moonp]: "sv) + file.first + '\n'; |
457 | output.write(head.c_str(), head.size()); | 457 | output.write(head.c_str(), head.size()); |
458 | } | 458 | } |
459 | output.write(codes.c_str(), codes.size()); | 459 | output.write(codes.c_str(), codes.size()); |