Daily update on 20250325-164701 by Nitload Youmu. Additional Message : Lineaar line and multi-linear line compile full function. String literal parsing improve.
Signed-off-by: Nitload <YoumuLiu_NSI@whv0t.onmicrosoft.com>
This commit is contained in:
@@ -42,14 +42,13 @@ namespace StgSharp.Script.Express
|
||||
public sealed class ExpConstantCollectionSource : ExpImmutableElement
|
||||
{
|
||||
|
||||
private Dictionary<string, ExpElementInstanceBase> _constants;
|
||||
private Dictionary<string, ExpElementInstance> _constants;
|
||||
private IScriptSourceProvider _sourceProvider;
|
||||
|
||||
public ExpConstantCollectionSource( IScriptSourceProvider sourceProvider )
|
||||
{
|
||||
_sourceProvider = sourceProvider;
|
||||
_constants = new Dictionary<string, ExpElementInstanceBase>(
|
||||
ExpressCompile.Multiplexer );
|
||||
_constants = new Dictionary<string, ExpElementInstance>( ExpressCompile.Multiplexer );
|
||||
}
|
||||
|
||||
public override ExpElementType ElementType => ExpElementType.Const;
|
||||
@@ -74,20 +73,20 @@ namespace StgSharp.Script.Express
|
||||
if( _constants.Count == 0 ) {
|
||||
return null!;
|
||||
}
|
||||
if( _constants.TryGetValue( str, out ExpElementInstanceBase? token ) ) {
|
||||
if( _constants.TryGetValue( str, out ExpElementInstance? token ) ) {
|
||||
return token;
|
||||
}
|
||||
return null!;
|
||||
}
|
||||
|
||||
public bool TryGetConstant( string name, out ExpElementInstanceBase instance )
|
||||
public bool TryGetConstant( string name, out ExpElementInstance instance )
|
||||
{
|
||||
return _constants.TryGetValue( name, out instance );
|
||||
}
|
||||
|
||||
public override bool TryGetMember( string name, out ExpNode memberNode )
|
||||
{
|
||||
if( _constants.TryGetValue( name, out ExpElementInstanceBase? node ) )
|
||||
if( _constants.TryGetValue( name, out ExpElementInstance? node ) )
|
||||
{
|
||||
memberNode = node;
|
||||
return true;
|
||||
@@ -96,7 +95,7 @@ namespace StgSharp.Script.Express
|
||||
return false;
|
||||
}
|
||||
|
||||
internal void AddConstant( string name, ExpElementInstanceBase value )
|
||||
internal void AddConstant( string name, ExpElementInstance value )
|
||||
{
|
||||
_constants.Add( name, value );
|
||||
}
|
||||
|
||||
@@ -40,25 +40,17 @@ namespace StgSharp.Script.Express
|
||||
private ScriptSourceTransmitter _transmitter;
|
||||
private string _name;
|
||||
|
||||
public ExpFunctionSource(
|
||||
string name,
|
||||
ScriptSourceTransmitter transmitter )
|
||||
public ExpFunctionSource( string name, ScriptSourceTransmitter transmitter )
|
||||
{
|
||||
_name = name;
|
||||
_transmitter = transmitter;
|
||||
}
|
||||
|
||||
public Dictionary<string, ExpElementInstanceBase> FuncParams
|
||||
{
|
||||
get;
|
||||
init;
|
||||
} = new Dictionary<string, ExpElementInstanceBase>();
|
||||
public Dictionary<string, ExpElementInstance> FuncParams { get; init; } = new Dictionary<string, ExpElementInstance>(
|
||||
);
|
||||
|
||||
public Dictionary<string, ExpElementInstanceBase> LocalVariables
|
||||
{
|
||||
get;
|
||||
init;
|
||||
} = new Dictionary<string, ExpElementInstanceBase>();
|
||||
public Dictionary<string, ExpElementInstance> LocalVariables { get; init; } = new Dictionary<string, ExpElementInstance>(
|
||||
);
|
||||
|
||||
public override ExpElementType ElementType => ExpElementType.Function;
|
||||
|
||||
@@ -66,11 +58,7 @@ namespace StgSharp.Script.Express
|
||||
|
||||
public override string Name => _name;
|
||||
|
||||
public string CallingFormat
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
public string CallingFormat { get; private set; }
|
||||
|
||||
public override void Analyse()
|
||||
{
|
||||
@@ -89,13 +77,13 @@ namespace StgSharp.Script.Express
|
||||
|
||||
public override bool TryGetMember( string name, out ExpNode memberNode )
|
||||
{
|
||||
if( FuncParams.TryGetValue(
|
||||
name, out ExpElementInstanceBase? param ) ) {
|
||||
if( FuncParams.TryGetValue( name, out ExpElementInstance? param ) )
|
||||
{
|
||||
memberNode = param;
|
||||
return true;
|
||||
}
|
||||
if( LocalVariables.TryGetValue(
|
||||
name, out ExpElementInstanceBase? variable ) ) {
|
||||
if( LocalVariables.TryGetValue( name, out ExpElementInstance? variable ) )
|
||||
{
|
||||
memberNode = variable;
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ using System.Text;
|
||||
|
||||
namespace StgSharp.Script.Express
|
||||
{
|
||||
public class ExpRule : ExpElementInstanceBase
|
||||
public class ExpRule : ExpElementInstance
|
||||
{
|
||||
|
||||
private ExpRuleSource _source;
|
||||
|
||||
@@ -77,7 +77,7 @@ namespace StgSharp.Script.Express
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public override ExpElementInstanceBase CreateInstanceNode()
|
||||
public override ExpElementInstance CreateInstanceNode()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
@@ -96,8 +96,7 @@ namespace StgSharp.Script.Express
|
||||
private class ExpVoidType : ExpTypeSource
|
||||
{
|
||||
|
||||
private static readonly ExpVoidType _onlyInstance = new ExpVoidType(
|
||||
);
|
||||
private static readonly ExpVoidType _onlyInstance = new ExpVoidType();
|
||||
|
||||
private ExpVoidType() : base( string.Empty ) { }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user