mirror of
https://github.com/tweag/nickel.git
synced 2024-11-10 10:46:49 +03:00
Merge pull request #231 from tweag/fix/hash-in-multiline-strings
[Fix]Mishandling of `#` in mutliline strings
This commit is contained in:
commit
edb90e6fa6
@ -278,7 +278,7 @@ pub enum MultiStringToken<'input> {
|
||||
#[regex("\"#+m")]
|
||||
CandidateEnd(&'input str),
|
||||
// Same as `FalseEnd` and `CandidateEnd` but for an interpolation sequence.
|
||||
#[token("#+")]
|
||||
#[regex("#+")]
|
||||
FalseInterpolation(&'input str),
|
||||
#[regex("#+\\{")]
|
||||
CandidateInterpolation(&'input str),
|
||||
|
@ -281,3 +281,16 @@ fn str_escape() {
|
||||
mk_single_chunk("#a#b#c#{d#"),
|
||||
);
|
||||
}
|
||||
|
||||
/// Regression test for [#230](https://github.com/tweag/nickel/issues/230).
|
||||
#[test]
|
||||
fn multiline_str_escape() {
|
||||
assert_eq!(
|
||||
parse_without_pos(r##"m#"#Hel##lo###"#m"##),
|
||||
mk_single_chunk("#Hel##lo###"),
|
||||
);
|
||||
assert_eq!(
|
||||
parse_without_pos(r##"m#"#Hel##{lo###{"#m"##),
|
||||
mk_single_chunk("#Hel##{lo###{"),
|
||||
);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user