Add support for escaped whitespace characters

master
Sven Slootweg 7 years ago
parent 85e1740708
commit b660ff511c

@ -26,9 +26,21 @@ string
= '"' chars:stringCharacter* '"' { return chars.join(""); }
stringCharacter
= !('"' / "\\") char:. { return char; } // Prefer a non-backslash character...
/ stringEscapedQuote { return '"'; } // ... then an escaped quotation mark...
/ !('"') char:. { return char; } // ... and finally any other character that doesn't terminate the string.
= !('"' / "\\") char:. { return char; } // Prefer a non-backslash character...
/ stringEscapedQuote { return '"'; } // ... then an escaped quotation mark...
/ stringEscapedNewline{ return "\n"; } // ... then various escaped whitespace characters...
/ stringEscapedCarriageReturn{ return "\r"; }
/ stringEscapedTab{ return "\t"; }
/ !('"') char:. { return char; } // ... and finally any other character that doesn't terminate the string.
stringEscapedQuote
= '\\"'
stringEscapedNewline
= '\\n'
stringEscapedCarriageReturn
= '\\r'
stringEscapedTab
= '\\t'

Loading…
Cancel
Save