Daily update on 20250325-164701 by Nitload Youmu. Additional Message : Lineaar line and multi-linear line compile full function. String literal parsing improve.

Signed-off-by: Nitload <YoumuLiu_NSI@whv0t.onmicrosoft.com>
This commit is contained in:
Nitload
2025-03-25 16:47:02 +08:00
parent ffd5825a05
commit 469cb88472
29 changed files with 414 additions and 273 deletions
@@ -36,7 +36,7 @@ using System.Text;
namespace StgSharp.Script.Express
{
public sealed class ExpBuiltinType : ExpTypeSource
internal sealed class ExpBuiltinType : ExpTypeSource
{
private Type _marshalType;
@@ -37,7 +37,7 @@ using System.Text;
namespace StgSharp.Script.Express
{
public abstract class ExpCollectionBase : ExpInstantiableElement, IEnumerable<ExpElementInstanceBase>
public abstract class ExpCollectionBase : ExpInstantiableElement, IEnumerable<ExpElementInstance>
{
protected internal string _accurateType;
@@ -49,10 +49,7 @@ namespace StgSharp.Script.Express
public override ExpElementType ElementType => ExpElementType.Collection;
public abstract int Count
{
get;
}
public abstract int Count { get; }
public override sealed IScriptSourceProvider SourceProvider => ScriptSourceTransmitter.Empty;
@@ -66,7 +63,7 @@ namespace StgSharp.Script.Express
return;
}
public abstract IEnumerator<ExpElementInstanceBase> GetEnumerator();
public abstract IEnumerator<ExpElementInstance> GetEnumerator();
public override bool TryGetMember( string name, out ExpNode memberNode )
{
@@ -84,18 +81,17 @@ namespace StgSharp.Script.Express
public class ExpArray : ExpCollectionBase
{
private ExpElementInstanceBase[] _collection;
private ExpElementInstance[] _collection;
public ExpArray( string accurateType ) : base( accurateType ) { }
public ExpElementInstanceBase this[ int index ]
public ExpElementInstance this[ int index ]
{
get { return _collection[ index ]; }
set
{
if( value.TypeName != MemberType ) {
throw new ExpInvalidCollectionMemberTypeException(
value, this );
throw new ExpInvalidCollectionMemberTypeException( value, this );
}
_collection[ index ] = value;
}
@@ -110,9 +106,9 @@ namespace StgSharp.Script.Express
throw new NotImplementedException();
}
public override IEnumerator<ExpElementInstanceBase> GetEnumerator()
public override IEnumerator<ExpElementInstance> GetEnumerator()
{
return ( ( IEnumerable<ExpElementInstanceBase> )_collection )
return ( ( IEnumerable<ExpElementInstance> )_collection )
.GetEnumerator();
}
@@ -121,7 +117,7 @@ namespace StgSharp.Script.Express
public class ExpBag : ExpCollectionBase
{
private ConcurrentBag<ExpElementInstanceBase> _collection = new ConcurrentBag<ExpElementInstanceBase>(
private ConcurrentBag<ExpElementInstance> _collection = new ConcurrentBag<ExpElementInstance>(
);
public ExpBag( string accurateType ) : base( accurateType ) { }
@@ -135,7 +131,7 @@ namespace StgSharp.Script.Express
throw new NotImplementedException();
}
public override IEnumerator<ExpElementInstanceBase> GetEnumerator()
public override IEnumerator<ExpElementInstance> GetEnumerator()
{
return _collection.GetEnumerator();
}
@@ -145,8 +141,7 @@ namespace StgSharp.Script.Express
public sealed class ExpList : ExpCollectionBase
{
private List<ExpElementInstanceBase> _collection = new List<ExpElementInstanceBase>(
);
private List<ExpElementInstance> _collection = new List<ExpElementInstance>();
public ExpList( string accurateType ) : base( accurateType ) { }
@@ -159,7 +154,7 @@ namespace StgSharp.Script.Express
throw new NotImplementedException();
}
public override IEnumerator<ExpElementInstanceBase> GetEnumerator()
public override IEnumerator<ExpElementInstance> GetEnumerator()
{
return _collection.GetEnumerator();
}
@@ -169,7 +164,7 @@ namespace StgSharp.Script.Express
public class ExpSet : ExpCollectionBase
{
private HashSet<ExpElementInstanceBase> _collection = new();
private HashSet<ExpElementInstance> _collection = new();
public ExpSet( string accurateType ) : base( accurateType ) { }
@@ -177,11 +172,10 @@ namespace StgSharp.Script.Express
public override string Name => ExpressCompile.PoolString( "SET" );
public void Add( ExpElementInstanceBase token )
public void Add( ExpElementInstance token )
{
if( token.TypeName != MemberType ) {
throw new ExpInvalidCollectionMemberTypeException( token,
this );
throw new ExpInvalidCollectionMemberTypeException( token, this );
}
_collection.Add( token );
}
@@ -191,10 +185,9 @@ namespace StgSharp.Script.Express
throw new NotImplementedException();
}
public override sealed IEnumerator<ExpElementInstanceBase> GetEnumerator(
)
public override sealed IEnumerator<ExpElementInstance> GetEnumerator()
{
return ( ( IEnumerable<ExpElementInstanceBase> )_collection )
return ( ( IEnumerable<ExpElementInstance> )_collection )
.GetEnumerator();
}
@@ -0,0 +1,45 @@
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
// file="IExpBuiltinType.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.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StgSharp.Script.Express
{
public interface IExpBuiltinType<TSelf> where TSelf: ExpElementInstance, IExpBuiltinType<TSelf>
{
static abstract ExpElementInstance CreateInstance();
}
}