Skip to content

Commit

Permalink
make format happy
Browse files Browse the repository at this point in the history
  • Loading branch information
xffxff committed Sep 19, 2023
1 parent b8ab446 commit 83dddba
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 14 deletions.
4 changes: 2 additions & 2 deletions components/lox-compile/src/compile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ fn compile_expr(db: &dyn crate::Db, expr: &syntax::Expr, chunk: &mut Chunk) {
let word_str = word.as_str(db);
let value = word_str.to_string();
chunk.emit_byte(Code::String(value))
},
}
syntax::Expr::BooleanLiteral(value) => {
if *value {
chunk.emit_byte(Code::True)
Expand Down Expand Up @@ -58,7 +58,7 @@ fn compile_expr(db: &dyn crate::Db, expr: &syntax::Expr, chunk: &mut Chunk) {
syntax::Op::Bang => chunk.emit_byte(Code::Not),
_ => todo!(),
}
},
}
syntax::Expr::Parenthesized(_) => todo!(),
}
}
18 changes: 9 additions & 9 deletions components/lox-execute/src/vm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -173,44 +173,44 @@ impl VM {
bytecode::Code::Negate => {
let a = self.pop();
self.push(-a);
},
}
bytecode::Code::Not => {
let a = self.pop();
self.push(!a);
},
}
bytecode::Code::Equal => {
let b = self.pop();
let a = self.pop();
self.push(a == b);
},
}
bytecode::Code::NotEqual => {
let b = self.pop();
let a = self.pop();
self.push(a != b);
},
}
bytecode::Code::Greater => {
let b = self.pop();
let a = self.pop();
self.push(a > b);
},
}
bytecode::Code::GreaterEqual => {
let b = self.pop();
let a = self.pop();
self.push(a >= b);
},
}
bytecode::Code::Less => {
let b = self.pop();
let a = self.pop();
self.push(a < b);
},
}
bytecode::Code::LessEqual => {
let b = self.pop();
let a = self.pop();
self.push(a <= b);
},
}
bytecode::Code::String(s) => {
self.push(s);
},
}
}
if let Some(step_inspect) = &mut step_inspect {
step_inspect(instruction, self);
Expand Down
2 changes: 1 addition & 1 deletion components/lox-ir/src/token_tree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ pub struct TokenTree {
// expected `Vec<Token>`, found `&Vec<Token>`
#[return_ref]
pub tokens: Vec<Token>,
}
}
5 changes: 3 additions & 2 deletions components/lox-parse/src/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use lox_ir::{
};

use crate::{
token_test::{AnyTree, Number, TokenTest, StringLiteral},
token_test::{AnyTree, Number, StringLiteral, TokenTest},
tokens::Tokens,
};

Expand All @@ -36,7 +36,8 @@ impl<'me> Parser<'me> {
}
if self.tokens.peek().is_some() {
let span = self.tokens.peek_span();
self.error(span, "extra tokens after expression").emit(self.db);
self.error(span, "extra tokens after expression")
.emit(self.db);
}
exprs
}
Expand Down

0 comments on commit 83dddba

Please sign in to comment.