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
@@ -40,6 +40,7 @@ namespace StgSharp.Script.Express
{
public class ExpSchema
{
private readonly ConcurrentStringHashMultiplexer _multiplexer = ExpCompile.Multiplexer;
private Dictionary<string, ExpConstantCollectionSource> _constDict;
private Dictionary<string, ExpEntitySource> _entityDict;
@@ -50,12 +51,18 @@ namespace StgSharp.Script.Express
public ExpSchema()
{
_constDict = new Dictionary<string, ExpConstantCollectionSource>(ExpCompile.Multiplexer);
_entityDict = new Dictionary<string, ExpEntitySource>(ExpCompile.Multiplexer);
_functionDict = new Dictionary<string, ExpFunctionSource>(ExpCompile.Multiplexer);
_ruleDict = new Dictionary<string, ExpRuleSource>(ExpCompile.Multiplexer);
_schemaInclude = new Dictionary<string, ExpSchema>(ExpCompile.Multiplexer);
_typeDict = new Dictionary<string, ExpTypeSource>(ExpCompile.Multiplexer);
_constDict = new Dictionary<string, ExpConstantCollectionSource>(
ExpCompile.Multiplexer );
_entityDict = new Dictionary<string, ExpEntitySource>(
ExpCompile.Multiplexer );
_functionDict = new Dictionary<string, ExpFunctionSource>(
ExpCompile.Multiplexer );
_ruleDict = new Dictionary<string, ExpRuleSource>(
ExpCompile.Multiplexer );
_schemaInclude = new Dictionary<string, ExpSchema>(
ExpCompile.Multiplexer );
_typeDict = new Dictionary<string, ExpTypeSource>(
ExpCompile.Multiplexer );
}
public string Name
@@ -66,8 +73,8 @@ namespace StgSharp.Script.Express
public ExpTypeSource GetExpType( string typeName )
{
if( ExpCompile.TryGetBuiltinType(
typeName, out ExpTypeSource? ret ) ) {
if( ExpCompile.TryGetBuiltinType( typeName,
out ExpTypeSource? ret ) ) {
return ret;
}
if( _typeDict.TryGetValue( typeName, out ret ) ) {
@@ -86,20 +93,21 @@ namespace StgSharp.Script.Express
return _schemaInclude.ContainsKey( schema.Name );
}
public bool TryGetConstant(string name, out ExpElementInstanceBase constInstance)
public bool TryGetConstant(
string name,
out ExpElementInstanceBase constInstance )
{
if (ExpCompile.BuiltinConst.TryGetValue(name, out constInstance))
{
if( ExpCompile.BuiltinConst.TryGetValue( name,
out constInstance ) ) {
return true;
}
foreach (var item in _constDict.Values)
{
if (item.TryGetConstant(name, out constInstance))
{
foreach( ExpConstantCollectionSource item in _constDict.Values ) {
if( item.TryGetConstant( name, out constInstance ) ) {
return true;
}
}
return false;
}
}
}