From dd912f70034ef04c5c161fdeccf6460360e8bf15 Mon Sep 17 00:00:00 2001 From: Taylor Holliday Date: Wed, 20 Sep 2023 21:18:53 -0700 Subject: [PATCH] logic binops --- src/lexer.rs | 9 +++++++++ tests/cases/booleans.lyte | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/lexer.rs b/src/lexer.rs index 8295450..c57b2a1 100644 --- a/src/lexer.rs +++ b/src/lexer.rs @@ -71,6 +71,7 @@ pub enum Token { Interface, Where, Underscore, + Ampersand, Endl, For, In, @@ -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'=' { diff --git a/tests/cases/booleans.lyte b/tests/cases/booleans.lyte index 36a4751..e1c18e7 100644 --- a/tests/cases/booleans.lyte +++ b/tests/cases/booleans.lyte @@ -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)