daily update on 20250220 by nitload youmu, building AST generator, correct type naming

This commit is contained in:
Nitload
2025-02-21 08:11:26 +08:00
parent ccef0de6f6
commit 83bde12d22
98 changed files with 4182 additions and 1855 deletions
@@ -33,36 +33,20 @@ using CommunityToolkit.HighPerformance.Helpers;
using StgSharp.Collections;
using System;
using System.Collections.Frozen;
using System.Collections.Generic;
using System.Text;
namespace StgSharp.Script.Express
{
public class ExpSchema
public class ExpSchema : ExpSchemaBase
{
private readonly ConcurrentStringHashMultiplexer _multiplexer = ExpCompile.Multiplexer;
private Dictionary<string, ExpConstantCollectionSource> _constDict;
private Dictionary<string, ExpEntitySource> _entityDict;
private Dictionary<string, ExpFunctionSource> _functionDict;
private Dictionary<string, ExpRuleSource> _ruleDict;
private Dictionary<string, ExpSchema> _schemaInclude;
private Dictionary<string, ExpTypeSource> _typeDict;
public ExpSchema() { }
public ExpSchema()
public static ExpSchema DefaultSchema
{
_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 );
get => ExpSchema_Nitload.Only;
}
public string Name
@@ -77,11 +61,11 @@ namespace StgSharp.Script.Express
out ExpTypeSource? ret ) ) {
return ret;
}
if( _typeDict.TryGetValue( typeName, out ret ) ) {
if( TypeDict.TryGetValue( typeName, out ret ) ) {
return ret;
}
foreach( ExpSchema item in _schemaInclude.Values ) {
if( item._typeDict.TryGetValue( typeName, out ret ) ) {
foreach( ExpSchema item in SchemaInclude.Values ) {
if( item.TypeDict.TryGetValue( typeName, out ret ) ) {
return ret;
}
}
@@ -90,7 +74,7 @@ namespace StgSharp.Script.Express
public bool HasSchemaInclude( ExpSchema schema )
{
return _schemaInclude.ContainsKey( schema.Name );
return SchemaInclude.ContainsKey( schema.Name );
}
public bool TryGetConstant(
@@ -101,7 +85,7 @@ namespace StgSharp.Script.Express
out constInstance ) ) {
return true;
}
foreach( ExpConstantCollectionSource item in _constDict.Values ) {
foreach( ExpConstantCollectionSource item in ConstDict.Values ) {
if( item.TryGetConstant( name, out constInstance ) ) {
return true;
}