diff options
-rw-r--r-- | src/tokens.rs | 10 | ||||
-rw-r--r-- | test-suite/tests/valid.rs | 6 | ||||
-rw-r--r-- | test-suite/tests/valid/string-delim-end.json | 14 | ||||
-rw-r--r-- | test-suite/tests/valid/string-delim-end.toml | 3 |
4 files changed, 32 insertions, 1 deletions
diff --git a/src/tokens.rs b/src/tokens.rs index 49265fb..fd8b6b9 100644 --- a/src/tokens.rs +++ b/src/tokens.rs @@ -334,7 +334,7 @@ impl<'a> Tokenizer<'a> { return Err(Error::NewlineInString(i)); } } - Some((i, ch)) if ch == delim => { + Some((mut i, ch)) if ch == delim => { if multiline { if !self.eatc(delim) { val.push(delim); @@ -345,6 +345,14 @@ impl<'a> Tokenizer<'a> { val.push(delim); continue 'outer; } + if self.eatc(delim) { + val.push(delim); + i += 1; + } + if self.eatc(delim) { + val.push(delim); + i += 1; + } } return Ok(String { src: &self.input[start..self.current()], diff --git a/test-suite/tests/valid.rs b/test-suite/tests/valid.rs index 0bb7caa..0745cc8 100644 --- a/test-suite/tests/valid.rs +++ b/test-suite/tests/valid.rs @@ -389,3 +389,9 @@ test!( include_str!("valid/float-exponent.toml"), include_str!("valid/float-exponent.json") ); + +test!( + string_delim_end, + include_str!("valid/string-delim-end.toml"), + include_str!("valid/string-delim-end.json") +); diff --git a/test-suite/tests/valid/string-delim-end.json b/test-suite/tests/valid/string-delim-end.json new file mode 100644 index 0000000..69b5a0a --- /dev/null +++ b/test-suite/tests/valid/string-delim-end.json @@ -0,0 +1,14 @@ +{ + "str1": { + "type": "string", + "value": "\"This,\" she said, \"is just a pointless statement.\"" + }, + "str2": { + "type": "string", + "value": "foo''bar''" + }, + "str3": { + "type": "string", + "value": "\"\"" + } +}
\ No newline at end of file diff --git a/test-suite/tests/valid/string-delim-end.toml b/test-suite/tests/valid/string-delim-end.toml new file mode 100644 index 0000000..9a41219 --- /dev/null +++ b/test-suite/tests/valid/string-delim-end.toml @@ -0,0 +1,3 @@ +str1 = """"This," she said, "is just a pointless statement."""" +str2 = '''foo''bar''''' +str3 = """""""" |