Skip to content

Commit

Permalink
fix cpp utf8 literals issue.
Browse files Browse the repository at this point in the history
  • Loading branch information
pigpigyyy committed Oct 18, 2023
1 parent 267fbb2 commit d947516
Show file tree
Hide file tree
Showing 4 changed files with 80 additions and 76 deletions.
2 changes: 1 addition & 1 deletion Source/3rdParty/yuescript/yue_compiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ static std::unordered_set<std::string> Metamethods = {
"close"s // Lua 5.4
};

const std::string_view version = "0.19.5"sv;
const std::string_view version = "0.19.6"sv;
const std::string_view extension = "yue"sv;

class CompileError : public std::logic_error {
Expand Down
4 changes: 3 additions & 1 deletion Source/3rdParty/yuescript/yue_parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,9 @@ YueParser::YueParser() {
import_name = ColonImportName | Variable;
import_name_list = Seperator >> *space_break >> space >> import_name >> *((+space_break | space >> ',' >> *space_break) >> space >> import_name);
ImportFrom = import_name_list >> *space_break >> space >> key("from") >> space >> (ImportLiteral | not_(String) >> Exp);
FromImport = key("from") >> space >> (ImportLiteral | not_(String) >> Exp) >> *space_break >> space >> key("import") >> space >> import_name_list;
from_import_name_list_line = import_name >> *(space >> ',' >> space >> import_name);
from_import_name_in_block = +space_break >> advance_match >> ensure(space >> from_import_name_list_line >> *(-(space >> ',') >> +space_break >> check_indent_match >> space >> from_import_name_list_line), pop_indent);
FromImport = key("from") >> space >> (ImportLiteral | not_(String) >> Exp) >> *space_break >> space >> key("import") >> space >> Seperator >> (from_import_name_list_line >> -(space >> ',') >> -from_import_name_in_block | from_import_name_in_block);

ImportLiteralInner = (range('a', 'z') | range('A', 'Z') | set("_-") | larger(255)) >> *(alpha_num | '-' | larger(255));
import_literal_chain = Seperator >> ImportLiteralInner >> *('.' >> ImportLiteralInner);
Expand Down
2 changes: 2 additions & 0 deletions Source/3rdParty/yuescript/yue_parser.h
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,8 @@ class YueParser {
NONE_AST_RULE(in_block);
NONE_AST_RULE(import_name);
NONE_AST_RULE(import_name_list);
NONE_AST_RULE(from_import_name_list_line);
NONE_AST_RULE(from_import_name_in_block);
NONE_AST_RULE(import_literal_chain);
NONE_AST_RULE(import_tab_item);
NONE_AST_RULE(import_tab_list);
Expand Down
Loading

0 comments on commit d947516

Please sign in to comment.