Skip to content

Commit 751c4f0

Browse files
committed
Fix #322
1 parent 9057218 commit 751c4f0

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

peglib.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -3447,7 +3447,7 @@ class ParserGenerator {
34473447
cho(seq(g["Char"], chr('-'), npd(chr(']')), g["Char"]), g["Char"]);
34483448

34493449
g["Char"] <=
3450-
cho(seq(chr('\\'), cls("fnrtv'\"[]\\^")),
3450+
cho(seq(chr('\\'), cls("fnrtv'\"[]\\^-")),
34513451
seq(chr('\\'), cls("0-3"), cls("0-7"), cls("0-7")),
34523452
seq(chr('\\'), cls("0-7"), opt(cls("0-7"))),
34533453
seq(lit("\\x"), cls("0-9a-fA-F"), opt(cls("0-9a-fA-F"))),

test/test3.cc

+2
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,8 @@ TEST(PEGTest, PEG_Class) {
156156
EXPECT_TRUE(ParserGenerator::parse_test("Class", "[-+]"));
157157
EXPECT_TRUE(ParserGenerator::parse_test("Class", "[+-]"));
158158
EXPECT_TRUE(ParserGenerator::parse_test("Class", "[\\^]"));
159+
EXPECT_TRUE(ParserGenerator::parse_test("Class", "[-]"));
160+
EXPECT_TRUE(ParserGenerator::parse_test("Class", "[\\-]"));
159161
}
160162

161163
TEST(PEGTest, PEG_Negated_Class) {

0 commit comments

Comments
 (0)