Skip to content

Commit

Permalink
logic binops
Browse files Browse the repository at this point in the history
  • Loading branch information
wtholliday committed Sep 21, 2023
1 parent c84cfee commit dd912f7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
9 changes: 9 additions & 0 deletions src/lexer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ pub enum Token {
Interface,
Where,
Underscore,
Ampersand,
Endl,
For,
In,
Expand Down Expand Up @@ -301,6 +302,14 @@ impl Lexer {
Token::Pipe
}
}
'&' => {
if self.i < n && bytes[self.i] == b'&' {
self.i += 1;
Token::And
} else {
Token::Ampersand
}
}
'@' => Token::At,
'<' => {
if self.i < n && bytes[self.i] == b'=' {
Expand Down
2 changes: 1 addition & 1 deletion tests/cases/booleans.lyte
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ main {
assert(t != f)
assert(!f)
assert(t || f)
// assert(t and t)
assert(t && t)
// assert(not (f or f))
// assert(not (t == f))
// assert(not f == t)
Expand Down

0 comments on commit dd912f7

Please sign in to comment.