diff options
| -rw-r--r-- | spec/inputs/test/format_spec.yue | 73 | ||||
| -rw-r--r-- | spec/outputs/test/format_spec.lua | 75 | ||||
| -rw-r--r-- | src/yuescript/yue_ast.cpp | 2 | ||||
| -rw-r--r-- | src/yuescript/yue_compiler.cpp | 2 |
4 files changed, 119 insertions, 33 deletions
diff --git a/spec/inputs/test/format_spec.yue b/spec/inputs/test/format_spec.yue index 6b94540..4da3f7e 100644 --- a/spec/inputs/test/format_spec.yue +++ b/spec/inputs/test/format_spec.yue | |||
| @@ -1,7 +1,12 @@ | |||
| 1 | files = [ | 1 | files = [ |
| 2 | "spec/inputs/import_global.yue" | ||
| 3 | "spec/inputs/nil_coalesce_precedence.yue" | ||
| 2 | "spec/inputs/macro_export.yue" | 4 | "spec/inputs/macro_export.yue" |
| 5 | "spec/inputs/props.yue" | ||
| 3 | "spec/inputs/attrib.yue" | 6 | "spec/inputs/attrib.yue" |
| 7 | "spec/inputs/upvalue_func.yue" | ||
| 4 | "spec/inputs/macro.yue" | 8 | "spec/inputs/macro.yue" |
| 9 | "spec/inputs/export_mixed.yue" | ||
| 5 | "spec/inputs/using.yue" | 10 | "spec/inputs/using.yue" |
| 6 | "spec/inputs/whitespace.yue" | 11 | "spec/inputs/whitespace.yue" |
| 7 | "spec/inputs/nil_coalescing.yue" | 12 | "spec/inputs/nil_coalescing.yue" |
| @@ -11,6 +16,7 @@ files = [ | |||
| 11 | "spec/inputs/string.yue" | 16 | "spec/inputs/string.yue" |
| 12 | "spec/inputs/local.yue" | 17 | "spec/inputs/local.yue" |
| 13 | "spec/inputs/tables.yue" | 18 | "spec/inputs/tables.yue" |
| 19 | "spec/inputs/pipe_chain_combo.yue" | ||
| 14 | "spec/inputs/operators.yue" | 20 | "spec/inputs/operators.yue" |
| 15 | "spec/inputs/lists.yue" | 21 | "spec/inputs/lists.yue" |
| 16 | "spec/inputs/compile_doc.yue" | 22 | "spec/inputs/compile_doc.yue" |
| @@ -18,9 +24,11 @@ files = [ | |||
| 18 | "spec/inputs/multiline_chain.yue" | 24 | "spec/inputs/multiline_chain.yue" |
| 19 | "spec/inputs/existential.yue" | 25 | "spec/inputs/existential.yue" |
| 20 | "spec/inputs/export_default.yue" | 26 | "spec/inputs/export_default.yue" |
| 27 | "spec/inputs/with_scope_shadow.yue" | ||
| 21 | "spec/inputs/assign.yue" | 28 | "spec/inputs/assign.yue" |
| 22 | "spec/inputs/literals.yue" | 29 | "spec/inputs/literals.yue" |
| 23 | "spec/inputs/luarocks_upload.yue" | 30 | "spec/inputs/luarocks_upload.yue" |
| 31 | "spec/inputs/comprehension_nested.yue" | ||
| 24 | "spec/inputs/ambiguous.yue" | 32 | "spec/inputs/ambiguous.yue" |
| 25 | "spec/inputs/bubbling.yue" | 33 | "spec/inputs/bubbling.yue" |
| 26 | "spec/inputs/try_catch.yue" | 34 | "spec/inputs/try_catch.yue" |
| @@ -41,17 +49,63 @@ files = [ | |||
| 41 | "spec/inputs/loops.yue" | 49 | "spec/inputs/loops.yue" |
| 42 | "spec/inputs/class.yue" | 50 | "spec/inputs/class.yue" |
| 43 | "spec/inputs/vararg.yue" | 51 | "spec/inputs/vararg.yue" |
| 52 | "spec/inputs/destructure_defaults.yue" | ||
| 44 | "spec/inputs/goto.yue" | 53 | "spec/inputs/goto.yue" |
| 45 | "spec/inputs/metatable.yue" | 54 | "spec/inputs/metatable.yue" |
| 46 | "spec/inputs/syntax.yue" | 55 | "spec/inputs/syntax.yue" |
| 47 | "spec/inputs/global.yue" | 56 | "spec/inputs/global.yue" |
| 48 | "spec/inputs/plus.yue" | 57 | "spec/inputs/plus.yue" |
| 58 | "spec/inputs/test/with_spec.yue" | ||
| 59 | "spec/inputs/test/try_catch_spec.yue" | ||
| 60 | "spec/inputs/test/operator_advanced_spec.yue" | ||
| 61 | "spec/inputs/test/with_statement_spec.yue" | ||
| 62 | "spec/inputs/test/literals_spec.yue" | ||
| 63 | "spec/inputs/test/varargs_assignment_spec.yue" | ||
| 64 | "spec/inputs/test/advanced_macro_spec.yue" | ||
| 65 | "spec/inputs/test/pipe_spec.yue" | ||
| 66 | "spec/inputs/test/export_spec.yue" | ||
| 67 | "spec/inputs/test/existential_spec.yue" | ||
| 68 | "spec/inputs/test/metatable_spec.yue" | ||
| 69 | "spec/inputs/test/multiline_args_spec.yue" | ||
| 70 | "spec/inputs/test/format_spec.yue" | ||
| 71 | "spec/inputs/test/do_statement_spec.yue" | ||
| 49 | "spec/inputs/test/class_spec.yue" | 72 | "spec/inputs/test/class_spec.yue" |
| 73 | "spec/inputs/test/stub_spec.yue" | ||
| 74 | "spec/inputs/test/whitespace_spec.yue" | ||
| 75 | "spec/inputs/test/in_expression_spec.yue" | ||
| 76 | "spec/inputs/test/param_destructure_spec.yue" | ||
| 77 | "spec/inputs/test/operators_spec.yue" | ||
| 78 | "spec/inputs/test/comprehension_spec.yue" | ||
| 79 | "spec/inputs/test/attrib_spec.yue" | ||
| 80 | "spec/inputs/test/nil_coalescing_spec.yue" | ||
| 81 | "spec/inputs/test/table_comprehension_spec.yue" | ||
| 82 | "spec/inputs/test/slicing_spec.yue" | ||
| 83 | "spec/inputs/test/close_attribute_spec.yue" | ||
| 84 | "spec/inputs/test/named_varargs_spec.yue" | ||
| 50 | "spec/inputs/test/table_spreading_spec.yue" | 85 | "spec/inputs/test/table_spreading_spec.yue" |
| 86 | "spec/inputs/test/macro_spec.yue" | ||
| 87 | "spec/inputs/test/chaining_comparison_spec.yue" | ||
| 88 | "spec/inputs/test/table_append_spec.yue" | ||
| 89 | "spec/inputs/test/destructure_spec.yue" | ||
| 90 | "spec/inputs/test/vararg_spec.yue" | ||
| 91 | "spec/inputs/test/string_spec.yue" | ||
| 92 | "spec/inputs/test/implicit_object_spec.yue" | ||
| 93 | "spec/inputs/test/backcall_spec.yue" | ||
| 94 | "spec/inputs/test/while_assignment_spec.yue" | ||
| 95 | "spec/inputs/test/switch_spec.yue" | ||
| 96 | "spec/inputs/test/functions_advanced_spec.yue" | ||
| 97 | "spec/inputs/test/config_spec.yue" | ||
| 98 | "spec/inputs/test/yaml_string_spec.yue" | ||
| 99 | "spec/inputs/test/const_attribute_spec.yue" | ||
| 100 | "spec/inputs/test/cond_spec.yue" | ||
| 101 | "spec/inputs/test/import_spec.yue" | ||
| 102 | "spec/inputs/test/reverse_index_spec.yue" | ||
| 103 | "spec/inputs/test/prefixed_return_spec.yue" | ||
| 104 | "spec/inputs/test/goto_spec.yue" | ||
| 105 | "spec/inputs/test/return_spec.yue" | ||
| 51 | "spec/inputs/test/loops_spec.yue" | 106 | "spec/inputs/test/loops_spec.yue" |
| 52 | "spec/inputs/test/format_spec.yue" | 107 | "spec/inputs/test/if_assignment_spec.yue" |
| 53 | "spec/inputs/upvalue_func.yue" | 108 | "spec/inputs/test/tables_advanced_spec.yue" |
| 54 | "spec/inputs/import_global.yue" | ||
| 55 | "spec/inputs/unicode/macro_export.yue" | 109 | "spec/inputs/unicode/macro_export.yue" |
| 56 | "spec/inputs/unicode/attrib.yue" | 110 | "spec/inputs/unicode/attrib.yue" |
| 57 | "spec/inputs/unicode/macro.yue" | 111 | "spec/inputs/unicode/macro.yue" |
| @@ -63,6 +117,7 @@ files = [ | |||
| 63 | "spec/inputs/unicode/string.yue" | 117 | "spec/inputs/unicode/string.yue" |
| 64 | "spec/inputs/unicode/local.yue" | 118 | "spec/inputs/unicode/local.yue" |
| 65 | "spec/inputs/unicode/tables.yue" | 119 | "spec/inputs/unicode/tables.yue" |
| 120 | "spec/inputs/unicode/pipe_chain_combo.yue" | ||
| 66 | "spec/inputs/unicode/operators.yue" | 121 | "spec/inputs/unicode/operators.yue" |
| 67 | "spec/inputs/unicode/lists.yue" | 122 | "spec/inputs/unicode/lists.yue" |
| 68 | "spec/inputs/unicode/switch.yue" | 123 | "spec/inputs/unicode/switch.yue" |
| @@ -95,18 +150,6 @@ files = [ | |||
| 95 | "spec/inputs/unicode/syntax.yue" | 150 | "spec/inputs/unicode/syntax.yue" |
| 96 | "spec/inputs/unicode/global.yue" | 151 | "spec/inputs/unicode/global.yue" |
| 97 | "spec/inputs/unicode/plus.yue" | 152 | "spec/inputs/unicode/plus.yue" |
| 98 | "spec/inputs/pipe_chain_combo.yue" | ||
| 99 | "spec/inputs/destructure_defaults.yue" | ||
| 100 | "spec/inputs/nil_coalesce_precedence.yue" | ||
| 101 | "spec/inputs/comprehension_nested.yue" | ||
| 102 | "spec/inputs/with_scope_shadow.yue" | ||
| 103 | "spec/inputs/export_mixed.yue" | ||
| 104 | "spec/inputs/unicode/pipe_chain_combo.yue" | ||
| 105 | "spec/inputs/test/destructure_spec.yue" | ||
| 106 | "spec/inputs/test/nil_coalescing_spec.yue" | ||
| 107 | "spec/inputs/test/pipe_spec.yue" | ||
| 108 | "spec/inputs/test/try_catch_spec.yue" | ||
| 109 | "spec/inputs/test/comprehension_spec.yue" | ||
| 110 | ] | 153 | ] |
| 111 | 154 | ||
| 112 | import "yue" | 155 | import "yue" |
diff --git a/spec/outputs/test/format_spec.lua b/spec/outputs/test/format_spec.lua index 74a511d..8307f6a 100644 --- a/spec/outputs/test/format_spec.lua +++ b/spec/outputs/test/format_spec.lua | |||
| @@ -1,7 +1,12 @@ | |||
| 1 | local files = { | 1 | local files = { |
| 2 | "spec/inputs/import_global.yue", | ||
| 3 | "spec/inputs/nil_coalesce_precedence.yue", | ||
| 2 | "spec/inputs/macro_export.yue", | 4 | "spec/inputs/macro_export.yue", |
| 5 | "spec/inputs/props.yue", | ||
| 3 | "spec/inputs/attrib.yue", | 6 | "spec/inputs/attrib.yue", |
| 7 | "spec/inputs/upvalue_func.yue", | ||
| 4 | "spec/inputs/macro.yue", | 8 | "spec/inputs/macro.yue", |
| 9 | "spec/inputs/export_mixed.yue", | ||
| 5 | "spec/inputs/using.yue", | 10 | "spec/inputs/using.yue", |
| 6 | "spec/inputs/whitespace.yue", | 11 | "spec/inputs/whitespace.yue", |
| 7 | "spec/inputs/nil_coalescing.yue", | 12 | "spec/inputs/nil_coalescing.yue", |
| @@ -11,6 +16,7 @@ local files = { | |||
| 11 | "spec/inputs/string.yue", | 16 | "spec/inputs/string.yue", |
| 12 | "spec/inputs/local.yue", | 17 | "spec/inputs/local.yue", |
| 13 | "spec/inputs/tables.yue", | 18 | "spec/inputs/tables.yue", |
| 19 | "spec/inputs/pipe_chain_combo.yue", | ||
| 14 | "spec/inputs/operators.yue", | 20 | "spec/inputs/operators.yue", |
| 15 | "spec/inputs/lists.yue", | 21 | "spec/inputs/lists.yue", |
| 16 | "spec/inputs/compile_doc.yue", | 22 | "spec/inputs/compile_doc.yue", |
| @@ -18,9 +24,11 @@ local files = { | |||
| 18 | "spec/inputs/multiline_chain.yue", | 24 | "spec/inputs/multiline_chain.yue", |
| 19 | "spec/inputs/existential.yue", | 25 | "spec/inputs/existential.yue", |
| 20 | "spec/inputs/export_default.yue", | 26 | "spec/inputs/export_default.yue", |
| 27 | "spec/inputs/with_scope_shadow.yue", | ||
| 21 | "spec/inputs/assign.yue", | 28 | "spec/inputs/assign.yue", |
| 22 | "spec/inputs/literals.yue", | 29 | "spec/inputs/literals.yue", |
| 23 | "spec/inputs/luarocks_upload.yue", | 30 | "spec/inputs/luarocks_upload.yue", |
| 31 | "spec/inputs/comprehension_nested.yue", | ||
| 24 | "spec/inputs/ambiguous.yue", | 32 | "spec/inputs/ambiguous.yue", |
| 25 | "spec/inputs/bubbling.yue", | 33 | "spec/inputs/bubbling.yue", |
| 26 | "spec/inputs/try_catch.yue", | 34 | "spec/inputs/try_catch.yue", |
| @@ -41,17 +49,63 @@ local files = { | |||
| 41 | "spec/inputs/loops.yue", | 49 | "spec/inputs/loops.yue", |
| 42 | "spec/inputs/class.yue", | 50 | "spec/inputs/class.yue", |
| 43 | "spec/inputs/vararg.yue", | 51 | "spec/inputs/vararg.yue", |
| 52 | "spec/inputs/destructure_defaults.yue", | ||
| 44 | "spec/inputs/goto.yue", | 53 | "spec/inputs/goto.yue", |
| 45 | "spec/inputs/metatable.yue", | 54 | "spec/inputs/metatable.yue", |
| 46 | "spec/inputs/syntax.yue", | 55 | "spec/inputs/syntax.yue", |
| 47 | "spec/inputs/global.yue", | 56 | "spec/inputs/global.yue", |
| 48 | "spec/inputs/plus.yue", | 57 | "spec/inputs/plus.yue", |
| 58 | "spec/inputs/test/with_spec.yue", | ||
| 59 | "spec/inputs/test/try_catch_spec.yue", | ||
| 60 | "spec/inputs/test/operator_advanced_spec.yue", | ||
| 61 | "spec/inputs/test/with_statement_spec.yue", | ||
| 62 | "spec/inputs/test/literals_spec.yue", | ||
| 63 | "spec/inputs/test/varargs_assignment_spec.yue", | ||
| 64 | "spec/inputs/test/advanced_macro_spec.yue", | ||
| 65 | "spec/inputs/test/pipe_spec.yue", | ||
| 66 | "spec/inputs/test/export_spec.yue", | ||
| 67 | "spec/inputs/test/existential_spec.yue", | ||
| 68 | "spec/inputs/test/metatable_spec.yue", | ||
| 69 | "spec/inputs/test/multiline_args_spec.yue", | ||
| 70 | "spec/inputs/test/format_spec.yue", | ||
| 71 | "spec/inputs/test/do_statement_spec.yue", | ||
| 49 | "spec/inputs/test/class_spec.yue", | 72 | "spec/inputs/test/class_spec.yue", |
| 73 | "spec/inputs/test/stub_spec.yue", | ||
| 74 | "spec/inputs/test/whitespace_spec.yue", | ||
| 75 | "spec/inputs/test/in_expression_spec.yue", | ||
| 76 | "spec/inputs/test/param_destructure_spec.yue", | ||
| 77 | "spec/inputs/test/operators_spec.yue", | ||
| 78 | "spec/inputs/test/comprehension_spec.yue", | ||
| 79 | "spec/inputs/test/attrib_spec.yue", | ||
| 80 | "spec/inputs/test/nil_coalescing_spec.yue", | ||
| 81 | "spec/inputs/test/table_comprehension_spec.yue", | ||
| 82 | "spec/inputs/test/slicing_spec.yue", | ||
| 83 | "spec/inputs/test/close_attribute_spec.yue", | ||
| 84 | "spec/inputs/test/named_varargs_spec.yue", | ||
| 50 | "spec/inputs/test/table_spreading_spec.yue", | 85 | "spec/inputs/test/table_spreading_spec.yue", |
| 86 | "spec/inputs/test/macro_spec.yue", | ||
| 87 | "spec/inputs/test/chaining_comparison_spec.yue", | ||
| 88 | "spec/inputs/test/table_append_spec.yue", | ||
| 89 | "spec/inputs/test/destructure_spec.yue", | ||
| 90 | "spec/inputs/test/vararg_spec.yue", | ||
| 91 | "spec/inputs/test/string_spec.yue", | ||
| 92 | "spec/inputs/test/implicit_object_spec.yue", | ||
| 93 | "spec/inputs/test/backcall_spec.yue", | ||
| 94 | "spec/inputs/test/while_assignment_spec.yue", | ||
| 95 | "spec/inputs/test/switch_spec.yue", | ||
| 96 | "spec/inputs/test/functions_advanced_spec.yue", | ||
| 97 | "spec/inputs/test/config_spec.yue", | ||
| 98 | "spec/inputs/test/yaml_string_spec.yue", | ||
| 99 | "spec/inputs/test/const_attribute_spec.yue", | ||
| 100 | "spec/inputs/test/cond_spec.yue", | ||
| 101 | "spec/inputs/test/import_spec.yue", | ||
| 102 | "spec/inputs/test/reverse_index_spec.yue", | ||
| 103 | "spec/inputs/test/prefixed_return_spec.yue", | ||
| 104 | "spec/inputs/test/goto_spec.yue", | ||
| 105 | "spec/inputs/test/return_spec.yue", | ||
| 51 | "spec/inputs/test/loops_spec.yue", | 106 | "spec/inputs/test/loops_spec.yue", |
| 52 | "spec/inputs/test/format_spec.yue", | 107 | "spec/inputs/test/if_assignment_spec.yue", |
| 53 | "spec/inputs/upvalue_func.yue", | 108 | "spec/inputs/test/tables_advanced_spec.yue", |
| 54 | "spec/inputs/import_global.yue", | ||
| 55 | "spec/inputs/unicode/macro_export.yue", | 109 | "spec/inputs/unicode/macro_export.yue", |
| 56 | "spec/inputs/unicode/attrib.yue", | 110 | "spec/inputs/unicode/attrib.yue", |
| 57 | "spec/inputs/unicode/macro.yue", | 111 | "spec/inputs/unicode/macro.yue", |
| @@ -63,6 +117,7 @@ local files = { | |||
| 63 | "spec/inputs/unicode/string.yue", | 117 | "spec/inputs/unicode/string.yue", |
| 64 | "spec/inputs/unicode/local.yue", | 118 | "spec/inputs/unicode/local.yue", |
| 65 | "spec/inputs/unicode/tables.yue", | 119 | "spec/inputs/unicode/tables.yue", |
| 120 | "spec/inputs/unicode/pipe_chain_combo.yue", | ||
| 66 | "spec/inputs/unicode/operators.yue", | 121 | "spec/inputs/unicode/operators.yue", |
| 67 | "spec/inputs/unicode/lists.yue", | 122 | "spec/inputs/unicode/lists.yue", |
| 68 | "spec/inputs/unicode/switch.yue", | 123 | "spec/inputs/unicode/switch.yue", |
| @@ -94,19 +149,7 @@ local files = { | |||
| 94 | "spec/inputs/unicode/metatable.yue", | 149 | "spec/inputs/unicode/metatable.yue", |
| 95 | "spec/inputs/unicode/syntax.yue", | 150 | "spec/inputs/unicode/syntax.yue", |
| 96 | "spec/inputs/unicode/global.yue", | 151 | "spec/inputs/unicode/global.yue", |
| 97 | "spec/inputs/unicode/plus.yue", | 152 | "spec/inputs/unicode/plus.yue" |
| 98 | "spec/inputs/pipe_chain_combo.yue", | ||
| 99 | "spec/inputs/destructure_defaults.yue", | ||
| 100 | "spec/inputs/nil_coalesce_precedence.yue", | ||
| 101 | "spec/inputs/comprehension_nested.yue", | ||
| 102 | "spec/inputs/with_scope_shadow.yue", | ||
| 103 | "spec/inputs/export_mixed.yue", | ||
| 104 | "spec/inputs/unicode/pipe_chain_combo.yue", | ||
| 105 | "spec/inputs/test/destructure_spec.yue", | ||
| 106 | "spec/inputs/test/nil_coalescing_spec.yue", | ||
| 107 | "spec/inputs/test/pipe_spec.yue", | ||
| 108 | "spec/inputs/test/try_catch_spec.yue", | ||
| 109 | "spec/inputs/test/comprehension_spec.yue" | ||
| 110 | } | 153 | } |
| 111 | local yue = require("yue") | 154 | local yue = require("yue") |
| 112 | local rewriteLineCol | 155 | local rewriteLineCol |
diff --git a/src/yuescript/yue_ast.cpp b/src/yuescript/yue_ast.cpp index cfd4cc6..89b8d3f 100644 --- a/src/yuescript/yue_ast.cpp +++ b/src/yuescript/yue_ast.cpp | |||
| @@ -860,7 +860,7 @@ std::string CompForEach_t::to_string(void* ud) const { | |||
| 860 | std::string CompForNum_t::to_string(void* ud) const { | 860 | std::string CompForNum_t::to_string(void* ud) const { |
| 861 | auto line = "for "s + varName->to_string(ud) + " = "s + startValue->to_string(ud) + ", "s + stopValue->to_string(ud); | 861 | auto line = "for "s + varName->to_string(ud) + " = "s + startValue->to_string(ud) + ", "s + stopValue->to_string(ud); |
| 862 | if (stepValue) { | 862 | if (stepValue) { |
| 863 | line += stepValue->to_string(ud); | 863 | line += ", "s + stepValue->to_string(ud); |
| 864 | } | 864 | } |
| 865 | return line; | 865 | return line; |
| 866 | } | 866 | } |
diff --git a/src/yuescript/yue_compiler.cpp b/src/yuescript/yue_compiler.cpp index 835a70a..370cee4 100644 --- a/src/yuescript/yue_compiler.cpp +++ b/src/yuescript/yue_compiler.cpp | |||
| @@ -78,7 +78,7 @@ static std::unordered_set<std::string> Metamethods = { | |||
| 78 | "close"s // Lua 5.4 | 78 | "close"s // Lua 5.4 |
| 79 | }; | 79 | }; |
| 80 | 80 | ||
| 81 | const std::string_view version = "0.32.6"sv; | 81 | const std::string_view version = "0.32.7"sv; |
| 82 | const std::string_view extension = "yue"sv; | 82 | const std::string_view extension = "yue"sv; |
| 83 | 83 | ||
| 84 | class CompileError : public std::logic_error { | 84 | class CompileError : public std::logic_error { |
