diff options
author | pyfisch <pyfisch@posteo.org> | 2020-05-28 17:39:55 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-28 10:39:55 -0500 |
commit | 940fcf9e183ab4f29204ef4f3ea92c01de8cc08a (patch) | |
tree | 7de5106a89888fe0c3dbe7220012e4d56de3bbee /src | |
parent | 7a43ac9e9c28afec8414f6d924024f5d33fe8fa2 (diff) | |
download | milf-rs-940fcf9e183ab4f29204ef4f3ea92c01de8cc08a.tar.gz milf-rs-940fcf9e183ab4f29204ef4f3ea92c01de8cc08a.zip |
Allow delimiter quotes at the end of multiline strings (#393)
TOML allows (unlike many other formats) up to 2
additonal quotes that are part of the string:
basic = """2 extra quotes -->"""""
literal = '''here too ''''
Changed in TOML v1.0.0-rc.1
See also #392
Diffstat (limited to 'src')
-rw-r--r-- | src/tokens.rs | 10 |
1 files changed, 9 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()], |