Daily update on 20250420-041137 by Nitload Youmu. Additional Message : Change: pipeline nodes use port to connect instead of connctors, this make send to multi-ports and recieve from multi-ports possible.

Remove: Some types in Pipeline namepace removed sueto no need for connectors

Signed-off-by: Nitload <YoumuLiu_NSI@whv0t.onmicrosoft.com>
This commit is contained in:
Nitload
2025-04-20 04:11:37 +08:00
parent c29993fd84
commit b618fdf7b5
72 changed files with 1343 additions and 602 deletions
@@ -40,15 +40,15 @@ using System.Threading.Tasks;
namespace StgSharp.Script.Express
{
public class ExpBinaryOperatorNode : ExpNode
public class ExpBinaryOperatorNode : ExpSyntaxNode
{
private ExpInstantiableElement _returnType;
private ExpNode _left;
private ExpNode _right;
private ExpSyntaxNode _left;
private ExpSyntaxNode _right;
private ExpBinaryOperatorNode( Token source, ExpNode left, ExpNode right )
private ExpBinaryOperatorNode( Token source, ExpSyntaxNode left, ExpSyntaxNode right )
: base( source )
{
_left = left;
@@ -57,11 +57,14 @@ namespace StgSharp.Script.Express
public override ExpInstantiableElement EqualityTypeConvert => _returnType;
public override ExpNode Left => _left;
public override ExpSyntaxNode Left => _left;
public override ExpNode Right => _right;
public override ExpSyntaxNode Right => _right;
public static ExpBinaryOperatorNode Add( Token source, ExpNode left, ExpNode right )
public static ExpBinaryOperatorNode Add(
Token source,
ExpSyntaxNode left,
ExpSyntaxNode right )
{
if( !left.IsNumber && !right.IsNumber ) {
throw new ExpInvalidTypeException( "Number", left.EqualityTypeConvert.Name );
@@ -77,7 +80,10 @@ namespace StgSharp.Script.Express
};
}
public static ExpBinaryOperatorNode Assign( Token source, ExpNode left, ExpNode right )
public static ExpBinaryOperatorNode Assign(
Token source,
ExpSyntaxNode left,
ExpSyntaxNode right )
{
if( left.EqualityTypeConvert != right.EqualityTypeConvert ) {
throw new ExpInvalidTypeException(
@@ -93,8 +99,8 @@ namespace StgSharp.Script.Express
public static ExpBinaryOperatorNode CompareInstanceEqual(
Token source,
ExpNode left,
ExpNode right )
ExpSyntaxNode left,
ExpSyntaxNode right )
{
return new ExpBinaryOperatorNode( source, left, right )
{
@@ -106,8 +112,8 @@ namespace StgSharp.Script.Express
public static ExpBinaryOperatorNode CompareInstanceNotEqual(
Token nsource,
ExpNode left,
ExpNode right )
ExpSyntaxNode left,
ExpSyntaxNode right )
{
return new ExpBinaryOperatorNode( nsource, left, right )
{
@@ -119,8 +125,8 @@ namespace StgSharp.Script.Express
public static ExpBinaryOperatorNode ConvertElement(
Token source,
ExpNode left,
ExpNode right )
ExpSyntaxNode left,
ExpSyntaxNode right )
{
if( right is not ExpMetaRefNode metaref ) {
throw new ExpInvalidTypeException(
@@ -138,7 +144,10 @@ namespace StgSharp.Script.Express
};
}
public static ExpBinaryOperatorNode Div( Token source, ExpNode left, ExpNode right )
public static ExpBinaryOperatorNode Div(
Token source,
ExpSyntaxNode left,
ExpSyntaxNode right )
{
if( !left.IsNumber && !right.IsNumber ) {
throw new ExpInvalidTypeException( "Number", left.EqualityTypeConvert.Name );
@@ -154,7 +163,10 @@ namespace StgSharp.Script.Express
};
}
public static ExpBinaryOperatorNode EqualTo( Token source, ExpNode left, ExpNode right )
public static ExpBinaryOperatorNode EqualTo(
Token source,
ExpSyntaxNode left,
ExpSyntaxNode right )
{
if( left.EqualityTypeConvert != right.EqualityTypeConvert ) {
throw new ExpInvalidTypeException(
@@ -168,7 +180,10 @@ namespace StgSharp.Script.Express
};
}
public static ExpBinaryOperatorNode GreaterThan( Token source, ExpNode left, ExpNode right )
public static ExpBinaryOperatorNode GreaterThan(
Token source,
ExpSyntaxNode left,
ExpSyntaxNode right )
{
if( !left.IsNumber && !right.IsNumber ) {
throw new ExpInvalidTypeException( "Number", left.EqualityTypeConvert.Name );
@@ -181,7 +196,10 @@ namespace StgSharp.Script.Express
};
}
public static ExpBinaryOperatorNode LessThan( Token source, ExpNode left, ExpNode right )
public static ExpBinaryOperatorNode LessThan(
Token source,
ExpSyntaxNode left,
ExpSyntaxNode right )
{
if( !left.IsNumber && !right.IsNumber ) {
throw new ExpInvalidTypeException( "Number", left.EqualityTypeConvert.Name );
@@ -194,7 +212,10 @@ namespace StgSharp.Script.Express
};
}
public static ExpBinaryOperatorNode Mul( Token source, ExpNode left, ExpNode right )
public static ExpBinaryOperatorNode Mul(
Token source,
ExpSyntaxNode left,
ExpSyntaxNode right )
{
if( !left.IsNumber && !right.IsNumber ) {
throw new ExpInvalidTypeException( "Number", left.EqualityTypeConvert.Name );
@@ -210,7 +231,10 @@ namespace StgSharp.Script.Express
};
}
public static ExpBinaryOperatorNode NotEqualTo( Token source, ExpNode left, ExpNode right )
public static ExpBinaryOperatorNode NotEqualTo(
Token source,
ExpSyntaxNode left,
ExpSyntaxNode right )
{
if( left.EqualityTypeConvert != right.EqualityTypeConvert ) {
throw new ExpInvalidTypeException(
@@ -224,7 +248,10 @@ namespace StgSharp.Script.Express
};
}
public static ExpBinaryOperatorNode SmallerThan( Token source, ExpNode left, ExpNode right )
public static ExpBinaryOperatorNode SmallerThan(
Token source,
ExpSyntaxNode left,
ExpSyntaxNode right )
{
if( !left.IsNumber && !right.IsNumber ) {
throw new ExpInvalidTypeException( "Number", left.EqualityTypeConvert.Name );
@@ -237,7 +264,10 @@ namespace StgSharp.Script.Express
};
}
public static ExpBinaryOperatorNode Sub( Token source, ExpNode left, ExpNode right )
public static ExpBinaryOperatorNode Sub(
Token source,
ExpSyntaxNode left,
ExpSyntaxNode right )
{
if( !left.IsNumber && !right.IsNumber ) {
throw new ExpInvalidTypeException( "Number", left.EqualityTypeConvert.Name );
@@ -36,17 +36,17 @@ using System.Threading.Tasks;
namespace StgSharp.Script.Express
{
public class ExpCollectionIndexNode : ExpNode
public class ExpCollectionIndexNode : ExpSyntaxNode
{
private ExpCollectionInstanceBase _collection;
private ExpNode _indexExpression;
private ExpSyntaxNode _indexExpression;
private ExpCollectionIndexNode(
Token source,
ExpCollectionInstanceBase instance,
ExpNode indexExpression )
Token source,
ExpCollectionInstanceBase instance,
ExpSyntaxNode indexExpression )
: base( source )
{
_collection = instance;
@@ -54,23 +54,22 @@ namespace StgSharp.Script.Express
CodeConvertTemplate = @"{0}[{1}]";
}
public override ExpNode Left => _collection;
public override ExpSyntaxNode Left => _collection;
public override ExpNode Right => _indexExpression;
public override ExpSyntaxNode Right => _indexExpression;
public override IExpElementSource EqualityTypeConvert => _collection.EqualityTypeConvert;
public static ExpCollectionIndexNode Create(
Token source,
ExpCollectionInstanceBase instance,
ExpNode indexExpression )
Token source,
ExpCollectionInstanceBase instance,
ExpSyntaxNode indexExpression )
{
if( !indexExpression.IsNumber ) {
throw new ExpInvalidTypeException(
"Number", indexExpression.EqualityTypeConvert.Name );
}
return new ExpCollectionIndexNode(
source, instance, indexExpression );
return new ExpCollectionIndexNode( source, instance, indexExpression );
}
}
@@ -36,25 +36,25 @@ using System.Threading.Tasks;
namespace StgSharp.Script.Express
{
public class ExpElementInitializingNode : ExpNode
public class ExpElementInitializingNode : ExpSyntaxNode
{
private ExpMetaRefNode _type;
private ExpNode _init;
private ExpSyntaxNode _init;
public ExpElementInitializingNode(
Token source,
ExpMetaRefNode type,
ExpNode initParameter )
ExpSyntaxNode initParameter )
: base( source )
{
_type = type;
_init = initParameter;
}
public override ExpNode Left => _type;
public override ExpSyntaxNode Left => _type;
public override ExpNode Right => _init;
public override ExpSyntaxNode Right => _init;
public override IExpElementSource EqualityTypeConvert => _type.SourceRef;
@@ -36,7 +36,7 @@ using System.Threading.Tasks;
namespace StgSharp.Script.Express
{
public class ExpElementMemberNameNode : ExpNode
public class ExpElementMemberNameNode : ExpSyntaxNode
{
internal ExpElementMemberNameNode( Token source )
@@ -46,9 +46,9 @@ namespace StgSharp.Script.Express
CodeConvertTemplate = source.Value;
}
public override ExpNode Left => Empty;
public override ExpSyntaxNode Left => Empty;
public override ExpNode Right => Empty;
public override ExpSyntaxNode Right => Empty;
public override IExpElementSource EqualityTypeConvert
{
@@ -36,31 +36,33 @@ using System.Threading.Tasks;
namespace StgSharp.Script.Express
{
public class ExpFunctionCallingNode : ExpNode
public class ExpFunctionCallingNode : ExpSyntaxNode
{
private ExpFunctionSource _function;
private ExpNode _parameter;
private ExpSyntaxNode _parameter;
private ExpFunctionCallingNode(
Token source,
ExpFunctionSource function,
ExpNode firstParameter )
ExpSyntaxNode firstParameter )
: base( source )
{
_function = function;
_parameter = firstParameter;
}
public ExpFunctionSource FunctionCaller => _function;
public override ExpInstantiableElement EqualityTypeConvert => throw new NotImplementedException(
);
public override ExpNode Left => Empty;
public override ExpSyntaxNode Left => Empty;
public override ExpNode Right => _parameter;
public override ExpSyntaxNode Right => _parameter;
public void AppendParameter( ExpNode parameter )
public void AppendParameter( ExpSyntaxNode parameter )
{
_parameter.AppendNode( parameter );
}
@@ -68,7 +70,7 @@ namespace StgSharp.Script.Express
public static ExpFunctionCallingNode CallFunction(
Token source,
ExpFunctionSource function,
ExpNode param )
ExpSyntaxNode param )
{
return new ExpFunctionCallingNode( source, function, param );
}
+12 -12
View File
@@ -36,14 +36,14 @@ using System.Text;
namespace StgSharp.Script.Express
{
public sealed class ExpIfNode : ExpNode
public sealed class ExpIfNode : ExpSyntaxNode
{
private ExpNode _falseOpBegin;
private ExpNode _rule;
private ExpNode _trueOpBegin ;
private ExpSyntaxNode _falseOpBegin;
private ExpSyntaxNode _rule;
private ExpSyntaxNode _trueOpBegin ;
public ExpIfNode( Token source, ExpNode rule, ExpNode trueOpBegin )
public ExpIfNode( Token source, ExpSyntaxNode rule, ExpSyntaxNode trueOpBegin )
: base( source )
{
_rule = rule;
@@ -59,9 +59,9 @@ namespace StgSharp.Script.Express
public ExpIfNode(
Token source,
ExpNode rule,
ExpNode rootOperationIfTrue,
ExpNode rootOperationIfFalse )
ExpSyntaxNode rule,
ExpSyntaxNode rootOperationIfTrue,
ExpSyntaxNode rootOperationIfFalse )
: base( source )
{
_rule = rule;
@@ -78,18 +78,18 @@ namespace StgSharp.Script.Express
""" );
}
public override ExpNode Left => _trueOpBegin;
public override ExpSyntaxNode Left => _trueOpBegin;
public override ExpNode Right => _falseOpBegin;
public override ExpSyntaxNode Right => _falseOpBegin;
public override IExpElementSource EqualityTypeConvert => null!;
public void AppendFalseOperation( ExpNode expressionRoot )
public void AppendFalseOperation( ExpSyntaxNode expressionRoot )
{
_falseOpBegin.AppendNode( expressionRoot );
}
public void AppendTrueOperation( ExpNode expressionRoot )
public void AppendTrueOperation( ExpSyntaxNode expressionRoot )
{
_trueOpBegin.AppendNode( expressionRoot );
}
@@ -38,12 +38,12 @@ using System.Threading.Tasks;
namespace StgSharp.Script.Express
{
public class ExpInstanceMemberNode : ExpNode
public class ExpInstanceMemberNode : ExpSyntaxNode
{
private ExpElementInstance _instance;
private ExpElementMemberNameNode _memberName;
private ExpNode _member;
private ExpSyntaxNode _member;
public ExpInstanceMemberNode(
Token source,
@@ -56,9 +56,9 @@ namespace StgSharp.Script.Express
_instance.TryGetMember( memberName.CodeConvertTemplate, out _member );
}
public override ExpNode Left => _instance;
public override ExpSyntaxNode Left => _instance;
public override ExpNode Right => _memberName;
public override ExpSyntaxNode Right => _memberName;
public override IExpElementSource EqualityTypeConvert => _member.EqualityTypeConvert;
@@ -37,7 +37,7 @@ using System.Threading.Tasks;
namespace StgSharp.Script.Express
{
public class ExpInstanceReferenceNode : ExpNode
public class ExpInstanceReferenceNode : ExpSyntaxNode
{
internal ExpInstanceReferenceNode( Token source, ExpElementInstance instance )
@@ -58,9 +58,9 @@ namespace StgSharp.Script.Express
public ExpElementInstance OriginObject { get ; private set; }
public override ExpNode Left => Empty;
public override ExpSyntaxNode Left => Empty;
public override ExpNode Right => Empty;
public override ExpSyntaxNode Right => Empty;
public override IExpElementSource EqualityTypeConvert => OriginObject.EqualityTypeConvert;
@@ -38,26 +38,29 @@ using System.Threading.Tasks;
namespace StgSharp.Script.Express
{
public class ExpMetaRefNode : ExpNode
public class ExpMetaRefNode : ExpSyntaxNode
{
internal ExpMetaRefNode( Token source, ExpInstantiableElement element ) : base( source )
internal ExpMetaRefNode( Token source, ExpInstantiableElement element )
: base( source )
{
SourceRef = element;
}
public ExpInstantiableElement SourceRef { get; init; }
public override ExpNode Left => Empty;
public override ExpSyntaxNode Left => Empty;
public override ExpNode Right => Empty;
public override ExpSyntaxNode Right => Empty;
public override IExpElementSource EqualityTypeConvert => ExpInstantiableElement.Void;
public static ExpMetaRefNode RefEntity( Token position, ExpEntitySource entity )
{
if( position.Value != entity.Name ) {
throw new ExpCompileException( position, $"Meta data does not match, name of source to match is {entity.Name}, but token is {position.Value}" );
throw new ExpCompileException(
position,
$"Meta data does not match, name of source to match is {entity.Name}, but token is {position.Value}" );
}
ExpMetaRefNode node = new ExpMetaRefNode( position, entity )
{
@@ -69,7 +72,9 @@ namespace StgSharp.Script.Express
public static ExpMetaRefNode RefType( Token position, ExpTypeSource type )
{
if( position.Value != type.Name ) {
throw new ExpCompileException( position, $"Meta data does not match, name of source to match is {type.Name}, but token is {position.Value}" );
throw new ExpCompileException(
position,
$"Meta data does not match, name of source to match is {type.Name}, but token is {position.Value}" );
}
ExpMetaRefNode node = new ExpMetaRefNode( position, type )
{
@@ -37,30 +37,33 @@ using System.Threading.Tasks;
namespace StgSharp.Script.Express
{
public class ExpProcedureCallingNode : ExpNode
public class ExpProcedureCallingNode : ExpSyntaxNode
{
private ExpNode _params;
private ExpSyntaxNode _params;
public ExpProcedureCallingNode( Token source, ExpProcedureSource caller, ExpNode param )
public ExpProcedureCallingNode(
Token source,
ExpProcedureSource caller,
ExpSyntaxNode param )
: base( source )
{
_params = param;
CalledProcedure = caller;
}
public override ExpNode Left => Empty;
public override ExpNode Right => _params;
public ExpProcedureSource CalledProcedure { get; init; }
public override ExpSyntaxNode Left => Empty;
public override ExpSyntaxNode Right => _params;
public override IExpElementSource EqualityTypeConvert => ExpInstantiableElement.Void;
public static ExpProcedureCallingNode CallProcedure(
Token postion,
ExpProcedureSource caller,
ExpNode input )
ExpSyntaxNode input )
{
ExpProcedureCallingNode node = new ExpProcedureCallingNode( postion, caller, input )
{
@@ -40,20 +40,20 @@ using ExpKeyword = StgSharp.Script.Express.ExpressCompile.Keyword;
namespace StgSharp.Script.Express
{
public class ExpProcedureControlNode : ExpNode
public class ExpProcedureControlNode : ExpSyntaxNode
{
private ExpNode _additional;
private ExpSyntaxNode _additional;
internal ExpProcedureControlNode( Token source ) : base( source ) { }
public override ExpNode Left => Empty;
public override ExpSyntaxNode Left => Empty;
public override ExpNode Right => _additional;
public override ExpSyntaxNode Right => _additional;
public override IExpElementSource EqualityTypeConvert => ExpTypeSource.Void;
public static ExpProcedureControlNode Return( Token t, ExpNode valueToReturn )
public static ExpProcedureControlNode Return( Token t, ExpSyntaxNode valueToReturn )
{
if( t.Value != ExpKeyword.Return ) {
throw new InvalidCastException();
@@ -37,21 +37,21 @@ using System.Threading.Channels;
namespace StgSharp.Script.Express
{
public class ExpRepeatNode : ExpNode
public class ExpRepeatNode : ExpSyntaxNode
{
private ExpElementInstance _variable;
private ExpNode _begin, _end, _increment, _operationBegin,_untilRule,_whileRule;
private ExpSyntaxNode _begin, _end, _increment, _operationBegin,_untilRule,_whileRule;
internal ExpRepeatNode(
Token source,
ExpElementInstance variable,
ExpNode begin,
ExpNode end,
ExpNode increment,
ExpNode operationBegin,
ExpNode untilRule,
ExpNode whileRule )
ExpSyntaxNode begin,
ExpSyntaxNode end,
ExpSyntaxNode increment,
ExpSyntaxNode operationBegin,
ExpSyntaxNode untilRule,
ExpSyntaxNode whileRule )
: base( source )
{
if( variable.NodeFlag != begin.NodeFlag || begin.NodeFlag != end.NodeFlag || ( increment !=
@@ -90,13 +90,13 @@ namespace StgSharp.Script.Express
_whileRule = whileRule;
}
public override ExpNode Left => throw new NotImplementedException();
public override ExpSyntaxNode Left => throw new NotImplementedException();
public override ExpNode Right => _operationBegin;
public override ExpSyntaxNode Right => _operationBegin;
public override IExpElementSource EqualityTypeConvert => null!;
public void AppendRepeatedOperation( ExpNode node )
public void AppendRepeatedOperation( ExpSyntaxNode node )
{
_operationBegin.AppendNode( node );
}
@@ -126,12 +126,12 @@ namespace StgSharp.Script.Express
public static ExpRepeatNode Create(
Token t,
ExpInstanceReferenceNode repeatVariable,
ExpNode begin,
ExpNode end,
ExpNode increment,
ExpNode whileRule,
ExpNode untilRule,
ExpNode body )
ExpSyntaxNode begin,
ExpSyntaxNode end,
ExpSyntaxNode increment,
ExpSyntaxNode whileRule,
ExpSyntaxNode untilRule,
ExpSyntaxNode body )
{
untilRule = ExpBoolNode.False( null );
whileRule = ExpBoolNode.True( null );
@@ -163,12 +163,12 @@ namespace StgSharp.Script.Express
public static ExpRepeatNode Create(
Token t,
ExpElementInstance repeatVariable,
ExpNode begin,
ExpNode end,
ExpNode increment,
ExpNode whileRule,
ExpNode untilRule,
ExpNode body )
ExpSyntaxNode begin,
ExpSyntaxNode end,
ExpSyntaxNode increment,
ExpSyntaxNode whileRule,
ExpSyntaxNode untilRule,
ExpSyntaxNode body )
{
whileRule = IsNullOrEmpty( whileRule ) ? ExpBoolNode.True( t ) : whileRule;
untilRule = IsNullOrEmpty( untilRule ) ? ExpBoolNode.False( t ) : untilRule;
@@ -35,25 +35,26 @@ using System.Text;
namespace StgSharp.Script.Express
{
public class ExpSwitchNode : ExpNode
public class ExpSwitchNode : ExpSyntaxNode
{
private ExpNode _default;
private ExpNode _target;
private ExpSyntaxNode _default;
private ExpSyntaxNode _target;
private FrozenDictionary<ExpNode, ExpNode> _cases;
private FrozenDictionary<ExpSyntaxNode, ExpSyntaxNode> _cases;
public ExpSwitchNode(
Token source,
ExpNode target,
ExpNode defaultCase,
params (ExpNode label, ExpNode op)[] cases )
ExpSyntaxNode target,
ExpSyntaxNode defaultCase,
params (ExpSyntaxNode label, ExpSyntaxNode op)[] cases )
: base( source )
{
_target = target;
_default = defaultCase;
Dictionary<ExpNode, ExpNode> casesDic = new Dictionary<ExpNode, ExpNode>();
foreach( (ExpNode label, ExpNode op ) item in cases )
Dictionary<ExpSyntaxNode, ExpSyntaxNode> casesDic = new Dictionary<ExpSyntaxNode, ExpSyntaxNode>(
);
foreach( (ExpSyntaxNode label, ExpSyntaxNode op ) item in cases )
{
if( item.op == null )
{
@@ -84,9 +85,9 @@ namespace StgSharp.Script.Express
public ExpSwitchNode(
Token source,
ExpNode target,
ExpNode defaultCase,
IDictionary<ExpNode, ExpNode> cases )
ExpSyntaxNode target,
ExpSyntaxNode defaultCase,
IDictionary<ExpSyntaxNode, ExpSyntaxNode> cases )
: base( source )
{
_target = target;
@@ -109,24 +110,24 @@ namespace StgSharp.Script.Express
CodeConvertTemplate = codeFormatBuilder.ToString();
}
public ExpNode this[ ExpNode index ]
public ExpSyntaxNode this[ ExpSyntaxNode index ]
{
get
{
if( _cases.TryGetValue( index, out ExpNode? ret ) ) {
if( _cases.TryGetValue( index, out ExpSyntaxNode? ret ) ) {
return ret;
}
return _default;
}
}
public override ExpNode Left => Empty;
public override ExpSyntaxNode Left => Empty;
public override ExpNode Right => Empty;
public override ExpSyntaxNode Right => Empty;
public override IExpElementSource EqualityTypeConvert => null!;
public bool ContainsCase( ExpNode token )
public bool ContainsCase( ExpSyntaxNode token )
{
return _cases.ContainsKey( token );
}
@@ -36,35 +36,29 @@ using System.Threading.Tasks;
namespace StgSharp.Script.Express
{
public class ExpUnaryOperatorNode : ExpNode
public class ExpUnaryOperatorNode : ExpSyntaxNode
{
private ExpNode _operand;
private ExpSyntaxNode _operand;
private ExpUnaryOperatorNode( Token source ) : base( source ) { }
public ExpUnaryOperatorNode(
Token source,
ExpNode operand,
ExpSchema context )
public ExpUnaryOperatorNode( Token source, ExpSyntaxNode operand, ExpSchema context )
: base( source )
{
_operand = operand;
}
public override ExpNode Left => null!;
public override ExpSyntaxNode Left => null!;
public override ExpNode Right => _operand;
public override ExpSyntaxNode Right => _operand;
public override IExpElementSource EqualityTypeConvert => _operand.EqualityTypeConvert;
public static ExpUnaryOperatorNode UnaryMinus(
Token source,
ExpNode operand )
public static ExpUnaryOperatorNode UnaryMinus( Token source, ExpSyntaxNode operand )
{
if( !operand.IsNumber ) {
throw new ExpInvalidTypeException(
"Number", operand.EqualityTypeConvert.Name );
throw new ExpInvalidTypeException( "Number", operand.EqualityTypeConvert.Name );
}
bool isFloat =
( operand._nodeFlag | ExpNodeFlag.BuiltinType_Real ) == 0;
@@ -75,9 +69,7 @@ namespace StgSharp.Script.Express
};
}
public static ExpUnaryOperatorNode UnaryNot(
Token source,
ExpNode operand )
public static ExpUnaryOperatorNode UnaryNot( Token source, ExpSyntaxNode operand )
{
if( ( operand._nodeFlag | ( ExpNodeFlag.BuiltinType_Logic | ExpNodeFlag.BuiltinType_Logic ) ) ==
0 ) {
@@ -91,13 +83,10 @@ namespace StgSharp.Script.Express
};
}
public static ExpUnaryOperatorNode UnaryPlus(
Token source,
ExpNode operand )
public static ExpUnaryOperatorNode UnaryPlus( Token source, ExpSyntaxNode operand )
{
if( !operand.IsNumber ) {
throw new ExpInvalidTypeException(
"Number", operand.EqualityTypeConvert.Name );
throw new ExpInvalidTypeException( "Number", operand.EqualityTypeConvert.Name );
}
bool isFloat =
( operand._nodeFlag | ExpNodeFlag.BuiltinType_Real ) == 0;
+16 -16
View File
@@ -39,13 +39,13 @@ using System.Text;
namespace StgSharp.Script.Express
{
public abstract class ExpNode : IASTNode<ExpNode, IExpElementSource>
public abstract class ExpSyntaxNode : ISyntaxNode<ExpSyntaxNode, IExpElementSource>
{
protected internal ExpNodeFlag _nodeFlag;
protected internal Token _source;
protected ExpNode( Token source )
protected ExpSyntaxNode( Token source )
{
_source = source;
Next = this;
@@ -57,18 +57,18 @@ namespace StgSharp.Script.Express
get { return ( _nodeFlag | ExpNodeFlag.BuiltinType_Number ) != 0; }
}
public abstract ExpNode Left { get; }
public abstract ExpSyntaxNode Left { get; }
public static ExpNode Empty
public static ExpSyntaxNode Empty
{
get => ExpEmptyNode._only;
}
public ExpNode Next { get; set; }
public ExpSyntaxNode Next { get; set; }
public abstract ExpNode Right { get; }
public abstract ExpSyntaxNode Right { get; }
public ExpNode Previous { get; set; }
public ExpSyntaxNode Previous { get; set; }
public abstract IExpElementSource EqualityTypeConvert { get; }
@@ -85,7 +85,7 @@ namespace StgSharp.Script.Express
get => _source;
}
public void AppendNode( ExpNode nextNode )
public void AppendNode( ExpSyntaxNode nextNode )
{
Next.Previous = nextNode;
nextNode.Next = Next;
@@ -93,24 +93,24 @@ namespace StgSharp.Script.Express
Next.Previous = this;
}
public static bool IsNullOrEmpty( [AllowNull]ExpNode node )
public static bool IsNullOrEmpty( [AllowNull]ExpSyntaxNode node )
{
return node == ExpEmptyNode._only || node == null;
}
[MethodImpl( MethodImplOptions.AggressiveInlining )]
public static ExpNode NonOperation( Token source )
public static ExpSyntaxNode NonOperation( Token source )
{
return new ExpEmptyNode( source.Line, source.Column );
}
[MethodImpl( MethodImplOptions.AggressiveInlining )]
public static ExpNode NonOperation( int line, int column )
public static ExpSyntaxNode NonOperation( int line, int column )
{
return new ExpEmptyNode( line, column );
}
public void PrependNode( ExpNode previousNode )
public void PrependNode( ExpSyntaxNode previousNode )
{
Previous.Next = previousNode;
previousNode.Previous = Previous;
@@ -118,7 +118,7 @@ namespace StgSharp.Script.Express
previousNode.Next = this;
}
public static bool VerifyTypeConvertable( ExpNode left, ExpNode right )
public static bool VerifyTypeConvertable( ExpSyntaxNode left, ExpSyntaxNode right )
{
IExpElementSource tLeft = left.EqualityTypeConvert,
tRight = right.EqualityTypeConvert;
@@ -132,7 +132,7 @@ namespace StgSharp.Script.Express
return tLeft.IsConvertable( tRight );
}
private class ExpEmptyNode : ExpNode
private class ExpEmptyNode : ExpSyntaxNode
{
internal static readonly ExpEmptyNode _only = new();
@@ -144,9 +144,9 @@ namespace StgSharp.Script.Express
public override ExpInstantiableElement EqualityTypeConvert => ExpInstantiableElement.Void;
public override ExpNode Left => _only;
public override ExpSyntaxNode Left => _only;
public override ExpNode Right => _only;
public override ExpSyntaxNode Right => _only;
}