From e460b7c6770ec63fe97c5de346c8343a968bb63d Mon Sep 17 00:00:00 2001 From: lyken Date: Fri, 26 Jul 2024 10:58:15 +0800 Subject: [PATCH] core/toplevel: reorganize PrimDef --- nac3core/src/toplevel/helper.rs | 50 +++++++++++++++++++-------------- 1 file changed, 29 insertions(+), 21 deletions(-) diff --git a/nac3core/src/toplevel/helper.rs b/nac3core/src/toplevel/helper.rs index 538e653e..22c883cd 100644 --- a/nac3core/src/toplevel/helper.rs +++ b/nac3core/src/toplevel/helper.rs @@ -27,17 +27,22 @@ pub enum PrimDef { List, NDArray, - // Member Functions + // Option methods OptionIsSome, OptionIsNone, OptionUnwrap, + + // Option-related functions + FunSome, + + // NDArray methods NDArrayCopy, NDArrayFill, - FunInt32, - FunInt64, - FunUInt32, - FunUInt64, - FunFloat, + + // Range methods + FunRangeInit, + + // NumPy & SciPy functions FunNpNDArray, FunNpEmpty, FunNpZeros, @@ -46,28 +51,15 @@ pub enum PrimDef { FunNpArray, FunNpEye, FunNpIdentity, - FunRound, - FunRound64, FunNpRound, - FunRangeInit, - FunStr, - FunBool, - FunFloor, - FunFloor64, FunNpFloor, - FunCeil, - FunCeil64, FunNpCeil, - FunLen, - FunMin, FunNpMin, FunNpMinimum, FunNpArgmin, - FunMax, FunNpMax, FunNpMaximum, FunNpArgmax, - FunAbs, FunNpIsNan, FunNpIsInf, FunNpSin, @@ -106,8 +98,24 @@ pub enum PrimDef { FunNpHypot, FunNpNextAfter, - // Top-Level Functions - FunSome, + // Miscellaneous + FunInt32, + FunInt64, + FunUInt32, + FunUInt64, + FunFloat, + FunRound, + FunRound64, + FunStr, + FunBool, + FunFloor, + FunFloor64, + FunCeil, + FunCeil64, + FunLen, + FunMin, + FunMax, + FunAbs, } /// Associated details of a [`PrimDef`]