Daily update on 20250302-043034 by Nitload Youmu.
Signed-off-by: Nitload <YoumuLiu_NSI@whv0t.onmicrosoft.com>
This commit is contained in:
@@ -1,17 +1,17 @@
|
|||||||
{
|
{
|
||||||
"format": 1,
|
"format": 1,
|
||||||
"restore": {
|
"restore": {
|
||||||
"D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\内核源代码\\StgSgharp.Generator\\StgSharp.Generator.csproj": {}
|
"D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\内核源代码\\StgSharp.Generator\\StgSharp.Generator.csproj": {}
|
||||||
},
|
},
|
||||||
"projects": {
|
"projects": {
|
||||||
"D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\内核源代码\\StgSgharp.Generator\\StgSharp.Generator.csproj": {
|
"D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\内核源代码\\StgSharp.Generator\\StgSharp.Generator.csproj": {
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"restore": {
|
"restore": {
|
||||||
"projectUniqueName": "D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\内核源代码\\StgSgharp.Generator\\StgSharp.Generator.csproj",
|
"projectUniqueName": "D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\内核源代码\\StgSharp.Generator\\StgSharp.Generator.csproj",
|
||||||
"projectName": "StgSharp.Generator",
|
"projectName": "StgSharp.Generator",
|
||||||
"projectPath": "D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\内核源代码\\StgSgharp.Generator\\StgSharp.Generator.csproj",
|
"projectPath": "D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\内核源代码\\StgSharp.Generator\\StgSharp.Generator.csproj",
|
||||||
"packagesPath": "C:\\Users\\Youmu\\.nuget\\packages\\",
|
"packagesPath": "C:\\Users\\Youmu\\.nuget\\packages\\",
|
||||||
"outputPath": "D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\内核源代码\\StgSgharp.Generator\\obj\\",
|
"outputPath": "D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\内核源代码\\StgSharp.Generator\\obj\\",
|
||||||
"projectStyle": "PackageReference",
|
"projectStyle": "PackageReference",
|
||||||
"fallbackFolders": [
|
"fallbackFolders": [
|
||||||
"C:\\Program Files (x86)\\Microsoft Visual Studio\\Shared\\NuGetPackages"
|
"C:\\Program Files (x86)\\Microsoft Visual Studio\\Shared\\NuGetPackages"
|
||||||
|
|||||||
@@ -962,11 +962,11 @@
|
|||||||
"project": {
|
"project": {
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"restore": {
|
"restore": {
|
||||||
"projectUniqueName": "D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\内核源代码\\StgSgharp.Generator\\StgSharp.Generator.csproj",
|
"projectUniqueName": "D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\内核源代码\\StgSharp.Generator\\StgSharp.Generator.csproj",
|
||||||
"projectName": "StgSharp.Generator",
|
"projectName": "StgSharp.Generator",
|
||||||
"projectPath": "D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\内核源代码\\StgSgharp.Generator\\StgSharp.Generator.csproj",
|
"projectPath": "D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\内核源代码\\StgSharp.Generator\\StgSharp.Generator.csproj",
|
||||||
"packagesPath": "C:\\Users\\Youmu\\.nuget\\packages\\",
|
"packagesPath": "C:\\Users\\Youmu\\.nuget\\packages\\",
|
||||||
"outputPath": "D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\内核源代码\\StgSgharp.Generator\\obj\\",
|
"outputPath": "D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\内核源代码\\StgSharp.Generator\\obj\\",
|
||||||
"projectStyle": "PackageReference",
|
"projectStyle": "PackageReference",
|
||||||
"fallbackFolders": [
|
"fallbackFolders": [
|
||||||
"C:\\Program Files (x86)\\Microsoft Visual Studio\\Shared\\NuGetPackages"
|
"C:\\Program Files (x86)\\Microsoft Visual Studio\\Shared\\NuGetPackages"
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ using System.Reflection;
|
|||||||
[assembly: System.Reflection.AssemblyCompanyAttribute("StgSharp.Generator")]
|
[assembly: System.Reflection.AssemblyCompanyAttribute("StgSharp.Generator")]
|
||||||
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
||||||
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
||||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+0aa052a17e1a5043fd6dc660caa41645c478bc77")]
|
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+b4b90da372efaff79c7c1c950ce22e7bb13223cb")]
|
||||||
[assembly: System.Reflection.AssemblyProductAttribute("StgSharp.Generator")]
|
[assembly: System.Reflection.AssemblyProductAttribute("StgSharp.Generator")]
|
||||||
[assembly: System.Reflection.AssemblyTitleAttribute("StgSharp.Generator")]
|
[assembly: System.Reflection.AssemblyTitleAttribute("StgSharp.Generator")]
|
||||||
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ using System.Text;
|
|||||||
|
|
||||||
namespace StgSharp.Script.Express
|
namespace StgSharp.Script.Express
|
||||||
{
|
{
|
||||||
public abstract class ExpCollectionBase : IExpElementSource, IEnumerable<ExpElementInstanceBase>
|
public abstract class ExpCollectionBase : ExpInstantiableElementBase, IEnumerable<ExpElementInstanceBase>
|
||||||
{
|
{
|
||||||
|
|
||||||
protected internal string _accurateType;
|
protected internal string _accurateType;
|
||||||
@@ -47,39 +47,38 @@ namespace StgSharp.Script.Express
|
|||||||
_accurateType = accurateType;
|
_accurateType = accurateType;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ExpElementType ElementType => ExpElementType.Collection;
|
public override ExpElementType ElementType => ExpElementType.Collection;
|
||||||
|
|
||||||
public abstract int Count
|
public abstract int Count
|
||||||
{
|
{
|
||||||
get;
|
get;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override sealed IScriptSourceProvider SourceProvider => ScriptSourceTransmitter.Empty;
|
||||||
|
|
||||||
public string MemberType
|
public string MemberType
|
||||||
{
|
{
|
||||||
get => _accurateType;
|
get => _accurateType;
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract string Name
|
public override void Analyse()
|
||||||
{
|
|
||||||
get;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Analyse()
|
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract IEnumerator<ExpElementInstanceBase> GetEnumerator();
|
public abstract IEnumerator<ExpElementInstanceBase> GetEnumerator();
|
||||||
|
|
||||||
public abstract bool IsConvertable( IExpElementSource targetType );
|
public override sealed bool IsConvertable(
|
||||||
|
ExpInstantiableElementBase targetType )
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
IEnumerator IEnumerable.GetEnumerator()
|
IEnumerator IEnumerable.GetEnumerator()
|
||||||
{
|
{
|
||||||
return GetEnumerator();
|
return GetEnumerator();
|
||||||
}
|
}
|
||||||
|
|
||||||
IScriptSourceProvider IExpElementSource.SourceProvider => null!;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class ExpArray : ExpCollectionBase
|
public class ExpArray : ExpCollectionBase
|
||||||
@@ -106,17 +105,17 @@ namespace StgSharp.Script.Express
|
|||||||
|
|
||||||
public override string Name => ExpCompile.PoolString( "ARRAY" );
|
public override string Name => ExpCompile.PoolString( "ARRAY" );
|
||||||
|
|
||||||
|
public override ExpBaseNode CreateInstanceNode()
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
public override IEnumerator<ExpElementInstanceBase> GetEnumerator()
|
public override IEnumerator<ExpElementInstanceBase> GetEnumerator()
|
||||||
{
|
{
|
||||||
return ( ( IEnumerable<ExpElementInstanceBase> )_collection )
|
return ( ( IEnumerable<ExpElementInstanceBase> )_collection )
|
||||||
.GetEnumerator();
|
.GetEnumerator();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool IsConvertable( IExpElementSource targetType )
|
|
||||||
{
|
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class ExpBag : ExpCollectionBase
|
public class ExpBag : ExpCollectionBase
|
||||||
@@ -131,16 +130,16 @@ namespace StgSharp.Script.Express
|
|||||||
|
|
||||||
public override string Name => ExpCompile.PoolString( "BAG" );
|
public override string Name => ExpCompile.PoolString( "BAG" );
|
||||||
|
|
||||||
|
public override ExpBaseNode CreateInstanceNode()
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
public override IEnumerator<ExpElementInstanceBase> GetEnumerator()
|
public override IEnumerator<ExpElementInstanceBase> GetEnumerator()
|
||||||
{
|
{
|
||||||
return _collection.GetEnumerator();
|
return _collection.GetEnumerator();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool IsConvertable( IExpElementSource targetType )
|
|
||||||
{
|
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public sealed class ExpList : ExpCollectionBase
|
public sealed class ExpList : ExpCollectionBase
|
||||||
@@ -155,16 +154,16 @@ namespace StgSharp.Script.Express
|
|||||||
|
|
||||||
public override string Name => ExpCompile.PoolString( "LIST" );
|
public override string Name => ExpCompile.PoolString( "LIST" );
|
||||||
|
|
||||||
|
public override ExpBaseNode CreateInstanceNode()
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
public override IEnumerator<ExpElementInstanceBase> GetEnumerator()
|
public override IEnumerator<ExpElementInstanceBase> GetEnumerator()
|
||||||
{
|
{
|
||||||
return _collection.GetEnumerator();
|
return _collection.GetEnumerator();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool IsConvertable( IExpElementSource targetType )
|
|
||||||
{
|
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class ExpSet : ExpCollectionBase
|
public class ExpSet : ExpCollectionBase
|
||||||
@@ -187,6 +186,11 @@ namespace StgSharp.Script.Express
|
|||||||
_collection.Add( token );
|
_collection.Add( token );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override ExpBaseNode CreateInstanceNode()
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
public override sealed IEnumerator<ExpElementInstanceBase> GetEnumerator(
|
public override sealed IEnumerator<ExpElementInstanceBase> GetEnumerator(
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@@ -194,10 +198,5 @@ namespace StgSharp.Script.Express
|
|||||||
.GetEnumerator();
|
.GetEnumerator();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool IsConvertable( IExpElementSource targetType )
|
|
||||||
{
|
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ namespace StgSharp.Script.Express
|
|||||||
|
|
||||||
public override ExpCollectionBase CollectionValue => _collection;
|
public override ExpCollectionBase CollectionValue => _collection;
|
||||||
|
|
||||||
public override IExpElementSource EqualityTypeConvert => throw new NotImplementedException(
|
public override ExpInstantiableElementBase EqualityTypeConvert => throw new NotImplementedException(
|
||||||
);
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -94,7 +94,7 @@ namespace StgSharp.Script.Express
|
|||||||
|
|
||||||
public override ExpCollectionBase CollectionValue => _collection;
|
public override ExpCollectionBase CollectionValue => _collection;
|
||||||
|
|
||||||
public override IExpElementSource EqualityTypeConvert => throw new NotImplementedException(
|
public override ExpInstantiableElementBase EqualityTypeConvert => throw new NotImplementedException(
|
||||||
);
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -112,7 +112,7 @@ namespace StgSharp.Script.Express
|
|||||||
|
|
||||||
public override ExpCollectionBase CollectionValue => _collection;
|
public override ExpCollectionBase CollectionValue => _collection;
|
||||||
|
|
||||||
public override IExpElementSource EqualityTypeConvert => throw new NotImplementedException(
|
public override ExpInstantiableElementBase EqualityTypeConvert => throw new NotImplementedException(
|
||||||
);
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -133,7 +133,7 @@ namespace StgSharp.Script.Express
|
|||||||
|
|
||||||
public override ExpCollectionBase CollectionValue => _collection;
|
public override ExpCollectionBase CollectionValue => _collection;
|
||||||
|
|
||||||
public override IExpElementSource EqualityTypeConvert => _collection;
|
public override ExpInstantiableElementBase EqualityTypeConvert => _collection;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ namespace StgSharp.Script.Express
|
|||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override ExpBaseNode CreateInstanceToken()
|
public override ExpBaseNode CreateInstanceNode()
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ namespace StgSharp.Script.Express
|
|||||||
|
|
||||||
public ExpElementType ElementType => ExpElementType.Function;
|
public ExpElementType ElementType => ExpElementType.Function;
|
||||||
|
|
||||||
public override IExpElementSource EqualityTypeConvert => throw new NotImplementedException(
|
public override ExpInstantiableElementBase EqualityTypeConvert => throw new NotImplementedException(
|
||||||
);
|
);
|
||||||
|
|
||||||
public void CallThisFunction( params ExpBaseNode[] parameters ) { }
|
public void CallThisFunction( params ExpBaseNode[] parameters ) { }
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ namespace StgSharp.Script.Express
|
|||||||
|
|
||||||
public override ExpBaseNode Right => throw new NotImplementedException();
|
public override ExpBaseNode Right => throw new NotImplementedException();
|
||||||
|
|
||||||
public override IExpElementSource EqualityTypeConvert => throw new NotImplementedException(
|
public override ExpInstantiableElementBase EqualityTypeConvert => throw new NotImplementedException(
|
||||||
);
|
);
|
||||||
|
|
||||||
public override string TypeName => _source.Name;
|
public override string TypeName => _source.Name;
|
||||||
|
|||||||
@@ -0,0 +1,128 @@
|
|||||||
|
//-----------------------------------------------------------------------
|
||||||
|
//-----------------------------------------------------------------------
|
||||||
|
// file="ExpTypeInstance.cs"
|
||||||
|
// Project: StgSharp
|
||||||
|
// AuthorGroup: Nitload Space
|
||||||
|
// Copyright (c) Nitload Space. All rights reserved.
|
||||||
|
//
|
||||||
|
// Permission is hereby granted, free of charge, to any person
|
||||||
|
// obtaining a copy of this software and associated documentation
|
||||||
|
// files (the ¡°Software¡±), to deal in the Software without restriction,
|
||||||
|
// including without limitation the rights to use, copy, modify, merge,
|
||||||
|
// publish, distribute, sublicense, and/or sell copies of the Software,
|
||||||
|
// and to permit persons to whom the Software is furnished to do so,
|
||||||
|
// subject to the following conditions:
|
||||||
|
//
|
||||||
|
// The above copyright notice and
|
||||||
|
// this permission notice shall be included in all copies
|
||||||
|
// or substantial portions of the Software.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED ¡°AS IS¡±,
|
||||||
|
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||||
|
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||||
|
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||||
|
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||||
|
// ARISING FROM, OUT OF OR IN CONNECTION WITH
|
||||||
|
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
//
|
||||||
|
//-----------------------------------------------------------------------
|
||||||
|
//-----------------------------------------------------------------------
|
||||||
|
using StgSharp.Script;
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace StgSharp.Script.Express
|
||||||
|
{
|
||||||
|
public class ExpTypeInstance : ExpElementInstanceBase
|
||||||
|
{
|
||||||
|
|
||||||
|
public ExpTypeInstance( string name, ExpSchema context )
|
||||||
|
: base( name, context ) { }
|
||||||
|
|
||||||
|
public override ExpBaseNode Left => throw new NotImplementedException();
|
||||||
|
|
||||||
|
public override ExpBaseNode Right => throw new NotImplementedException();
|
||||||
|
|
||||||
|
public override ExpInstantiableElementBase EqualityTypeConvert => throw new NotImplementedException(
|
||||||
|
);
|
||||||
|
|
||||||
|
public override string TypeName => throw new NotImplementedException();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public class ExpTypeSource : IExpElementSource
|
||||||
|
{
|
||||||
|
|
||||||
|
private ScriptSourceTransmitter _transmitter;
|
||||||
|
private string _name;
|
||||||
|
protected bool _isBuiltinType;
|
||||||
|
|
||||||
|
protected ExpTypeSource( string name )
|
||||||
|
{
|
||||||
|
_name = name;
|
||||||
|
_transmitter = ScriptSourceTransmitter.Empty;
|
||||||
|
_isBuiltinType = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ExpTypeSource( string name, ScriptSourceTransmitter transmitter )
|
||||||
|
{
|
||||||
|
_name = name;
|
||||||
|
_transmitter = transmitter;
|
||||||
|
_isBuiltinType = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool IsLanguageBuiltinType
|
||||||
|
{
|
||||||
|
get => _isBuiltinType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ExpElementType ElementType => ExpElementType.Type;
|
||||||
|
|
||||||
|
public ExpTypeSource Void
|
||||||
|
{
|
||||||
|
get => ExpVoidType.Only;
|
||||||
|
}
|
||||||
|
|
||||||
|
public IScriptSourceProvider SourceProvider => _transmitter;
|
||||||
|
|
||||||
|
public string Name => _name;
|
||||||
|
|
||||||
|
public virtual void Analyse()
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool IsConvertable( IExpElementSource targetType )
|
||||||
|
{
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -116,6 +116,11 @@ namespace StgSharp.Script.Express
|
|||||||
return new ExpNodeNextEnumerator( this );
|
return new ExpNodeNextEnumerator( this );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static bool IsNullOrEmpty( ExpBaseNode node )
|
||||||
|
{
|
||||||
|
return node == ExpEmptyNode._only || node == null;
|
||||||
|
}
|
||||||
|
|
||||||
public static bool VerifyTypeConvertable(
|
public static bool VerifyTypeConvertable(
|
||||||
ExpBaseNode left,
|
ExpBaseNode left,
|
||||||
ExpBaseNode right )
|
ExpBaseNode right )
|
||||||
@@ -149,8 +154,7 @@ namespace StgSharp.Script.Express
|
|||||||
|
|
||||||
public override ExpBaseNode Right => _only;
|
public override ExpBaseNode Right => _only;
|
||||||
|
|
||||||
public override IExpElementSource EqualityTypeConvert => throw new NotImplementedException(
|
public override ExpInstantiableElementBase EqualityTypeConvert => ExpInstantiableElementBase.Void;
|
||||||
);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ namespace StgSharp.Script.Express
|
|||||||
|
|
||||||
private ExpBaseNode _left;
|
private ExpBaseNode _left;
|
||||||
private ExpBaseNode _right;
|
private ExpBaseNode _right;
|
||||||
private ExpTypeSource _returnType;
|
private ExpInstantiableElementBase _returnType;
|
||||||
|
|
||||||
public ExpBinaryOperatorNode( string name ) : base( name, null! ) { }
|
public ExpBinaryOperatorNode( string name ) : base( name, null! ) { }
|
||||||
|
|
||||||
@@ -66,7 +66,7 @@ namespace StgSharp.Script.Express
|
|||||||
|
|
||||||
public override ExpBaseNode Right => _right;
|
public override ExpBaseNode Right => _right;
|
||||||
|
|
||||||
public override IExpElementSource EqualityTypeConvert => _returnType;
|
public override ExpInstantiableElementBase EqualityTypeConvert => _returnType;
|
||||||
|
|
||||||
public static ExpBinaryOperatorNode Add(
|
public static ExpBinaryOperatorNode Add(
|
||||||
ExpBaseNode left,
|
ExpBaseNode left,
|
||||||
@@ -87,6 +87,23 @@ namespace StgSharp.Script.Express
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static ExpBinaryOperatorNode Assign(
|
||||||
|
ExpBaseNode left,
|
||||||
|
ExpBaseNode right )
|
||||||
|
{
|
||||||
|
if( left.EqualityTypeConvert != right.EqualityTypeConvert ) {
|
||||||
|
throw new ExpInvalidTypeException(
|
||||||
|
left.EqualityTypeConvert.Name,
|
||||||
|
right.EqualityTypeConvert.Name );
|
||||||
|
}
|
||||||
|
return new ExpBinaryOperatorNode( ExpCompile.KeyWord.Assignment )
|
||||||
|
{
|
||||||
|
_returnType = ExpTypeSource.,
|
||||||
|
_nodeFlag = ExpNodeFlag.Operator_Binary | left._nodeFlag,
|
||||||
|
CodeConvertTemplate = "{0} & {1}",
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
public static ExpBinaryOperatorNode Div(
|
public static ExpBinaryOperatorNode Div(
|
||||||
ExpBaseNode left,
|
ExpBaseNode left,
|
||||||
ExpBaseNode right )
|
ExpBaseNode right )
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ namespace StgSharp.Script.Express
|
|||||||
|
|
||||||
public override ExpBaseNode Right => _parameter;
|
public override ExpBaseNode Right => _parameter;
|
||||||
|
|
||||||
public override IExpElementSource EqualityTypeConvert => throw new NotImplementedException(
|
public override ExpInstantiableElementBase EqualityTypeConvert => throw new NotImplementedException(
|
||||||
);
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -93,7 +93,7 @@ namespace StgSharp.Script.Express
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override ExpBaseNode Left => ExpBaseNode;
|
public override ExpBaseNode Left => Empty;
|
||||||
|
|
||||||
public override ExpBaseNode Right => throw new NotImplementedException();
|
public override ExpBaseNode Right => throw new NotImplementedException();
|
||||||
|
|
||||||
|
|||||||
@@ -40,15 +40,16 @@ namespace StgSharp.Script.Express
|
|||||||
public enum ExpElementType : int
|
public enum ExpElementType : int
|
||||||
{
|
{
|
||||||
|
|
||||||
Const = 0,
|
Void = 0,
|
||||||
Entity = 1,
|
Const = 1,
|
||||||
Type = 2,
|
Entity = 2,
|
||||||
Function = 4,
|
Type = 4,
|
||||||
Section = 8,
|
Function = 8,
|
||||||
Expression = 16,
|
Section = 16,
|
||||||
Rule = 32,
|
Expression = 32,
|
||||||
Procedure = 64,
|
Rule = 64,
|
||||||
Collection = 128 | Type,
|
Procedure = 128,
|
||||||
|
Collection = 256,
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -66,6 +66,11 @@ namespace StgSharp.Script.Express
|
|||||||
get;
|
get;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static ExpInstantiableElementBase Void
|
||||||
|
{
|
||||||
|
get => ExpVoidElement.Only;
|
||||||
|
}
|
||||||
|
|
||||||
public abstract IScriptSourceProvider SourceProvider
|
public abstract IScriptSourceProvider SourceProvider
|
||||||
{
|
{
|
||||||
get;
|
get;
|
||||||
@@ -78,9 +83,41 @@ namespace StgSharp.Script.Express
|
|||||||
|
|
||||||
public abstract void Analyse();
|
public abstract void Analyse();
|
||||||
|
|
||||||
public abstract ExpBaseNode CreateInstanceToken();
|
public abstract ExpBaseNode CreateInstanceNode();
|
||||||
|
|
||||||
public abstract bool IsConvertable( IExpElementSource targetType );
|
public abstract bool IsConvertable(
|
||||||
|
ExpInstantiableElementBase targetType );
|
||||||
|
|
||||||
|
private sealed class ExpVoidElement : ExpInstantiableElementBase
|
||||||
|
{
|
||||||
|
|
||||||
|
private static readonly ExpVoidElement _only = new ExpVoidElement();
|
||||||
|
|
||||||
|
public override ExpElementType ElementType => ExpElementType.Void;
|
||||||
|
|
||||||
|
public static ExpVoidElement Only => _only;
|
||||||
|
|
||||||
|
public override IScriptSourceProvider SourceProvider => ScriptSourceTransmitter.Empty;
|
||||||
|
|
||||||
|
public override string Name => "void";
|
||||||
|
|
||||||
|
public override void Analyse()
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override ExpBaseNode CreateInstanceNode()
|
||||||
|
{
|
||||||
|
return default!;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override bool IsConvertable(
|
||||||
|
ExpInstantiableElementBase targetType )
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -31,7 +31,9 @@
|
|||||||
using StgSharp.Collections;
|
using StgSharp.Collections;
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
using System.Collections;
|
||||||
using System.Collections.Frozen;
|
using System.Collections.Frozen;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
||||||
namespace StgSharp.Script.Express
|
namespace StgSharp.Script.Express
|
||||||
@@ -77,6 +79,8 @@ namespace StgSharp.Script.Express
|
|||||||
set;
|
set;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public IEnumerable<ExpSchema> IncludedSchema => IncludedSchema;
|
||||||
|
|
||||||
protected FrozenDictionary<string, ExpEntitySource> EntityDict
|
protected FrozenDictionary<string, ExpEntitySource> EntityDict
|
||||||
{
|
{
|
||||||
get;
|
get;
|
||||||
|
|||||||
@@ -51,8 +51,7 @@ namespace StgSharp.Script.Express
|
|||||||
|
|
||||||
public ExpTypeSource GetExpType( string typeName )
|
public ExpTypeSource GetExpType( string typeName )
|
||||||
{
|
{
|
||||||
if( ExpCompile.TryGetBuiltinType( typeName,
|
if( BuiltinSchema.TryGetType( typeName, out ExpTypeSource? ret ) ) {
|
||||||
out ExpTypeSource? ret ) ) {
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
if( TypeDict.TryGetValue( typeName, out ret ) ) {
|
if( TypeDict.TryGetValue( typeName, out ret ) ) {
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ using System.Reflection;
|
|||||||
[assembly: System.Reflection.AssemblyCompanyAttribute("StgSharp.Script")]
|
[assembly: System.Reflection.AssemblyCompanyAttribute("StgSharp.Script")]
|
||||||
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
||||||
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
||||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+83bde12d2227bf32a3b939e94849bbd7273bad21")]
|
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+b4b90da372efaff79c7c1c950ce22e7bb13223cb")]
|
||||||
[assembly: System.Reflection.AssemblyProductAttribute("StgSharp.Script")]
|
[assembly: System.Reflection.AssemblyProductAttribute("StgSharp.Script")]
|
||||||
[assembly: System.Reflection.AssemblyTitleAttribute("StgSharp.Script")]
|
[assembly: System.Reflection.AssemblyTitleAttribute("StgSharp.Script")]
|
||||||
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
||||||
|
|||||||
Reference in New Issue
Block a user