From c46703c3d7c756608ca050143703483368ebf466 Mon Sep 17 00:00:00 2001 From: Li Jin Date: Sun, 2 May 2021 00:15:33 +0800 Subject: fix issue #51 by aliasing symbol :: as colon chain item. --- src/yuescript/yue_compiler.cpp | 2 +- src/yuescript/yue_parser.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'src') 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) { return std::string(sv); } -const std::string_view version = "0.7.11"sv; +const std::string_view version = "0.7.12"sv; const std::string_view extension = "yue"sv; 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() { Index = symx('[') >> Exp >> sym(']'); ChainItem = Invoke >> -existential_op | DotChainItem >> -existential_op | Slice | Index >> -existential_op; DotChainItem = symx('.') >> (Name >> not_('#') | Metatable | Metamethod); - ColonChainItem = symx('\\') >> ((LuaKeyword | Name) >> not_('#') | Metamethod); + ColonChainItem = (expr('\\') | expr("::")) >> ((LuaKeyword | Name) >> not_('#') | Metamethod); invoke_chain = Invoke >> -existential_op >> -ChainItems; ColonChain = ColonChainItem >> -existential_op >> -invoke_chain; @@ -534,7 +534,7 @@ YueParser::YueParser() { Space >> SingleString | Space >> LuaString ) >> - symx(':') >> + symx(':') >> not_(':') >> (Exp | TableBlock | +(SpaceBreak) >> Exp); meta_variable_pair = sym(':') >> Variable >> expr('#'); -- cgit v1.2.3-55-g6feb