Fix integer reading
This commit is contained in:
parent
b51ace40df
commit
ec48ff8852
4 changed files with 6 additions and 4 deletions
|
@ -78,7 +78,6 @@ impl LispState {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn execute(&self, instructions: Vec<OpCode>) {
|
pub fn execute(&self, instructions: Vec<OpCode>) {
|
||||||
println!("{:?}", instructions);
|
|
||||||
for op in instructions {
|
for op in instructions {
|
||||||
match op {
|
match op {
|
||||||
OpCode::Call(func, args) => {
|
OpCode::Call(func, args) => {
|
||||||
|
|
|
@ -17,6 +17,7 @@ fn main() {
|
||||||
Vec::new()
|
Vec::new()
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
println!("{:?}", tokens);
|
||||||
let instructions = parse(tokens);
|
let instructions = parse(tokens);
|
||||||
|
|
||||||
let state = LispState::new();
|
let state = LispState::new();
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
; This is a comment
|
; This is a comment
|
||||||
|
|
||||||
(print "Hello, World")
|
(print (add 1333 12423))
|
||||||
|
|
||||||
(print (add 1 2))
|
|
|
@ -92,6 +92,7 @@ impl Tokenizer {
|
||||||
|
|
||||||
tokens.push(Token::Identifier(self.storage.iter().collect()));
|
tokens.push(Token::Identifier(self.storage.iter().collect()));
|
||||||
self.storage.clear();
|
self.storage.clear();
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
self.storage.push(char);
|
self.storage.push(char);
|
||||||
|
@ -105,6 +106,9 @@ impl Tokenizer {
|
||||||
|
|
||||||
tokens.push(Token::Integer(self.storage.iter().collect::<String>().parse().unwrap()));
|
tokens.push(Token::Integer(self.storage.iter().collect::<String>().parse().unwrap()));
|
||||||
self.storage.clear();
|
self.storage.clear();
|
||||||
|
} else {
|
||||||
|
self.storage.push(char);
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Reference in a new issue