Skip to content

Commit

Permalink
fix: enable multi-byte char in block comment.
Browse files Browse the repository at this point in the history
  • Loading branch information
ashigeru committed Jul 8, 2024
1 parent 28083c3 commit e951283
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/mizugaki/parser/sql_scanner.ll
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ UTF8_CHAR {ASCII}|{UTF8_2}{U}|{UTF8_3}{U}{U}|{UTF8_4}{U}{U}{U}
auto loc = exit_comment(true);
return parser_type::make_UNCLOSED_BLOCK_COMMENT(loc(0, 2));
}
{UTF8_CHAR} {}
[\x00-\xff] {}
}
Expand Down
10 changes: 10 additions & 0 deletions test/mizugaki/parser/sql_parser_misc_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,16 @@ R"(
*/)");
}

TEST_F(sql_parser_misc_test, block_comment_multibyte) {
sql_parser parser;
auto result = parser("-", u8"/* \u3042 */");
ASSERT_TRUE(result) << diagnostics(result);

auto&& unit = **result;
ASSERT_EQ(unit.comments().size(), 1);
EXPECT_EQ(comment(unit, 0), u8"/* \u3042 */");
}

TEST_F(sql_parser_misc_test, block_comment_unclosed) {
sql_parser parser;
auto result = parser("-", "; /* unexpected EOF");
Expand Down

0 comments on commit e951283

Please sign in to comment.