Skip to content

Commit 21934dd

Browse files
committed
Fixed yhirose#22.
1 parent 5e67fcb commit 21934dd

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

peglib.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1787,7 +1787,7 @@ class ParserGenerator
17871787
seq(npd(chr('\\')), dot()));
17881788

17891789
#if !defined(PEGLIB_NO_UNICODE_CHARS)
1790-
g["LEFTARROW"] <= seq(cho(lit("<-"), lit("")), g["Spacing"]);
1790+
g["LEFTARROW"] <= seq(cho(lit("<-"), lit(u8"")), g["Spacing"]);
17911791
#else
17921792
g["LEFTARROW"] <= seq(lit("<-"), g["Spacing"]);
17931793
#endif

test/test.cc

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
1+
22
#define CATCH_CONFIG_MAIN
33
#include "catch.hpp"
44

@@ -9,7 +9,7 @@
99
TEST_CASE("Simple syntax test (with unicode)", "[general]")
1010
{
1111
peg::parser parser(
12-
" ROOT ← _ "
12+
u8" ROOT ← _ "
1313
" _ <- ' ' "
1414
);
1515

@@ -809,7 +809,7 @@ TEST_CASE("Semantic predicate test", "[predicate]")
809809

810810
TEST_CASE("Japanese character", "[unicode]")
811811
{
812-
peg::parser parser(R"(
812+
peg::parser parser(u8R"(
813813
文 <- 修飾語? 主語 述語 '。'
814814
主語 <- 名詞 助詞
815815
述語 <- 動詞 助詞
@@ -820,7 +820,7 @@ TEST_CASE("Japanese character", "[unicode]")
820820
助詞 <- 'が' / 'を' / 'た' / 'ます' / 'に'
821821
)");
822822

823-
auto ret = parser.parse(R"(サーバーを復旧します。)");
823+
auto ret = parser.parse(u8R"(サーバーを復旧します。)");
824824

825825
REQUIRE(ret == true);
826826
}
@@ -846,7 +846,7 @@ TEST_CASE("PEG Definition", "[peg]")
846846
auto g = ParserGenerator::grammar();
847847
REQUIRE(exact(g, "Definition", "Definition <- a / (b c) / d ") == true);
848848
REQUIRE(exact(g, "Definition", "Definition <- a / b c / d ") == true);
849-
REQUIRE(exact(g, "Definition", "Definitiond ← a ") == true);
849+
REQUIRE(exact(g, "Definition", u8"Definitiond ← a ") == true);
850850
REQUIRE(exact(g, "Definition", "Definition ") == false);
851851
REQUIRE(exact(g, "Definition", " ") == false);
852852
REQUIRE(exact(g, "Definition", "") == false);
@@ -962,7 +962,7 @@ TEST_CASE("PEG Literal", "[peg]")
962962
REQUIRE(exact(g, "Literal", "\"'\"abc\"'\" ") == false);
963963
REQUIRE(exact(g, "Literal", "abc") == false);
964964
REQUIRE(exact(g, "Literal", "") == false);
965-
REQUIRE(exact(g, "Literal", "日本語") == false);
965+
REQUIRE(exact(g, "Literal", u8"日本語") == false);
966966
}
967967

968968
TEST_CASE("PEG Class", "[peg]")
@@ -980,7 +980,7 @@ TEST_CASE("PEG Class", "[peg]")
980980
REQUIRE(exact(g, "Class", "[a") == false);
981981
REQUIRE(exact(g, "Class", "]") == false);
982982
REQUIRE(exact(g, "Class", "a]") == false);
983-
REQUIRE(exact(g, "Class", "あ-ん") == false);
983+
REQUIRE(exact(g, "Class", u8"あ-ん") == false);
984984
REQUIRE(exact(g, "Class", "[-+]") == true);
985985
REQUIRE(exact(g, "Class", "[+-]") == false);
986986
}
@@ -1026,7 +1026,7 @@ TEST_CASE("PEG Char", "[peg]")
10261026
REQUIRE(exact(g, "Char", " ") == true);
10271027
REQUIRE(exact(g, "Char", " ") == false);
10281028
REQUIRE(exact(g, "Char", "") == false);
1029-
REQUIRE(exact(g, "Char", "") == false);
1029+
REQUIRE(exact(g, "Char", u8"") == false);
10301030
}
10311031

10321032
TEST_CASE("PEG Operators", "[peg]")

0 commit comments

Comments
 (0)