aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2018-10-29 09:47:56 -0700
committerGitHub <noreply@github.com>2018-10-29 09:47:56 -0700
commit2a6d85b0dde5772241a2cf7e0ac8427949bc4112 (patch)
tree651c289273b112378ea0d63b84ee0324a9b200b9 /src
parent2fbcf8623acda16ae633dbec41cad28f3bbf9ab4 (diff)
parent94c95bd15e63520fc2844ffb1bc387d1bc9c79ae (diff)
downloadmilf-rs-2a6d85b0dde5772241a2cf7e0ac8427949bc4112.tar.gz
milf-rs-2a6d85b0dde5772241a2cf7e0ac8427949bc4112.zip
Merge pull request #268 from jmhain/allow-ws-after-bs
Allow whitespace after line ending backslash (#162)
Diffstat (limited to 'src')
-rw-r--r--src/tokens.rs19
1 files changed, 18 insertions, 1 deletions
diff --git a/src/tokens.rs b/src/tokens.rs
index 15c3b41..382c1ec 100644
--- a/src/tokens.rs
+++ b/src/tokens.rs
@@ -364,7 +364,24 @@ impl<'a> Tokenizer<'a> {
let len = if c == 'u' {4} else {8};
val.push(me.hex(start, i, len)?);
}
- Some((_, '\n')) if multi => {
+ Some((i, c @ ' ')) |
+ Some((i, c @ '\t')) |
+ Some((i, c @ '\n')) if multi => {
+ if c != '\n' {
+ while let Some((_, ch)) = me.chars.clone().next() {
+ match ch {
+ ' ' | '\t' => {
+ me.chars.next();
+ continue
+ },
+ '\n' => {
+ me.chars.next();
+ break
+ },
+ _ => return Err(Error::InvalidEscape(i, c)),
+ }
+ }
+ }
while let Some((_, ch)) = me.chars.clone().next() {
match ch {
' ' | '\t' | '\n' => {