diff options
author | Alex Crichton <alex@alexcrichton.com> | 2018-10-29 09:47:56 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-10-29 09:47:56 -0700 |
commit | 2a6d85b0dde5772241a2cf7e0ac8427949bc4112 (patch) | |
tree | 651c289273b112378ea0d63b84ee0324a9b200b9 /src | |
parent | 2fbcf8623acda16ae633dbec41cad28f3bbf9ab4 (diff) | |
parent | 94c95bd15e63520fc2844ffb1bc387d1bc9c79ae (diff) | |
download | milf-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.rs | 19 |
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' => { |