Refactor
This commit is contained in:
parent
b0e1826449
commit
a3c668ae83
@ -639,7 +639,7 @@ pub(crate) fn eat_expr<I: Iterator<Item = Token>>(
|
||||
fn eat_interpolation<I: Iterator<Item = Token>>(toks: &mut Peekable<I>) -> Vec<Token> {
|
||||
let mut vals = Vec::new();
|
||||
let mut n = 0;
|
||||
while let Some(tok) = toks.next() {
|
||||
for tok in toks {
|
||||
match tok.kind {
|
||||
TokenKind::Symbol(Symbol::OpenCurlyBrace) => n += 1,
|
||||
TokenKind::Symbol(Symbol::CloseCurlyBrace) => n -= 1,
|
||||
|
10
src/value.rs
10
src/value.rs
@ -271,9 +271,8 @@ impl Value {
|
||||
TokenKind::Symbol(Symbol::DoubleQuote) => {
|
||||
let mut s = String::new();
|
||||
while let Some(tok) = toks.next() {
|
||||
match tok.kind {
|
||||
TokenKind::Symbol(Symbol::DoubleQuote) => break,
|
||||
_ => {}
|
||||
if tok.kind == TokenKind::Symbol(Symbol::DoubleQuote) {
|
||||
break;
|
||||
}
|
||||
s.push_str(&tok.kind.to_string());
|
||||
}
|
||||
@ -282,9 +281,8 @@ impl Value {
|
||||
TokenKind::Symbol(Symbol::SingleQuote) => {
|
||||
let mut s = String::new();
|
||||
while let Some(tok) = toks.next() {
|
||||
match tok.kind {
|
||||
TokenKind::Symbol(Symbol::SingleQuote) => break,
|
||||
_ => {}
|
||||
if tok.kind == TokenKind::Symbol(Symbol::SingleQuote) {
|
||||
break;
|
||||
}
|
||||
s.push_str(&tok.kind.to_string());
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user