diff options
author | Li Jin <dragon-fly@qq.com> | 2021-05-02 00:15:33 +0800 |
---|---|---|
committer | Li Jin <dragon-fly@qq.com> | 2021-05-02 00:15:33 +0800 |
commit | c46703c3d7c756608ca050143703483368ebf466 (patch) | |
tree | a0a6620f75b43b89936f6a88c096350e800bc792 | |
parent | 7b11ae6e9a5b71db627ae5eb497d2b5855a66db0 (diff) | |
download | yuescript-c46703c3d7c756608ca050143703483368ebf466.tar.gz yuescript-c46703c3d7c756608ca050143703483368ebf466.tar.bz2 yuescript-c46703c3d7c756608ca050143703483368ebf466.zip |
fix issue #51 by aliasing symbol :: as colon chain item.
-rw-r--r-- | src/yuescript/yue_compiler.cpp | 2 | ||||
-rw-r--r-- | src/yuescript/yue_parser.cpp | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/src/yuescript/yue_compiler.cpp b/src/yuescript/yue_compiler.cpp index 7cd39af..78fb5e2 100644 --- a/src/yuescript/yue_compiler.cpp +++ b/src/yuescript/yue_compiler.cpp | |||
@@ -59,7 +59,7 @@ inline std::string s(std::string_view sv) { | |||
59 | return std::string(sv); | 59 | return std::string(sv); |
60 | } | 60 | } |
61 | 61 | ||
62 | const std::string_view version = "0.7.11"sv; | 62 | const std::string_view version = "0.7.12"sv; |
63 | const std::string_view extension = "yue"sv; | 63 | const std::string_view extension = "yue"sv; |
64 | 64 | ||
65 | class YueCompilerImpl { | 65 | class YueCompilerImpl { |
diff --git a/src/yuescript/yue_parser.cpp b/src/yuescript/yue_parser.cpp index 185d54b..607edc9 100644 --- a/src/yuescript/yue_parser.cpp +++ b/src/yuescript/yue_parser.cpp | |||
@@ -444,7 +444,7 @@ YueParser::YueParser() { | |||
444 | Index = symx('[') >> Exp >> sym(']'); | 444 | Index = symx('[') >> Exp >> sym(']'); |
445 | ChainItem = Invoke >> -existential_op | DotChainItem >> -existential_op | Slice | Index >> -existential_op; | 445 | ChainItem = Invoke >> -existential_op | DotChainItem >> -existential_op | Slice | Index >> -existential_op; |
446 | DotChainItem = symx('.') >> (Name >> not_('#') | Metatable | Metamethod); | 446 | DotChainItem = symx('.') >> (Name >> not_('#') | Metatable | Metamethod); |
447 | ColonChainItem = symx('\\') >> ((LuaKeyword | Name) >> not_('#') | Metamethod); | 447 | ColonChainItem = (expr('\\') | expr("::")) >> ((LuaKeyword | Name) >> not_('#') | Metamethod); |
448 | invoke_chain = Invoke >> -existential_op >> -ChainItems; | 448 | invoke_chain = Invoke >> -existential_op >> -ChainItems; |
449 | ColonChain = ColonChainItem >> -existential_op >> -invoke_chain; | 449 | ColonChain = ColonChainItem >> -existential_op >> -invoke_chain; |
450 | 450 | ||
@@ -534,7 +534,7 @@ YueParser::YueParser() { | |||
534 | Space >> SingleString | | 534 | Space >> SingleString | |
535 | Space >> LuaString | 535 | Space >> LuaString |
536 | ) >> | 536 | ) >> |
537 | symx(':') >> | 537 | symx(':') >> not_(':') >> |
538 | (Exp | TableBlock | +(SpaceBreak) >> Exp); | 538 | (Exp | TableBlock | +(SpaceBreak) >> Exp); |
539 | 539 | ||
540 | meta_variable_pair = sym(':') >> Variable >> expr('#'); | 540 | meta_variable_pair = sym(':') >> Variable >> expr('#'); |