Skip to content

Commit

Permalink
Merge pull request #27 from dolik-rce/backslash-escape
Browse files Browse the repository at this point in the history
Support escaped backslash
  • Loading branch information
arithy committed Apr 2, 2021
2 parents f40f083 + 51aee69 commit aaddff5
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/packcc.c
Original file line number Diff line number Diff line change
Expand Up @@ -591,6 +591,7 @@ static bool_t unescape_string(char *str) {
i++;
switch (str[i]) {
case '\0': str[j++] = '\\'; str[j] = '\0'; return FALSE;
case '\\': str[j++] = '\\'; break;
case '0': str[j++] = '\x00'; break;
case 'a': str[j++] = '\x07'; break;
case 'b': str[j++] = '\x08'; break;
Expand Down
2 changes: 1 addition & 1 deletion tests/strings.d/expected-escapes.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
 =€
\ =€
2 changes: 1 addition & 1 deletion tests/strings.d/input-escapes.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
 =€
\ =€
2 changes: 1 addition & 1 deletion tests/strings.d/input.peg
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ TOKEN <- (HELLO / WORLD / SMILEY / ESCAPES) { PRINT($0); }
HELLO <- "Hello"
WORLD <- 'world'
SMILEY <- "😊"
ESCAPES <- '\a\b\f\t\v\x3d\u20AC\r\n'
ESCAPES <- '\\\a\b\f\t\v\x3d\u20AC\r\n'
_ <- ' ' / '\n'

0 comments on commit aaddff5

Please sign in to comment.