diff --git a/src/lexer.rs b/src/lexer.rs index a3047be..5c7295b 100644 --- a/src/lexer.rs +++ b/src/lexer.rs @@ -27,7 +27,7 @@ fn is_operator(char: &str) -> bool { return chars.contains(&char); } fn is_sep(char: &str) -> bool { - let chars = vec!["(",")","[","]","{","}",",","."]; + let chars = vec!["(",")","[","]","{","}",",",".","="]; return chars.contains(&char); } @@ -162,6 +162,14 @@ fn read_identifier(splitted: &Vec<&str>, pos: &mut usize, out: &mut Vec) token.typ = TokenType::IDENTIFIER; } } + if token.typ == TokenType::IDENTIFIER { + if token.value.starts_with(" ") { + token.value.remove(0); + } + if token.value.ends_with(" ") { + token.value.remove(token.value.len()-1); + } + } } //Check for identifiers next to each other let mut i = 1; diff --git a/test.as b/test.as index c14683c..858b213 100644 --- a/test.as +++ b/test.as @@ -1,8 +1,2 @@ -szaft"Hello, World! -ugva"szaft -64 -//ez egy komment -/*ez -is*/420 -69+69 -ez egy identifier ha nem geny piszolj lőcs \ No newline at end of file +gethelj a = 1 +gethelj b = a + 2 \ No newline at end of file