daily update on 20250214 by nitload youmu, building syntax analysor, tough!

This commit is contained in:
Nitload
2025-02-14 13:30:17 +08:00
parent c23b640cae
commit ccef0de6f6
68 changed files with 2594 additions and 913 deletions
@@ -30,13 +30,15 @@
//-----------------------------------------------------------------------
using System;
using System.Collections;
using System.Collections.Frozen;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Runtime.CompilerServices;
using System.Text;
namespace StgSharp.Script.Express
{
public class ExpConstantCollectionSource : IExpImmutableElement
public sealed class ExpConstantCollectionSource : ExpImmutableElementBase
{
private Dictionary<string, ExpElementInstanceBase> _constants;
@@ -50,23 +52,23 @@ namespace StgSharp.Script.Express
ExpCompile.Multiplexer );
}
public static Dictionary<string, ExpElementInstanceBase> BuiltinConst => ExpCompile.BuiltinConst;
public override ExpElementType ElementType => ExpElementType.Const;
public ExpElementType ElementType => ExpElementType.Const;
public static FrozenDictionary<string, ExpElementInstanceBase> BuiltinConst => ExpCompile.BuiltinConst;
public IScriptSourceProvider SourceProvider => _sourceProvider;
public override IScriptSourceProvider SourceProvider => _sourceProvider;
public string Name
public override string Name
{
get => ExpCompile.KeyWord.Constant;
}
public virtual void Analyse()
public override void Analyse()
{
throw new NotImplementedException();
}
public ExpToken MakeReference( params object[] options )
public override ExpToken MakeReference( params object[] options )
{
if( options.Length == 0 || options[ 0 ] is not string str ) {
return null!;
@@ -40,9 +40,22 @@ namespace StgSharp.Script.Express
public ExpEntity( string name, ExpSchema context )
: base( name, context ) { }
public override ExpToken Left => throw new NotImplementedException();
public override ExpToken Right => throw new NotImplementedException();
public override ExpToken Next
{
get => throw new NotImplementedException();
set => throw new NotImplementedException();
}
public override IExpElementSource EqualityTypeConvert => throw new NotImplementedException(
);
}
public class ExpEntitySource : IExpInstantiableElement
public class ExpEntitySource : ExpInstantiableElementBase
{
private ExpExpressionTree _expressionTree;
@@ -55,18 +68,23 @@ namespace StgSharp.Script.Express
_source = provider;
}
public ExpElementType ElementType => ExpElementType.Entity;
public override ExpElementType ElementType => ExpElementType.Entity;
public IScriptSourceProvider SourceProvider => _source;
public override IScriptSourceProvider SourceProvider => _source;
public string Name => _name;
public override string Name => _name;
public void Analyse()
public override void Analyse()
{
throw new NotImplementedException();
}
public ExpToken CreateInstanceToken()
public override ExpToken CreateInstanceToken()
{
throw new NotImplementedException();
}
public override bool IsConvertable( IExpElementSource targetType )
{
throw new NotImplementedException();
}
@@ -47,11 +47,24 @@ namespace StgSharp.Script.Express
public ExpElementType ElementType => ExpElementType.Function;
public override ExpToken Left => throw new NotImplementedException();
public override ExpToken Next
{
get => throw new NotImplementedException();
set => throw new NotImplementedException();
}
public override ExpToken Right => throw new NotImplementedException();
public override IExpElementSource EqualityTypeConvert => throw new NotImplementedException(
);
public void CallThisFunction( params ExpToken[] parameters ) { }
}
public class ExpFunctionSource : IExpImmutableElement
public class ExpFunctionSource : ExpImmutableElementBase
{
private ScriptSourceTransmitter _transmitter;
@@ -65,18 +78,18 @@ namespace StgSharp.Script.Express
_transmitter = transmitter;
}
public ExpElementType ElementType => ExpElementType.Function;
public override ExpElementType ElementType => ExpElementType.Function;
public IScriptSourceProvider SourceProvider => _transmitter;
public override IScriptSourceProvider SourceProvider => _transmitter;
public string Name => _name;
public override string Name => _name;
public void Analyse()
public override void Analyse()
{
throw new NotImplementedException();
}
public ExpToken MakeReference( params object[] options )
public override ExpToken MakeReference( params object[] options )
{
throw new NotImplementedException();
}
@@ -31,6 +31,7 @@
using System;
using System.Collections.Generic;
using System.Data;
using System.Reflection.Metadata.Ecma335;
using System.Text;
namespace StgSharp.Script.Express
@@ -45,11 +46,24 @@ namespace StgSharp.Script.Express
public object? value => throw new NotImplementedException();
public override ExpToken Left => throw new NotImplementedException();
public override ExpToken Next
{
get => null!;
set { }
}
public override ExpToken Right => throw new NotImplementedException();
public override IExpElementSource EqualityTypeConvert => throw new NotImplementedException(
);
public override string TypeName => _source.Name;
}
public class ExpRuleSource : IExpImmutableElement
public class ExpRuleSource : ExpImmutableElementBase
{
private ScriptSourceTransmitter _transmitter;
@@ -61,18 +75,18 @@ namespace StgSharp.Script.Express
_transmitter = transmitter;
}
public ExpElementType ElementType => ExpElementType.Rule;
public override ExpElementType ElementType => ExpElementType.Rule;
public IScriptSourceProvider SourceProvider => _transmitter;
public override IScriptSourceProvider SourceProvider => _transmitter;
public string Name => _name;
public override string Name => _name;
public void Analyse()
public override void Analyse()
{
throw new NotImplementedException();
}
public ExpToken MakeReference( params object[] options )
public override ExpToken MakeReference( params object[] options )
{
throw new NotImplementedException();
}
@@ -41,6 +41,19 @@ namespace StgSharp.Script.Express
public ExpType( string name, ExpSchema context )
: base( name, context ) { }
public override ExpToken Left => throw new NotImplementedException();
public override ExpToken Next
{
get => throw new NotImplementedException();
set => throw new NotImplementedException();
}
public override ExpToken Right => throw new NotImplementedException();
public override IExpElementSource EqualityTypeConvert => throw new NotImplementedException(
);
public override string TypeName => throw new NotImplementedException();
}
@@ -68,5 +81,10 @@ namespace StgSharp.Script.Express
throw new NotImplementedException();
}
public bool IsConvertable( IExpElementSource targetType )
{
throw new NotImplementedException();
}
}
}