Skip to content

Commit f5b3fb2

Browse files
authored
add DEL character example invalid_parses in examples/error_printer (#260)
1 parent 4295f90 commit f5b3fb2

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

examples/error_printer.cpp

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ namespace
1717
"########## comments and whitespace"sv,
1818
"# bar\rkek"sv,
1919
"# bar\bkek"sv,
20+
"# DEL character: '\x7f'"sv,
2021
"# \xf1\x63"sv,
2122
"# val1 = 1\fval2 = 2"sv,
2223
"foo = 1\n\u2000\nbar = 2"sv,
@@ -115,11 +116,19 @@ namespace
115116
}
116117
else
117118
{
118-
if (c == '\\')
119+
if (c == '\x7F')
119120
{
120-
std::cout << '\\';
121+
// DEL character.
122+
std::cout << "\\u007F"sv;
123+
}
124+
else
125+
{
126+
if (c == '\\')
127+
{
128+
std::cout << '\\';
129+
}
130+
std::cout << c;
121131
}
122-
std::cout << c;
123132
}
124133
}
125134
}

0 commit comments

Comments
 (0)