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
@@ -32,7 +32,7 @@ using System;
namespace StgSharp.Script.Express
{
public class ExpBuiltinConstant<T> : ExpLiteralToken<T>
public class ExpBuiltinConstant<T> : ExpLiteralNode<T>
{
internal ExpBuiltinConstant( string name, T value )
@@ -34,7 +34,7 @@ using System.Text;
namespace StgSharp.Script.Express
{
public abstract class ExpCollectionInstanceBase : ExpToken
public abstract class ExpCollectionInstanceBase : ExpBaseNode
{
protected internal (int min, int max) _range;
@@ -53,11 +53,9 @@ namespace StgSharp.Script.Express
get => _memberType;
}
public override ExpToken Left => null!;
public override ExpBaseNode Left => null!;
public override ExpToken Right => null!;
public override ExpToken Next => null!;
public override ExpBaseNode Right => null!;
public int MinCapacity => _range.min;
@@ -78,11 +76,6 @@ namespace StgSharp.Script.Express
public override ExpCollectionBase CollectionValue => _collection;
public override ExpToken Next
{
set => throw new NotImplementedException();
}
public override IExpElementSource EqualityTypeConvert => throw new NotImplementedException(
);
@@ -101,11 +94,6 @@ namespace StgSharp.Script.Express
public override ExpCollectionBase CollectionValue => _collection;
public override ExpToken Next
{
set => throw new NotImplementedException();
}
public override IExpElementSource EqualityTypeConvert => throw new NotImplementedException(
);
@@ -124,11 +112,6 @@ namespace StgSharp.Script.Express
public override ExpCollectionBase CollectionValue => _collection;
public override ExpToken Next
{
set => throw new NotImplementedException();
}
public override IExpElementSource EqualityTypeConvert => throw new NotImplementedException(
);
@@ -150,11 +133,6 @@ namespace StgSharp.Script.Express
public override ExpCollectionBase CollectionValue => _collection;
public override ExpToken Next
{
set => throw new NotImplementedException();
}
public override IExpElementSource EqualityTypeConvert => _collection;
}
@@ -0,0 +1,73 @@
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
// file="ExpLogic.cs"
// Project: StgSharp
// AuthorGroup: Nitload Space
// Copyright (c) Nitload Space. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
// files (the “Software”), to deal in the Software without restriction,
// including without limitation the rights to use, copy, modify, merge,
// publish, distribute, sublicense, and/or sell copies of the Software,
// and to permit persons to whom the Software is furnished to do so,
// subject to the following conditions:
//
// The above copyright notice and
// this permission notice shall be included in all copies
// or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED “AS IS”,
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
using System;
using System.Collections.Generic;
using System.Text;
namespace StgSharp.Script.Express
{
public enum ExpLogic
{
Unknown = 0,
False = 1,
True = 2,
}
public static class LogicConverter
{
public static bool? AsNullableBool(this ExpLogic l)
{
switch (l)
{
case ExpLogic.Unknown:
return null;
case ExpLogic.False:
return false;
case ExpLogic.True:
return true;
default:
throw new ArgumentException();
}
}
public static ExpLogic AsNullableInt(this bool? b)
{
return b switch
{
null => ExpLogic.Unknown,
true => ExpLogic.True,
false => ExpLogic.False,
};
}
}
}