daily update on 20250210 by nitload youmu

This commit is contained in:
Nitload
2025-02-10 12:48:02 +08:00
parent ae94c265ae
commit c23b640cae
70 changed files with 2135 additions and 805 deletions
@@ -38,28 +38,24 @@ namespace StgSharp.Script.Express
{
public class ExpConstantCollectionSource : IExpImmutableElement
{
private IScriptSourceProvider _sourceProvider;
private Dictionary<string, ExpElementInstanceBase> _constants;
private IScriptSourceProvider _sourceProvider;
public ExpConstantCollectionSource(
IScriptSourceProvider sourceProvider )
{
_sourceProvider = sourceProvider;
_constants = new Dictionary<string, ExpElementInstanceBase>(
ExpCompile.Multiplexer);
ExpCompile.Multiplexer );
}
internal void AddConstant(string name, ExpElementInstanceBase value)
{
_constants.Add(name, value);
}
public static Dictionary<string, ExpElementInstanceBase> BuiltinConst => ExpCompile.BuiltinConst;
public ExpElementType ElementType => ExpElementType.Const;
public IScriptSourceProvider SourceProvider => _sourceProvider;
public static Dictionary<string, ExpElementInstanceBase> BuiltinConst => ExpCompile.BuiltinConst;
public string Name
{
get => ExpCompile.KeyWord.Constant;
@@ -70,26 +66,32 @@ namespace StgSharp.Script.Express
throw new NotImplementedException();
}
public ExpToken MakeReference(params object[] options)
public ExpToken MakeReference( params object[] options )
{
if (options.Length == 0 || options[0] is not string str)
{
if( options.Length == 0 || options[ 0 ] is not string str ) {
return null!;
}
if (_constants.Count == 0)
{
if( _constants.Count == 0 ) {
return null!;
}
if (_constants.TryGetValue(str, out var token))
{
if( _constants.TryGetValue( str,
out ExpElementInstanceBase? token ) ) {
return token;
}
return null!;
}
public bool TryGetConstant(string name, out ExpElementInstanceBase instance)
public bool TryGetConstant(
string name,
out ExpElementInstanceBase instance )
{
return _constants.TryGetValue(name, out instance);
return _constants.TryGetValue( name, out instance );
}
internal void AddConstant( string name, ExpElementInstanceBase value )
{
_constants.Add( name, value );
}
}
}
@@ -37,10 +37,8 @@ namespace StgSharp.Script.Express
public class ExpEntity : ExpToken
{
public ExpEntity( string name ,ExpSchema context):
base(name, context)
{
}
public ExpEntity( string name, ExpSchema context )
: base( name, context ) { }
}
@@ -72,5 +70,6 @@ namespace StgSharp.Script.Express
{
throw new NotImplementedException();
}
}
}
@@ -36,13 +36,14 @@ namespace StgSharp.Script.Express
{
public class ExpFunction : ExpToken
{
private ExpFunctionSource _source;
private readonly ExpToken _return;
private readonly List<KeyValuePair<string, ExpToken>> _parameterList
= new List<KeyValuePair<string, ExpToken>>();
public ExpFunction(string name, ExpSchema context) : base(name, context)
{ }
public ExpFunction( string name, ExpSchema context )
: base( name, context ) { }
public ExpElementType ElementType => ExpElementType.Function;
@@ -75,9 +76,10 @@ namespace StgSharp.Script.Express
throw new NotImplementedException();
}
public ExpToken MakeReference(params object[] options)
public ExpToken MakeReference( params object[] options )
{
throw new NotImplementedException();
}
}
}
@@ -37,15 +37,16 @@ namespace StgSharp.Script.Express
{
public class ExpRule : ExpElementInstanceBase
{
private ExpRuleSource _source;
public ExpRule(string name, ExpSchema context) : base(name,context)
{
}
public ExpRule( string name, ExpSchema context )
: base( name, context ) { }
public object? value => throw new NotImplementedException();
public override string TypeName => _source.Name;
}
public class ExpRuleSource : IExpImmutableElement
@@ -71,9 +72,10 @@ namespace StgSharp.Script.Express
throw new NotImplementedException();
}
public ExpToken MakeReference(params object[] options)
public ExpToken MakeReference( params object[] options )
{
throw new NotImplementedException();
}
}
}
@@ -37,14 +37,12 @@ namespace StgSharp.Script.Express
{
public class ExpType : ExpElementInstanceBase
{
public ExpType( string name, ExpSchema context )
: base( name, context ) { }
public override string TypeName => throw new NotImplementedException();
public ExpType(string name, ExpSchema context) : base(name, context)
{
}
}
public class ExpTypeSource : IExpElementSource