rustfmt
This commit is contained in:
parent
e8ee76f7dc
commit
776e6444e6
@ -286,14 +286,22 @@ impl Value {
|
||||
}
|
||||
}
|
||||
}
|
||||
q @ TokenKind::Symbol(Symbol::DoubleQuote) |
|
||||
q @ TokenKind::Symbol(Symbol::SingleQuote) => {
|
||||
q @ TokenKind::Symbol(Symbol::DoubleQuote)
|
||||
| q @ TokenKind::Symbol(Symbol::SingleQuote) => {
|
||||
let mut s = String::new();
|
||||
let mut is_escaped = false;
|
||||
while let Some(tok) = toks.next() {
|
||||
match tok.kind {
|
||||
TokenKind::Symbol(Symbol::DoubleQuote) if !is_escaped && q == TokenKind::Symbol(Symbol::DoubleQuote) => break,
|
||||
TokenKind::Symbol(Symbol::SingleQuote) if !is_escaped && q == TokenKind::Symbol(Symbol::SingleQuote) => break,
|
||||
TokenKind::Symbol(Symbol::DoubleQuote)
|
||||
if !is_escaped && q == TokenKind::Symbol(Symbol::DoubleQuote) =>
|
||||
{
|
||||
break
|
||||
}
|
||||
TokenKind::Symbol(Symbol::SingleQuote)
|
||||
if !is_escaped && q == TokenKind::Symbol(Symbol::SingleQuote) =>
|
||||
{
|
||||
break
|
||||
}
|
||||
TokenKind::Symbol(Symbol::BackSlash) if !is_escaped => is_escaped = true,
|
||||
TokenKind::Symbol(Symbol::BackSlash) => s.push('\\'),
|
||||
TokenKind::Interpolation => {
|
||||
@ -315,7 +323,7 @@ impl Value {
|
||||
let quotes = match q {
|
||||
TokenKind::Symbol(Symbol::DoubleQuote) => QuoteKind::Double,
|
||||
TokenKind::Symbol(Symbol::SingleQuote) => QuoteKind::Single,
|
||||
_ => unreachable!()
|
||||
_ => unreachable!(),
|
||||
};
|
||||
Ok(Value::Ident(s, quotes))
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user