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
@@ -31,6 +31,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
@@ -39,6 +40,23 @@ namespace StgSharp.Script.Express
public static partial class ExpCompile
{
private static void PoolKeywords()
{
FieldInfo[] fields = typeof( KeyWord ).GetFields(
BindingFlags.Public );
ParallelLoopResult result = Parallel.ForEach(
fields, static( field ) => {
if( field.FieldType == typeof( string ) ) {
string? str =
field.GetValue( null ) as string;
if( str != null ) {
_compileStringCache.GetOrAdd( str );
}
}
} );
while( !result.IsCompleted ) { }
}
public static class KeyWord
{
@@ -56,6 +74,7 @@ namespace StgSharp.Script.Express
SUB = "SUB",
MUL = "MUL",
DIV = "DIV",
NOT = "NOT",
Assignment = ":=",
Equal = "=",
Mod = "MOD",
@@ -66,9 +85,9 @@ namespace StgSharp.Script.Express
Insert = "INSERT",
Remove = "REMOVE",
ANDOR = "ANDOR",
GetIndex = "[]",
UnaryAdd = "unary+",
UnarySub = "unary-",
GetIndex = "[",
UnaryAdd = "+",
UnarySub = "-",
Exp = "**";
}