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()