Daily update on 20250303-043627 by Nitload Youmu. Additional Message : remove node dependency to context, node instance ctor switched to factory mode,

Signed-off-by: Nitload <YoumuLiu_NSI@whv0t.onmicrosoft.com>
This commit is contained in:
Nitload
2025-03-03 04:36:27 +08:00
parent d12bbbd873
commit 825e68853c
26 changed files with 440 additions and 238 deletions
+2 -2
View File
@@ -38,7 +38,7 @@ using System.Text;
namespace StgSharp.Script.Express
{
public sealed class ExpConstantCollectionSource : ExpImmutableElementBase
public sealed class ExpConstantCollectionSource : ExpImmutableElement
{
private Dictionary<string, ExpElementInstanceBase> _constants;
@@ -66,7 +66,7 @@ namespace StgSharp.Script.Express
throw new NotImplementedException();
}
public override ExpBaseNode MakeReference( params object[] options )
public override ExpNode MakeReference( params object[] options )
{
if( options.Length == 0 || options[ 0 ] is not string str ) {
return null!;
+7 -13
View File
@@ -34,25 +34,24 @@ using System.Text;
namespace StgSharp.Script.Express
{
public class ExpEntity : ExpBaseNode
public class ExpEntity : ExpNode
{
public ExpEntity( string name, ExpSchema context )
: base( name, context ) { }
public ExpEntity( string name, ExpSchema context ) : base( name ) { }
public override ExpBaseNode Left => throw new NotImplementedException();
public override ExpNode Left => throw new NotImplementedException();
public override ExpBaseNode Right => throw new NotImplementedException();
public override ExpNode Right => throw new NotImplementedException();
public override IExpElementSource EqualityTypeConvert => throw new NotImplementedException(
);
}
public class ExpEntitySource : ExpInstantiableElementBase
public class ExpEntitySource : ExpInstantiableElement
{
private AbstractSyntaxTree<ExpBaseNode, IExpElementSource> _expressionTree;
private AbstractSyntaxTree<ExpNode, IExpElementSource> _expressionTree;
private ScriptSourceTransmitter _source;
private string _name;
@@ -73,12 +72,7 @@ namespace StgSharp.Script.Express
throw new NotImplementedException();
}
public override ExpBaseNode CreateInstanceNode()
{
throw new NotImplementedException();
}
public override bool IsConvertable( IExpElementSource targetType )
public override ExpNode CreateInstanceNode()
{
throw new NotImplementedException();
}
+13 -14
View File
@@ -34,32 +34,31 @@ using System.Text;
namespace StgSharp.Script.Express
{
public class ExpFunction : ExpBaseNode
public class ExpFunction : ExpNode
{
private readonly ExpBaseNode _return;
private ExpFunctionSource _source;
private readonly List<KeyValuePair<string, ExpBaseNode>> _parameterList
= new List<KeyValuePair<string, ExpBaseNode>>();
public ExpFunction( string name, ExpSchema context )
: base( name, context ) { }
private readonly ExpNode _return;
private readonly List<KeyValuePair<string, ExpNode>> _parameterList
= new List<KeyValuePair<string, ExpNode>>();
public override ExpBaseNode Left => throw new NotImplementedException();
public override ExpBaseNode Right => throw new NotImplementedException();
public ExpFunction( string name, ExpSchema context ) : base( name ) { }
public ExpElementType ElementType => ExpElementType.Function;
public override ExpInstantiableElementBase EqualityTypeConvert => throw new NotImplementedException(
public override ExpInstantiableElement EqualityTypeConvert => throw new NotImplementedException(
);
public void CallThisFunction( params ExpBaseNode[] parameters ) { }
public override ExpNode Left => throw new NotImplementedException();
public override ExpNode Right => throw new NotImplementedException();
public void CallThisFunction( params ExpNode[] parameters ) { }
}
public class ExpFunctionSource : ExpImmutableElementBase
public class ExpFunctionSource : ExpImmutableElement
{
private ScriptSourceTransmitter _transmitter;
@@ -95,7 +94,7 @@ namespace StgSharp.Script.Express
*/
}
public override ExpBaseNode MakeReference( params object[] options )
public override ExpNode MakeReference( params object[] options )
{
throw new NotImplementedException();
}
+8 -9
View File
@@ -41,23 +41,22 @@ namespace StgSharp.Script.Express
private ExpRuleSource _source;
public ExpRule( string name, ExpSchema context )
: base( name, context ) { }
public ExpRule( string name, ExpSchema context ) : base( name ) { }
public object? value => throw new NotImplementedException();
public override ExpBaseNode Left => throw new NotImplementedException();
public override ExpBaseNode Right => throw new NotImplementedException();
public override ExpInstantiableElementBase EqualityTypeConvert => throw new NotImplementedException(
public override ExpInstantiableElement EqualityTypeConvert => throw new NotImplementedException(
);
public override ExpNode Left => throw new NotImplementedException();
public override ExpNode Right => throw new NotImplementedException();
public override string TypeName => _source.Name;
}
public class ExpRuleSource : ExpImmutableElementBase
public class ExpRuleSource : ExpImmutableElement
{
private ScriptSourceTransmitter _transmitter;
@@ -80,7 +79,7 @@ namespace StgSharp.Script.Express
throw new NotImplementedException();
}
public override ExpBaseNode MakeReference( params object[] options )
public override ExpNode MakeReference( params object[] options )
{
throw new NotImplementedException();
}
+37 -8
View File
@@ -35,19 +35,18 @@ using System.Collections.Generic;
namespace StgSharp.Script.Express
{
public class ExpType : ExpElementInstanceBase
public class ExpTypeInstance : ExpElementInstanceBase
{
public ExpType( string name, ExpSchema context )
: base( name, context ) { }
public ExpTypeInstance( string name ) : base( name ) { }
public override ExpBaseNode Left => throw new NotImplementedException();
public override ExpBaseNode Right => throw new NotImplementedException();
public override IExpElementSource EqualityTypeConvert => throw new NotImplementedException(
public override ExpInstantiableElement EqualityTypeConvert => throw new NotImplementedException(
);
public override ExpNode Left => throw new NotImplementedException();
public override ExpNode Right => throw new NotImplementedException();
public override string TypeName => throw new NotImplementedException();
}
@@ -80,6 +79,11 @@ namespace StgSharp.Script.Express
public ExpElementType ElementType => ExpElementType.Type;
public ExpTypeSource Void
{
get => ExpVoidType.Only;
}
public IScriptSourceProvider SourceProvider => _transmitter;
public string Name => _name;
@@ -94,5 +98,30 @@ namespace StgSharp.Script.Express
throw new NotImplementedException();
}
public static bool IsNullOrVoid( IExpElementSource type )
{
return type == null || type == ExpVoidType.Only;
}
private class ExpVoidType : ExpTypeSource
{
private static readonly ExpVoidType _onlyInstance = new ExpVoidType(
);
private ExpVoidType() : base( string.Empty ) { }
public static ExpVoidType Only
{
get => _onlyInstance;
}
public override void Analyse()
{
return;
}
}
}
}