aboutsummaryrefslogtreecommitdiff
path: root/src/tokens.rs
diff options
context:
space:
mode:
authorJoey Hain <hain.joseph@gmail.com>2018-10-27 12:41:52 -0700
committerJoey Hain <hain.joseph@gmail.com>2018-10-27 12:49:17 -0700
commit94c95bd15e63520fc2844ffb1bc387d1bc9c79ae (patch)
treeab9aae664e155c8a012d09b3b541202735e7ebe3 /src/tokens.rs
parent3aec5a918a6cb39fa32e8a56725a3c2fc0ed6bc2 (diff)
downloadmilf-rs-94c95bd15e63520fc2844ffb1bc387d1bc9c79ae.tar.gz
milf-rs-94c95bd15e63520fc2844ffb1bc387d1bc9c79ae.zip
Allow whitespace after line ending backslash (#162)
Diffstat (limited to 'src/tokens.rs')
-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' => {