From 59b73f314a0cf84f3a59fe66e73d8180cccd6639 Mon Sep 17 00:00:00 2001 From: John Date: Mon, 26 Feb 2024 15:30:50 -0600 Subject: [PATCH] ast: Remove unary hash operator to reserve the symbol for use in attribute parsing --- libconlang/src/ast.rs | 2 -- libconlang/src/ast/ast_impl.rs | 1 - libconlang/src/interpreter.rs | 3 +-- libconlang/src/parser.rs | 1 - 4 files changed, 1 insertion(+), 6 deletions(-) diff --git a/libconlang/src/ast.rs b/libconlang/src/ast.rs index 89b35c1..5780ad8 100644 --- a/libconlang/src/ast.rs +++ b/libconlang/src/ast.rs @@ -367,8 +367,6 @@ pub enum UnaryKind { /// Unused At, /// Unused - Hash, - /// Unused Tilde, } diff --git a/libconlang/src/ast/ast_impl.rs b/libconlang/src/ast/ast_impl.rs index e4e5ce6..c0cbcc9 100644 --- a/libconlang/src/ast/ast_impl.rs +++ b/libconlang/src/ast/ast_impl.rs @@ -367,7 +367,6 @@ mod display { UnaryKind::Neg => "-", UnaryKind::Not => "!", UnaryKind::At => "@", - UnaryKind::Hash => "#", UnaryKind::Tilde => "~", } .fmt(f) diff --git a/libconlang/src/interpreter.rs b/libconlang/src/interpreter.rs index 8598aea..0e0649e 100644 --- a/libconlang/src/interpreter.rs +++ b/libconlang/src/interpreter.rs @@ -551,8 +551,7 @@ pub mod interpret { UnaryKind::Deref => todo!("Deref operator"), UnaryKind::Neg => (-operand)?, UnaryKind::Not => (!operand)?, - UnaryKind::At => unimplemented!("At operator"), - UnaryKind::Hash => { + UnaryKind::At => { println!("{operand}"); operand } diff --git a/libconlang/src/parser.rs b/libconlang/src/parser.rs index 2df8abe..6155e15 100644 --- a/libconlang/src/parser.rs +++ b/libconlang/src/parser.rs @@ -1215,7 +1215,6 @@ impl<'t> Parser<'t> { Minus => Neg, // - Bang => Not, // ! At => At, // @ - Hash => Hash, // # Tilde => Tilde, // ~ }; }