From 12d2e8637ee2f2551e97206535785f189b6ee760 Mon Sep 17 00:00:00 2001 From: 0xGlitchbyte <49317853+0xGlitchbyte@users.noreply.github.com> Date: Fri, 2 Feb 2024 07:51:15 -0500 Subject: [PATCH] all unary operators are implemented --- src/ocaml.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/ocaml.rs b/src/ocaml.rs index 1318d6f..9fa3369 100644 --- a/src/ocaml.rs +++ b/src/ocaml.rs @@ -52,7 +52,7 @@ impl OCaml { let syntax = syn::parse_file(&src) .map_err(|e| OCamlError::Parse(format!("'{}': {}", file_path, e)))?; - println!("{:#?}", syntax); + //println!("{:#?}", syntax); let syntax_items: Vec = syntax.items.iter().map(|item| item.into()).collect(); @@ -245,9 +245,9 @@ impl From<&syn::LitFloat> for OCamlLiteral { impl From<&syn::ExprUnary> for OCamlUnary { fn from(value: &syn::ExprUnary) -> Self { match value.op { - syn::UnOp::Deref(_) => todo!(), - syn::UnOp::Not(_) => todo!(), - syn::UnOp::Neg(minus, ..) => OCamlUnary::Minus(value.expr.as_ref().into()), + syn::UnOp::Deref(_) => OCamlUnary::Deref(value.expr.as_ref().into()), + syn::UnOp::Not(_) => OCamlUnary::Not(value.expr.as_ref().into()), + syn::UnOp::Neg(_) => OCamlUnary::Minus(value.expr.as_ref().into()), _ => todo!(), } }