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(""); } = '"' chars:stringCharacter* '"' { return chars.join(""); }
stringCharacter stringCharacter
= !('"' / "\\") char:. { return char; } // Prefer a non-backslash character... = !('"' / "\\") char:. { return char; } // Prefer a non-backslash character...
/ stringEscapedQuote { return '"'; } // ... then an escaped quotation mark... / stringEscapedQuote { return '"'; } // ... then an escaped quotation mark...
/ !('"') char:. { return char; } // ... and finally any other character that doesn't terminate the string. / 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 stringEscapedQuote
= '\\"' = '\\"'
stringEscapedNewline
= '\\n'
stringEscapedCarriageReturn
= '\\r'
stringEscapedTab
= '\\t'

Loading…
Cancel
Save