Daily update on 20250305-052510 by Nitload Youmu. Additional Message : message

Signed-off-by: Nitload <YoumuLiu_NSI@whv0t.onmicrosoft.com>
This commit is contained in:
Nitload
2025-03-05 05:25:11 +08:00
parent 5d4f516a28
commit c5777f4bfe
8 changed files with 171 additions and 69 deletions
@@ -58,7 +58,7 @@ namespace StgSharp.Script.Express
public override IExpElementSource EqualityTypeConvert => _operand.EqualityTypeConvert;
public static ExpUnaryOperatorNode UnaryNegation( ExpNode operand )
public static ExpUnaryOperatorNode UnaryMinus( ExpNode operand )
{
if( !operand.IsNumber ) {
throw new ExpInvalidTypeException(
@@ -87,5 +87,20 @@ namespace StgSharp.Script.Express
};
}
public static ExpUnaryOperatorNode UnaryPlus( ExpNode operand )
{
if( !operand.IsNumber ) {
throw new ExpInvalidTypeException(
"Number", operand.EqualityTypeConvert.Name );
}
bool isFloat =
( operand._nodeFlag | ExpNodeFlag.BuiltinType_Float ) == 0;
return new ExpUnaryOperatorNode( ExpCompile.KeyWord.SUB )
{
_nodeFlag = ExpNodeFlag.Operator_Unary | ExpNodeFlag.BuiltinType_Number,
CodeConvertTemplate = "+ {0}",
};
}
}
}
+21 -4
View File
@@ -32,6 +32,7 @@ using CommunityToolkit.HighPerformance.Buffers;
using System;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
using System.Text;
namespace StgSharp.Script.Express
@@ -96,11 +97,11 @@ namespace StgSharp.Script.Express
public string Name => _name;
public virtual void AppendNode( ExpNode nextToken )
public void AppendNode( ExpNode nextNode )
{
Next.Previous = nextToken;
nextToken.Next = Next;
Next = nextToken;
Next.Previous = nextNode;
nextNode.Next = Next;
Next = nextNode;
Next.Previous = this;
}
@@ -114,6 +115,20 @@ namespace StgSharp.Script.Express
return node == ExpEmptyNode._only || node == null;
}
[MethodImpl( MethodImplOptions.AggressiveInlining )]
public static ExpNode NonOperation( string name )
{
return new ExpEmptyNode( name );
}
public void PrependNode( ExpNode previousNode )
{
Previous.Next = previousNode;
previousNode.Previous = Previous;
Previous = previousNode;
previousNode.Next = this;
}
public static bool VerifyTypeConvertable( ExpNode left, ExpNode right )
{
IExpElementSource tLeft = left.EqualityTypeConvert,
@@ -131,6 +146,8 @@ namespace StgSharp.Script.Express
public ExpEmptyNode() : base( string.Empty ) { }
public ExpEmptyNode( string name ) : base( name ) { }
public override ExpInstantiableElement EqualityTypeConvert => ExpInstantiableElement.Void;
public override ExpNode Left => _only;