added booleans, variable updates and function execution

This commit is contained in:
afonya2 2025-05-23 20:26:39 +02:00
parent 28c440539d
commit b074f18648
Signed by: afonya
GPG key ID: EBB9C4CAFAAFB2DC
4 changed files with 51 additions and 3 deletions

View file

@ -124,7 +124,7 @@ fn read_identifier(splitted: &Vec<&str>, pos: &mut usize, out: &mut Vec<Token>)
identifier += char;
}
//Lets break it up to tokens
let words: Vec<&str> = identifier.split(" ").collect();
let words: Vec<&str> = identifier.trim().split(" ").collect();
let mut state: Vec<&str> = vec![];
let mut state_pos: usize = 0;
let mut i = 0;
@ -159,7 +159,9 @@ fn read_identifier(splitted: &Vec<&str>, pos: &mut usize, out: &mut Vec<Token>)
}
i += 1;
}
pre_out.push(Token { typ: TokenType::IDENTIFIER, value: state.join(" "), pos: state_pos });
if state_pos > 0 {
pre_out.push(Token { typ: TokenType::IDENTIFIER, value: state.join(" "), pos: state_pos });
}
//Check for invalid keywords!
for token in &mut pre_out {
if token.typ == TokenType::KEYWORD {