Skip to content

Commit

Permalink
fix: enable multi-byte char in line comment.
Browse files Browse the repository at this point in the history
  • Loading branch information
ashigeru committed Jul 8, 2024
1 parent e951283 commit 37c6132
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 @@ -115,6 +115,7 @@ UTF8_CHAR {ASCII}|{UTF8_2}{U}|{UTF8_3}{U}{U}|{UTF8_4}{U}{U}{U}
driver.add_comment(exit_comment(true));
return parser_type::make_END_OF_FILE(location(true));
}
{UTF8_CHAR} {}
. {}
}
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 @@ -76,6 +76,16 @@ TEST_F(sql_parser_misc_test, simple_comment_crlf) {
EXPECT_EQ(comment(unit, 1), "--b");
}

TEST_F(sql_parser_misc_test, simple_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) {
sql_parser parser;
auto result = parser("-",
Expand Down

0 comments on commit 37c6132

Please sign in to comment.