daily update on 20240203 by nitload youmu, ExpComment[D[D[D[D[D[D[D [C[C[C[C[C[C[D[D[D[D[D[DComment Splitter ok, case code(* comment[D[D[D[D[D[D[D[D[D[D[C[C[[C[Dcomment*)code--comment and comment*)code--comment not added, may use span optimize all programme
This commit is contained in:
@@ -39,14 +39,11 @@ namespace StgSharp.Script.Express
|
||||
public class ExpConstantCollectionSource : IExpImmutableElement
|
||||
{
|
||||
private IScriptSourceProvider _sourceProvider;
|
||||
private string _name;
|
||||
private Dictionary<string, ExpElementInstanceBase> _constants;
|
||||
|
||||
public ExpConstantCollectionSource(
|
||||
string name,
|
||||
IScriptSourceProvider sourceProvider )
|
||||
{
|
||||
_name = name;
|
||||
_sourceProvider = sourceProvider;
|
||||
_constants = new Dictionary<string, ExpElementInstanceBase>(
|
||||
ExpCompile.Multiplexer);
|
||||
@@ -61,11 +58,11 @@ namespace StgSharp.Script.Express
|
||||
|
||||
public IScriptSourceProvider SourceProvider => _sourceProvider;
|
||||
|
||||
public static Dictionary<string, ExpConstantCollectionSource> BuiltinConst => ExpCompile.BuiltinConst;
|
||||
public static Dictionary<string, ExpElementInstanceBase> BuiltinConst => ExpCompile.BuiltinConst;
|
||||
|
||||
public string Name
|
||||
{
|
||||
get => _name;
|
||||
get => ExpCompile.KeyWord.Constant;
|
||||
}
|
||||
|
||||
public virtual void Analyse()
|
||||
@@ -75,7 +72,24 @@ namespace StgSharp.Script.Express
|
||||
|
||||
public ExpToken MakeReference(params object[] options)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
if (options.Length == 0 || options[0] is not string str)
|
||||
{
|
||||
return null!;
|
||||
}
|
||||
if (_constants.Count == 0)
|
||||
{
|
||||
return null!;
|
||||
}
|
||||
if (_constants.TryGetValue(str, out var token))
|
||||
{
|
||||
return token;
|
||||
}
|
||||
return null!;
|
||||
}
|
||||
|
||||
public bool TryGetConstant(string name, out ExpElementInstanceBase instance)
|
||||
{
|
||||
return _constants.TryGetValue(name, out instance);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user