Daily update 2 on 20240228 by nitload youmu
This commit is contained in:
@@ -0,0 +1,61 @@
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
// file="AbstractSyntaxTree.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 StgSharp.Collections;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Xml.Schema;
|
||||
|
||||
namespace StgSharp.Script
|
||||
{
|
||||
public sealed class AbstractSyntaxTree<TNode, TType>
|
||||
where TNode: IASTNode<TNode, TType>
|
||||
where TType: ITypeSource<TType>
|
||||
{
|
||||
|
||||
private List<TNode> _allToken = new();
|
||||
private TNode _root;
|
||||
|
||||
public int Count
|
||||
{
|
||||
get { return _allToken.Count; }
|
||||
}
|
||||
|
||||
public TNode Root => _root;
|
||||
|
||||
public bool Contains( TNode node )
|
||||
{
|
||||
return _allToken.Contains( node );
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,108 @@
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
// file="CodeLineHelper.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
|
||||
{
|
||||
public static class CodeLineHelper
|
||||
{
|
||||
|
||||
public static string SliceAndTrim( this string line, int startIndex )
|
||||
{
|
||||
if( line == null ) {
|
||||
throw new ArgumentNullException( nameof( line ) );
|
||||
}
|
||||
|
||||
if( startIndex < 0 || startIndex >= line.Length ) {
|
||||
throw new ArgumentOutOfRangeException( nameof( startIndex ) );
|
||||
}
|
||||
|
||||
ReadOnlySpan<char> sourceSpan = line.AsSpan();
|
||||
ReadOnlySpan<char> subSpan = sourceSpan.Slice( startIndex );
|
||||
|
||||
int start = 0;
|
||||
while( start < subSpan.Length && char.IsWhiteSpace(
|
||||
subSpan[ start ] ) ) {
|
||||
start++;
|
||||
}
|
||||
int end = subSpan.Length - 1;
|
||||
while( end >= start && char.IsWhiteSpace( subSpan[ end ] ) ) {
|
||||
end--;
|
||||
}
|
||||
if( start > end ) {
|
||||
return string.Empty;
|
||||
}
|
||||
int finalLength = end - start + 1;
|
||||
|
||||
return new string( subSpan.Slice( start, finalLength ) );
|
||||
}
|
||||
|
||||
public static string SliceAndTrim(
|
||||
this string line,
|
||||
int startIndex,
|
||||
int length )
|
||||
{
|
||||
if( line == null ) {
|
||||
throw new ArgumentNullException( nameof( line ) );
|
||||
}
|
||||
|
||||
if( startIndex < 0 || startIndex >= line.Length ) {
|
||||
throw new ArgumentOutOfRangeException( nameof( startIndex ) );
|
||||
}
|
||||
|
||||
if( length < 0 || startIndex + length > line.Length ) {
|
||||
throw new ArgumentOutOfRangeException( nameof( length ) );
|
||||
}
|
||||
|
||||
ReadOnlySpan<char> sourceSpan = line.AsSpan();
|
||||
ReadOnlySpan<char> subSpan = sourceSpan.Slice( startIndex, length );
|
||||
|
||||
int start = 0;
|
||||
while( start < subSpan.Length && char.IsWhiteSpace(
|
||||
subSpan[ start ] ) ) {
|
||||
start++;
|
||||
}
|
||||
int end = subSpan.Length - 1;
|
||||
while( end >= start && char.IsWhiteSpace( subSpan[ end ] ) ) {
|
||||
end--;
|
||||
}
|
||||
if( start > end ) {
|
||||
return string.Empty;
|
||||
}
|
||||
int finalLength = end - start + 1;
|
||||
|
||||
return new string( subSpan.Slice( start, finalLength ) );
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
// file="ExpBuiltinConstant.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;
|
||||
|
||||
namespace StgSharp.Script.Express
|
||||
{
|
||||
public class ExpBuiltinConstant<T> : ExpLiteralGenericNode<T>
|
||||
{
|
||||
|
||||
internal ExpBuiltinConstant( string name, T value )
|
||||
: base( name, null!, value ) { }
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
// file="ExpBuiltinType.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 StgSharp.Data;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp.Script.Express
|
||||
{
|
||||
public sealed class ExpBuiltinType : ExpTypeSource
|
||||
{
|
||||
|
||||
private Type _marshalType;
|
||||
|
||||
internal ExpBuiltinType( string name, Type origin )
|
||||
: base( name, ScriptSourceTransmitter.Empty )
|
||||
{
|
||||
_marshalType = origin;
|
||||
}
|
||||
|
||||
public override void Analyse()
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//A method convert value to CLR type
|
||||
//Used for direct running rather than compiling to C# code.
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,203 @@
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
// file="ExpCollection.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;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp.Script.Express
|
||||
{
|
||||
public abstract class ExpCollectionBase : IExpElementSource, IEnumerable<ExpElementInstanceBase>
|
||||
{
|
||||
|
||||
protected internal string _accurateType;
|
||||
|
||||
protected ExpCollectionBase( string accurateType )
|
||||
{
|
||||
_accurateType = accurateType;
|
||||
}
|
||||
|
||||
public ExpElementType ElementType => ExpElementType.Collection;
|
||||
|
||||
public abstract int Count
|
||||
{
|
||||
get;
|
||||
}
|
||||
|
||||
public string MemberType
|
||||
{
|
||||
get => _accurateType;
|
||||
}
|
||||
|
||||
public abstract string Name
|
||||
{
|
||||
get;
|
||||
}
|
||||
|
||||
public void Analyse()
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
public abstract IEnumerator<ExpElementInstanceBase> GetEnumerator();
|
||||
|
||||
public abstract bool IsConvertable( IExpElementSource targetType );
|
||||
|
||||
IEnumerator IEnumerable.GetEnumerator()
|
||||
{
|
||||
return GetEnumerator();
|
||||
}
|
||||
|
||||
IScriptSourceProvider IExpElementSource.SourceProvider => null!;
|
||||
|
||||
}
|
||||
|
||||
public class ExpArray : ExpCollectionBase
|
||||
{
|
||||
|
||||
private ExpElementInstanceBase[] _collection;
|
||||
|
||||
public ExpArray( string accurateType ) : base( accurateType ) { }
|
||||
|
||||
public ExpElementInstanceBase this[ int index ]
|
||||
{
|
||||
get { return _collection[ index ]; }
|
||||
set
|
||||
{
|
||||
if( value.TypeName != MemberType ) {
|
||||
throw new ExpInvalidCollectionMemberTypeException(
|
||||
value, this );
|
||||
}
|
||||
_collection[ index ] = value;
|
||||
}
|
||||
}
|
||||
|
||||
public override int Count => _collection.Length;
|
||||
|
||||
public override string Name => ExpCompile.PoolString( "ARRAY" );
|
||||
|
||||
public override IEnumerator<ExpElementInstanceBase> GetEnumerator()
|
||||
{
|
||||
return ( ( IEnumerable<ExpElementInstanceBase> )_collection )
|
||||
.GetEnumerator();
|
||||
}
|
||||
|
||||
public override bool IsConvertable( IExpElementSource targetType )
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public class ExpBag : ExpCollectionBase
|
||||
{
|
||||
|
||||
private ConcurrentBag<ExpElementInstanceBase> _collection = new ConcurrentBag<ExpElementInstanceBase>(
|
||||
);
|
||||
|
||||
public ExpBag( string accurateType ) : base( accurateType ) { }
|
||||
|
||||
public override int Count => _collection.Count;
|
||||
|
||||
public override string Name => ExpCompile.PoolString( "BAG" );
|
||||
|
||||
public override IEnumerator<ExpElementInstanceBase> GetEnumerator()
|
||||
{
|
||||
return _collection.GetEnumerator();
|
||||
}
|
||||
|
||||
public override bool IsConvertable( IExpElementSource targetType )
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public sealed class ExpList : ExpCollectionBase
|
||||
{
|
||||
|
||||
private List<ExpElementInstanceBase> _collection = new List<ExpElementInstanceBase>(
|
||||
);
|
||||
|
||||
public ExpList( string accurateType ) : base( accurateType ) { }
|
||||
|
||||
public override int Count => _collection.Count;
|
||||
|
||||
public override string Name => ExpCompile.PoolString( "LIST" );
|
||||
|
||||
public override IEnumerator<ExpElementInstanceBase> GetEnumerator()
|
||||
{
|
||||
return _collection.GetEnumerator();
|
||||
}
|
||||
|
||||
public override bool IsConvertable( IExpElementSource targetType )
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public class ExpSet : ExpCollectionBase
|
||||
{
|
||||
|
||||
private HashSet<ExpElementInstanceBase> _collection = new();
|
||||
|
||||
public ExpSet( string accurateType ) : base( accurateType ) { }
|
||||
|
||||
public override int Count => _collection.Count;
|
||||
|
||||
public override string Name => ExpCompile.PoolString( "SET" );
|
||||
|
||||
public void Add( ExpElementInstanceBase token )
|
||||
{
|
||||
if( token.TypeName != MemberType ) {
|
||||
throw new ExpInvalidCollectionMemberTypeException( token,
|
||||
this );
|
||||
}
|
||||
_collection.Add( token );
|
||||
}
|
||||
|
||||
public override sealed IEnumerator<ExpElementInstanceBase> GetEnumerator(
|
||||
)
|
||||
{
|
||||
return ( ( IEnumerable<ExpElementInstanceBase> )_collection )
|
||||
.GetEnumerator();
|
||||
}
|
||||
|
||||
public override bool IsConvertable( IExpElementSource targetType )
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,139 @@
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
// file="ExpCollectionInstance.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 abstract class ExpCollectionInstanceBase : ExpBaseNode
|
||||
{
|
||||
|
||||
protected internal (int min, int max) _range;
|
||||
protected internal ExpElementType _memberType;
|
||||
|
||||
protected ExpCollectionInstanceBase( string name, ExpSchema context )
|
||||
: base( name, context ) { }
|
||||
|
||||
public override ExpBaseNode Left => null!;
|
||||
|
||||
public override ExpBaseNode Right => null!;
|
||||
|
||||
public abstract ExpCollectionBase CollectionValue
|
||||
{
|
||||
get;
|
||||
}
|
||||
|
||||
public ExpElementType MemberType
|
||||
{
|
||||
get => _memberType;
|
||||
}
|
||||
|
||||
public int MinCapacity => _range.min;
|
||||
|
||||
public int MaxCapacity => _range.max;
|
||||
|
||||
}
|
||||
|
||||
public sealed class ExpSetInstance : ExpCollectionInstanceBase
|
||||
{
|
||||
|
||||
private ExpSet _collection;
|
||||
|
||||
public ExpSetInstance( string name, ExpSet set, ExpSchema context )
|
||||
: base( name, context )
|
||||
{
|
||||
_collection = set;
|
||||
}
|
||||
|
||||
public override ExpCollectionBase CollectionValue => _collection;
|
||||
|
||||
public override IExpElementSource EqualityTypeConvert => throw new NotImplementedException(
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
public sealed class ExpBagInstance : ExpCollectionInstanceBase
|
||||
{
|
||||
|
||||
private ExpBag _collection;
|
||||
|
||||
public ExpBagInstance( string name, ExpBag bag, ExpSchema context )
|
||||
: base( name, context )
|
||||
{
|
||||
_collection = bag;
|
||||
}
|
||||
|
||||
public override ExpCollectionBase CollectionValue => _collection;
|
||||
|
||||
public override IExpElementSource EqualityTypeConvert => throw new NotImplementedException(
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
public sealed class ExpListInstance : ExpCollectionInstanceBase
|
||||
{
|
||||
|
||||
private ExpList _collection;
|
||||
|
||||
public ExpListInstance( string name, ExpList list, ExpSchema context )
|
||||
: base( name, context )
|
||||
{
|
||||
_collection = list;
|
||||
}
|
||||
|
||||
public override ExpCollectionBase CollectionValue => _collection;
|
||||
|
||||
public override IExpElementSource EqualityTypeConvert => throw new NotImplementedException(
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
public sealed class ExpArrayInstance : ExpCollectionInstanceBase
|
||||
{
|
||||
|
||||
private ExpArray _collection;
|
||||
|
||||
public ExpArrayInstance(
|
||||
string name,
|
||||
ExpArray array,
|
||||
ExpSchema context )
|
||||
: base( name, context )
|
||||
{
|
||||
_collection = array;
|
||||
}
|
||||
|
||||
public override ExpCollectionBase CollectionValue => _collection;
|
||||
|
||||
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,
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,142 @@
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
// file="DefaultSchema.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;
|
||||
using System.Collections.Frozen;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Xml.Linq;
|
||||
|
||||
using static StgSharp.Script.Express.ExpCompile;
|
||||
|
||||
namespace StgSharp.Script.Express
|
||||
{
|
||||
internal partial class ExpSchema_Nitload : ExpSchema
|
||||
{
|
||||
|
||||
private static readonly ExpSchema_Nitload _onlyInstance = new ExpSchema_Nitload(
|
||||
);
|
||||
|
||||
private ExpSchema_Nitload()
|
||||
: base()
|
||||
{
|
||||
Name = "Nitload";
|
||||
}
|
||||
|
||||
public static ExpSchema Only
|
||||
{
|
||||
get => _onlyInstance;
|
||||
}
|
||||
|
||||
public override void LoadFromSource( ExpSchemaSource source )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
public override bool TryGetConst(
|
||||
string name,
|
||||
out ExpElementInstanceBase c )
|
||||
{
|
||||
return ConstDict.TryGetValue( name, out c );
|
||||
}
|
||||
|
||||
public override bool TryGetEntity( string name, out ExpEntitySource e )
|
||||
{
|
||||
e = null;
|
||||
return false;
|
||||
}
|
||||
|
||||
public override bool TryGetFunction(
|
||||
string name,
|
||||
out ExpFunctionSource f )
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public override bool TryGetRule( string name, out ExpRuleSource r )
|
||||
{
|
||||
r = null!;
|
||||
return false;
|
||||
}
|
||||
|
||||
public override bool TryGetSchemaInclude(
|
||||
string name,
|
||||
out ExpSchema include )
|
||||
{
|
||||
include = null!;
|
||||
return false;
|
||||
}
|
||||
|
||||
public override bool TryGetType( string name, out ExpTypeSource t )
|
||||
{
|
||||
return TypeDict.TryGetValue( name, out t );
|
||||
}
|
||||
|
||||
internal void Init()
|
||||
{
|
||||
IEnumerable<KeyValuePair<string, ExpTypeSource>> builtinTypeSource = [
|
||||
new KeyValuePair<string, ExpTypeSource>(
|
||||
PoolString( KeyWord.Int ),
|
||||
new ExpBuiltinType( KeyWord.Int, typeof( int ) ) ),
|
||||
new KeyValuePair<string, ExpTypeSource>(
|
||||
PoolString( KeyWord.Real ),
|
||||
new ExpBuiltinType( KeyWord.Real, typeof( float ) ) ),
|
||||
new KeyValuePair<string, ExpTypeSource>(
|
||||
PoolString( KeyWord.Bool ),
|
||||
new ExpBuiltinType( KeyWord.Bool, typeof( bool ) ) ),
|
||||
new KeyValuePair<string, ExpTypeSource>(
|
||||
PoolString( KeyWord.Logic ),
|
||||
new ExpBuiltinType( KeyWord.Logic, typeof( ExpLogic ) ) ),
|
||||
new KeyValuePair<string, ExpTypeSource>(
|
||||
PoolString( KeyWord.String ),
|
||||
new ExpBuiltinType( KeyWord.String, typeof( string ) ) ),
|
||||
new KeyValuePair<string, ExpTypeSource>(
|
||||
PoolString( KeyWord.Binary ),
|
||||
new ExpBuiltinType( KeyWord.Binary, typeof( BitArray ) ) ),
|
||||
|
||||
];
|
||||
TypeDict = new Dictionary<string, ExpTypeSource>(
|
||||
builtinTypeSource, Multiplexer ).ToFrozenDictionary();
|
||||
|
||||
|
||||
ConstDict = new Dictionary<string, ExpElementInstanceBase>(
|
||||
Multiplexer ) {
|
||||
{ PoolString( "PI" ), new ExpBuiltinConstant<float>(
|
||||
PoolString( "PI" ), MathF.PI ) },
|
||||
{ PoolString( "E" ), new ExpBuiltinConstant<float>(
|
||||
PoolString( "E" ), MathF.E ) },
|
||||
}.ToFrozenDictionary();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,120 @@
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
// file="ExpCompile.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 CommunityToolkit.HighPerformance.Buffers;
|
||||
|
||||
using StgSharp.Collections;
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Frozen;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.ComponentModel;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp.Script.Express
|
||||
{
|
||||
public static partial class ExpCompile
|
||||
{
|
||||
|
||||
private static string[] _operatorsWithLetter;
|
||||
private static ConcurrentStringHashMultiplexer _multiplexer;
|
||||
private static FrozenDictionary<string, ExpElementInstanceBase> _builtinConst;
|
||||
private static FrozenDictionary<string, ExpTypeSource> _builtinType;
|
||||
private static FrozenDictionary<string, ExpBinaryOperatorNode> _operators;
|
||||
private static StringPool _compileStringCache;
|
||||
|
||||
internal static ConcurrentStringHashMultiplexer Multiplexer
|
||||
{
|
||||
get
|
||||
{
|
||||
if( _multiplexer == null ) {
|
||||
throw new ExpCompileNotInitializedException();
|
||||
}
|
||||
return _multiplexer;
|
||||
}
|
||||
}
|
||||
|
||||
public static void ClearStringCache()
|
||||
{
|
||||
_compileStringCache.Reset();
|
||||
}
|
||||
|
||||
public static void DeinitCompile()
|
||||
{
|
||||
_compileStringCache.Reset();
|
||||
_compileStringCache = null!;
|
||||
|
||||
_multiplexer.Dispose();
|
||||
_multiplexer = null!;
|
||||
}
|
||||
|
||||
public static void InitCompile()
|
||||
{
|
||||
_compileStringCache = new StringPool();
|
||||
_multiplexer = new ConcurrentStringHashMultiplexer();
|
||||
|
||||
PoolKeywords();
|
||||
InitPrecedence();
|
||||
|
||||
_operatorsWithLetter = [
|
||||
KeyWord.ADD,
|
||||
KeyWord.SUB,
|
||||
KeyWord.MUL,
|
||||
KeyWord.DIV,
|
||||
KeyWord.AND,
|
||||
KeyWord.OR,
|
||||
KeyWord.XOR,
|
||||
KeyWord.ANDOR,
|
||||
KeyWord.NOT,
|
||||
];
|
||||
}
|
||||
|
||||
public static bool LetterIsOperator( string str )
|
||||
{
|
||||
if( char.IsLetter( str[ 0 ] ) ) {
|
||||
return Array.IndexOf( _operatorsWithLetter, str ) != -1;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public static string PoolString( string str )
|
||||
{
|
||||
return _compileStringCache.GetOrAdd( str );
|
||||
}
|
||||
|
||||
public static string PoolString( ReadOnlySpan<char> str )
|
||||
{
|
||||
return _compileStringCache.GetOrAdd( str );
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,106 @@
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
// file="ExpOperatorPrecedence.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.Frozen;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StgSharp.Script.Express
|
||||
{
|
||||
public static partial class ExpCompile
|
||||
{
|
||||
|
||||
public static bool TryGetOperatorPrecedence(
|
||||
string operatorName,
|
||||
out int precedence )
|
||||
{
|
||||
return _operatorPrecedence.TryGetValue(
|
||||
operatorName, out precedence );
|
||||
}
|
||||
|
||||
public static bool TryGetSuperTypeOperatorPrecedence(
|
||||
string operatorName,
|
||||
out int precedence )
|
||||
{
|
||||
return _superTypeOperatorPrecedent.TryGetValue(
|
||||
operatorName, out precedence );
|
||||
}
|
||||
|
||||
private static void InitPrecedence()
|
||||
{
|
||||
KeyValuePair<string, int>[] source = [
|
||||
new KeyValuePair<string, int>( PoolString( "[" ), 1 ),
|
||||
new KeyValuePair<string, int>( PoolString( "." ), 1 ),
|
||||
new KeyValuePair<string, int>( PoolString( "\\" ), 1 ),
|
||||
new KeyValuePair<string, int>( PoolString( "unary+" ), 2 ),
|
||||
new KeyValuePair<string, int>( PoolString( "unary-" ), 2 ),
|
||||
new KeyValuePair<string, int>( PoolString( "NOT" ), 2 ),
|
||||
new KeyValuePair<string, int>( PoolString( "**" ), 3 ),
|
||||
new KeyValuePair<string, int>( PoolString( "*" ), 4 ),
|
||||
new KeyValuePair<string, int>( PoolString( "/" ), 4 ),
|
||||
new KeyValuePair<string, int>( PoolString( "AND" ), 4 ),
|
||||
new KeyValuePair<string, int>( PoolString( "MOD" ), 4 ),
|
||||
new KeyValuePair<string, int>( PoolString( "DIV" ), 4 ),
|
||||
new KeyValuePair<string, int>( PoolString( "||" ), 4 ),
|
||||
new KeyValuePair<string, int>( PoolString( "+" ), 5 ),
|
||||
new KeyValuePair<string, int>( PoolString( "-" ), 5 ),
|
||||
new KeyValuePair<string, int>( PoolString( "OR" ), 5 ),
|
||||
new KeyValuePair<string, int>( PoolString( "XOR" ), 5 ),
|
||||
new KeyValuePair<string, int>( PoolString( "=" ), 6 ),
|
||||
new KeyValuePair<string, int>( PoolString( "<>" ), 6 ),
|
||||
new KeyValuePair<string, int>( PoolString( "<=" ), 6 ),
|
||||
new KeyValuePair<string, int>( PoolString( ">=" ), 6 ),
|
||||
new KeyValuePair<string, int>( PoolString( ">" ), 6 ),
|
||||
new KeyValuePair<string, int>( PoolString( "<" ), 6 ),
|
||||
new KeyValuePair<string, int>( PoolString( ":=:" ), 6 ),
|
||||
new KeyValuePair<string, int>( PoolString( ":<>:" ), 6 ),
|
||||
new KeyValuePair<string, int>( PoolString( "IN" ), 6 ),
|
||||
new KeyValuePair<string, int>( PoolString( "LIKE" ), 6 ),
|
||||
];
|
||||
_operatorPrecedence = new Dictionary<string, int>(
|
||||
source, _multiplexer ).ToFrozenDictionary();
|
||||
source = [
|
||||
new KeyValuePair<string, int>( "ONEOF", 1 ),
|
||||
new KeyValuePair<string, int>( "AND", 2 ),
|
||||
new KeyValuePair<string, int>( "ANDOR", 3 ),
|
||||
];
|
||||
_superTypeOperatorPrecedent = new Dictionary<string, int>(
|
||||
source, _multiplexer ).ToFrozenDictionary();
|
||||
}
|
||||
|
||||
#pragma warning disable CS8618
|
||||
private static FrozenDictionary<string, int> _superTypeOperatorPrecedent;
|
||||
private static FrozenDictionary<string, int> _operatorPrecedence;
|
||||
#pragma warning restore CS8618
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,93 @@
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
// file="KeyWord.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.Reflection;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
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 ) && field.GetValue(
|
||||
null ) is string str ) {
|
||||
_compileStringCache.GetOrAdd( str );
|
||||
}
|
||||
} );
|
||||
while( !result.IsCompleted ) { }
|
||||
}
|
||||
|
||||
public static class KeyWord
|
||||
{
|
||||
|
||||
public const string Int = "INTAGER",
|
||||
Real = "REAL",
|
||||
Bool = "BOOLEAN",
|
||||
String = "STRING",
|
||||
Logic = "LOGIC",
|
||||
Binary = "BINARY",
|
||||
Constant = "CONSTANT",
|
||||
AND = "AND",
|
||||
OR = "OR",
|
||||
XOR = "XOR",
|
||||
ADD = "+",
|
||||
SUB = "-",
|
||||
MUL = "*",
|
||||
DIV = "/",
|
||||
NOT = "NOT",
|
||||
Assignment = ":=",
|
||||
Equal = "=",
|
||||
Mod = "MOD",
|
||||
Self = "SELF",
|
||||
Pi = "PI",
|
||||
True = "TRUE",
|
||||
False = "FALSE",
|
||||
Insert = "INSERT",
|
||||
Remove = "REMOVE",
|
||||
ANDOR = "ANDOR",
|
||||
GetIndex = "[",
|
||||
UnaryAdd = "+",
|
||||
UnarySub = "-",
|
||||
Exp = "**";
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,97 @@
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
// file="ExpConst.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;
|
||||
using System.Collections.Frozen;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp.Script.Express
|
||||
{
|
||||
public sealed class ExpConstantCollectionSource : ExpImmutableElementBase
|
||||
{
|
||||
|
||||
private Dictionary<string, ExpElementInstanceBase> _constants;
|
||||
private IScriptSourceProvider _sourceProvider;
|
||||
|
||||
public ExpConstantCollectionSource(
|
||||
IScriptSourceProvider sourceProvider )
|
||||
{
|
||||
_sourceProvider = sourceProvider;
|
||||
_constants = new Dictionary<string, ExpElementInstanceBase>(
|
||||
ExpCompile.Multiplexer );
|
||||
}
|
||||
|
||||
public override ExpElementType ElementType => ExpElementType.Const;
|
||||
|
||||
public override IScriptSourceProvider SourceProvider => _sourceProvider;
|
||||
|
||||
public override string Name
|
||||
{
|
||||
get => ExpCompile.KeyWord.Constant;
|
||||
}
|
||||
|
||||
public override void Analyse()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public override ExpBaseNode MakeReference( params object[] options )
|
||||
{
|
||||
if( options.Length == 0 || options[ 0 ] is not string str ) {
|
||||
return null!;
|
||||
}
|
||||
if( _constants.Count == 0 ) {
|
||||
return null!;
|
||||
}
|
||||
if( _constants.TryGetValue( str,
|
||||
out ExpElementInstanceBase? token ) ) {
|
||||
return token;
|
||||
}
|
||||
return null!;
|
||||
}
|
||||
|
||||
public bool TryGetConstant(
|
||||
string name,
|
||||
out ExpElementInstanceBase instance )
|
||||
{
|
||||
return _constants.TryGetValue( name, out instance );
|
||||
}
|
||||
|
||||
internal void AddConstant( string name, ExpElementInstanceBase value )
|
||||
{
|
||||
_constants.Add( name, value );
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
// file="ExpEntity.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 class ExpEntity : ExpBaseNode
|
||||
{
|
||||
|
||||
public ExpEntity( string name, ExpSchema context )
|
||||
: base( name, context ) { }
|
||||
|
||||
public override ExpBaseNode Left => throw new NotImplementedException();
|
||||
|
||||
public override ExpBaseNode Right => throw new NotImplementedException();
|
||||
|
||||
public override IExpElementSource EqualityTypeConvert => throw new NotImplementedException(
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
public class ExpEntitySource : ExpInstantiableElementBase
|
||||
{
|
||||
|
||||
private AbstractSyntaxTree<ExpBaseNode, IExpElementSource> _expressionTree;
|
||||
private ScriptSourceTransmitter _source;
|
||||
private string _name;
|
||||
|
||||
public ExpEntitySource( string name, ScriptSourceTransmitter provider )
|
||||
{
|
||||
_name = name;
|
||||
_source = provider;
|
||||
}
|
||||
|
||||
public override ExpElementType ElementType => ExpElementType.Entity;
|
||||
|
||||
public override IScriptSourceProvider SourceProvider => _source;
|
||||
|
||||
public override string Name => _name;
|
||||
|
||||
public override void Analyse()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public override ExpBaseNode CreateInstanceToken()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public override bool IsConvertable( IExpElementSource targetType )
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,104 @@
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
// file="ExpFunction.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 class ExpFunction : ExpBaseNode
|
||||
{
|
||||
|
||||
private readonly ExpBaseNode _return;
|
||||
|
||||
private ExpFunctionSource _source;
|
||||
private readonly List<KeyValuePair<string, ExpBaseNode>> _parameterList
|
||||
= new List<KeyValuePair<string, ExpBaseNode>>();
|
||||
|
||||
public ExpFunction( string name, ExpSchema context )
|
||||
: base( name, context ) { }
|
||||
|
||||
public override ExpBaseNode Left => throw new NotImplementedException();
|
||||
|
||||
public override ExpBaseNode Right => throw new NotImplementedException();
|
||||
|
||||
public ExpElementType ElementType => ExpElementType.Function;
|
||||
|
||||
public override IExpElementSource EqualityTypeConvert => throw new NotImplementedException(
|
||||
);
|
||||
|
||||
public void CallThisFunction( params ExpBaseNode[] parameters ) { }
|
||||
|
||||
}
|
||||
|
||||
public class ExpFunctionSource : ExpImmutableElementBase
|
||||
{
|
||||
|
||||
private ScriptSourceTransmitter _transmitter;
|
||||
private string _name;
|
||||
|
||||
public ExpFunctionSource(
|
||||
string name,
|
||||
ScriptSourceTransmitter transmitter )
|
||||
{
|
||||
_name = name;
|
||||
_transmitter = transmitter;
|
||||
}
|
||||
|
||||
public override ExpElementType ElementType => ExpElementType.Function;
|
||||
|
||||
public override IScriptSourceProvider SourceProvider => _transmitter;
|
||||
|
||||
public override string Name => _name;
|
||||
|
||||
public string CallingFormat
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
|
||||
public override void Analyse()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
/*
|
||||
* generate parameter list,
|
||||
* generate C# code
|
||||
* generate calling syntax
|
||||
*/
|
||||
}
|
||||
|
||||
public override ExpBaseNode MakeReference( params object[] options )
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
// file="ExpRule.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.Data;
|
||||
using System.Reflection.Metadata.Ecma335;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp.Script.Express
|
||||
{
|
||||
public class ExpRule : ExpElementInstanceBase
|
||||
{
|
||||
|
||||
private ExpRuleSource _source;
|
||||
|
||||
public ExpRule( string name, ExpSchema context )
|
||||
: base( name, context ) { }
|
||||
|
||||
public object? value => throw new NotImplementedException();
|
||||
|
||||
public override ExpBaseNode Left => throw new NotImplementedException();
|
||||
|
||||
public override ExpBaseNode Right => throw new NotImplementedException();
|
||||
|
||||
public override IExpElementSource EqualityTypeConvert => throw new NotImplementedException(
|
||||
);
|
||||
|
||||
public override string TypeName => _source.Name;
|
||||
|
||||
}
|
||||
|
||||
public class ExpRuleSource : ExpImmutableElementBase
|
||||
{
|
||||
|
||||
private ScriptSourceTransmitter _transmitter;
|
||||
private string _name;
|
||||
|
||||
public ExpRuleSource( string name, ScriptSourceTransmitter transmitter )
|
||||
{
|
||||
_name = name;
|
||||
_transmitter = transmitter;
|
||||
}
|
||||
|
||||
public override ExpElementType ElementType => ExpElementType.Rule;
|
||||
|
||||
public override IScriptSourceProvider SourceProvider => _transmitter;
|
||||
|
||||
public override string Name => _name;
|
||||
|
||||
public override void Analyse()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public override ExpBaseNode MakeReference( params object[] options )
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
// file="ExpType.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 StgSharp.Script;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace StgSharp.Script.Express
|
||||
{
|
||||
public class ExpType : ExpElementInstanceBase
|
||||
{
|
||||
|
||||
public ExpType( string name, ExpSchema context )
|
||||
: base( name, context ) { }
|
||||
|
||||
public override ExpBaseNode Left => throw new NotImplementedException();
|
||||
|
||||
public override ExpBaseNode Right => throw new NotImplementedException();
|
||||
|
||||
public override IExpElementSource EqualityTypeConvert => throw new NotImplementedException(
|
||||
);
|
||||
|
||||
public override string TypeName => throw new NotImplementedException();
|
||||
|
||||
}
|
||||
|
||||
public class ExpTypeSource : IExpElementSource
|
||||
{
|
||||
|
||||
private ScriptSourceTransmitter _transmitter;
|
||||
private string _name;
|
||||
protected bool _isBuiltinType;
|
||||
|
||||
protected ExpTypeSource( string name )
|
||||
{
|
||||
_name = name;
|
||||
_transmitter = ScriptSourceTransmitter.Empty;
|
||||
_isBuiltinType = true;
|
||||
}
|
||||
|
||||
public ExpTypeSource( string name, ScriptSourceTransmitter transmitter )
|
||||
{
|
||||
_name = name;
|
||||
_transmitter = transmitter;
|
||||
_isBuiltinType = false;
|
||||
}
|
||||
|
||||
public bool IsLanguageBuiltinType
|
||||
{
|
||||
get => _isBuiltinType;
|
||||
}
|
||||
|
||||
public ExpElementType ElementType => ExpElementType.Type;
|
||||
|
||||
public IScriptSourceProvider SourceProvider => _transmitter;
|
||||
|
||||
public string Name => _name;
|
||||
|
||||
public virtual void Analyse()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public bool IsConvertable( IExpElementSource targetType )
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,158 @@
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
// file="ExpBaseNode.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 CommunityToolkit.HighPerformance.Buffers;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp.Script.Express
|
||||
{
|
||||
public abstract class ExpBaseNode : IASTNode<ExpBaseNode, IExpElementSource>
|
||||
{
|
||||
|
||||
protected internal ExpNodeFlag _nodeFlag;
|
||||
protected internal string _name;
|
||||
|
||||
protected ExpBaseNode( string name, ExpSchema context )
|
||||
{
|
||||
_name = name;
|
||||
NameSpace = context;
|
||||
Next = this;
|
||||
Previous = this;
|
||||
}
|
||||
|
||||
public bool IsNumber
|
||||
{
|
||||
get { return ( _nodeFlag | ExpNodeFlag.BuiltinType_Number ) != 0; }
|
||||
}
|
||||
|
||||
public abstract ExpBaseNode Left
|
||||
{
|
||||
get;
|
||||
}
|
||||
|
||||
public static ExpBaseNode Empty
|
||||
{
|
||||
get => ExpEmptyNode._only;
|
||||
}
|
||||
|
||||
public ExpBaseNode Next
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public abstract ExpBaseNode Right
|
||||
{
|
||||
get;
|
||||
}
|
||||
|
||||
public ExpBaseNode Previous
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public ExpSchema NameSpace
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
|
||||
public abstract IExpElementSource EqualityTypeConvert
|
||||
{
|
||||
get;
|
||||
}
|
||||
|
||||
public long NodeFlag => ( long )_nodeFlag;
|
||||
|
||||
public string CodeConvertTemplate
|
||||
{
|
||||
get;
|
||||
internal set;
|
||||
}
|
||||
|
||||
public string Name => _name;
|
||||
|
||||
public virtual void AppendNode( ExpBaseNode nextToken )
|
||||
{
|
||||
Next.Previous = nextToken;
|
||||
nextToken.Next = Next;
|
||||
Next = nextToken;
|
||||
Next.Previous = this;
|
||||
}
|
||||
|
||||
public ExpNodeNextEnumerator GetEnumerator()
|
||||
{
|
||||
return new ExpNodeNextEnumerator( this );
|
||||
}
|
||||
|
||||
public static bool VerifyTypeConvertable(
|
||||
ExpBaseNode left,
|
||||
ExpBaseNode right )
|
||||
{
|
||||
IExpElementSource tLeft = left.EqualityTypeConvert,
|
||||
tRight = right.EqualityTypeConvert;
|
||||
if( tLeft == null || tRight == null ) {
|
||||
return false;
|
||||
}
|
||||
return tLeft.IsConvertable( tRight );
|
||||
}
|
||||
|
||||
protected void AssertSchemaInclude( ExpBaseNode expressionRoot )
|
||||
{
|
||||
if( expressionRoot.NameSpace != NameSpace && NameSpace.TryGetSchemaInclude(
|
||||
expressionRoot.NameSpace.Name, out _ ) ) {
|
||||
throw new ExpInvalidSchemaIncludeException(
|
||||
NameSpace, expressionRoot.NameSpace );
|
||||
}
|
||||
}
|
||||
|
||||
private class ExpEmptyNode : ExpBaseNode
|
||||
{
|
||||
|
||||
internal static readonly ExpEmptyNode _only = new();
|
||||
|
||||
public ExpEmptyNode()
|
||||
: base( string.Empty, ExpSchema.BuiltinSchema ) { }
|
||||
|
||||
public override ExpBaseNode Left => _only;
|
||||
|
||||
public override ExpBaseNode Right => _only;
|
||||
|
||||
public override IExpElementSource EqualityTypeConvert => throw new NotImplementedException(
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,148 @@
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
// file="ExpBinaryOperatorNode.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.Runtime.CompilerServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StgSharp.Script.Express
|
||||
{
|
||||
public class ExpBinaryOperatorNode : ExpBaseNode
|
||||
{
|
||||
|
||||
private ExpBaseNode _left;
|
||||
private ExpBaseNode _right;
|
||||
private ExpTypeSource _returnType;
|
||||
|
||||
public ExpBinaryOperatorNode( string name ) : base( name, null! ) { }
|
||||
|
||||
public ExpBinaryOperatorNode(
|
||||
string source,
|
||||
ExpSchema context,
|
||||
ExpBaseNode left,
|
||||
ExpBaseNode right )
|
||||
: base( source, context )
|
||||
{
|
||||
if( !left.EqualityTypeConvert
|
||||
.IsConvertable( right.EqualityTypeConvert ) ) {
|
||||
throw new InvalidCastException(
|
||||
$"Cannot convert element {left.EqualityTypeConvert} to {right.EqualityTypeConvert}" );
|
||||
}
|
||||
_left = left;
|
||||
_right = right;
|
||||
}
|
||||
|
||||
public override ExpBaseNode Left => _left;
|
||||
|
||||
public override ExpBaseNode Right => _right;
|
||||
|
||||
public override IExpElementSource EqualityTypeConvert => _returnType;
|
||||
|
||||
public static ExpBinaryOperatorNode Add(
|
||||
ExpBaseNode left,
|
||||
ExpBaseNode right )
|
||||
{
|
||||
if( !left.IsNumber && !right.IsNumber ) {
|
||||
throw new ExpInvalidTypeException(
|
||||
"Number", left.EqualityTypeConvert.Name );
|
||||
}
|
||||
bool isFloat =
|
||||
( left._nodeFlag | ExpNodeFlag.BuiltinType_Float ) == 0 || ( right._nodeFlag | ExpNodeFlag.BuiltinType_Float ) ==
|
||||
0;
|
||||
return new ExpBinaryOperatorNode( ExpCompile.KeyWord.ADD )
|
||||
{
|
||||
_returnType = isFloat ? null : null,
|
||||
_nodeFlag = ExpNodeFlag.Operator_Binary | ExpNodeFlag.BuiltinType_Number,
|
||||
CodeConvertTemplate = "{0} + {1}",
|
||||
};
|
||||
}
|
||||
|
||||
public static ExpBinaryOperatorNode Div(
|
||||
ExpBaseNode left,
|
||||
ExpBaseNode right )
|
||||
{
|
||||
if( !left.IsNumber && !right.IsNumber ) {
|
||||
throw new ExpInvalidTypeException(
|
||||
"Number", left.EqualityTypeConvert.Name );
|
||||
}
|
||||
bool isFloat =
|
||||
( left._nodeFlag | ExpNodeFlag.BuiltinType_Float ) == 0 || ( right._nodeFlag | ExpNodeFlag.BuiltinType_Float ) ==
|
||||
0;
|
||||
return new ExpBinaryOperatorNode( ExpCompile.KeyWord.DIV )
|
||||
{
|
||||
_returnType = isFloat ? null : null,
|
||||
_nodeFlag = ExpNodeFlag.Operator_Binary | ExpNodeFlag.BuiltinType_Number,
|
||||
CodeConvertTemplate = "{0} / {1}",
|
||||
};
|
||||
}
|
||||
|
||||
public static ExpBinaryOperatorNode Mul(
|
||||
ExpBaseNode left,
|
||||
ExpBaseNode right )
|
||||
{
|
||||
if( !left.IsNumber && !right.IsNumber ) {
|
||||
throw new ExpInvalidTypeException(
|
||||
"Number", left.EqualityTypeConvert.Name );
|
||||
}
|
||||
bool isFloat =
|
||||
( left._nodeFlag | ExpNodeFlag.BuiltinType_Float ) == 0 || ( right._nodeFlag | ExpNodeFlag.BuiltinType_Float ) ==
|
||||
0;
|
||||
return new ExpBinaryOperatorNode( ExpCompile.KeyWord.MUL )
|
||||
{
|
||||
_returnType = isFloat ? null : null,
|
||||
_nodeFlag = ExpNodeFlag.Operator_Binary | ExpNodeFlag.BuiltinType_Number,
|
||||
CodeConvertTemplate = "{0} * {1}",
|
||||
};
|
||||
}
|
||||
|
||||
public static ExpBinaryOperatorNode Sub(
|
||||
ExpBaseNode left,
|
||||
ExpBaseNode right )
|
||||
{
|
||||
if( !left.IsNumber && !right.IsNumber ) {
|
||||
throw new ExpInvalidTypeException(
|
||||
"Number", left.EqualityTypeConvert.Name );
|
||||
}
|
||||
bool isFloat =
|
||||
( left._nodeFlag | ExpNodeFlag.BuiltinType_Float ) == 0 || ( right._nodeFlag | ExpNodeFlag.BuiltinType_Float ) ==
|
||||
0;
|
||||
return new ExpBinaryOperatorNode( ExpCompile.KeyWord.SUB )
|
||||
{
|
||||
_returnType = isFloat ? : null,
|
||||
_nodeFlag = ExpNodeFlag.Operator_Binary | ExpNodeFlag.BuiltinType_Number,
|
||||
CodeConvertTemplate = "{0} - {1}",
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
// file="ExpFunctionCallingNode.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
|
||||
{
|
||||
internal class ExpFunctionCallingNode : ExpBaseNode
|
||||
{
|
||||
|
||||
private ExpBaseNode _parameter;
|
||||
private ExpFunctionSource _function;
|
||||
|
||||
public ExpFunctionCallingNode(
|
||||
string functionName,
|
||||
int line,
|
||||
int column,
|
||||
ExpSchema context,
|
||||
ExpBaseNode firstParameter )
|
||||
: base( $"{functionName}_{line}_{column}", context )
|
||||
{
|
||||
_parameter = firstParameter;
|
||||
if( !context.TryGetFunction( functionName, out _function ) ) {
|
||||
foreach( var item in context. ) { }
|
||||
}
|
||||
}
|
||||
|
||||
public override ExpBaseNode Left => throw new NotImplementedException();
|
||||
|
||||
public override ExpBaseNode Right => _parameter;
|
||||
|
||||
public override IExpElementSource EqualityTypeConvert => throw new NotImplementedException(
|
||||
);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
// file="ExpIfNode.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 StgSharp.Script.Express;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp.Script.Express
|
||||
{
|
||||
public sealed class ExpIfNode : ExpBaseNode
|
||||
{
|
||||
|
||||
private ExpBaseNode _falseOpBegin;
|
||||
private ExpBaseNode _rule;
|
||||
private ExpBaseNode _trueOpBegin ;
|
||||
|
||||
public ExpIfNode(
|
||||
string name,
|
||||
ExpSchema context,
|
||||
ExpBaseNode rule,
|
||||
ExpBaseNode rootOperationIfTrue,
|
||||
ExpBaseNode rootOperationIfFalse )
|
||||
: base( name, context )
|
||||
{
|
||||
_rule = rule;
|
||||
_trueOpBegin = rootOperationIfFalse;
|
||||
_falseOpBegin = rootOperationIfFalse;
|
||||
}
|
||||
|
||||
public override ExpBaseNode Left => _trueOpBegin;
|
||||
|
||||
public override ExpBaseNode Right => _falseOpBegin;
|
||||
|
||||
public override IExpElementSource EqualityTypeConvert => null!;
|
||||
|
||||
public void AppendFalseOperation( ExpBaseNode expressionRoot )
|
||||
{
|
||||
AssertSchemaInclude( expressionRoot );
|
||||
_falseOpBegin.AppendNode( expressionRoot );
|
||||
}
|
||||
|
||||
public void AppendTrueOperation( ExpBaseNode expressionRoot )
|
||||
{
|
||||
AssertSchemaInclude( expressionRoot );
|
||||
_trueOpBegin.AppendNode( expressionRoot );
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
// file="ExpIndexOfNode.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 class ExpIndexOfNode : ExpBaseNode
|
||||
{
|
||||
|
||||
private ExpBaseNode _indexExpression;
|
||||
|
||||
private ExpCollectionInstanceBase _collection;
|
||||
|
||||
public ExpIndexOfNode(
|
||||
ExpSchema context,
|
||||
ExpCollectionInstanceBase instance,
|
||||
ExpBaseNode indexExpression )
|
||||
: base( ExpCompile.PoolString( "[" ), context )
|
||||
{
|
||||
_collection = instance;
|
||||
_indexExpression = indexExpression;
|
||||
}
|
||||
|
||||
public override ExpBaseNode Left => _collection;
|
||||
|
||||
public override ExpBaseNode Right => throw new NotImplementedException();
|
||||
|
||||
public override IExpElementSource EqualityTypeConvert => throw new NotImplementedException(
|
||||
);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,107 @@
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
// file="ExpLiteralGenericNode.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 StgSharp.Data;
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp.Script.Express
|
||||
{
|
||||
public class ExpLiteralNode
|
||||
{
|
||||
|
||||
private readonly IValueBox box;
|
||||
|
||||
}
|
||||
|
||||
public class ExpLiteralGenericNode<T> : ExpElementInstanceBase
|
||||
{
|
||||
|
||||
private readonly ExpBuiltinType _type;
|
||||
private readonly T _value;
|
||||
|
||||
public ExpLiteralGenericNode( string name, ExpSchema context, T value )
|
||||
: base( name, context )
|
||||
{
|
||||
_value = value;
|
||||
switch( value ) {
|
||||
case float f:
|
||||
ExpSchema.BuiltinSchema
|
||||
.TryGetType(
|
||||
ExpCompile.KeyWord.Real,
|
||||
out ExpTypeSource? type );
|
||||
_type = ( type as ExpBuiltinType )!;
|
||||
_nodeFlag = ExpNodeFlag.BuiltinType_Float | ExpNodeFlag.Element_Const;
|
||||
break;
|
||||
case int i:
|
||||
ExpSchema.BuiltinSchema
|
||||
.TryGetType( ExpCompile.KeyWord.Int, out type );
|
||||
_type = ( type as ExpBuiltinType )!;
|
||||
_nodeFlag = ExpNodeFlag.BuiltinType_Int | ExpNodeFlag.Element_Const;
|
||||
break;
|
||||
case BitArray b:
|
||||
ExpSchema.BuiltinSchema
|
||||
.TryGetType( ExpCompile.KeyWord.Binary, out type );
|
||||
_type = ( type as ExpBuiltinType )!;
|
||||
_nodeFlag = ExpNodeFlag.BuiltinType_Binary | ExpNodeFlag.Element_Const;
|
||||
break;
|
||||
case string s:
|
||||
ExpSchema.BuiltinSchema
|
||||
.TryGetType( ExpCompile.KeyWord.String, out type );
|
||||
_type = ( type as ExpBuiltinType )!;
|
||||
_nodeFlag = ExpNodeFlag.BuiltinType_Int | ExpNodeFlag.Element_Const;
|
||||
break;
|
||||
case ExpLogic l:
|
||||
ExpSchema.BuiltinSchema
|
||||
.TryGetType( ExpCompile.KeyWord.Logic, out type );
|
||||
_type = ( type as ExpBuiltinType )!;
|
||||
_nodeFlag = ExpNodeFlag.BuiltinType_Int | ExpNodeFlag.Element_Const;
|
||||
break;
|
||||
default:
|
||||
throw new ExpInvalidTypeException(
|
||||
"Builtin Type", value!.GetType().Name );
|
||||
}
|
||||
}
|
||||
|
||||
public override ExpBaseNode Left => ExpBaseNode;
|
||||
|
||||
public override ExpBaseNode Right => throw new NotImplementedException();
|
||||
|
||||
public override IExpElementSource EqualityTypeConvert => _type;
|
||||
|
||||
public override string TypeName => _type.Name;
|
||||
|
||||
public T value => _value;
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,96 @@
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
// file="ExpRepeatNode.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.Runtime.Serialization;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp.Script.Express
|
||||
{
|
||||
public class ExpRepeatToken : ExpBaseNode
|
||||
{
|
||||
|
||||
private ExpBaseNode _operationBegin;
|
||||
|
||||
private ExpElementInstanceBase _variable, _begin, _end, _increment;
|
||||
|
||||
public ExpRepeatToken(
|
||||
string name,
|
||||
ExpSchema context,
|
||||
ExpBaseNode operationBegin,
|
||||
ExpElementInstanceBase variable,
|
||||
ExpElementInstanceBase begin,
|
||||
ExpElementInstanceBase end,
|
||||
ExpElementInstanceBase increment )
|
||||
: base( name, context )
|
||||
{
|
||||
if( variable.NodeFlag != begin.NodeFlag || begin.NodeFlag !=
|
||||
end.NodeFlag || ( increment != null && end.NodeFlag !=
|
||||
increment.NodeFlag ) ) {
|
||||
throw new InvalidCastException();
|
||||
}
|
||||
if( increment == null ) {
|
||||
switch( ( ExpNodeFlag )variable.NodeFlag | ExpNodeFlag.BuiltinType_Any ) {
|
||||
case ExpNodeFlag.BuiltinType_Float:
|
||||
increment = new ExpLiteralGenericNode<float>(
|
||||
$"{name}_defaultIncrement", context, 1.0f );
|
||||
break;
|
||||
case ExpNodeFlag.BuiltinType_Int:
|
||||
increment = new ExpLiteralGenericNode<int>(
|
||||
$"{name}_defaultIncrement", context, 1 );
|
||||
break;
|
||||
default:
|
||||
throw new ExpInvalidTypeException(
|
||||
"Int or Real", "otherwise" );
|
||||
}
|
||||
}
|
||||
_begin = begin;
|
||||
_variable = variable;
|
||||
_end = end;
|
||||
_increment = increment;
|
||||
_nodeFlag = ExpNodeFlag.Branch_Repeat;
|
||||
_operationBegin = operationBegin;
|
||||
}
|
||||
|
||||
public override ExpBaseNode Left => throw new NotImplementedException();
|
||||
|
||||
public override ExpBaseNode Right => _operationBegin;
|
||||
|
||||
public override IExpElementSource EqualityTypeConvert => null!;
|
||||
|
||||
public void AppendRepeatedOperation( ExpBaseNode node )
|
||||
{
|
||||
_operationBegin.AppendNode( node );
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,113 @@
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
// file="ExpSwitchNode.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 class ExpSwitchNode : ExpBaseNode
|
||||
{
|
||||
|
||||
private Dictionary<ExpBaseNode, ExpBaseNode> _cases;
|
||||
private ExpBaseNode _default;
|
||||
private ExpBaseNode _target;
|
||||
|
||||
public ExpSwitchNode(
|
||||
string name,
|
||||
ExpSchema context,
|
||||
ExpBaseNode target,
|
||||
ExpBaseNode defaultCase,
|
||||
params (ExpBaseNode label, ExpBaseNode op)[] cases )
|
||||
: base( name, context )
|
||||
{
|
||||
_target = target;
|
||||
_default = defaultCase;
|
||||
_cases = new Dictionary<ExpBaseNode, ExpBaseNode>();
|
||||
foreach( (ExpBaseNode label, ExpBaseNode op ) item in cases ) {
|
||||
if( item.op == null ) {
|
||||
_cases.Add( item.label, null! );
|
||||
} else {
|
||||
_cases.Add( item.label, item.op );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public ExpBaseNode this[ ExpBaseNode index ]
|
||||
{
|
||||
get
|
||||
{
|
||||
if( _cases.TryGetValue( index, out ExpBaseNode? ret ) ) {
|
||||
return ret;
|
||||
}
|
||||
return _default;
|
||||
}
|
||||
}
|
||||
|
||||
public override ExpBaseNode Left => throw new NotImplementedException();
|
||||
|
||||
public override ExpBaseNode Right => throw new NotImplementedException();
|
||||
|
||||
public override IExpElementSource EqualityTypeConvert => null!;
|
||||
|
||||
public void AddOperationToDefault( ExpBaseNode expressionRoot )
|
||||
{
|
||||
if( expressionRoot != null ) {
|
||||
_default.AppendNode( expressionRoot );
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds an expression to certain <see langword="case" />. The added expression will be run
|
||||
/// at last.
|
||||
/// </summary>
|
||||
/// <param name="label"> Label of case to add operation </param>
|
||||
/// <param name="expressionRoot"> Root token of the expression to be added. </param>
|
||||
/// <exception cref="ExpCaseNotFoundException"> Cannot fine the case label in current witch expression. </exception>
|
||||
public void AppendOperationToCase(
|
||||
ExpBaseNode label,
|
||||
ExpBaseNode expressionRoot )
|
||||
{
|
||||
AssertSchemaInclude( expressionRoot );
|
||||
if( _cases.TryGetValue( label, out ExpBaseNode? op ) ) {
|
||||
op.AppendNode( expressionRoot );
|
||||
} else {
|
||||
throw new ExpCaseNotFoundException( this, label );
|
||||
}
|
||||
}
|
||||
|
||||
public bool ContainsCase( ExpBaseNode token )
|
||||
{
|
||||
return _cases.ContainsKey( token );
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
// file="ExpUnaryOperatorNode.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 class ExpUnaryOperatorNode : ExpBaseNode
|
||||
{
|
||||
|
||||
private ExpBaseNode _operand;
|
||||
|
||||
public ExpUnaryOperatorNode(
|
||||
string name,
|
||||
ExpBaseNode operand,
|
||||
ExpSchema context )
|
||||
: base( name, context )
|
||||
{
|
||||
_operand = operand;
|
||||
}
|
||||
|
||||
public override ExpBaseNode Left => null!;
|
||||
|
||||
public override ExpBaseNode Right => _operand;
|
||||
|
||||
public override IExpElementSource EqualityTypeConvert => _operand.EqualityTypeConvert;
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
// file="ExpElementInstanceBase.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.IO;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp.Script.Express
|
||||
{
|
||||
[Flags]
|
||||
public enum ExpElementType : int
|
||||
{
|
||||
|
||||
Const = 0,
|
||||
Entity = 1,
|
||||
Type = 2,
|
||||
Function = 4,
|
||||
Section = 8,
|
||||
Expression = 16,
|
||||
Rule = 32,
|
||||
Procedure = 64,
|
||||
Collection = 128 | Type,
|
||||
|
||||
}
|
||||
|
||||
public abstract class ExpElementInstanceBase : ExpBaseNode
|
||||
{
|
||||
|
||||
protected ExpElementInstanceBase( string name, ExpSchema context )
|
||||
: base( name, context ) { }
|
||||
|
||||
public ExpElementType ElementType
|
||||
{
|
||||
get;
|
||||
}
|
||||
|
||||
public abstract string TypeName
|
||||
{
|
||||
get;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,115 @@
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
// file="ExpElmentSource.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 IExpElementSource : ITypeSource<IExpElementSource>
|
||||
{
|
||||
|
||||
public ExpElementType ElementType
|
||||
{
|
||||
get;
|
||||
}
|
||||
|
||||
IScriptSourceProvider SourceProvider
|
||||
{
|
||||
get;
|
||||
}
|
||||
|
||||
string Name
|
||||
{
|
||||
get;
|
||||
}
|
||||
|
||||
public void Analyse();
|
||||
|
||||
}
|
||||
|
||||
public abstract class ExpInstantiableElementBase : IExpElementSource
|
||||
{
|
||||
|
||||
public abstract ExpElementType ElementType
|
||||
{
|
||||
get;
|
||||
}
|
||||
|
||||
public abstract IScriptSourceProvider SourceProvider
|
||||
{
|
||||
get;
|
||||
}
|
||||
|
||||
public abstract string Name
|
||||
{
|
||||
get;
|
||||
}
|
||||
|
||||
public abstract void Analyse();
|
||||
|
||||
public abstract ExpBaseNode CreateInstanceToken();
|
||||
|
||||
public abstract bool IsConvertable( IExpElementSource targetType );
|
||||
|
||||
}
|
||||
|
||||
public abstract class ExpImmutableElementBase : IExpElementSource
|
||||
{
|
||||
|
||||
public abstract ExpElementType ElementType
|
||||
{
|
||||
get;
|
||||
}
|
||||
|
||||
public abstract IScriptSourceProvider SourceProvider
|
||||
{
|
||||
get;
|
||||
}
|
||||
|
||||
public abstract string Name
|
||||
{
|
||||
get;
|
||||
}
|
||||
|
||||
public abstract void Analyse();
|
||||
|
||||
public bool IsConvertable( IExpElementSource targetType )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public abstract ExpBaseNode MakeReference( params object[] options );
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,135 @@
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
// file="ExpExceptions.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.IO;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp.Script.Express
|
||||
{
|
||||
public class ExpCompileNotInitializedException : InvalidOperationException
|
||||
{
|
||||
|
||||
public ExpCompileNotInitializedException()
|
||||
: base(
|
||||
"Attempt to compile an EXPRESS script before the init of compiler." ) { }
|
||||
|
||||
}
|
||||
|
||||
public class ExpInvalidCharException : Exception
|
||||
{
|
||||
|
||||
public ExpInvalidCharException( char c )
|
||||
: base( $"An unknown char {c} occurred." ) { }
|
||||
|
||||
}
|
||||
|
||||
public class ExpInvalidTokenException : Exception
|
||||
{
|
||||
|
||||
public ExpInvalidTokenException( int index )
|
||||
: base( $"Cannot read a token from line at {index}" ) { }
|
||||
|
||||
}
|
||||
|
||||
public class ExpInvalidTypeDeclareEndingExceptions : Exception
|
||||
{
|
||||
|
||||
public ExpInvalidTypeDeclareEndingExceptions(
|
||||
string declaredName,
|
||||
string endedName )
|
||||
: base(
|
||||
$"The datatype is declared with name {declaredName} but ended with {endedName}" ) { }
|
||||
|
||||
}
|
||||
|
||||
public class ExpInvalidElementNameException : Exception
|
||||
{
|
||||
|
||||
public ExpInvalidElementNameException(
|
||||
string elementName,
|
||||
ExpSchema schema )
|
||||
: base(
|
||||
$"Cannot find any element named {elementName} in {schema.Name}" ) { }
|
||||
|
||||
}
|
||||
|
||||
public class ExpInvalidTypeException : InvalidCastException
|
||||
{
|
||||
|
||||
public ExpInvalidTypeException( string required, string provided )
|
||||
: base(
|
||||
$"Type {required} is required at position, but a {provided} instance is provided." ) { }
|
||||
|
||||
}
|
||||
|
||||
public class ExpInvalidCollectionMemberTypeException : InvalidCastException
|
||||
{
|
||||
|
||||
public ExpInvalidCollectionMemberTypeException(
|
||||
ExpElementInstanceBase elementInstance,
|
||||
ExpCollectionBase collection )
|
||||
: base(
|
||||
$"Attempt to add or remove an element of type: {elementInstance.ElementType} from a collection collects {collection.MemberType}" ) { }
|
||||
|
||||
}
|
||||
|
||||
public class ExpInvalidSchemaIncludeException : InvalidOperationException
|
||||
{
|
||||
|
||||
public ExpInvalidSchemaIncludeException(
|
||||
ExpSchema context,
|
||||
ExpSchema source )
|
||||
: base(
|
||||
$"Attempted to reference an EXPRESS language expression in the current schema context '{context.Name}', " + $"but this expression comes from another schema '{source.Name}' that has not been included." ) { }
|
||||
|
||||
}
|
||||
|
||||
public class ExpCaseNotFoundException : ArgumentOutOfRangeException
|
||||
{
|
||||
|
||||
public ExpCaseNotFoundException(
|
||||
ExpSwitchNode token,
|
||||
ExpBaseNode label )
|
||||
: base(
|
||||
$"Attempt to read or write the label {label.Name} not exist in SWITCH expression {token.Name}" ) { }
|
||||
|
||||
}
|
||||
|
||||
public class ExpTypeNotFoundException : Exception
|
||||
{
|
||||
|
||||
public ExpTypeNotFoundException( string typeName, ExpSchema context )
|
||||
: base(
|
||||
$"Cannot find the type {typeName} in schema {context.Name} and its included schemas" ) { }
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,113 @@
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
// file="ExpSchemaBase.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 StgSharp.Collections;
|
||||
|
||||
using System;
|
||||
using System.Collections.Frozen;
|
||||
using System.Linq;
|
||||
|
||||
namespace StgSharp.Script.Express
|
||||
{
|
||||
public abstract class ExpSchema
|
||||
{
|
||||
|
||||
public static ExpSchema BuiltinSchema
|
||||
{
|
||||
get => ExpSchema_Nitload.Only;
|
||||
}
|
||||
|
||||
public string Name
|
||||
{
|
||||
get;
|
||||
internal set;
|
||||
}
|
||||
|
||||
public abstract void LoadFromSource( ExpSchemaSource source );
|
||||
|
||||
public abstract bool TryGetConst(
|
||||
string name,
|
||||
out ExpElementInstanceBase c );
|
||||
|
||||
public abstract bool TryGetEntity( string name, out ExpEntitySource e );
|
||||
|
||||
public abstract bool TryGetFunction(
|
||||
string name,
|
||||
out ExpFunctionSource f );
|
||||
|
||||
public abstract bool TryGetRule( string name, out ExpRuleSource r );
|
||||
|
||||
public abstract bool TryGetSchemaInclude(
|
||||
string name,
|
||||
out ExpSchema include );
|
||||
|
||||
public abstract bool TryGetType( string name, out ExpTypeSource t );
|
||||
|
||||
#pragma warning disable CS8618
|
||||
protected FrozenDictionary<string, ExpElementInstanceBase> ConstDict
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
protected FrozenDictionary<string, ExpEntitySource> EntityDict
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
protected FrozenDictionary<string, ExpFunctionSource> FunctionDict
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
protected ConcurrentStringHashMultiplexer StringMultiplexer => ExpCompile.Multiplexer;
|
||||
|
||||
protected FrozenDictionary<string, ExpRuleSource> RuleDict
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
protected FrozenDictionary<string, ExpSchema> SchemaInclude
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
protected FrozenDictionary<string, ExpTypeSource> TypeDict
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
#pragma warning restore CS8618
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,357 @@
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
// file="ExpSchemaSource.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 StgSharp.Collections;
|
||||
using StgSharp.Graphics.OpenGL;
|
||||
|
||||
using System;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Diagnostics.Tracing;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace StgSharp.Script.Express
|
||||
{
|
||||
public partial class ExpSchemaSource
|
||||
{
|
||||
|
||||
private static Regex
|
||||
_constDefineBegin = GetConstDefineBegin(),
|
||||
_constDefineEnd = GetConstDefineEnd(),
|
||||
_schemaBegin = GetSchemaBegin(),
|
||||
_schemaEnd = GetSchemaEnd(),
|
||||
_entityDefineBegin = GetEntityDefineBegin(),
|
||||
_entityDefineEnd = GetEntityDefineEnd(),
|
||||
_typeDefineBegin = GetTypeDefineBegin(),
|
||||
_typeDefineEnd = GetTypeDefineEnd(),
|
||||
_functionDefineBegin = GetFunctionDefineBegin(),
|
||||
_functionDefineEnd = GetFunctionDefineEnd(),
|
||||
_ruleDefineBegin = GetRuleDefineBegin(),
|
||||
_ruleDefineEnd = GetRuleDefineEnd();
|
||||
|
||||
private readonly GeneratedExpSchema _compileResult = new GeneratedExpSchema(
|
||||
);
|
||||
|
||||
private List<IExpElementSource> _sourceCache = [];
|
||||
|
||||
private string name;
|
||||
|
||||
public ExpSchemaSource() { }
|
||||
|
||||
public List<IExpElementSource> Cache
|
||||
{
|
||||
get => _sourceCache;
|
||||
}
|
||||
|
||||
public string Name
|
||||
{
|
||||
get => _compileResult.Name;
|
||||
internal set => _compileResult.Name = value;
|
||||
}
|
||||
|
||||
public ExpSchema Organize()
|
||||
{
|
||||
_compileResult.LoadFromSource( this );
|
||||
return _compileResult;
|
||||
}
|
||||
|
||||
public void ReadSchema( ExpFileSource reader )
|
||||
{
|
||||
string line = reader.ReadLine();
|
||||
while( !_schemaBegin.IsMatch( line ) ) {
|
||||
line = reader.ReadLine();
|
||||
}
|
||||
name = _schemaBegin.Match( line ).Groups[ "namespace" ].Value;
|
||||
|
||||
while( !_schemaEnd.IsMatch( line ) ) {
|
||||
if( TryReadConst( line, reader,
|
||||
out IExpElementSource source ) ) {
|
||||
_sourceCache.Add( source );
|
||||
} else if( TryReadType( line, reader, out source ) ) {
|
||||
_sourceCache.Add( source );
|
||||
} else if( TryReadEntity( line, reader, out source ) ) {
|
||||
_sourceCache.Add( source );
|
||||
} else if( TryReadRule( line, reader, out source ) ) {
|
||||
_sourceCache.Add( source );
|
||||
} else if( TryReadFunction( line, reader, out source ) ) {
|
||||
_sourceCache.Add( source );
|
||||
}
|
||||
line = reader.ReadLine();
|
||||
}
|
||||
}
|
||||
|
||||
public static bool TryReadSchema(
|
||||
string firstLine,
|
||||
ExpFileSource reader,
|
||||
out ExpSchemaSource source )
|
||||
{
|
||||
if( !_schemaBegin.IsMatch( firstLine ) ) {
|
||||
source = null!;
|
||||
return false;
|
||||
}
|
||||
ExpSchemaSource _source = new ExpSchemaSource();
|
||||
_source.name = _schemaBegin.Match( firstLine ).Groups[ "namespace" ].Value;
|
||||
|
||||
while( !_schemaEnd.IsMatch( firstLine ) ) {
|
||||
if( _source.TryReadConst(
|
||||
firstLine, reader,
|
||||
out IExpElementSource _elementSource ) ) {
|
||||
_source._sourceCache.Add( _elementSource );
|
||||
} else if( _source.TryReadType(
|
||||
firstLine, reader, out _elementSource ) ) {
|
||||
_source._sourceCache.Add( _elementSource );
|
||||
} else if( _source.TryReadEntity(
|
||||
firstLine, reader, out _elementSource ) ) {
|
||||
_source._sourceCache.Add( _elementSource );
|
||||
} else if( _source.TryReadRule(
|
||||
firstLine, reader, out _elementSource ) ) {
|
||||
_source._sourceCache.Add( _elementSource );
|
||||
} else if( _source.TryReadFunction(
|
||||
firstLine, reader, out _elementSource ) ) {
|
||||
_source._sourceCache.Add( _elementSource );
|
||||
}
|
||||
firstLine = reader.ReadLine();
|
||||
}
|
||||
source = _source;
|
||||
return true;
|
||||
}
|
||||
|
||||
[GeneratedRegex( @"\s*CONSTANT" )]
|
||||
private static partial Regex GetConstDefineBegin();
|
||||
|
||||
[GeneratedRegex( @"\s*END_CONSTANT;" )]
|
||||
private static partial Regex GetConstDefineEnd();
|
||||
|
||||
[GeneratedRegex(
|
||||
@"\s*ENTITY\s*(?<TypeName>[A-Za-z0-9_]+)\s*",
|
||||
RegexOptions.Compiled )]
|
||||
private static partial Regex GetEntityDefineBegin();
|
||||
|
||||
[GeneratedRegex(
|
||||
@"\s*END_ENTITY;\s*--\s*(?<TypeName>[A-Za-z0-9_]+)\s*",
|
||||
RegexOptions.Compiled )]
|
||||
private static partial Regex GetEntityDefineEnd();
|
||||
|
||||
[GeneratedRegex(
|
||||
@"\s*FUNCTION\s*\s*(?<FunctionName>[a-zA-Z0-9_]+)\s*(?<Remaining>.*)",
|
||||
RegexOptions.Compiled )]
|
||||
private static partial Regex GetFunctionDefineBegin();
|
||||
|
||||
[GeneratedRegex(
|
||||
@"\s*END_FUNCTION\s*;\s*--\s*(?<FunctionName>[a-zA-Z0-9_]+)",
|
||||
RegexOptions.Compiled )]
|
||||
private static partial Regex GetFunctionDefineEnd();
|
||||
|
||||
[GeneratedRegex(
|
||||
@"\s*RULE\s*(?<RuleName>[a-zA-Z0-9_]+)\s*FOR\s*\((?<Target>[a-zA-Z0-9_]*(?:\s*\)\s*;)?)",
|
||||
RegexOptions.Compiled )]
|
||||
private static partial Regex GetRuleDefineBegin();
|
||||
|
||||
[GeneratedRegex(
|
||||
@"\s*END_RULE\s*;\s*--\s*(?<RuleName>[A-Za-z0-9_]+)",
|
||||
RegexOptions.Compiled )]
|
||||
private static partial Regex GetRuleDefineEnd();
|
||||
|
||||
[GeneratedRegex( @"\s*SCHEMA\s*(?<namespace>[A-Za-z0-9_]+)\s?;" )]
|
||||
private static partial Regex GetSchemaBegin();
|
||||
|
||||
[GeneratedRegex(
|
||||
@"END_SCHEMA;\s*--\s*(?<namespace>[A-Za-z0-9_]+)",
|
||||
RegexOptions.Compiled )]
|
||||
private static partial Regex GetSchemaEnd();
|
||||
|
||||
[GeneratedRegex(
|
||||
@"\s*TYPE\s+(?<TypeName>[A-Za-z0-9_]+)\s*=\s*(?<Remaining>[A-Z]+)",
|
||||
RegexOptions.Compiled )]
|
||||
private static partial Regex GetTypeDefineBegin();
|
||||
|
||||
[GeneratedRegex(
|
||||
@"\s*END_TYPE\s*;\s*--\s*(?<TypeName>[a-zA-Z0-9_]+)",
|
||||
RegexOptions.Compiled )]
|
||||
private static partial Regex GetTypeDefineEnd();
|
||||
|
||||
private bool TryReadConst(
|
||||
string firstLine,
|
||||
ExpFileSource reader,
|
||||
out IExpElementSource source )
|
||||
{
|
||||
Match match = _constDefineBegin.Match( firstLine );
|
||||
if( match.Success ) {
|
||||
ScriptSourceTransmitter transmitter = new ScriptSourceTransmitter(
|
||||
"END_CONSTANT", reader.Location );
|
||||
ExpConstantCollectionSource _source = new ExpConstantCollectionSource(
|
||||
transmitter );
|
||||
string line = reader.ReadLine();
|
||||
while( !_constDefineEnd.IsMatch( line ) ) {
|
||||
transmitter.WriteLine( line );
|
||||
line = reader.ReadLine();
|
||||
}
|
||||
transmitter.WriteLine( "END_CONSTANT" );
|
||||
source = _source;
|
||||
return true;
|
||||
}
|
||||
source = null!;
|
||||
return false;
|
||||
}
|
||||
|
||||
private bool TryReadEntity(
|
||||
string firstLine,
|
||||
ExpFileSource reader,
|
||||
out IExpElementSource source )
|
||||
{
|
||||
Match match = _entityDefineBegin.Match( firstLine );
|
||||
if( match.Success ) {
|
||||
ScriptSourceTransmitter transmitter = new ScriptSourceTransmitter(
|
||||
"END_ENTITY", reader.Location );
|
||||
ExpEntitySource _source = new ExpEntitySource(
|
||||
match.Groups[ "TypeName" ].ToString(), transmitter );
|
||||
string line = reader.ReadLine();
|
||||
match = _entityDefineEnd.Match( line );
|
||||
while( !match.Success ) {
|
||||
transmitter.WriteLine( line );
|
||||
line = reader.ReadLine();
|
||||
match = _entityDefineEnd.Match( line );
|
||||
}
|
||||
string endedName = match.Groups[ "TypeName" ].ToString();
|
||||
if( !string.Equals( endedName, _source.Name ) ) {
|
||||
throw new ExpInvalidTypeDeclareEndingExceptions(
|
||||
_source.Name, endedName );
|
||||
}
|
||||
transmitter.WriteLine( "END_ENTITY" );
|
||||
source = _source;
|
||||
return true;
|
||||
}
|
||||
source = null!;
|
||||
return false;
|
||||
}
|
||||
|
||||
private bool TryReadFunction(
|
||||
string firstLine,
|
||||
ExpFileSource reader,
|
||||
out IExpElementSource source )
|
||||
{
|
||||
Match match = _functionDefineBegin.Match( firstLine );
|
||||
if( match.Success ) {
|
||||
ScriptSourceTransmitter transmitter = new ScriptSourceTransmitter(
|
||||
"END_FUNCTION", reader.Location );
|
||||
ExpFunctionSource _source = new ExpFunctionSource(
|
||||
match.Groups[ "FunctionName" ].ToString(), transmitter );
|
||||
transmitter.WriteLine( match.Groups[ "Remaining" ].ToString() );
|
||||
string line = reader.ReadLine();
|
||||
match = _functionDefineEnd.Match( line );
|
||||
while( !match.Success ) {
|
||||
transmitter.WriteLine( line );
|
||||
line = reader.ReadLine();
|
||||
match = _functionDefineEnd.Match( line );
|
||||
}
|
||||
string endedName = match.Groups[ "FunctionName" ].ToString();
|
||||
if( !string.Equals( endedName, _source.Name ) ) {
|
||||
throw new ExpInvalidTypeDeclareEndingExceptions(
|
||||
_source.Name, endedName );
|
||||
}
|
||||
transmitter.WriteLine( "END_FUNCTION" );
|
||||
source = _source;
|
||||
return true;
|
||||
}
|
||||
source = null!;
|
||||
return false;
|
||||
}
|
||||
|
||||
private bool TryReadRule(
|
||||
string firstLine,
|
||||
ExpFileSource reader,
|
||||
out IExpElementSource source )
|
||||
{
|
||||
Match match = _ruleDefineBegin.Match( firstLine );
|
||||
if( match.Success ) {
|
||||
ScriptSourceTransmitter transmitter = new ScriptSourceTransmitter(
|
||||
"END_RULE", reader.Location );
|
||||
ExpRuleSource _source = new ExpRuleSource(
|
||||
match.Groups[ "RuleName" ].ToString(), transmitter );
|
||||
string target = match.Groups[ "Target" ].ToString();
|
||||
if( !string.IsNullOrEmpty( target ) ) {
|
||||
transmitter.WriteLine( target );
|
||||
}
|
||||
string line = reader.ReadLine();
|
||||
match = _ruleDefineEnd.Match( line );
|
||||
while( !match.Success ) {
|
||||
transmitter.WriteLine( line );
|
||||
line = reader.ReadLine();
|
||||
match = _ruleDefineEnd.Match( line );
|
||||
}
|
||||
string endedName = match.Groups[ "RuleName" ].ToString();
|
||||
if( !string.Equals( endedName, _source.Name ) ) {
|
||||
throw new ExpInvalidTypeDeclareEndingExceptions(
|
||||
_source.Name, endedName );
|
||||
}
|
||||
transmitter.WriteLine( "END_RULE" );
|
||||
source = _source;
|
||||
return true;
|
||||
}
|
||||
source = null!;
|
||||
return false;
|
||||
}
|
||||
|
||||
private bool TryReadType(
|
||||
string firstLine,
|
||||
ExpFileSource reader,
|
||||
out IExpElementSource source )
|
||||
{
|
||||
Match match = _typeDefineBegin.Match( firstLine );
|
||||
if( match.Success ) {
|
||||
ScriptSourceTransmitter transmitter = new ScriptSourceTransmitter(
|
||||
"END_ENTITY", reader.Location );
|
||||
ExpTypeSource _source = new ExpTypeSource(
|
||||
match.Groups[ "TypeName" ].ToString(), transmitter );
|
||||
transmitter.WriteLine( match.Groups[ "Remaining" ].ToString() );
|
||||
string line = reader.ReadLine();
|
||||
match = _typeDefineEnd.Match( line );
|
||||
while( !match.Success ) {
|
||||
transmitter.WriteLine( line );
|
||||
line = reader.ReadLine();
|
||||
match = _typeDefineEnd.Match( line );
|
||||
}
|
||||
string endedName = match.Groups[ "TypeName" ].ToString();
|
||||
if( !string.Equals( endedName, _source.Name ) ) {
|
||||
throw new ExpInvalidTypeDeclareEndingExceptions(
|
||||
_source.Name, endedName );
|
||||
}
|
||||
transmitter.WriteLine( "END_ENTITY" );
|
||||
source = _source;
|
||||
return true;
|
||||
}
|
||||
source = null!;
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,127 @@
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
// file="ExpSource.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.IO;
|
||||
using System.IO.MemoryMappedFiles;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
|
||||
namespace StgSharp.Script.Express
|
||||
{
|
||||
public class ExpFileSource : IDisposable, IScriptSourceProvider
|
||||
{
|
||||
|
||||
private bool disposedValue;
|
||||
private FileStream _expFileStream;
|
||||
private int _location;
|
||||
private MemoryMappedFile _expMemoryMappedFile;
|
||||
private MemoryMappedViewStream _expMemoryMappedStream;
|
||||
|
||||
private SemaphoreSlim readLineSemaphore = new SemaphoreSlim( 1, 1 );
|
||||
private StreamReader _memoryReader;
|
||||
|
||||
public ExpFileSource( string path )
|
||||
{
|
||||
if ( !File.Exists( path ) ) {
|
||||
throw new FileNotFoundException();
|
||||
}
|
||||
_expFileStream = new FileStream(
|
||||
path, FileMode.Open, FileAccess.Read );
|
||||
_expMemoryMappedFile = MemoryMappedFile.CreateFromFile(
|
||||
_expFileStream, null, 0, MemoryMappedFileAccess.Read,
|
||||
HandleInheritability.None, true );
|
||||
_expMemoryMappedStream = _expMemoryMappedFile.CreateViewStream(
|
||||
offset: 0, size: 0, access: MemoryMappedFileAccess.Read );
|
||||
_memoryReader = new StreamReader( _expMemoryMappedStream );
|
||||
}
|
||||
|
||||
public bool IsEmpty => _memoryReader.EndOfStream;
|
||||
|
||||
public int Location => _location;
|
||||
|
||||
// ~ExpFileSource()
|
||||
// {
|
||||
// Dispose(disposing: false);
|
||||
// }
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
Dispose( disposing: true );
|
||||
GC.SuppressFinalize( this );
|
||||
}
|
||||
|
||||
public void EndWriting()
|
||||
{
|
||||
}
|
||||
|
||||
public string ReadLine()
|
||||
{
|
||||
readLineSemaphore.Wait();
|
||||
string line = _memoryReader.ReadLine()!;
|
||||
_location++;
|
||||
readLineSemaphore.Release();
|
||||
return line;
|
||||
}
|
||||
|
||||
public string ReadLine(out int position)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void ResetToBegin()
|
||||
{
|
||||
readLineSemaphore.Wait();
|
||||
_expMemoryMappedStream.Seek( 0, SeekOrigin.Begin );
|
||||
_location = 0;
|
||||
readLineSemaphore.Release();
|
||||
}
|
||||
|
||||
IScriptSourceProvider IScriptSourceProvider.Slice(int location, int count)
|
||||
{
|
||||
throw new NotSupportedException();
|
||||
}
|
||||
|
||||
protected virtual void Dispose( bool disposing )
|
||||
{
|
||||
if( !disposedValue ) {
|
||||
if( disposing ) {
|
||||
_expFileStream.Dispose();
|
||||
_expMemoryMappedFile.Dispose();
|
||||
_expMemoryMappedStream.Dispose();
|
||||
_memoryReader.Dispose();
|
||||
}
|
||||
disposedValue = true;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,313 @@
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
// file="ExpSourceReader.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 CommunityToolkit.HighPerformance;
|
||||
|
||||
using StgSharp.HighPerformance;
|
||||
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace StgSharp.Script.Express
|
||||
{
|
||||
public partial class ExpSourceReader
|
||||
{
|
||||
|
||||
private const int
|
||||
MultiLineEnd = 0x0029002A; // *)
|
||||
|
||||
private const string Token = "token", End = "end", Rest = "rest";
|
||||
|
||||
private bool _isReadingMultiLineComment;
|
||||
private int _current, _lineNum;
|
||||
private IScriptSourceProvider _provider;
|
||||
|
||||
private Regex _nextWordTokenPattern = GetNextWordTokenPattern(),
|
||||
_nextStringLiteralPattern = GetStringLiteralPattern(),
|
||||
_nextNumberLiteralPattern = GetNumberLiteralPattern(),
|
||||
_skipBlankPattern = GetSkipBlankPattern();
|
||||
private string _lineCache;
|
||||
private Token _last;
|
||||
|
||||
public ExpSourceReader( IScriptSourceProvider provider )
|
||||
{
|
||||
_provider = provider;
|
||||
_current = 0;
|
||||
_lineCache = string.Empty;
|
||||
_isReadingMultiLineComment = false;
|
||||
}
|
||||
|
||||
public bool IsEmpty
|
||||
{
|
||||
get => ( ( string.IsNullOrEmpty( _lineCache ) || _current >=
|
||||
_lineCache.Length ) ) && _provider.IsEmpty;
|
||||
}
|
||||
|
||||
public int LineNumber
|
||||
{
|
||||
get => _provider.Location;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <para>Read code until end of a line. Lines in multi-line comment will be ignored. Line
|
||||
/// begins with part of multi-line comment will automatically remove the comment part, but
|
||||
/// beginning with a full multi-line comment will not causing removing.</para> <para> (*Just
|
||||
/// Like The Comment Here*) Will Not Be Removed </para>
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public unsafe ReadOnlySpan<char> ReadLine()
|
||||
{
|
||||
bool lineOver = string.IsNullOrEmpty( _lineCache ) || _current >=
|
||||
_lineCache.Length;
|
||||
while( lineOver || _isReadingMultiLineComment ) {
|
||||
if( lineOver ) {
|
||||
do {
|
||||
_lineCache = _provider.ReadLine( out _lineNum );
|
||||
} while (string.IsNullOrEmpty( _lineCache ));
|
||||
_current = 0;
|
||||
}
|
||||
if( _isReadingMultiLineComment ) {
|
||||
int index;
|
||||
fixed( char* cPtr = _lineCache.AsSpan( _current ) ) {
|
||||
index = UnsafeCompute.IndexOfCharPair(
|
||||
cPtr, MultiLineEnd, _lineCache.Length );
|
||||
}
|
||||
if( index == -1 ) {
|
||||
_lineCache = string.Empty;
|
||||
} else {
|
||||
_isReadingMultiLineComment = false;
|
||||
_current += index + 2;
|
||||
}
|
||||
}
|
||||
lineOver = string.IsNullOrEmpty( _lineCache ) || _current >=
|
||||
_lineCache.Length;
|
||||
}
|
||||
return _lineCache.AsSpan().Slice( _current );
|
||||
}
|
||||
|
||||
public unsafe Token ReadToken()
|
||||
{
|
||||
int begin, end, rest;
|
||||
readLine:
|
||||
ReadOnlySpan<char> source = ReadLine();
|
||||
char c = source[ 0 ];
|
||||
|
||||
if( char.IsLetter( c ) ) {
|
||||
Match match = _nextWordTokenPattern.Match(
|
||||
_lineCache, _current );
|
||||
if( match.Success ) {
|
||||
begin = match.Groups[ Token ].Index;
|
||||
end = match.Groups[ End ].Index;
|
||||
rest = match.Groups[ Rest ].Index;
|
||||
_current = rest;
|
||||
_last = new(
|
||||
ExpCompile.PoolString( source[ .. ( end - begin ) ] ),
|
||||
_lineNum, begin, TokenFlag.Member );
|
||||
return _last;
|
||||
} else {
|
||||
throw new ExpInvalidTokenException( _current );
|
||||
}
|
||||
} else if( char.IsPunctuation( c ) || char.IsSymbol( c ) ) {
|
||||
switch( c ) {
|
||||
case '"':
|
||||
char cNext = source[ 1 ];
|
||||
if( cNext == '\"' ) //empty string
|
||||
{
|
||||
begin = _current;
|
||||
_current += 2;
|
||||
return new(
|
||||
string.Empty, _lineNum, begin,
|
||||
TokenFlag.String );
|
||||
}
|
||||
Match match = _nextStringLiteralPattern.Match(
|
||||
_lineCache, _current );
|
||||
if( match.Success ) {
|
||||
begin = match.Groups[ "token" ].Index;
|
||||
end = match.Groups[ "end" ].Index;
|
||||
rest = match.Groups[ "rest" ].Index;
|
||||
_current = rest;
|
||||
_last = new(
|
||||
ExpCompile.PoolString(
|
||||
source[ 1..( end - begin ) ] ),
|
||||
_lineNum, begin, TokenFlag.String );
|
||||
return _last;
|
||||
} else {
|
||||
throw new ExpInvalidCharException( '\"' );
|
||||
}
|
||||
case '(':
|
||||
cNext = source[ 1 ];
|
||||
if( cNext == '*' ) {
|
||||
_isReadingMultiLineComment = true;
|
||||
_current += 2;
|
||||
goto readLine;
|
||||
} else {
|
||||
begin = _current;
|
||||
_current++;
|
||||
_last = new(
|
||||
ExpCompile.PoolString( source[ ..1 ] ),
|
||||
_lineNum, begin, TokenFlag.Separator_Left );
|
||||
return _last;
|
||||
}
|
||||
case ')' or '}':
|
||||
begin = _current;
|
||||
_current++;
|
||||
_last = new Token(
|
||||
ExpCompile.PoolString( ")" ), _lineNum, begin,
|
||||
TokenFlag.Separator_Right );
|
||||
return _last;
|
||||
case '-':
|
||||
|
||||
// 1. -number
|
||||
// 2. -- comment
|
||||
// 3. - number type param(UNARY)
|
||||
// 4. param - param(BINARY)
|
||||
cNext = source[ 1 ];
|
||||
if( char.IsNumber( cNext ) ) {
|
||||
match = _nextNumberLiteralPattern.Match(
|
||||
_lineCache, _current );
|
||||
if( match.Success ) {
|
||||
begin = match.Groups[ Token ].Index;
|
||||
end = match.Groups[ End ].Index;
|
||||
rest = match.Groups[ Rest ].Index;
|
||||
_current = rest;
|
||||
return new(
|
||||
ExpCompile.PoolString(
|
||||
source[ ..( end - begin ) ] ),
|
||||
_lineNum, begin, TokenFlag.Number );
|
||||
} else {
|
||||
throw new ExpInvalidTokenException( _current );
|
||||
}
|
||||
} else if( cNext == '-' ) {
|
||||
_lineCache = string.Empty;
|
||||
_current = 0;
|
||||
goto readLine;
|
||||
} else {
|
||||
begin = _current;
|
||||
_current++;
|
||||
if( _last.Flag != TokenFlag.Member ) {
|
||||
_last = new(
|
||||
ExpCompile.PoolString( source[ ..1 ] ),
|
||||
_lineNum, begin, TokenFlag.Symbol_Unary );
|
||||
} else {
|
||||
_last = new(
|
||||
ExpCompile.PoolString( source[ ..1 ] ),
|
||||
_lineNum, begin, TokenFlag.Symbol_Binary );
|
||||
}
|
||||
return _last;
|
||||
}
|
||||
case '{':
|
||||
begin = _current;
|
||||
_current++;
|
||||
return new Token(
|
||||
ExpCompile.PoolString( "{" ), _lineNum, begin,
|
||||
TokenFlag.Separator_Left );
|
||||
case '[':
|
||||
begin = _current;
|
||||
_current++;
|
||||
return new Token(
|
||||
ExpCompile.PoolString( "[" ), _lineNum, begin,
|
||||
TokenFlag.Index_Left );
|
||||
case ']':
|
||||
begin = _current;
|
||||
_current++;
|
||||
return new Token(
|
||||
ExpCompile.PoolString( "]" ), _lineNum, begin,
|
||||
TokenFlag.Index_Right );
|
||||
case ';' or ',':
|
||||
begin = _current;
|
||||
_current++;
|
||||
return new Token(
|
||||
ExpCompile.PoolString( source[ ..1 ] ), _lineNum,
|
||||
begin, TokenFlag.Separator_Single );
|
||||
case ':' or '+' or '/' or '\\' or '*' or '.':
|
||||
begin = _current;
|
||||
_current++;
|
||||
return new(
|
||||
ExpCompile.PoolString( source[ ..1 ] ), _lineNum,
|
||||
begin, TokenFlag.Symbol_Binary );
|
||||
default:
|
||||
throw new ExpInvalidCharException( c );
|
||||
}
|
||||
} else if( char.IsNumber( c ) ) {
|
||||
Match match = _nextNumberLiteralPattern.Match(
|
||||
_lineCache, _current );
|
||||
if( match.Success ) {
|
||||
begin = match.Groups[ Token ].Index;
|
||||
end = match.Groups[ End ].Index;
|
||||
rest = match.Groups[ Rest ].Index;
|
||||
_current = rest;
|
||||
string str = ExpCompile.PoolString(
|
||||
source[ ..( end - begin ) ] );
|
||||
TokenFlag flag;
|
||||
if( ReferenceEquals( str, ExpCompile.KeyWord.NOT ) ) {
|
||||
flag = TokenFlag.Symbol_Unary;
|
||||
} else {
|
||||
flag = ExpCompile.LetterIsOperator( str ) ?
|
||||
TokenFlag.Symbol_Binary : TokenFlag.Member;
|
||||
}
|
||||
return new( str, _lineNum, begin, flag );
|
||||
} else {
|
||||
throw new ExpInvalidTokenException( _current );
|
||||
}
|
||||
} else if( char.IsWhiteSpace( c ) ) {
|
||||
Match match = _skipBlankPattern.Match( _lineCache, _current );
|
||||
if( match.Success ) {
|
||||
rest = match.Groups[ Rest ].Index;
|
||||
_current = rest;
|
||||
goto readLine;
|
||||
} else {
|
||||
throw new ExpInvalidTokenException( _current );
|
||||
}
|
||||
} else {
|
||||
throw new ExpInvalidCharException( c );
|
||||
}
|
||||
}
|
||||
|
||||
[GeneratedRegex(
|
||||
@"(?<token>[a-zA-Z][a-zA-Z0-9_]*)(?<end>\s*?)(?<rest>\S|$)",
|
||||
RegexOptions.Singleline )]
|
||||
private static partial Regex GetNextWordTokenPattern();
|
||||
|
||||
[GeneratedRegex(
|
||||
@"(?<token>-?\s*?[0-9]+(?:\.[0-9]*)?)(?<end>\s*?)(?<rest>\S|$)",
|
||||
RegexOptions.Singleline )]
|
||||
private static partial Regex GetNumberLiteralPattern();
|
||||
|
||||
[GeneratedRegex( @"(?:\s+?)(?<rest>\S|$)", RegexOptions.Singleline )]
|
||||
private static partial Regex GetSkipBlankPattern();
|
||||
|
||||
[GeneratedRegex(
|
||||
@"(?<token>"")(?:.*?[^\\](?:\\\\)*?)(?<end>"")\s*?(?<rest>\S|$)",
|
||||
RegexOptions.Singleline )]
|
||||
private static partial Regex GetStringLiteralPattern();
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,118 @@
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
// file="GeneratedExpSchema.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 CommunityToolkit.HighPerformance.Helpers;
|
||||
|
||||
using StgSharp.Collections;
|
||||
|
||||
using System;
|
||||
using System.Collections.Frozen;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp.Script.Express
|
||||
{
|
||||
internal class GeneratedExpSchema : ExpSchema
|
||||
{
|
||||
|
||||
public GeneratedExpSchema() { }
|
||||
|
||||
public static ExpSchema DefaultSchema
|
||||
{
|
||||
get => ExpSchema_Nitload.Only;
|
||||
}
|
||||
|
||||
public ExpTypeSource GetExpType( string typeName )
|
||||
{
|
||||
if( ExpCompile.TryGetBuiltinType( typeName,
|
||||
out ExpTypeSource? ret ) ) {
|
||||
return ret;
|
||||
}
|
||||
if( TypeDict.TryGetValue( typeName, out ret ) ) {
|
||||
return ret;
|
||||
}
|
||||
foreach( GeneratedExpSchema item in SchemaInclude.Values ) {
|
||||
if( item.TypeDict.TryGetValue( typeName, out ret ) ) {
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
throw new ExpTypeNotFoundException( typeName, this );
|
||||
}
|
||||
|
||||
public bool HasSchemaInclude( GeneratedExpSchema schema )
|
||||
{
|
||||
return SchemaInclude.ContainsKey( schema.Name );
|
||||
}
|
||||
|
||||
public override void LoadFromSource( ExpSchemaSource source )
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public override bool TryGetConst(
|
||||
string name,
|
||||
out ExpElementInstanceBase c )
|
||||
{
|
||||
return ConstDict.TryGetValue( name, out c );
|
||||
}
|
||||
|
||||
public override bool TryGetEntity( string name, out ExpEntitySource e )
|
||||
{
|
||||
return EntityDict.TryGetValue( name, out e );
|
||||
}
|
||||
|
||||
public override bool TryGetFunction(
|
||||
string name,
|
||||
out ExpFunctionSource f )
|
||||
{
|
||||
return FunctionDict.TryGetValue( name, out f );
|
||||
}
|
||||
|
||||
public override bool TryGetRule( string name, out ExpRuleSource r )
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public override bool TryGetSchemaInclude(
|
||||
string name,
|
||||
out ExpSchema include )
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public override bool TryGetType(
|
||||
string name,
|
||||
out ExpTypeSource element )
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
// file="ExpErrorThrow.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 partial class ExpNodeGenerator
|
||||
{
|
||||
|
||||
public void ThrowCompileException( int errorCode )
|
||||
{
|
||||
switch( errorCode ) {
|
||||
case 0 or 1:
|
||||
return;
|
||||
case TokenTypeNotMatch:
|
||||
throw new Exception();
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,155 @@
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
// file="ExpNodeGenerator.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 StgSharp.Threading;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StgSharp.Script.Express
|
||||
{
|
||||
public partial class ExpNodeGenerator
|
||||
{
|
||||
|
||||
private const int EndLine = 1;
|
||||
private const int TokenGenerated = 0;
|
||||
private const int TokenTypeNotMatch = -1;
|
||||
|
||||
private ExpBaseNode _lastStatement;
|
||||
|
||||
private GeneratedExpSchema _context;
|
||||
private IExpElementSource _local;
|
||||
private List<ExpBaseNode> _cache;
|
||||
private Stack<ExpBaseNode> _operandsNode;
|
||||
private Stack<Token> _operandsToken;
|
||||
private Stack<Token> _operators;
|
||||
|
||||
public ExpNodeGenerator()
|
||||
{
|
||||
_operators = new Stack<Token>();
|
||||
_operandsToken = new Stack<Token>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Append a token to top of cache. This method will automatically convert token to node if
|
||||
/// meets separators or operators.
|
||||
/// </summary>
|
||||
/// <param name="expToken"></param>
|
||||
public void AppendToken( Token expToken )
|
||||
{
|
||||
switch( expToken.Flag ) {
|
||||
case TokenFlag.Symbol_Unary or TokenFlag.Symbol_Binary:
|
||||
|
||||
_operandsToken.Push( expToken );
|
||||
break;
|
||||
case TokenFlag.Number or TokenFlag.String or TokenFlag.Member:
|
||||
break;
|
||||
case TokenFlag.Separator_Single:
|
||||
break;
|
||||
case TokenFlag.Separator_Left:
|
||||
break;
|
||||
case TokenFlag.Separator_Right:
|
||||
break;
|
||||
case TokenFlag.Index_Left:
|
||||
break;
|
||||
case TokenFlag.Index_Right:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void CacheNextOperandNode( ExpBaseNode node )
|
||||
{
|
||||
_operandsNode.Push( node );
|
||||
}
|
||||
|
||||
public AbstractSyntaxTree<ExpBaseNode, IExpElementSource> CloseAndDispose(
|
||||
)
|
||||
{
|
||||
if( _operandsToken.Count != 0 ) {
|
||||
// convert rest to AST
|
||||
}
|
||||
return new AbstractSyntaxTree<ExpBaseNode, IExpElementSource>();
|
||||
}
|
||||
|
||||
public ExpBaseNode GenerateNode( Token t )
|
||||
{
|
||||
switch( t.Flag ) {
|
||||
case TokenFlag.Symbol_Unary:
|
||||
break;
|
||||
case TokenFlag.Symbol_Binary:
|
||||
break;
|
||||
case TokenFlag.Number:
|
||||
break;
|
||||
case TokenFlag.String:
|
||||
break;
|
||||
case TokenFlag.Member:
|
||||
break;
|
||||
case TokenFlag.Separator_Single:
|
||||
break;
|
||||
case TokenFlag.Separator_Left:
|
||||
break;
|
||||
case TokenFlag.Separator_Right:
|
||||
break;
|
||||
case TokenFlag.Index_Left:
|
||||
break;
|
||||
case TokenFlag.Index_Right:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public int GetNextOperandCache(
|
||||
out Token? token,
|
||||
out ExpBaseNode? node )
|
||||
{
|
||||
if( _operandsNode.Count != 0 ) {
|
||||
node = _operandsNode.Pop();
|
||||
token = null!;
|
||||
return 2;
|
||||
}
|
||||
if( _operandsToken.Count != 0 ) {
|
||||
token = _operandsToken.Pop();
|
||||
node = null!;
|
||||
return 1;
|
||||
}
|
||||
token = null;
|
||||
node = null!;
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
// file="GenerateUnaryToken.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 partial class ExpNodeGenerator
|
||||
{
|
||||
|
||||
public ExpBaseNode GenerateUnaryToken( Token t )
|
||||
{
|
||||
switch( t.Value ) {
|
||||
case ExpCompile.KeyWord.UnaryAdd:
|
||||
break;
|
||||
case ExpCompile.KeyWord.UnarySub:
|
||||
break;
|
||||
case ExpCompile.KeyWord.NOT:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
// file="LeftSperatorProcess.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.Frozen;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Security.Cryptography.X509Certificates;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StgSharp.Script.Express
|
||||
{
|
||||
public partial class ExpNodeGenerator
|
||||
{
|
||||
|
||||
private int _lbToken = 0; // [ count
|
||||
private int _lcbCount = 0; // { count
|
||||
private int _lpCount = 0; // ( count
|
||||
|
||||
private void ProcessLeftSeparator( Token t )
|
||||
{
|
||||
switch( t.Value ) {
|
||||
case "[":
|
||||
_lbToken++;
|
||||
break;
|
||||
case "{":
|
||||
_lcbCount++;
|
||||
break;
|
||||
case "(":
|
||||
_lpCount++;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,97 @@
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
// file="ExpNodeFlag.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
|
||||
{
|
||||
[Flags]
|
||||
public enum ExpNodeFlag : long
|
||||
{
|
||||
|
||||
//string as name of non-builtin variables
|
||||
None = 0,
|
||||
Name_Element = 1,
|
||||
Name_Param = 2,
|
||||
Name_Block = 4,
|
||||
Name_Keyword = 8,
|
||||
Name_Operator = 16,
|
||||
Name_Any = Name_Block | Name_Element | Name_Keyword | Name_Param | Name_Operator,
|
||||
|
||||
//any type of collections, also has NAME flag
|
||||
Collection_Set = 32,
|
||||
Collection_Bag = 64,
|
||||
Collection_Array = 128,
|
||||
Collection_List = 256,
|
||||
Collection_Any = Collection_Set | Collection_Bag | Collection_Array | Collection_List,
|
||||
|
||||
//the variable is type of element, both builtin and non-builtin has this flag
|
||||
Element_Const = 512,
|
||||
Element_Entity = 1024,
|
||||
Element_Type = 2048,
|
||||
Element_Rule = 4096,
|
||||
Element_Function = 8192,
|
||||
Element_Any = Element_Entity | Element_Const | Element_Function | Element_Rule | Element_Type,
|
||||
|
||||
//variable is one of these builtin type
|
||||
BuiltinType_Int = 16384,
|
||||
BuiltinType_Float = 32768,
|
||||
BuiltinType_String = 65536,
|
||||
BuiltinType_Boolean = 0x2000,
|
||||
BuiltinType_Binary = 0x4000,
|
||||
BuiltinType_Logic = 0x8000,
|
||||
BuiltinType_Number = BuiltinType_Float | BuiltinType_Int,
|
||||
BuiltinType_Any = BuiltinType_Int | BuiltinType_Float | BuiltinType_String | BuiltinType_Boolean | BuiltinType_Binary | BuiltinType_Logic,
|
||||
|
||||
//the token is root of a branch
|
||||
Branch_If = 0x1_000,
|
||||
Branch_Switch = 0x2_0000,
|
||||
Branch_Repeat = 0x4_0000,
|
||||
Branch_Any = Branch_If | Branch_Repeat | Branch_Switch,
|
||||
|
||||
//the token is one of separators
|
||||
Separator_Inline = 0x8_0000, //, or sth else
|
||||
Separator_Line = 0x10_0000, //; or eth else
|
||||
Separator_Block = 0x20_0000, //{}or sth else
|
||||
Separator_Range = 0x40_0000, //()or sth else
|
||||
Separator_Any = Separator_Inline | Separator_Line | Separator_Block | Separator_Range,
|
||||
|
||||
//the token is a kind of operator
|
||||
Operator_Unary = 0x40_0000,
|
||||
Operator_Binary = 0x80_0000,
|
||||
Operator_SuperType = 0x100_0000,
|
||||
Operator_Any = Operator_Unary | Operator_Binary | Operator_SuperType,
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
// file="ExpNodeNextEnumerator.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;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StgSharp.Script.Express
|
||||
{
|
||||
public class ExpNodeNextEnumerator : IEnumerator<ExpBaseNode>
|
||||
{
|
||||
|
||||
private ExpBaseNode _begin;
|
||||
private ExpBaseNode _current;
|
||||
|
||||
public ExpNodeNextEnumerator( ExpBaseNode token )
|
||||
{
|
||||
_begin = token;
|
||||
_current = token;
|
||||
}
|
||||
|
||||
void IDisposable.Dispose()
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
bool IEnumerator.MoveNext()
|
||||
{
|
||||
ExpBaseNode next = _current.Next;
|
||||
if( ReferenceEquals( next, _begin ) || next == null ) {
|
||||
return false;
|
||||
}
|
||||
_current = next;
|
||||
return true;
|
||||
}
|
||||
|
||||
void IEnumerator.Reset()
|
||||
{
|
||||
_current = _begin;
|
||||
}
|
||||
|
||||
object IEnumerator.Current => throw new NotImplementedException();
|
||||
|
||||
ExpBaseNode IEnumerator<ExpBaseNode>.Current => throw new NotImplementedException(
|
||||
);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
// file="IASTNode.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 StgSharp.Collections;
|
||||
using StgSharp.Script.Express;
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp.Script
|
||||
{
|
||||
public interface IASTNode<TNode, TType> where TNode: IASTNode<TNode, TType>
|
||||
where TType: ITypeSource<TType>
|
||||
{
|
||||
|
||||
long NodeFlag
|
||||
{
|
||||
get;
|
||||
}
|
||||
|
||||
string Name
|
||||
{
|
||||
get;
|
||||
}
|
||||
|
||||
string CodeConvertTemplate
|
||||
{
|
||||
get;
|
||||
}
|
||||
|
||||
TNode Previous
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
TNode Next
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
TNode Left
|
||||
{
|
||||
get;
|
||||
}
|
||||
|
||||
TNode Right
|
||||
{
|
||||
get;
|
||||
}
|
||||
|
||||
TType EqualityTypeConvert
|
||||
{
|
||||
get;
|
||||
}
|
||||
|
||||
void AppendNode( TNode nextToken );
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
// file="IScriptSourceProvider.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
|
||||
{
|
||||
public interface IScriptSourceProvider
|
||||
{
|
||||
|
||||
bool IsEmpty
|
||||
{
|
||||
get;
|
||||
}
|
||||
|
||||
int Location
|
||||
{
|
||||
get;
|
||||
}
|
||||
|
||||
void EndWriting();
|
||||
|
||||
string ReadLine();
|
||||
|
||||
string ReadLine( out int position );
|
||||
|
||||
/// <summary>
|
||||
/// Return part of current provider.
|
||||
/// </summary>
|
||||
/// <param name="count"> Count of lines to be sliced </param>
|
||||
/// <returns></returns>
|
||||
public IScriptSourceProvider Slice( int location, int count );
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
// file="ITypeSource.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
|
||||
{
|
||||
public interface ITypeSource<in TConvert>
|
||||
where TConvert: ITypeSource<TConvert>
|
||||
{
|
||||
|
||||
bool IsConvertable( TConvert targetType );
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,159 @@
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
// file="ScriptSourceTransmitter.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;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace StgSharp.Script
|
||||
{
|
||||
/// <summary>
|
||||
/// Transmit a continuous part of script code to interpreter or compiler. This transmitter is
|
||||
/// designed for single-thread-write and single-thread read. Any multi thread operation will
|
||||
/// cause undefined behaviour.
|
||||
/// </summary>
|
||||
public class ScriptSourceTransmitter : IScriptSourceProvider
|
||||
{
|
||||
|
||||
private static ScriptSourceTransmitter _empty = new ScriptSourceTransmitter(
|
||||
string.Empty, 0, 0 )
|
||||
{
|
||||
_cache = [],
|
||||
_buffer = []
|
||||
};
|
||||
|
||||
private string[] _buffer;
|
||||
private bool _isWriting = true;
|
||||
private int _begin, _index;
|
||||
private List<string> _cache;
|
||||
private readonly string _completeMark;
|
||||
|
||||
internal ScriptSourceTransmitter( string[] buffer, int start )
|
||||
{
|
||||
_buffer = buffer;
|
||||
_begin = start;
|
||||
_isWriting = false;
|
||||
}
|
||||
|
||||
public ScriptSourceTransmitter( string endMark, int start )
|
||||
{
|
||||
_cache = new List<string>();
|
||||
_completeMark = endMark;
|
||||
_begin = start;
|
||||
_index = 0;
|
||||
}
|
||||
|
||||
public ScriptSourceTransmitter(
|
||||
string endMark,
|
||||
int start,
|
||||
int capacity )
|
||||
{
|
||||
_cache = new List<string>( capacity );
|
||||
_completeMark = endMark;
|
||||
_begin = start;
|
||||
_index = 0;
|
||||
}
|
||||
|
||||
public bool IsEmpty => _isWriting ?
|
||||
( _cache.Count == 0 ) : ( _buffer.Length == 0 ) || ( _index >=
|
||||
_buffer.Length );
|
||||
|
||||
public bool IsFrozen => !_isWriting;
|
||||
|
||||
public int Location => _begin + _index;
|
||||
|
||||
public static ScriptSourceTransmitter Empty => _empty;
|
||||
|
||||
public void EndWriting()
|
||||
{
|
||||
if( !_isWriting ) {
|
||||
return;
|
||||
}
|
||||
_isWriting = false;
|
||||
_buffer = _cache.ToArray();
|
||||
_cache = null!;
|
||||
}
|
||||
|
||||
public string ReadLine()
|
||||
{
|
||||
if( _isWriting ) {
|
||||
throw new InvalidOperationException(
|
||||
"Cannot read before all writing operation." );
|
||||
}
|
||||
if( _index >= _buffer.Length ) {
|
||||
return string.Empty;
|
||||
}
|
||||
string str = _buffer[ _index ];
|
||||
_index++;
|
||||
return str;
|
||||
}
|
||||
|
||||
public string ReadLine( out int position )
|
||||
{
|
||||
if( _isWriting ) {
|
||||
throw new InvalidOperationException(
|
||||
"Cannot read before all writing operation." );
|
||||
}
|
||||
if( _index >= _buffer.Length ) {
|
||||
position = -1;
|
||||
return string.Empty;
|
||||
}
|
||||
position = _begin + _index;
|
||||
string str = _buffer[ _index ];
|
||||
_index++;
|
||||
return str;
|
||||
}
|
||||
|
||||
public IScriptSourceProvider Slice( int location, int count )
|
||||
{
|
||||
ArgumentOutOfRangeException.ThrowIfLessThan( location, _begin );
|
||||
ArgumentOutOfRangeException.ThrowIfGreaterThan(
|
||||
location + count, _begin + _buffer.Length );
|
||||
return new ScriptSourceTransmitter(
|
||||
_buffer.AsSpan().Slice( location, count ).ToArray(), location );
|
||||
}
|
||||
|
||||
public void WriteLine( string line )
|
||||
{
|
||||
if( !_isWriting ) {
|
||||
return;
|
||||
}
|
||||
if( string.Equals( _completeMark, line ) ) {
|
||||
EndWriting();
|
||||
return;
|
||||
}
|
||||
_cache.Add( line );
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<LangVersion>preview</LangVersion>
|
||||
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
|
||||
<Platforms>AnyCPU;x64</Platforms>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="CommunityToolkit.HighPerformance" Version="8.4.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\StgSharp.Common\StgSharp.Common.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -0,0 +1,76 @@
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
// file="Token.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
|
||||
{
|
||||
public readonly struct Token
|
||||
{
|
||||
|
||||
public readonly int Column;
|
||||
public readonly int Line;
|
||||
public readonly string Value;
|
||||
public readonly TokenFlag Flag;
|
||||
|
||||
public Token(
|
||||
string chars,
|
||||
int lineNumber,
|
||||
int columnNumber,
|
||||
TokenFlag flag )
|
||||
{
|
||||
Value = chars;
|
||||
Line = lineNumber;
|
||||
Column = columnNumber;
|
||||
Flag = flag;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public enum TokenFlag : int
|
||||
{
|
||||
|
||||
Symbol_Unary = 1,
|
||||
Symbol_Binary = 2,
|
||||
Number = 3,
|
||||
String = 4,
|
||||
Member = 5,
|
||||
Separator_Single = 6,
|
||||
Separator_Left = 7,
|
||||
Separator_Right = 8,
|
||||
Index_Left = 9,
|
||||
Index_Right = 10,
|
||||
|
||||
}
|
||||
}
|
||||
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,648 @@
|
||||
<?xml version="1.0"?>
|
||||
<doc>
|
||||
<assembly>
|
||||
<name>StgSharp.Common</name>
|
||||
</assembly>
|
||||
<members>
|
||||
<member name="M:StgSharp.Commom.Collections.IBidirectionalDictionary`2.Contains(`1)">
|
||||
<summary>
|
||||
Determines whether the <see cref="T:StgSharp.Commom.Collections.IBidirectionalDictionary`2" /> contains
|
||||
the specified key.
|
||||
</summary>
|
||||
<param _name="key"> The value to locate in the <see cref="T:StgSharp.Commom.Collections.IBidirectionalDictionary`2" />. </param>
|
||||
<returns>
|
||||
true if the <see cref="T:StgSharp.Commom.Collections.IBidirectionalDictionary`2" /> contains an element
|
||||
with the specified key; otherwise, false.
|
||||
</returns>
|
||||
</member>
|
||||
<member name="M:StgSharp.Commom.Collections.IBidirectionalDictionary`2.Contains(`0)">
|
||||
<summary>
|
||||
Determines whether the <see cref="T:StgSharp.Commom.Collections.IBidirectionalDictionary`2" /> contains
|
||||
the specified key.
|
||||
</summary>
|
||||
<param _name="key"> The value to locate in the <see cref="T:StgSharp.Commom.Collections.IBidirectionalDictionary`2" />. </param>
|
||||
<returns>
|
||||
true if the <see cref="T:StgSharp.Commom.Collections.IBidirectionalDictionary`2" /> contains an element
|
||||
with the specified key; otherwise, false.
|
||||
</returns>
|
||||
</member>
|
||||
<member name="T:StgSharp.Collections.ListSegment`1">
|
||||
<summary>
|
||||
Part of a collection. This contains a direct reference to origin collection,
|
||||
so all change to origin collection will be reflected in this object.
|
||||
</summary>
|
||||
<typeparam name="T"></typeparam>
|
||||
</member>
|
||||
<member name="M:StgSharp.StgSharp.InitGL(System.Int32,System.Int32)">
|
||||
<summary>
|
||||
CustomizeInit an instance of OpenGL program, This method should be called before any
|
||||
other StgSharp api.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:StgSharp.StgSharp.version">
|
||||
<summary>
|
||||
Version of current StgSharp platform. Main version represent in hundred's digit, and sub
|
||||
version represent in ten's digit.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:StgSharp.StgSharp.WriteLog(System.String,StgSharp.LogType)">
|
||||
<summary>
|
||||
Write a log message to log file, and mark the _level of this message.
|
||||
</summary>
|
||||
<param _name="message"> A string contains information of how current evironment runs. </param>
|
||||
<param _name="logType"> The severity of current message. </param>
|
||||
</member>
|
||||
<member name="T:StgSharp.Internal.Serializer">
|
||||
<summary>
|
||||
A class contains a sets of methods to serialize several types
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:StgSharp.Internal.Area">
|
||||
<summary>
|
||||
An independent storage area, used as the only folder type in root folder. Contains several
|
||||
<see cref="T:StgSharp.Internal.SSD" /> files reference as virtual disc. Data is actually stored in <see
|
||||
cref="T:StgSharp.Internal.SSD" />s in certain RAID mode.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:StgSharp.Internal.GLclampf">
|
||||
<summary>
|
||||
OpenGL numeric type. An IEEE-754 floating-point value, clamped to the range [0,1].
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:StgSharp.Internal.GLclampd">
|
||||
<summary>
|
||||
OpenGL numeric type. An IEEE-754 double precision floating-point value, clamped to the range
|
||||
[0,1].
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:StgSharp.IEntity.X">
|
||||
<summary>
|
||||
X position of an enenmy entity
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:StgSharp.IEntity.Y">
|
||||
<summary>
|
||||
Y position of an enemy entity
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:StgSharp.IEntity.CollisionSensor">
|
||||
<summary>
|
||||
A sensor used for checking out if a bullet hit a player or something else
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:StgSharp.IEntity.Location">
|
||||
<summary>
|
||||
A 2D vector presenting the position of an enemy entity, position can also be visited by
|
||||
X, Y
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:StgSharp.Geometries.UnusedVertexException">
|
||||
<summary>
|
||||
当几何体调用了过多的CalcVec方法时,产生UnusedVertexException异常
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:StgSharp.Geometries.PartialPlainCoordinate.origin">
|
||||
<summary>
|
||||
The origin of this coordinate.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:StgSharp.Geometries.PartialPlainCoordinate.axis_H">
|
||||
<summary>
|
||||
The horizontial axis of the coordinate. Point to the right direction.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:StgSharp.Geometries.PartialPlainCoordinate.axis_V">
|
||||
<summary>
|
||||
The vertical axis of the coordinate. Point to the top direction.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:StgSharp.Geometries.PlainGeometry">
|
||||
<summary>
|
||||
Plain geometry only contains straight sides.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:StgSharp.Geometries.Rectangle.MovCenter(System.UInt32)">
|
||||
<summary>
|
||||
Calculate movement to center
|
||||
</summary>
|
||||
<param _name="tick"> CurrentBlueprint time tick </param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="T:StgSharp.Geometries.Square">
|
||||
<summary>
|
||||
A square
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:StgSharp.Math.Vec2">
|
||||
<summary>
|
||||
A two dimension vector defined by two elements. Vec2Ds in StgSharp are default used as colum
|
||||
vector.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:StgSharp.Math.Linear.Orthogonalize(StgSharp.Math.Vec3@,StgSharp.Math.Vec3@)">
|
||||
<summary>
|
||||
Orthogonalize two <see cref="T:StgSharp.Math.Vec3" />s, let their length be 1 and perpendicular to each
|
||||
other.
|
||||
</summary>
|
||||
<param _name="source"></param>
|
||||
<param _name="target"></param>
|
||||
</member>
|
||||
<member name="M:StgSharp.Math.Scaler.ASin(System.Single)">
|
||||
<summary>
|
||||
Reurns the value of ArcSin(x)
|
||||
</summary>
|
||||
<param _name="x"> The sine value of the angle </param>
|
||||
<returns></returns>
|
||||
<exception cref="T:System.ArgumentException"></exception>
|
||||
</member>
|
||||
<member name="M:StgSharp.Math.Scaler.Exp(System.Single)">
|
||||
<summary>
|
||||
Get the value of E ^ x;
|
||||
</summary>
|
||||
<param _name="x"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:StgSharp.Math.Scaler.Log(System.Single)">
|
||||
<summary>
|
||||
|
||||
</summary>
|
||||
<param _name="x"></param>
|
||||
<returns>
|
||||
Returns the value of ln(x).
|
||||
</returns>
|
||||
</member>
|
||||
<member name="M:StgSharp.Math.Scaler.Pow(System.Single,System.Single)">
|
||||
<summary>
|
||||
calculate the value of x^y
|
||||
</summary>
|
||||
<param _name="x"></param>
|
||||
<param _name="y"></param>
|
||||
<returns> Returns the value of x^y </returns>
|
||||
</member>
|
||||
<member name="M:StgSharp.Math.Scaler.LowProceisionRandom">
|
||||
<summary>
|
||||
returns a random float number between 0 and 1.
|
||||
</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:StgSharp.Math.Scaler.Random``1">
|
||||
<summary>
|
||||
|
||||
</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:StgSharp.Math.Scaler.RandomSeed">
|
||||
<summary>
|
||||
Generates a random seed in int value.
|
||||
</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="T:StgSharp.Graphics.BufferObjectBase">
|
||||
<summary>
|
||||
Interface of all kinds OpenGL Buffer objects
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:StgSharp.Graphics.BufferObjectBase.Item(System.Int32)">
|
||||
<summary>
|
||||
Get the only handle to one of the Object instance
|
||||
</summary>
|
||||
<param _name="index"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.BufferObjectBase.Bind(System.Int32)">
|
||||
<summary>
|
||||
Bind a Buffer instance to OpenGL
|
||||
</summary>
|
||||
<param _name="index"> Index of handle of the object in this instance to be bind </param>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.BufferObjectBase.ToString">
|
||||
<inheritdoc />
|
||||
</member>
|
||||
<member name="T:StgSharp.Graphics.glLoader">
|
||||
<summary>
|
||||
Function handler to load an opengl function by searching its _name.
|
||||
</summary>
|
||||
<param _name="name"> the _name of the Opengl function </param>
|
||||
<returns> An Intptr value representing the pointer to the function </returns>
|
||||
</member>
|
||||
<member name="P:StgSharp.Graphics.Image.PixelUpdateCount">
|
||||
<summary>
|
||||
Hash code of time pixels updated last time.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:StgSharp.Graphics.OpenGL.AutoTextureGL">
|
||||
<summary>
|
||||
A collection of a sets of OpenGL textures. The collection can automatically select one of
|
||||
the texture with minimum costs to upgrade pixels to Buffer. Usually <see
|
||||
cref="T:StgSharp.Graphics.OpenGL.AutoTextureGL" /> is used for <see cref="T:StgSharp.Graphics.IImageProvider" /> loading, but not for
|
||||
target of <see cref="M:StgSharp.Graphics.OpenGL.OpenGLFunction.FrameBufferTexture2d(StgSharp.Graphics.OpenGL.FrameBufferTarget,System.UInt32,StgSharp.Graphics.OpenGL.Texture2DTarget,StgSharp.Graphics.OpenGL.GlHandle,System.Int32)" />.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:StgSharp.Graphics.OpenGL.ElementBuffer">
|
||||
<summary>
|
||||
A collection of handle to Element Buffer Object in OpenglFunc. Each <see langword="uint" />
|
||||
value indexed from instance of this class this is the only handle to one Element Buffer
|
||||
Object.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.OpenGL.FrameBuffer.Bind(System.Int32)">
|
||||
<summary>
|
||||
Bind the frame Buffer object with _name frame Buffer to the frame Buffer target specified
|
||||
by target. <see langword="FrameBufferTarget.All" /> will be set as default target.
|
||||
</summary>
|
||||
<param _name="index"> Index of object to be binded in handle set </param>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.OpenGL.FrameBuffer.Bind(StgSharp.Graphics.OpenGL.FrameBufferTarget,System.Int32)">
|
||||
<summary>
|
||||
Bind the frame Buffer object with _name frame Buffer to the frame Buffer target specified
|
||||
by target. Target of this frame Buffer should be set manually.
|
||||
</summary>
|
||||
<param _name="target"> The frame Buffer target of the binding operation. </param>
|
||||
<param _name="index"> Index of object to be binded in handle set </param>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.OpenGL.TextureGL.LoadTexture(System.Int32,StgSharp.Graphics.Image)">
|
||||
<summary>
|
||||
Load an <see cref="T:StgSharp.Graphics.Image" /> to certain texture.
|
||||
</summary>
|
||||
<param _name="index"> </param>
|
||||
<param _name="i"> </param>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.OpenGL.VertexBuffer.Unbind">
|
||||
<summary>
|
||||
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.OpenGL.VertexBuffer.WriteMatrixData``1(System.Int32,``0,StgSharp.Graphics.OpenGL.BufferUsage)">
|
||||
<summary>
|
||||
Set _data to current vertex Buffer object
|
||||
</summary>
|
||||
<typeparam _name="T"> Type of bufferData </typeparam>
|
||||
<param _name="index"> Index to find certain VBO in this instance </param>
|
||||
<param _name="bufferData"> Data to write in </param>
|
||||
<param _name="usage"> How OpenGL use these _data, defined by <see cref="T:StgSharp.Graphics.OpenGL.BufferUsage" /></param>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.OpenGL.VertexBuffer.WriteScalerData``1(System.Int32,``0[],StgSharp.Graphics.OpenGL.BufferUsage)">
|
||||
<summary>
|
||||
Set _data to current vertex Buffer object
|
||||
</summary>
|
||||
<typeparam _name="T"> Type of bufferData </typeparam>
|
||||
<param _name="index"> Index to find certain VBO in this instance </param>
|
||||
<param _name="bufferArray"> Data to write in </param>
|
||||
<param _name="usage"> How OpenGL use these _data, defined by <see cref="T:StgSharp.Graphics.OpenGL.BufferUsage" /></param>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.OpenGL.VertexBuffer.WriteScalerData``1(System.Int32,System.ReadOnlySpan{``0},StgSharp.Graphics.OpenGL.BufferUsage)">
|
||||
<summary>
|
||||
Set _data to current vertex Buffer object
|
||||
</summary>
|
||||
<typeparam _name="T"> Type of bufferData </typeparam>
|
||||
<param _name="index"> Index to find certain VBO in this instance </param>
|
||||
<param _name="scalerSpan"> A <see cref="T:System.Span`1" /> of _data to write in </param>
|
||||
<param _name="usage"> How OpenGL use these _data, defined by <see cref="T:StgSharp.Graphics.OpenGL.BufferUsage" /></param>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.OpenGL.VertexBuffer.WriteVectorData``1(System.Int32,System.ReadOnlySpan{``0},StgSharp.Graphics.OpenGL.BufferUsage)">
|
||||
<summary>
|
||||
Set _data to current vertex Buffer object
|
||||
</summary>
|
||||
<typeparam _name="T"> Type of bufferData </typeparam>
|
||||
<param _name="index"> Index to find certain VBO in this instance </param>
|
||||
<param _name="vectorSpan"> A <see cref="T:System.Span`1" /> of _data to write in </param>
|
||||
<param _name="usage"> How OpenGL use these _data, defined by <see cref="T:StgSharp.Graphics.OpenGL.BufferUsage" /></param>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.OpenGL.VertexBuffer.WriteVectorData``1(System.Int32,``0[],StgSharp.Graphics.OpenGL.BufferUsage)">
|
||||
<summary>
|
||||
Set _data to current vertex Buffer object
|
||||
</summary>
|
||||
<typeparam _name="T"> Type of bufferData </typeparam>
|
||||
<param _name="index"> Index to find certain VBO in this instance </param>
|
||||
<param _name="vectorArray"> A array of _data to write in </param>
|
||||
<param _name="usage"> How OpenGL use these _data, defined by <see cref="T:StgSharp.Graphics.OpenGL.BufferUsage" /></param>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.OpenGL.glManager.LoadGLfunc(System.String)">
|
||||
<summary>
|
||||
Get the function pointer of given OpenGL api _name
|
||||
</summary>
|
||||
<param _name="name"> ContextName of the OpenGL api </param>
|
||||
<returns> The funtion pointer of the api in stream of <see cref="T:System.IntPtr" /></returns>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.OpenGL.glManager.LoadOpenGLApiTo(System.IntPtr)">
|
||||
<summary>
|
||||
Load all supported OpenGL APIs and bind them to given <see cref="T:StgSharp.MVVM.ViewPort" />.
|
||||
</summary>
|
||||
<param _name="contextHandle"> The handle to current OpenGL viewPortDisplay </param>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.OpenGL.OpenGLFunction.BindFrameBuffer(StgSharp.Graphics.OpenGL.FrameBufferTarget,StgSharp.Graphics.OpenGL.GlHandle)">
|
||||
<summary>
|
||||
Bind a frame Buffer to a frame Buffer target Same function as <see
|
||||
href="https://docs._gl/gl3/glBindFramebuffer">glBindFramebuffer</see>.
|
||||
</summary>
|
||||
<param _name="target"> The frame Buffer target of the binding operation. </param>
|
||||
<param _name="handle"> The handle of the frame Buffer object to bind. </param>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.OpenGL.OpenGLFunction.DeleteRenderBuffer(StgSharp.Graphics.OpenGL.GlHandle)">
|
||||
<summary>
|
||||
Delete a render Buffer object Very simlilar function as <see
|
||||
href="https://docs.gl/gl3/glDeleteRenderbuffers">glDeleteRenderbuffers</see>. The only
|
||||
deifference is that this mehtod can only delete one renderbuffer at the same time.
|
||||
</summary>
|
||||
<param _name="bufferHandle"> Handle to Buffer to delete. </param>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.OpenGL.glRender.CreateElementBuffer(System.Int32)">
|
||||
<summary>
|
||||
Create a set of <see cref="T:StgSharp.Graphics.OpenGL.ElementBuffer" />.
|
||||
</summary>
|
||||
<param _name="count"> Amount of EBO to be created. </param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.OpenGL.glRender.CreateTexture(System.Int32)">
|
||||
<summary>
|
||||
Create a sets of <see cref="T:StgSharp.Graphics.OpenGL.TextureGL" />
|
||||
</summary>
|
||||
<param _name="count"> Amount of textures to be created. </param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.OpenGL.glRender.CreateVertexArray(System.Int32)">
|
||||
<summary>
|
||||
Create a set of <see cref="T:StgSharp.Graphics.OpenGL.VertexArray" />.
|
||||
</summary>
|
||||
<param _name="count"> Amount of VAO to be created. </param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.OpenGL.glRender.CreateVertexBuffer(System.Int32)">
|
||||
<summary>
|
||||
Create a set of <see cref="T:StgSharp.Graphics.OpenGL.VertexBuffer" />.
|
||||
</summary>
|
||||
<param _name="count"> Amount of Object to be created. </param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.OpenGL.glRender.InitializeContext">
|
||||
<summary>
|
||||
Initialize an opengl context and load all opengl functions.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.OpenGL.glRender.MakeAsCurrentContext">
|
||||
<summary>
|
||||
Initialize an OpenGl viewPortDisplay if current form has not been binded to any
|
||||
viewPortDisplay. and set the viewPortDisplay binded to current form as current OpenGL
|
||||
viewPortDisplay.
|
||||
</summary>
|
||||
<exception cref="T:System.Exception">
|
||||
Something goes wrong and StgSharp fails in creating a new OpenGL viewPortDisplay.
|
||||
</exception>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.OpenGL.glRender.RenderEnd">
|
||||
<inheritdoc />
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.OpenGL.glRender.RenderStart">
|
||||
<inheritdoc />
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.OpenGL.glRender.CreateShaderProgram">
|
||||
<summary>
|
||||
Create an instance of <see cref="T:StgSharp.Graphics.OpenGL.Shader" /> program
|
||||
</summary>
|
||||
<returns> New instance of <see cref="T:StgSharp.Graphics.OpenGL.Shader" /> instance. </returns>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.OpenGL.Shader.AttachTo(System.Int32,StgSharp.Graphics.OpenGL.ShaderProgram)">
|
||||
<summary>
|
||||
Attach one shader code to a shader program.
|
||||
</summary>
|
||||
<param _name="target"> Shader program to attach </param>
|
||||
<param _name="index"> Index of shader code in current shader code set. </param>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.OpenGL.ShaderProgram.#ctor(StgSharp.Graphics.OpenGL.glRender)">
|
||||
<summary>
|
||||
CustomizeInit a program with no shader attached.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.OpenGL.ShaderProgram.GetUniform``1(System.String)">
|
||||
<summary>
|
||||
Get a uniform form current shader, the value type of the uniform should be provided.
|
||||
</summary>
|
||||
<param _name="name"> ContextName of the Uniform in shader code </param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.OpenGL.ShaderProgram.GetUniform``2(System.String)">
|
||||
<summary>
|
||||
Get a uniform form current shader, the value type of the uniform should be provided.
|
||||
</summary>
|
||||
<param _name="name"> ContextName of the Uniform in shader code </param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.OpenGL.ShaderProgram.GetUniform``3(System.String)">
|
||||
<summary>
|
||||
Get a uniform form current shader, the value type of the uniform should be provided.
|
||||
</summary>
|
||||
<param _name="name"> ContextName of the Uniform in shader code </param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.OpenGL.ShaderProgram.GetUniform``4(System.String)">
|
||||
<summary>
|
||||
Get a uniform form current shader, the value type of the uniform should be provided.
|
||||
</summary>
|
||||
<param _name="name"> ContextName of the Uniform in shader code </param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.OpenGL.ShaderProgram.Link">
|
||||
<summary>
|
||||
Link the shader to current viewPortDisplay.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.OpenGL.ShaderProgram.Use">
|
||||
<summary>
|
||||
Let the current viewPortDisplay use this shader.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.ShaderEdit.IglConvertable.DisplayGLtypeDefinition">
|
||||
<summary>
|
||||
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.ShaderEdit.IglConvertable.GainAllUniforms(StgSharp.Graphics.OpenGL.ShaderProgram,System.String[])">
|
||||
<summary>
|
||||
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.ShaderEdit.IglConvertable.GetConvertedGLtype">
|
||||
<summary>
|
||||
|
||||
</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.ShaderEdit.IglConvertable.SetAllUniforms">
|
||||
<summary>
|
||||
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.RenderStream.SetSizeLimit(System.Int32,System.Int32,System.Int32,System.Int32)">
|
||||
<summary>
|
||||
Set the size limit of current form
|
||||
</summary>
|
||||
<param _name="minWidth"> Minimum width of current form </param>
|
||||
<param _name="minHeight"> Minimum height of current form </param>
|
||||
<param _name="maxWidth"> Maximum width of current form </param>
|
||||
<param _name="maxHeight"> Maximum height of current form </param>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.RenderStream.NativeCameraUniform(StgSharp.Graphics.OpenGL.ShaderProgram,System.String)">
|
||||
<summary>
|
||||
Get <see cref="T:StgSharp.Graphics.OpenGL.Uniform`1" />(TView is <see cref="T:StgSharp.Math.Matrix44" />) uniform from a shader.
|
||||
This uniform will be used as projection matrix of this camera. Additionally, for multi-
|
||||
shader rendering, each shader requires a uniform, so do not ignore return value of this
|
||||
method.
|
||||
</summary>
|
||||
<param _name="source"> Shader using this camera </param>
|
||||
<param _name="name"> ContextName of projection camera named in shader </param>
|
||||
<returns>
|
||||
<see cref="T:StgSharp.Graphics.OpenGL.Uniform`1" />(TView is <see cref="T:StgSharp.Math.Matrix44" />) representing projection
|
||||
matrix in shader program.
|
||||
</returns>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.RenderStream.RenderStart">
|
||||
<summary>
|
||||
Marking the start of current render operations, and set this renser context as current.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.RenderStream.RenderEnd">
|
||||
<summary>
|
||||
Marking the end of current render operations, and release the binding of this renser
|
||||
context to current, making it available for another thread as current.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.Camera.GainAllUniforms(StgSharp.Graphics.OpenGL.ShaderProgram,System.String[])">
|
||||
<summary>
|
||||
Get all uniform related to this <see cref="T:StgSharp.Graphics.Camera" />.
|
||||
</summary>
|
||||
<param _name="source"> Shader program requires this camera. </param>
|
||||
<param _name="uniformName">
|
||||
ContextName of all related uniforms. If you fallow form from <see
|
||||
cref="M:StgSharp.Graphics.ShaderEdit.IglConvertable.DisplayGLtypeDefinition" />
|
||||
</param>
|
||||
<exception cref="T:System.ArgumentException"></exception>
|
||||
</member>
|
||||
<member name="P:StgSharp.Threading.ThreadHelper.EmptyThread">
|
||||
<summary>
|
||||
An individual thread doing nothing, and its <see cref="P:System.Threading.Thread.IsAlive" /> <see
|
||||
langword="property" /> always returns false.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:StgSharp.Blueprint.BlueprintSchedueler">
|
||||
<summary>
|
||||
A sets of complex logic designed for running in multi threads environment. Warning: do not
|
||||
run a <see cref="T:StgSharp.Blueprint.BlueprintSchedueler" /> instance in multi threads more than once.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:StgSharp.Blueprint.BlueprintNode">
|
||||
<summary>
|
||||
|
||||
</summary>
|
||||
<risk>
|
||||
Reset pipeline has risk, this operation is a direct operation to port in current node, the
|
||||
port on the other node cannot get the change.
|
||||
</risk>
|
||||
</member>
|
||||
<member name="P:StgSharp.Blueprint.BlueprintRunner.IsValidCalling">
|
||||
<summary>
|
||||
Only the fallowing occasions of calling are valid:
|
||||
1. no bp is running or the only bp is quitting.
|
||||
2. calling from the main thread and the current running bp.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:StgSharp.Timing.TimeSpanProvider">
|
||||
<summary>
|
||||
A microsecond-accuracy timer. It will refresh every a certain time span.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:StgSharp.Timing.TimeSpanProvider.#ctor(System.Int64,StgSharp.Timing.TimeSourceProviderBase)">
|
||||
<summary>
|
||||
Create a new <see cref="T:StgSharp.Timing.TimeSpanProvider" /> and define the length of time span. Length
|
||||
of a single time span is defined in microseconds.
|
||||
</summary>
|
||||
<param _name="spanMicroSeconds"></param>
|
||||
<param _name="provider"></param>
|
||||
</member>
|
||||
<member name="M:StgSharp.Timing.TimeSpanProvider.#ctor(System.Double,StgSharp.Timing.TimeSourceProviderBase)">
|
||||
<summary>
|
||||
Create a new <see cref="T:StgSharp.Timing.TimeSpanProvider" /> and define the length of time span. Length
|
||||
of a single time span is defined in seconds.
|
||||
</summary>
|
||||
<param _name="spanSeconds"></param>
|
||||
<param _name="provider"></param>
|
||||
</member>
|
||||
<member name="M:StgSharp.Timing.TimeSpanProvider.#ctor(System.Int64,System.Int64,StgSharp.Timing.TimeSourceProviderBase)">
|
||||
<summary>
|
||||
Create a new <see cref="T:StgSharp.Timing.TimeSpanProvider" /> and define the length of time span. Length
|
||||
of a single time span is defined in microseconds.
|
||||
</summary>
|
||||
<param _name="spanLength"></param>
|
||||
<param _name="maxSpan"></param>
|
||||
<param _name="provider"></param>
|
||||
</member>
|
||||
<member name="P:StgSharp.Timing.TimeSpanProvider.DefaultProvider">
|
||||
<summary>
|
||||
Time source provider provided in <see cref="T:StgSharp.StgSharp" /> internal framework.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:StgSharp.MVVM.ViewModel.ViewModelBase.UseViewModel(System.String)">
|
||||
<summary>
|
||||
CustomizeInit this form and render it on screen, and respond with operation
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:StgSharp.MVVM.ViewModel.ViewModelBase.Height">
|
||||
<summary>
|
||||
Height of this form, represent in <see cref="T:System.Int32" />
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:StgSharp.MVVM.ViewModel.ViewModelBase.Width">
|
||||
<summary>
|
||||
Width of this form, represent in <see cref="T:System.Int32" />
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:StgSharp.MVVM.ViewModel.ViewModelBase.Size">
|
||||
<summary>
|
||||
Width of this form, represent in <see cref="T:System.Int32" />
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:StgSharp.MVVM.ViewModel.ViewModelBase.SetSizeLimit(StgSharp.Math.Vec2,StgSharp.Math.Vec2)">
|
||||
<summary>
|
||||
Set the size limit of current form
|
||||
</summary>
|
||||
<param _name="minSize">
|
||||
Minimum size of current form. In form of a <see cref="T:StgSharp.Math.Vec2" /> of (width,height)
|
||||
</param>
|
||||
<param _name="maxSize">
|
||||
Maximum size of current form. In form of a <see cref="T:StgSharp.Math.Vec2" /> of (width,height)
|
||||
</param>
|
||||
</member>
|
||||
<member name="M:StgSharp.MVVM.ViewModel.ViewModelBase.SetSizeLimit(System.Int32,System.Int32,System.Int32,System.Int32)">
|
||||
<summary>
|
||||
Set the size limit of current form
|
||||
</summary>
|
||||
<param _name="minWidth"> Minimum width of current form </param>
|
||||
<param _name="minHeight"> Minimum height of current form </param>
|
||||
<param _name="maxWidth"> Maximum width of current form </param>
|
||||
<param _name="maxHeight"> Maximum height of current form </param>
|
||||
</member>
|
||||
<member name="T:StgSharp.MVVM.View.ViewBase">
|
||||
<summary>
|
||||
ViewBase is the base type for all view types, providing context binding and control element
|
||||
binding. A complete view should contain one complete <see cref="T:StgSharp.MVVM.View.ViewBase.ViewDesigner`1" />, <see
|
||||
cref="T:StgSharp.MVVM.View.ViewBase.ViewRender`1" />, and <see cref="!:ViewResponder" />, which provide layout
|
||||
descriptions of control elements, user responses, and rendering implementations in the view.
|
||||
Data between instances of <see cref="T:StgSharp.MVVM.View.ViewBase.ViewDesigner`1" />, <see cref="T:StgSharp.MVVM.View.ViewBase.ViewRender`1" />,
|
||||
and <see cref="T:StgSharp.MVVM.View.ViewBase.ViewResponder`1" /> is shared through <see cref="T:StgSharp.MVVM.View.ViewBase" />.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:StgSharp.MVVM.View.ViewBase.GetKeyStatus(StgSharp.KeyboardKey)">
|
||||
<summary>
|
||||
Get the status of a certain key on the keyboard.
|
||||
</summary>
|
||||
<param _name="key"></param>
|
||||
<returns><see cref="T:StgSharp.KeyStatus" /> representing if a key is pressed or released. </returns>
|
||||
</member>
|
||||
<member name="T:StgSharp.MVVM.View.ViewBase.ViewDesigner`1">
|
||||
<summary>
|
||||
ViewDesigner provides descriptions of various controls in the view, binds the controls
|
||||
to specific user actions and behaviors, and describes the layout and interactions of
|
||||
each control.
|
||||
</summary>
|
||||
</member>
|
||||
</members>
|
||||
</doc>
|
||||
@@ -0,0 +1,75 @@
|
||||
{
|
||||
"runtimeTarget": {
|
||||
"name": ".NETCoreApp,Version=v8.0",
|
||||
"signature": ""
|
||||
},
|
||||
"compilationOptions": {},
|
||||
"targets": {
|
||||
".NETCoreApp,Version=v8.0": {
|
||||
"StgSharp.Script/1.0.0": {
|
||||
"dependencies": {
|
||||
"CommunityToolkit.HighPerformance": "8.4.0",
|
||||
"StgSharp.Common": "1.0.0"
|
||||
},
|
||||
"runtime": {
|
||||
"StgSharp.Script.dll": {}
|
||||
}
|
||||
},
|
||||
"CommunityToolkit.HighPerformance/8.4.0": {
|
||||
"runtime": {
|
||||
"lib/net8.0/CommunityToolkit.HighPerformance.dll": {
|
||||
"assemblyVersion": "8.4.0.0",
|
||||
"fileVersion": "8.4.0.1"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Microsoft.CSharp/4.7.0": {},
|
||||
"System.Runtime.CompilerServices.Unsafe/6.1.0": {},
|
||||
"StgSharp.Common/1.0.0": {
|
||||
"dependencies": {
|
||||
"Microsoft.CSharp": "4.7.0",
|
||||
"System.Runtime.CompilerServices.Unsafe": "6.1.0"
|
||||
},
|
||||
"runtime": {
|
||||
"StgSharp.Common.dll": {
|
||||
"assemblyVersion": "1.0.0",
|
||||
"fileVersion": "1.0.0.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"libraries": {
|
||||
"StgSharp.Script/1.0.0": {
|
||||
"type": "project",
|
||||
"serviceable": false,
|
||||
"sha512": ""
|
||||
},
|
||||
"CommunityToolkit.HighPerformance/8.4.0": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-flxspiBs0G/0GMp7IK2J2ijV9bTG6hEwFc/z6ekHqB6nwRJ4Ry2yLdx+TkbCUYFCl4XhABkAwomeKbT6zM2Zlg==",
|
||||
"path": "communitytoolkit.highperformance/8.4.0",
|
||||
"hashPath": "communitytoolkit.highperformance.8.4.0.nupkg.sha512"
|
||||
},
|
||||
"Microsoft.CSharp/4.7.0": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-pTj+D3uJWyN3My70i2Hqo+OXixq3Os2D1nJ2x92FFo6sk8fYS1m1WLNTs0Dc1uPaViH0YvEEwvzddQ7y4rhXmA==",
|
||||
"path": "microsoft.csharp/4.7.0",
|
||||
"hashPath": "microsoft.csharp.4.7.0.nupkg.sha512"
|
||||
},
|
||||
"System.Runtime.CompilerServices.Unsafe/6.1.0": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-5o/HZxx6RVqYlhKSq8/zronDkALJZUT2Vz0hx43f0gwe8mwlM0y2nYlqdBwLMzr262Bwvpikeb/yEwkAa5PADg==",
|
||||
"path": "system.runtime.compilerservices.unsafe/6.1.0",
|
||||
"hashPath": "system.runtime.compilerservices.unsafe.6.1.0.nupkg.sha512"
|
||||
},
|
||||
"StgSharp.Common/1.0.0": {
|
||||
"type": "project",
|
||||
"serviceable": false,
|
||||
"sha512": ""
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,4 @@
|
||||
// <autogenerated />
|
||||
using System;
|
||||
using System.Reflection;
|
||||
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETCoreApp,Version=v8.0", FrameworkDisplayName = ".NET 8.0")]
|
||||
@@ -0,0 +1,22 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
using System;
|
||||
using System.Reflection;
|
||||
|
||||
[assembly: System.Reflection.AssemblyCompanyAttribute("StgSharp.Script")]
|
||||
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
||||
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+ccef0de6f686f94da655b0e7d854d0acaf907d04")]
|
||||
[assembly: System.Reflection.AssemblyProductAttribute("StgSharp.Script")]
|
||||
[assembly: System.Reflection.AssemblyTitleAttribute("StgSharp.Script")]
|
||||
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
||||
|
||||
// 由 MSBuild WriteCodeFragment 类生成。
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
561c9de4ecc1d80fa1ee7dae0ef96e18e41fffd68e906958beb6a297a11ca74c
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
is_global = true
|
||||
build_property.TargetFramework = net8.0
|
||||
build_property.TargetPlatformMinVersion =
|
||||
build_property.UsingMicrosoftNETSdkWeb =
|
||||
build_property.ProjectTypeGuids =
|
||||
build_property.InvariantGlobalization =
|
||||
build_property.PlatformNeutralAssembly =
|
||||
build_property.EnforceExtendedAnalyzerRules =
|
||||
build_property._SupportedPlatformList = Linux,macOS,Windows
|
||||
build_property.RootNamespace = StgSharp.Script
|
||||
build_property.ProjectDir = D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.Script\
|
||||
build_property.EnableComHosting =
|
||||
build_property.EnableGeneratedComInterfaceComImportInterop =
|
||||
Binary file not shown.
Binary file not shown.
+4
@@ -0,0 +1,4 @@
|
||||
// <autogenerated />
|
||||
using System;
|
||||
using System.Reflection;
|
||||
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
|
||||
@@ -0,0 +1,23 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// 此代码由工具生成。
|
||||
// 运行时版本:4.0.30319.42000
|
||||
//
|
||||
// 对此文件的更改可能会导致不正确的行为,并且如果
|
||||
// 重新生成代码,这些更改将会丢失。
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
using System;
|
||||
using System.Reflection;
|
||||
|
||||
[assembly: System.Reflection.AssemblyCompanyAttribute("StgSharp.Script")]
|
||||
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
||||
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+e687473132786f419a48170313782d6779890c3d")]
|
||||
[assembly: System.Reflection.AssemblyProductAttribute("StgSharp.Script")]
|
||||
[assembly: System.Reflection.AssemblyTitleAttribute("StgSharp.Script")]
|
||||
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
||||
|
||||
// 由 MSBuild WriteCodeFragment 类生成。
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
4c7f817069768658fd11e2f809ae41e403d5cd4106134072df87718bc9fed9f4
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
is_global = true
|
||||
build_property.RootNamespace = StgSharp.Script
|
||||
build_property.ProjectDir = D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.Script\
|
||||
build_property.EnableComHosting =
|
||||
build_property.EnableGeneratedComInterfaceComImportInterop =
|
||||
Binary file not shown.
BIN
Binary file not shown.
+4
@@ -0,0 +1,4 @@
|
||||
// <autogenerated />
|
||||
using System;
|
||||
using System.Reflection;
|
||||
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
|
||||
@@ -0,0 +1,23 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// 此代码由工具生成。
|
||||
// 运行时版本:4.0.30319.42000
|
||||
//
|
||||
// 对此文件的更改可能会导致不正确的行为,并且如果
|
||||
// 重新生成代码,这些更改将会丢失。
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
using System;
|
||||
using System.Reflection;
|
||||
|
||||
[assembly: System.Reflection.AssemblyCompanyAttribute("StgSharp.Script")]
|
||||
[assembly: System.Reflection.AssemblyConfigurationAttribute("Release")]
|
||||
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+e687473132786f419a48170313782d6779890c3d")]
|
||||
[assembly: System.Reflection.AssemblyProductAttribute("StgSharp.Script")]
|
||||
[assembly: System.Reflection.AssemblyTitleAttribute("StgSharp.Script")]
|
||||
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
||||
|
||||
// 由 MSBuild WriteCodeFragment 类生成。
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
763989be4fc1c0038f6ed3f9723e1b5dc4f3d10b1809f46a2fcbee31212930ff
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
is_global = true
|
||||
build_property.RootNamespace = StgSharp.Script
|
||||
build_property.ProjectDir = D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.Script\
|
||||
build_property.EnableComHosting =
|
||||
build_property.EnableGeneratedComInterfaceComImportInterop =
|
||||
Binary file not shown.
BIN
Binary file not shown.
@@ -0,0 +1,160 @@
|
||||
{
|
||||
"format": 1,
|
||||
"restore": {
|
||||
"D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\内核源代码\\StgSharp.Script\\StgSharp.Script.csproj": {}
|
||||
},
|
||||
"projects": {
|
||||
"D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\内核源代码\\StgSharp.Common\\StgSharp.Common.csproj": {
|
||||
"version": "1.0.0",
|
||||
"restore": {
|
||||
"projectUniqueName": "D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\内核源代码\\StgSharp.Common\\StgSharp.Common.csproj",
|
||||
"projectName": "StgSharp.Common",
|
||||
"projectPath": "D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\内核源代码\\StgSharp.Common\\StgSharp.Common.csproj",
|
||||
"packagesPath": "C:\\Users\\Youmu\\.nuget\\packages\\",
|
||||
"outputPath": "D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\内核源代码\\StgSharp.Common\\obj\\",
|
||||
"projectStyle": "PackageReference",
|
||||
"fallbackFolders": [
|
||||
"C:\\Program Files (x86)\\Microsoft Visual Studio\\Shared\\NuGetPackages"
|
||||
],
|
||||
"configFilePaths": [
|
||||
"C:\\Users\\Youmu\\AppData\\Roaming\\NuGet\\NuGet.Config",
|
||||
"C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.FallbackLocation.config",
|
||||
"C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config"
|
||||
],
|
||||
"originalTargetFrameworks": [
|
||||
"net8.0"
|
||||
],
|
||||
"sources": {
|
||||
"C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {},
|
||||
"C:\\Program Files\\dotnet\\library-packs": {},
|
||||
"D:\\Programmer\\NugetLocal": {},
|
||||
"https://api.nuget.org/v3/index.json": {}
|
||||
},
|
||||
"frameworks": {
|
||||
"net8.0": {
|
||||
"targetAlias": "net8.0",
|
||||
"projectReferences": {}
|
||||
}
|
||||
},
|
||||
"warningProperties": {
|
||||
"warnAsError": [
|
||||
"NU1605"
|
||||
]
|
||||
},
|
||||
"restoreAuditProperties": {
|
||||
"enableAudit": "true",
|
||||
"auditLevel": "low",
|
||||
"auditMode": "direct"
|
||||
}
|
||||
},
|
||||
"frameworks": {
|
||||
"net8.0": {
|
||||
"targetAlias": "net8.0",
|
||||
"dependencies": {
|
||||
"Microsoft.CSharp": {
|
||||
"target": "Package",
|
||||
"version": "[4.7.0, )"
|
||||
},
|
||||
"System.Runtime.CompilerServices.Unsafe": {
|
||||
"target": "Package",
|
||||
"version": "[6.1.0, )"
|
||||
}
|
||||
},
|
||||
"imports": [
|
||||
"net461",
|
||||
"net462",
|
||||
"net47",
|
||||
"net471",
|
||||
"net472",
|
||||
"net48",
|
||||
"net481"
|
||||
],
|
||||
"assetTargetFallback": true,
|
||||
"warn": true,
|
||||
"frameworkReferences": {
|
||||
"Microsoft.NETCore.App": {
|
||||
"privateAssets": "all"
|
||||
}
|
||||
},
|
||||
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\8.0.400/PortableRuntimeIdentifierGraph.json"
|
||||
}
|
||||
}
|
||||
},
|
||||
"D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\内核源代码\\StgSharp.Script\\StgSharp.Script.csproj": {
|
||||
"version": "1.0.0",
|
||||
"restore": {
|
||||
"projectUniqueName": "D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\内核源代码\\StgSharp.Script\\StgSharp.Script.csproj",
|
||||
"projectName": "StgSharp.Script",
|
||||
"projectPath": "D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\内核源代码\\StgSharp.Script\\StgSharp.Script.csproj",
|
||||
"packagesPath": "C:\\Users\\Youmu\\.nuget\\packages\\",
|
||||
"outputPath": "D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\内核源代码\\StgSharp.Script\\obj\\",
|
||||
"projectStyle": "PackageReference",
|
||||
"fallbackFolders": [
|
||||
"C:\\Program Files (x86)\\Microsoft Visual Studio\\Shared\\NuGetPackages"
|
||||
],
|
||||
"configFilePaths": [
|
||||
"C:\\Users\\Youmu\\AppData\\Roaming\\NuGet\\NuGet.Config",
|
||||
"C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.FallbackLocation.config",
|
||||
"C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config"
|
||||
],
|
||||
"originalTargetFrameworks": [
|
||||
"net8.0"
|
||||
],
|
||||
"sources": {
|
||||
"C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {},
|
||||
"C:\\Program Files\\dotnet\\library-packs": {},
|
||||
"D:\\Programmer\\NugetLocal": {},
|
||||
"https://api.nuget.org/v3/index.json": {}
|
||||
},
|
||||
"frameworks": {
|
||||
"net8.0": {
|
||||
"targetAlias": "net8.0",
|
||||
"projectReferences": {
|
||||
"D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\内核源代码\\StgSharp.Common\\StgSharp.Common.csproj": {
|
||||
"projectPath": "D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\内核源代码\\StgSharp.Common\\StgSharp.Common.csproj"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"warningProperties": {
|
||||
"warnAsError": [
|
||||
"NU1605"
|
||||
]
|
||||
},
|
||||
"restoreAuditProperties": {
|
||||
"enableAudit": "true",
|
||||
"auditLevel": "low",
|
||||
"auditMode": "direct"
|
||||
}
|
||||
},
|
||||
"frameworks": {
|
||||
"net8.0": {
|
||||
"targetAlias": "net8.0",
|
||||
"dependencies": {
|
||||
"CommunityToolkit.HighPerformance": {
|
||||
"target": "Package",
|
||||
"version": "[8.4.0, )"
|
||||
}
|
||||
},
|
||||
"imports": [
|
||||
"net461",
|
||||
"net462",
|
||||
"net47",
|
||||
"net471",
|
||||
"net472",
|
||||
"net48",
|
||||
"net481"
|
||||
],
|
||||
"assetTargetFallback": true,
|
||||
"warn": true,
|
||||
"frameworkReferences": {
|
||||
"Microsoft.NETCore.App": {
|
||||
"privateAssets": "all"
|
||||
}
|
||||
},
|
||||
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\8.0.400/PortableRuntimeIdentifierGraph.json"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="utf-8" standalone="no"?>
|
||||
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
|
||||
<RestoreSuccess Condition=" '$(RestoreSuccess)' == '' ">True</RestoreSuccess>
|
||||
<RestoreTool Condition=" '$(RestoreTool)' == '' ">NuGet</RestoreTool>
|
||||
<ProjectAssetsFile Condition=" '$(ProjectAssetsFile)' == '' ">$(MSBuildThisFileDirectory)project.assets.json</ProjectAssetsFile>
|
||||
<NuGetPackageRoot Condition=" '$(NuGetPackageRoot)' == '' ">$(UserProfile)\.nuget\packages\</NuGetPackageRoot>
|
||||
<NuGetPackageFolders Condition=" '$(NuGetPackageFolders)' == '' ">C:\Users\Youmu\.nuget\packages\;C:\Program Files (x86)\Microsoft Visual Studio\Shared\NuGetPackages</NuGetPackageFolders>
|
||||
<NuGetProjectStyle Condition=" '$(NuGetProjectStyle)' == '' ">PackageReference</NuGetProjectStyle>
|
||||
<NuGetToolVersion Condition=" '$(NuGetToolVersion)' == '' ">6.11.0</NuGetToolVersion>
|
||||
</PropertyGroup>
|
||||
<ItemGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
|
||||
<SourceRoot Include="C:\Users\Youmu\.nuget\packages\" />
|
||||
<SourceRoot Include="C:\Program Files (x86)\Microsoft Visual Studio\Shared\NuGetPackages\" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,2 @@
|
||||
<?xml version="1.0" encoding="utf-8" standalone="no"?>
|
||||
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" />
|
||||
@@ -0,0 +1,265 @@
|
||||
{
|
||||
"version": 3,
|
||||
"targets": {
|
||||
"net8.0": {
|
||||
"CommunityToolkit.HighPerformance/8.4.0": {
|
||||
"type": "package",
|
||||
"compile": {
|
||||
"lib/net8.0/CommunityToolkit.HighPerformance.dll": {
|
||||
"related": ".pdb;.xml"
|
||||
}
|
||||
},
|
||||
"runtime": {
|
||||
"lib/net8.0/CommunityToolkit.HighPerformance.dll": {
|
||||
"related": ".pdb;.xml"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Microsoft.CSharp/4.7.0": {
|
||||
"type": "package",
|
||||
"compile": {
|
||||
"ref/netcoreapp2.0/_._": {}
|
||||
},
|
||||
"runtime": {
|
||||
"lib/netcoreapp2.0/_._": {}
|
||||
}
|
||||
},
|
||||
"System.Runtime.CompilerServices.Unsafe/6.1.0": {
|
||||
"type": "package",
|
||||
"compile": {
|
||||
"lib/net7.0/_._": {}
|
||||
},
|
||||
"runtime": {
|
||||
"lib/net7.0/_._": {}
|
||||
},
|
||||
"build": {
|
||||
"buildTransitive/net6.0/_._": {}
|
||||
}
|
||||
},
|
||||
"StgSharp.Common/1.0.0": {
|
||||
"type": "project",
|
||||
"framework": ".NETCoreApp,Version=v8.0",
|
||||
"dependencies": {
|
||||
"Microsoft.CSharp": "4.7.0",
|
||||
"System.Runtime.CompilerServices.Unsafe": "6.1.0"
|
||||
},
|
||||
"compile": {
|
||||
"bin/placeholder/StgSharp.Common.dll": {}
|
||||
},
|
||||
"runtime": {
|
||||
"bin/placeholder/StgSharp.Common.dll": {}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"libraries": {
|
||||
"CommunityToolkit.HighPerformance/8.4.0": {
|
||||
"sha512": "flxspiBs0G/0GMp7IK2J2ijV9bTG6hEwFc/z6ekHqB6nwRJ4Ry2yLdx+TkbCUYFCl4XhABkAwomeKbT6zM2Zlg==",
|
||||
"type": "package",
|
||||
"path": "communitytoolkit.highperformance/8.4.0",
|
||||
"files": [
|
||||
".nupkg.metadata",
|
||||
".signature.p7s",
|
||||
"Icon.png",
|
||||
"License.md",
|
||||
"ThirdPartyNotices.txt",
|
||||
"communitytoolkit.highperformance.8.4.0.nupkg.sha512",
|
||||
"communitytoolkit.highperformance.nuspec",
|
||||
"lib/net7.0/CommunityToolkit.HighPerformance.dll",
|
||||
"lib/net7.0/CommunityToolkit.HighPerformance.pdb",
|
||||
"lib/net7.0/CommunityToolkit.HighPerformance.xml",
|
||||
"lib/net8.0/CommunityToolkit.HighPerformance.dll",
|
||||
"lib/net8.0/CommunityToolkit.HighPerformance.pdb",
|
||||
"lib/net8.0/CommunityToolkit.HighPerformance.xml",
|
||||
"lib/netstandard2.0/CommunityToolkit.HighPerformance.dll",
|
||||
"lib/netstandard2.0/CommunityToolkit.HighPerformance.pdb",
|
||||
"lib/netstandard2.0/CommunityToolkit.HighPerformance.xml",
|
||||
"lib/netstandard2.1/CommunityToolkit.HighPerformance.dll",
|
||||
"lib/netstandard2.1/CommunityToolkit.HighPerformance.pdb",
|
||||
"lib/netstandard2.1/CommunityToolkit.HighPerformance.xml"
|
||||
]
|
||||
},
|
||||
"Microsoft.CSharp/4.7.0": {
|
||||
"sha512": "pTj+D3uJWyN3My70i2Hqo+OXixq3Os2D1nJ2x92FFo6sk8fYS1m1WLNTs0Dc1uPaViH0YvEEwvzddQ7y4rhXmA==",
|
||||
"type": "package",
|
||||
"path": "microsoft.csharp/4.7.0",
|
||||
"files": [
|
||||
".nupkg.metadata",
|
||||
".signature.p7s",
|
||||
"LICENSE.TXT",
|
||||
"THIRD-PARTY-NOTICES.TXT",
|
||||
"lib/MonoAndroid10/_._",
|
||||
"lib/MonoTouch10/_._",
|
||||
"lib/net45/_._",
|
||||
"lib/netcore50/Microsoft.CSharp.dll",
|
||||
"lib/netcoreapp2.0/_._",
|
||||
"lib/netstandard1.3/Microsoft.CSharp.dll",
|
||||
"lib/netstandard2.0/Microsoft.CSharp.dll",
|
||||
"lib/netstandard2.0/Microsoft.CSharp.xml",
|
||||
"lib/portable-net45+win8+wp8+wpa81/_._",
|
||||
"lib/uap10.0.16299/_._",
|
||||
"lib/win8/_._",
|
||||
"lib/wp80/_._",
|
||||
"lib/wpa81/_._",
|
||||
"lib/xamarinios10/_._",
|
||||
"lib/xamarinmac20/_._",
|
||||
"lib/xamarintvos10/_._",
|
||||
"lib/xamarinwatchos10/_._",
|
||||
"microsoft.csharp.4.7.0.nupkg.sha512",
|
||||
"microsoft.csharp.nuspec",
|
||||
"ref/MonoAndroid10/_._",
|
||||
"ref/MonoTouch10/_._",
|
||||
"ref/net45/_._",
|
||||
"ref/netcore50/Microsoft.CSharp.dll",
|
||||
"ref/netcore50/Microsoft.CSharp.xml",
|
||||
"ref/netcore50/de/Microsoft.CSharp.xml",
|
||||
"ref/netcore50/es/Microsoft.CSharp.xml",
|
||||
"ref/netcore50/fr/Microsoft.CSharp.xml",
|
||||
"ref/netcore50/it/Microsoft.CSharp.xml",
|
||||
"ref/netcore50/ja/Microsoft.CSharp.xml",
|
||||
"ref/netcore50/ko/Microsoft.CSharp.xml",
|
||||
"ref/netcore50/ru/Microsoft.CSharp.xml",
|
||||
"ref/netcore50/zh-hans/Microsoft.CSharp.xml",
|
||||
"ref/netcore50/zh-hant/Microsoft.CSharp.xml",
|
||||
"ref/netcoreapp2.0/_._",
|
||||
"ref/netstandard1.0/Microsoft.CSharp.dll",
|
||||
"ref/netstandard1.0/Microsoft.CSharp.xml",
|
||||
"ref/netstandard1.0/de/Microsoft.CSharp.xml",
|
||||
"ref/netstandard1.0/es/Microsoft.CSharp.xml",
|
||||
"ref/netstandard1.0/fr/Microsoft.CSharp.xml",
|
||||
"ref/netstandard1.0/it/Microsoft.CSharp.xml",
|
||||
"ref/netstandard1.0/ja/Microsoft.CSharp.xml",
|
||||
"ref/netstandard1.0/ko/Microsoft.CSharp.xml",
|
||||
"ref/netstandard1.0/ru/Microsoft.CSharp.xml",
|
||||
"ref/netstandard1.0/zh-hans/Microsoft.CSharp.xml",
|
||||
"ref/netstandard1.0/zh-hant/Microsoft.CSharp.xml",
|
||||
"ref/netstandard2.0/Microsoft.CSharp.dll",
|
||||
"ref/netstandard2.0/Microsoft.CSharp.xml",
|
||||
"ref/portable-net45+win8+wp8+wpa81/_._",
|
||||
"ref/uap10.0.16299/_._",
|
||||
"ref/win8/_._",
|
||||
"ref/wp80/_._",
|
||||
"ref/wpa81/_._",
|
||||
"ref/xamarinios10/_._",
|
||||
"ref/xamarinmac20/_._",
|
||||
"ref/xamarintvos10/_._",
|
||||
"ref/xamarinwatchos10/_._",
|
||||
"useSharedDesignerContext.txt",
|
||||
"version.txt"
|
||||
]
|
||||
},
|
||||
"System.Runtime.CompilerServices.Unsafe/6.1.0": {
|
||||
"sha512": "5o/HZxx6RVqYlhKSq8/zronDkALJZUT2Vz0hx43f0gwe8mwlM0y2nYlqdBwLMzr262Bwvpikeb/yEwkAa5PADg==",
|
||||
"type": "package",
|
||||
"path": "system.runtime.compilerservices.unsafe/6.1.0",
|
||||
"files": [
|
||||
".nupkg.metadata",
|
||||
".signature.p7s",
|
||||
"Icon.png",
|
||||
"PACKAGE.md",
|
||||
"buildTransitive/net461/System.Runtime.CompilerServices.Unsafe.targets",
|
||||
"buildTransitive/net462/_._",
|
||||
"buildTransitive/net6.0/_._",
|
||||
"buildTransitive/netcoreapp2.0/System.Runtime.CompilerServices.Unsafe.targets",
|
||||
"lib/net462/System.Runtime.CompilerServices.Unsafe.dll",
|
||||
"lib/net462/System.Runtime.CompilerServices.Unsafe.xml",
|
||||
"lib/net7.0/_._",
|
||||
"lib/netstandard2.0/System.Runtime.CompilerServices.Unsafe.dll",
|
||||
"lib/netstandard2.0/System.Runtime.CompilerServices.Unsafe.xml",
|
||||
"system.runtime.compilerservices.unsafe.6.1.0.nupkg.sha512",
|
||||
"system.runtime.compilerservices.unsafe.nuspec"
|
||||
]
|
||||
},
|
||||
"StgSharp.Common/1.0.0": {
|
||||
"type": "project",
|
||||
"path": "../StgSharp.Common/StgSharp.Common.csproj",
|
||||
"msbuildProject": "../StgSharp.Common/StgSharp.Common.csproj"
|
||||
}
|
||||
},
|
||||
"projectFileDependencyGroups": {
|
||||
"net8.0": [
|
||||
"CommunityToolkit.HighPerformance >= 8.4.0",
|
||||
"StgSharp.Common >= 1.0.0"
|
||||
]
|
||||
},
|
||||
"packageFolders": {
|
||||
"C:\\Users\\Youmu\\.nuget\\packages\\": {},
|
||||
"C:\\Program Files (x86)\\Microsoft Visual Studio\\Shared\\NuGetPackages": {}
|
||||
},
|
||||
"project": {
|
||||
"version": "1.0.0",
|
||||
"restore": {
|
||||
"projectUniqueName": "D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\内核源代码\\StgSharp.Script\\StgSharp.Script.csproj",
|
||||
"projectName": "StgSharp.Script",
|
||||
"projectPath": "D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\内核源代码\\StgSharp.Script\\StgSharp.Script.csproj",
|
||||
"packagesPath": "C:\\Users\\Youmu\\.nuget\\packages\\",
|
||||
"outputPath": "D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\内核源代码\\StgSharp.Script\\obj\\",
|
||||
"projectStyle": "PackageReference",
|
||||
"fallbackFolders": [
|
||||
"C:\\Program Files (x86)\\Microsoft Visual Studio\\Shared\\NuGetPackages"
|
||||
],
|
||||
"configFilePaths": [
|
||||
"C:\\Users\\Youmu\\AppData\\Roaming\\NuGet\\NuGet.Config",
|
||||
"C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.FallbackLocation.config",
|
||||
"C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config"
|
||||
],
|
||||
"originalTargetFrameworks": [
|
||||
"net8.0"
|
||||
],
|
||||
"sources": {
|
||||
"C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {},
|
||||
"C:\\Program Files\\dotnet\\library-packs": {},
|
||||
"D:\\Programmer\\NugetLocal": {},
|
||||
"https://api.nuget.org/v3/index.json": {}
|
||||
},
|
||||
"frameworks": {
|
||||
"net8.0": {
|
||||
"targetAlias": "net8.0",
|
||||
"projectReferences": {
|
||||
"D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\内核源代码\\StgSharp.Common\\StgSharp.Common.csproj": {
|
||||
"projectPath": "D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\内核源代码\\StgSharp.Common\\StgSharp.Common.csproj"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"warningProperties": {
|
||||
"warnAsError": [
|
||||
"NU1605"
|
||||
]
|
||||
},
|
||||
"restoreAuditProperties": {
|
||||
"enableAudit": "true",
|
||||
"auditLevel": "low",
|
||||
"auditMode": "direct"
|
||||
}
|
||||
},
|
||||
"frameworks": {
|
||||
"net8.0": {
|
||||
"targetAlias": "net8.0",
|
||||
"dependencies": {
|
||||
"CommunityToolkit.HighPerformance": {
|
||||
"target": "Package",
|
||||
"version": "[8.4.0, )"
|
||||
}
|
||||
},
|
||||
"imports": [
|
||||
"net461",
|
||||
"net462",
|
||||
"net47",
|
||||
"net471",
|
||||
"net472",
|
||||
"net48",
|
||||
"net481"
|
||||
],
|
||||
"assetTargetFallback": true,
|
||||
"warn": true,
|
||||
"frameworkReferences": {
|
||||
"Microsoft.NETCore.App": {
|
||||
"privateAssets": "all"
|
||||
}
|
||||
},
|
||||
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\8.0.400/PortableRuntimeIdentifierGraph.json"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"version": 2,
|
||||
"dgSpecHash": "zG4VQdi6zL8=",
|
||||
"success": true,
|
||||
"projectFilePath": "D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\内核源代码\\StgSharp.Script\\StgSharp.Script.csproj",
|
||||
"expectedPackageFiles": [
|
||||
"C:\\Users\\Youmu\\.nuget\\packages\\communitytoolkit.highperformance\\8.4.0\\communitytoolkit.highperformance.8.4.0.nupkg.sha512",
|
||||
"C:\\Users\\Youmu\\.nuget\\packages\\microsoft.csharp\\4.7.0\\microsoft.csharp.4.7.0.nupkg.sha512",
|
||||
"C:\\Users\\Youmu\\.nuget\\packages\\system.runtime.compilerservices.unsafe\\6.1.0\\system.runtime.compilerservices.unsafe.6.1.0.nupkg.sha512"
|
||||
],
|
||||
"logs": []
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
// file=".NETCoreApp,Version=v8.0.AssemblyAttributes.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.
|
||||
//
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
// <autogenerated />
|
||||
using System;
|
||||
using System.Reflection;
|
||||
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(
|
||||
".NETCoreApp,Version=v8.0",
|
||||
FrameworkDisplayName = ".NET 8.0" )]
|
||||
@@ -0,0 +1,23 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// 此代码由工具生成。
|
||||
// 运行时版本:4.0.30319.42000
|
||||
//
|
||||
// 对此文件的更改可能会导致不正确的行为,并且如果
|
||||
// 重新生成代码,这些更改将会丢失。
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
using System;
|
||||
using System.Reflection;
|
||||
|
||||
[assembly: System.Reflection.AssemblyCompanyAttribute("StgSharp.Script")]
|
||||
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
||||
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+83bde12d2227bf32a3b939e94849bbd7273bad21")]
|
||||
[assembly: System.Reflection.AssemblyProductAttribute("StgSharp.Script")]
|
||||
[assembly: System.Reflection.AssemblyTitleAttribute("StgSharp.Script")]
|
||||
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
||||
|
||||
// 由 MSBuild WriteCodeFragment 类生成。
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
967c2e069112d5dabd8cab52d62d12eab04edfe539a43f99c3504fda5cb70b49
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
is_global = true
|
||||
build_property.TargetFramework = net8.0
|
||||
build_property.TargetPlatformMinVersion =
|
||||
build_property.UsingMicrosoftNETSdkWeb =
|
||||
build_property.ProjectTypeGuids =
|
||||
build_property.InvariantGlobalization =
|
||||
build_property.PlatformNeutralAssembly =
|
||||
build_property.EnforceExtendedAnalyzerRules =
|
||||
build_property._SupportedPlatformList = Linux,macOS,Windows
|
||||
build_property.RootNamespace = StgSharp.Script
|
||||
build_property.ProjectDir = D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.Script\
|
||||
build_property.EnableComHosting =
|
||||
build_property.EnableGeneratedComInterfaceComImportInterop =
|
||||
Binary file not shown.
Binary file not shown.
@@ -0,0 +1 @@
|
||||
7e53934ec725e63bf76ab4e118210f46257ab2e0ae5460f70569be713b225c54
|
||||
@@ -0,0 +1,17 @@
|
||||
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.Script\bin\x64\Debug\net8.0\StgSharp.Script.deps.json
|
||||
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.Script\bin\x64\Debug\net8.0\StgSharp.Script.dll
|
||||
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.Script\bin\x64\Debug\net8.0\StgSharp.Script.pdb
|
||||
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.Script\bin\x64\Debug\net8.0\StgSharp.Common.dll
|
||||
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.Script\bin\x64\Debug\net8.0\StgSharp.Common.pdb
|
||||
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.Script\bin\x64\Debug\net8.0\StgSharp.Common.xml
|
||||
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.Script\obj\x64\Debug\net8.0\StgSharp.Script.csproj.AssemblyReference.cache
|
||||
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.Script\obj\x64\Debug\net8.0\StgSharp.Script.GeneratedMSBuildEditorConfig.editorconfig
|
||||
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.Script\obj\x64\Debug\net8.0\StgSharp.Script.AssemblyInfoInputs.cache
|
||||
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.Script\obj\x64\Debug\net8.0\StgSharp.Script.AssemblyInfo.cs
|
||||
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.Script\obj\x64\Debug\net8.0\StgSharp.Script.csproj.CoreCompileInputs.cache
|
||||
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.Script\obj\x64\Debug\net8.0\StgSharp.Script.sourcelink.json
|
||||
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.Script\obj\x64\Debug\net8.0\StgSharp.D39FE6B0.Up2Date
|
||||
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.Script\obj\x64\Debug\net8.0\StgSharp.Script.dll
|
||||
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.Script\obj\x64\Debug\net8.0\refint\StgSharp.Script.dll
|
||||
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.Script\obj\x64\Debug\net8.0\StgSharp.Script.pdb
|
||||
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.Script\obj\x64\Debug\net8.0\ref\StgSharp.Script.dll
|
||||
Binary file not shown.
Binary file not shown.
@@ -0,0 +1 @@
|
||||
{"documents":{"D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\*":"https://raw.githubusercontent.com/Nitload-NSI/CCD_Github/ccef0de6f686f94da655b0e7d854d0acaf907d04/*"}}
|
||||
Binary file not shown.
Binary file not shown.
+4
@@ -0,0 +1,4 @@
|
||||
// <autogenerated />
|
||||
using System;
|
||||
using System.Reflection;
|
||||
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
|
||||
Binary file not shown.
+4
@@ -0,0 +1,4 @@
|
||||
// <autogenerated />
|
||||
using System;
|
||||
using System.Reflection;
|
||||
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
|
||||
@@ -0,0 +1,23 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// 此代码由工具生成。
|
||||
// 运行时版本:4.0.30319.42000
|
||||
//
|
||||
// 对此文件的更改可能会导致不正确的行为,并且如果
|
||||
// 重新生成代码,这些更改将会丢失。
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
using System;
|
||||
using System.Reflection;
|
||||
|
||||
[assembly: System.Reflection.AssemblyCompanyAttribute("StgSharp.Script")]
|
||||
[assembly: System.Reflection.AssemblyConfigurationAttribute("Release")]
|
||||
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+e687473132786f419a48170313782d6779890c3d")]
|
||||
[assembly: System.Reflection.AssemblyProductAttribute("StgSharp.Script")]
|
||||
[assembly: System.Reflection.AssemblyTitleAttribute("StgSharp.Script")]
|
||||
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
||||
|
||||
// 由 MSBuild WriteCodeFragment 类生成。
|
||||
|
||||
+1
@@ -0,0 +1 @@
|
||||
763989be4fc1c0038f6ed3f9723e1b5dc4f3d10b1809f46a2fcbee31212930ff
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
is_global = true
|
||||
build_property.RootNamespace = StgSharp.Script
|
||||
build_property.ProjectDir = D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.Script\
|
||||
build_property.EnableComHosting =
|
||||
build_property.EnableGeneratedComInterfaceComImportInterop =
|
||||
Binary file not shown.
BIN
Binary file not shown.
Reference in New Issue
Block a user