This commit is contained in:
yhirose 2016-10-27 20:28:03 -04:00
parent 5e67fcb329
commit 21934dd1ce
2 changed files with 9 additions and 9 deletions

View File

@ -1787,7 +1787,7 @@ private:
seq(npd(chr('\\')), dot())); seq(npd(chr('\\')), dot()));
#if !defined(PEGLIB_NO_UNICODE_CHARS) #if !defined(PEGLIB_NO_UNICODE_CHARS)
g["LEFTARROW"] <= seq(cho(lit("<-"), lit("")), g["Spacing"]); g["LEFTARROW"] <= seq(cho(lit("<-"), lit(u8"")), g["Spacing"]);
#else #else
g["LEFTARROW"] <= seq(lit("<-"), g["Spacing"]); g["LEFTARROW"] <= seq(lit("<-"), g["Spacing"]);
#endif #endif

View File

@ -1,4 +1,4 @@

#define CATCH_CONFIG_MAIN #define CATCH_CONFIG_MAIN
#include "catch.hpp" #include "catch.hpp"
@ -9,7 +9,7 @@
TEST_CASE("Simple syntax test (with unicode)", "[general]") TEST_CASE("Simple syntax test (with unicode)", "[general]")
{ {
peg::parser parser( peg::parser parser(
" ROOT ← _ " u8" ROOT ← _ "
" _ <- ' ' " " _ <- ' ' "
); );
@ -809,7 +809,7 @@ TEST_CASE("Semantic predicate test", "[predicate]")
TEST_CASE("Japanese character", "[unicode]") TEST_CASE("Japanese character", "[unicode]")
{ {
peg::parser parser(R"( peg::parser parser(u8R"(
<- ? '' <- ? ''
<- <-
<- <-
@ -820,7 +820,7 @@ TEST_CASE("Japanese character", "[unicode]")
<- '' / '' / '' / '' / '' <- '' / '' / '' / '' / ''
)"); )");
auto ret = parser.parse(R"(サーバーを復旧します。)"); auto ret = parser.parse(u8R"(サーバーを復旧します。)");
REQUIRE(ret == true); REQUIRE(ret == true);
} }
@ -846,7 +846,7 @@ TEST_CASE("PEG Definition", "[peg]")
auto g = ParserGenerator::grammar(); auto g = ParserGenerator::grammar();
REQUIRE(exact(g, "Definition", "Definition <- a / (b c) / d ") == true); REQUIRE(exact(g, "Definition", "Definition <- a / (b c) / d ") == true);
REQUIRE(exact(g, "Definition", "Definition <- a / b c / d ") == true); REQUIRE(exact(g, "Definition", "Definition <- a / b c / d ") == true);
REQUIRE(exact(g, "Definition", "Definitiond ← a ") == true); REQUIRE(exact(g, "Definition", u8"Definitiond ← a ") == true);
REQUIRE(exact(g, "Definition", "Definition ") == false); REQUIRE(exact(g, "Definition", "Definition ") == false);
REQUIRE(exact(g, "Definition", " ") == false); REQUIRE(exact(g, "Definition", " ") == false);
REQUIRE(exact(g, "Definition", "") == false); REQUIRE(exact(g, "Definition", "") == false);
@ -962,7 +962,7 @@ TEST_CASE("PEG Literal", "[peg]")
REQUIRE(exact(g, "Literal", "\"'\"abc\"'\" ") == false); REQUIRE(exact(g, "Literal", "\"'\"abc\"'\" ") == false);
REQUIRE(exact(g, "Literal", "abc") == false); REQUIRE(exact(g, "Literal", "abc") == false);
REQUIRE(exact(g, "Literal", "") == false); REQUIRE(exact(g, "Literal", "") == false);
REQUIRE(exact(g, "Literal", "日本語") == false); REQUIRE(exact(g, "Literal", u8"日本語") == false);
} }
TEST_CASE("PEG Class", "[peg]") TEST_CASE("PEG Class", "[peg]")
@ -980,7 +980,7 @@ TEST_CASE("PEG Class", "[peg]")
REQUIRE(exact(g, "Class", "[a") == false); REQUIRE(exact(g, "Class", "[a") == false);
REQUIRE(exact(g, "Class", "]") == false); REQUIRE(exact(g, "Class", "]") == false);
REQUIRE(exact(g, "Class", "a]") == false); REQUIRE(exact(g, "Class", "a]") == false);
REQUIRE(exact(g, "Class", "あ-ん") == false); REQUIRE(exact(g, "Class", u8"あ-ん") == false);
REQUIRE(exact(g, "Class", "[-+]") == true); REQUIRE(exact(g, "Class", "[-+]") == true);
REQUIRE(exact(g, "Class", "[+-]") == false); REQUIRE(exact(g, "Class", "[+-]") == false);
} }
@ -1026,7 +1026,7 @@ TEST_CASE("PEG Char", "[peg]")
REQUIRE(exact(g, "Char", " ") == true); REQUIRE(exact(g, "Char", " ") == true);
REQUIRE(exact(g, "Char", " ") == false); REQUIRE(exact(g, "Char", " ") == false);
REQUIRE(exact(g, "Char", "") == false); REQUIRE(exact(g, "Char", "") == false);
REQUIRE(exact(g, "Char", "") == false); REQUIRE(exact(g, "Char", u8"") == false);
} }
TEST_CASE("PEG Operators", "[peg]") TEST_CASE("PEG Operators", "[peg]")