From 3ec3858ff2ff94c6eec1b12f369e3f0a6826f50e Mon Sep 17 00:00:00 2001 From: Jordan Wages Date: Wed, 24 Jun 2026 02:33:34 -0500 Subject: [PATCH 1/2] XMLDoc --- src/Core/FunctionArgument.cs | 21 +++++++- src/Core/FunctionValue.cs | 51 ++++++++++++++++++- src/Core/FunctionValueType.cs | 4 ++ src/Core/ICodedFunction.cs | 14 +++++ src/Core/Variable.cs | 15 ++++++ src/Core/VariableType.cs | 5 ++ src/StandardLibrary/functions/FunctionBase.cs | 12 +++++ 7 files changed, 119 insertions(+), 3 deletions(-) diff --git a/src/Core/FunctionArgument.cs b/src/Core/FunctionArgument.cs index 80b5d6f..2ae72b9 100644 --- a/src/Core/FunctionArgument.cs +++ b/src/Core/FunctionArgument.cs @@ -6,15 +6,32 @@ using System.Threading.Tasks; namespace CSMic { + /// An encapsulated function argument. public class FunctionArgument { + #region Properties + + /// Gets or sets the name. + /// The name. public string Name { get; set; } + + /// Gets or sets the value. + /// The value. public FunctionValue Value { get; set; } - public FunctionArgument(string name, FunctionValue fv) + #endregion + + #region Constructors + + /// Constructor. + /// The name. + /// The fv. + public FunctionArgument(string name, FunctionValue fv) { this.Name = name; this.Value = fv; - } + } + + #endregion } } diff --git a/src/Core/FunctionValue.cs b/src/Core/FunctionValue.cs index e40a5dc..a1dee1c 100644 --- a/src/Core/FunctionValue.cs +++ b/src/Core/FunctionValue.cs @@ -7,28 +7,77 @@ using System.Threading.Tasks; namespace CSMic { + /// An encapsulated function value. public class FunctionValue { + #region Properties + + /// Gets or sets the value type of a function. + /// The type. public FunctionValueType Type { get; set; } + + /// Gets or sets the value. + /// The value. public object? Value { get; set; } + #endregion + + #region Constants + + /// + /// (Immutable) A defined that represents a true + /// whose value is 1. + /// public static readonly FunctionValue TRUE = new FunctionValue(FunctionValueType.Numeric, 1m); + + /// + /// (Immutable) A defined that represents a false + /// whose value is 0. + /// public static readonly FunctionValue FALSE = new FunctionValue(FunctionValueType.Numeric, 0m); + + /// + /// (Immutable) A defined that represents a undefined value. + /// public static readonly FunctionValue NONE = new FunctionValue(FunctionValueType.None, null); + + /// + /// (Immutable) A defined that represents a numeric value. The + /// default value is 0. + /// public static readonly FunctionValue NUMBER = new FunctionValue(FunctionValueType.Numeric, 0m); + + /// + /// (Immutable) A defined that represents a string value. The default + /// value is . + /// public static readonly FunctionValue STRING = new FunctionValue(FunctionValueType.String, string.Empty); + + /// + /// (Immutable) A defined that represents the number zero. + /// public static readonly FunctionValue ZERO = new FunctionValue(FunctionValueType.Numeric, 0m); + #endregion + + #region Constructors + + /// Default constructor. public FunctionValue() { this.Type = FunctionValueType.None; this.Value = null; } + /// Constructor. + /// The type. + /// The value. public FunctionValue(FunctionValueType type, object? value) { this.Type = type; this.Value = value; - } + } + + #endregion } } diff --git a/src/Core/FunctionValueType.cs b/src/Core/FunctionValueType.cs index 5649c92..f6825d6 100644 --- a/src/Core/FunctionValueType.cs +++ b/src/Core/FunctionValueType.cs @@ -6,10 +6,14 @@ using System.Threading.Tasks; namespace CSMic { + /// Values that represent function value types. public enum FunctionValueType { + /// An enum constant representing an undefined or unsupported function value type. None, + /// An enum constant representing a numeric function value type. Numeric, + /// An enum constant representing a string function value type. String } } diff --git a/src/Core/ICodedFunction.cs b/src/Core/ICodedFunction.cs index d81e7d8..4d87726 100644 --- a/src/Core/ICodedFunction.cs +++ b/src/Core/ICodedFunction.cs @@ -6,18 +6,32 @@ using System.Threading.Tasks; namespace CSMic { + /// + /// Interface for a coded function that can be created at compiletime and invoked at runtime. + /// public interface ICodedFunction { #region Properties + /// Gets the name of the function. + /// The name. string Name { get; } + + /// Gets the expected arguments of the function. + /// The expected arguments. IEnumerable ExpectedArguments { get; } + + /// Gets the return value of the function. + /// The return value. FunctionValue ReturnValue { get; } #endregion #region Methods + /// Executes the function with the given arguments. + /// A variable-length parameters list containing arguments. + /// A FunctionValue representing the result of the function execution. FunctionValue Execute(params FunctionArgument[] args); #endregion diff --git a/src/Core/Variable.cs b/src/Core/Variable.cs index 5da61c5..c121ece 100644 --- a/src/Core/Variable.cs +++ b/src/Core/Variable.cs @@ -6,20 +6,26 @@ using System.Threading.Tasks; namespace CSMic { + /// An encapsulated variable that names a runtime value. public class Variable { #region Members + /// The type of the variable. private VariableType type; + /// The name of the variable. private string name; + /// The value assigned to the variable. private object? value; #endregion #region Properties + /// Gets the variable type. + /// The type. public VariableType Type { get @@ -28,6 +34,8 @@ namespace CSMic } } + /// Gets the variable name. + /// The name. public string Name { get @@ -36,6 +44,8 @@ namespace CSMic } } + /// Gets the assigned value. + /// The assigned value. public object? Value { get @@ -48,6 +58,7 @@ namespace CSMic #region Constructor + /// Default constructor. public Variable() { this.type = VariableType.None; @@ -55,6 +66,10 @@ namespace CSMic this.value = null; } + /// Constructor. + /// The type of the variable. + /// The name of the variable. + /// The value assigned to the variable. public Variable(VariableType type, string name, object? value) { this.type = type; diff --git a/src/Core/VariableType.cs b/src/Core/VariableType.cs index ada5056..bd2e72f 100644 --- a/src/Core/VariableType.cs +++ b/src/Core/VariableType.cs @@ -6,11 +6,16 @@ using System.Threading.Tasks; namespace CSMic { + /// Values that represent variable types supported by the parser. public enum VariableType { + /// An enum constant representing an unknown or unsupported type. None, + /// An enum constant representing a numeric type backed by a . Numeric, + /// An enum constant representing numeric array backed by a of . NumericArray, + /// An enum constant representing an expression type backed by a and interpreted by the parser at runtime. Expression, } } diff --git a/src/StandardLibrary/functions/FunctionBase.cs b/src/StandardLibrary/functions/FunctionBase.cs index eff760f..5708d7a 100644 --- a/src/StandardLibrary/functions/FunctionBase.cs +++ b/src/StandardLibrary/functions/FunctionBase.cs @@ -2,10 +2,15 @@ namespace CSMic.StandardLibrary.Functions { + /// A base class that handles base function handling. public abstract class FunctionBase { + /// Gets the expected arguments. + /// The expected arguments. public virtual IEnumerable ExpectedArguments { get; } + /// Gets the return value. + /// The return value. public virtual FunctionValue ReturnValue { get @@ -15,6 +20,9 @@ namespace CSMic.StandardLibrary.Functions } } + /// Checks the provided arguments to ensure the function contract is honored. + /// A variable-length parameters list containing arguments. + /// True if it succeeds, false if it fails. public bool ArgumentCheck(params FunctionArgument[] args) { // Top level sanity checks. @@ -49,6 +57,10 @@ namespace CSMic.StandardLibrary.Functions return true; } + /// Executes a standard library function. + /// A variable-length parameters list containing arguments. + /// The functions action body. + /// A . public FunctionValue Execute(FunctionArgument[] args, Func action) { if (!ArgumentCheck(args)) From 2a7077eeddb37ccf01e096f7da07cd52f021454f Mon Sep 17 00:00:00 2001 From: Jordan Wages Date: Wed, 24 Jun 2026 02:34:59 -0500 Subject: [PATCH 2/2] Update .gitignore Github isn't the primary repository anymore, so github specific config should be unnecessary. --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index b9e2e93..5627e5f 100644 --- a/.gitignore +++ b/.gitignore @@ -409,3 +409,4 @@ FodyWeavers.xsd /src/core/cocor/Scanner.cs.old /src/core/cocor/Parser.cs /src/core/cocor/Scanner.cs +/src/.github