aboutsummaryrefslogtreecommitdiff
path: root/src/yue.cpp
diff options
context:
space:
mode:
authorLi Jin <dragon-fly@qq.com>2021-11-19 13:23:11 +0800
committerLi Jin <dragon-fly@qq.com>2021-11-19 13:23:11 +0800
commit2ff18b4fb66d25d22e5a25fb386fe171853e0b06 (patch)
treed6e6f1671f74a4430b24869c74767aaf0ee2e128 /src/yue.cpp
parenta8e5aaf64969792741f3a094fe0070ddb5e3bc7d (diff)
downloadyuescript-2ff18b4fb66d25d22e5a25fb386fe171853e0b06.tar.gz
yuescript-2ff18b4fb66d25d22e5a25fb386fe171853e0b06.tar.bz2
yuescript-2ff18b4fb66d25d22e5a25fb386fe171853e0b06.zip
try to fix issue #69 with new macro functions. add builtin macro $MODULE and $LINE.
Diffstat (limited to 'src/yue.cpp')
-rw-r--r--src/yue.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/yue.cpp b/src/yue.cpp
index b04bd92..1704b57 100644
--- a/src/yue.cpp
+++ b/src/yue.cpp
@@ -429,9 +429,11 @@ int main(int narg, const char** args) {
429 std::string s( 429 std::string s(
430 (std::istreambuf_iterator<char>(input)), 430 (std::istreambuf_iterator<char>(input)),
431 std::istreambuf_iterator<char>()); 431 std::istreambuf_iterator<char>());
432 auto conf = config;
433 conf.module = file.first;
432 if (dumpCompileTime) { 434 if (dumpCompileTime) {
433 auto start = std::chrono::high_resolution_clock::now(); 435 auto start = std::chrono::high_resolution_clock::now();
434 auto result = yue::YueCompiler{YUE_ARGS}.compile(s, config); 436 auto result = yue::YueCompiler{YUE_ARGS}.compile(s, conf);
435 auto end = std::chrono::high_resolution_clock::now(); 437 auto end = std::chrono::high_resolution_clock::now();
436 if (!result.codes.empty()) { 438 if (!result.codes.empty()) {
437 std::chrono::duration<double> diff = end - start; 439 std::chrono::duration<double> diff = end - start;
@@ -451,7 +453,7 @@ int main(int narg, const char** args) {
451 return std::tuple{1, file.first, buf.str()}; 453 return std::tuple{1, file.first, buf.str()};
452 } 454 }
453 } 455 }
454 auto result = yue::YueCompiler{YUE_ARGS}.compile(s, config); 456 auto result = yue::YueCompiler{YUE_ARGS}.compile(s, conf);
455 if (result.error.empty()) { 457 if (result.error.empty()) {
456 if (!writeToFile) { 458 if (!writeToFile) {
457 return std::tuple{0, file.first, result.codes + '\n'}; 459 return std::tuple{0, file.first, result.codes + '\n'};