From a13bba4d02f0ed2ab949cc7bbe6e80a12eb98aff Mon Sep 17 00:00:00 2001 From: Selimaj Dev Date: Tue, 5 May 2026 23:03:31 +0200 Subject: [PATCH] Not prefix --- parser/src/ast.rs | 1 + parser/src/grammar.pest | 2 ++ parser/src/lib.rs | 1 + src/codegen.rs | 1 + 4 files changed, 5 insertions(+) diff --git a/parser/src/ast.rs b/parser/src/ast.rs index 5a75b81..05bca76 100644 --- a/parser/src/ast.rs +++ b/parser/src/ast.rs @@ -115,6 +115,7 @@ pub enum Prefix { RefMut, Deref, New, + Not, } #[derive(Debug, Clone, Serialize)] diff --git a/parser/src/grammar.pest b/parser/src/grammar.pest index 9bc04cc..9913b8c 100644 --- a/parser/src/grammar.pest +++ b/parser/src/grammar.pest @@ -172,12 +172,14 @@ prefix = { | mut_ref_px | ref_px | new_px + | not_px } deref_px = { "*" } mut_ref_px = { "&" ~ mutable } ref_px = { "&" } new_px = { "new" } +not_px = { "!" } prefix_list = { prefix* } diff --git a/parser/src/lib.rs b/parser/src/lib.rs index d4e2c27..bb3f16d 100644 --- a/parser/src/lib.rs +++ b/parser/src/lib.rs @@ -403,6 +403,7 @@ impl From> for Prefix { Rule::mut_ref_px => Self::RefMut, Rule::ref_px => Self::Ref, Rule::new_px => Self::New, + Rule::not_px => Self::Not, _ => unimplemented!("{pair:#?}"), } } diff --git a/src/codegen.rs b/src/codegen.rs index 463e448..6bfa172 100644 --- a/src/codegen.rs +++ b/src/codegen.rs @@ -164,6 +164,7 @@ impl GetRust for Prefix { Self::Deref => "*", Self::Ref => "&", Self::RefMut => "&mut ", + Self::Not => "!", Self::New => "", } .to_string()