forked from mirrors/jj
templater: ignore all ascii whitespace characters
Per Rust/WhatWG definition. https://doc.rust-lang.org/std/primitive.char.html#method.is_ascii_whitespace
This commit is contained in:
parent
224edd73ee
commit
39d3420694
2 changed files with 12 additions and 1 deletions
|
@ -17,7 +17,7 @@
|
|||
// predecessors % ("predecessor: " ++ commit_id)
|
||||
// parents % (commit_id ++ " is a parent of " ++ super.commit_id)
|
||||
|
||||
whitespace = _{ " " | "\t" | "\n" }
|
||||
whitespace = _{ " " | "\t" | "\r" | "\n" | "\x0c" }
|
||||
|
||||
escape = @{ "\\" ~ ("t" | "r" | "n" | "\"" | "\\") }
|
||||
literal_char = @{ !("\"" | "\\") ~ ANY }
|
||||
|
|
|
@ -1245,6 +1245,17 @@ mod tests {
|
|||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_parse_whitespace() {
|
||||
let ascii_whitespaces: String = ('\x00'..='\x7f')
|
||||
.filter(char::is_ascii_whitespace)
|
||||
.collect();
|
||||
assert_eq!(
|
||||
parse_normalized(&format!("{ascii_whitespaces}f()")).unwrap(),
|
||||
parse_normalized("f()").unwrap(),
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_function_call_syntax() {
|
||||
// Trailing comma isn't allowed for empty argument
|
||||
|
|
Loading…
Reference in a new issue