Daily update on 20250618-051714 by Nitload Youmu. Additional Message : Brief support to collection operation in EXPRESS. A collection type added in core lib and compilestack.
Signed-off-by: Nitload <YoumuLiu_NSI@whv0t.onmicrosoft.com>
This commit is contained in:
@@ -51,8 +51,7 @@ namespace StgSharp.Script
|
||||
ReadOnlySpan<char> subSpan = sourceSpan.Slice( startIndex );
|
||||
|
||||
int start = 0;
|
||||
while( start < subSpan.Length && char.IsWhiteSpace(
|
||||
subSpan[ start ] ) ) {
|
||||
while( start < subSpan.Length && char.IsWhiteSpace( subSpan[ start ] ) ) {
|
||||
start++;
|
||||
}
|
||||
int end = subSpan.Length - 1;
|
||||
@@ -67,10 +66,7 @@ namespace StgSharp.Script
|
||||
return new string( subSpan.Slice( start, finalLength ) );
|
||||
}
|
||||
|
||||
public static string SliceAndTrim(
|
||||
this string line,
|
||||
int startIndex,
|
||||
int length )
|
||||
public static string SliceAndTrim( this string line, int startIndex, int length )
|
||||
{
|
||||
if( line == null ) {
|
||||
throw new ArgumentNullException( nameof( line ) );
|
||||
@@ -88,8 +84,7 @@ namespace StgSharp.Script
|
||||
ReadOnlySpan<char> subSpan = sourceSpan.Slice( startIndex, length );
|
||||
|
||||
int start = 0;
|
||||
while( start < subSpan.Length && char.IsWhiteSpace(
|
||||
subSpan[ start ] ) ) {
|
||||
while( start < subSpan.Length && char.IsWhiteSpace( subSpan[ start ] ) ) {
|
||||
start++;
|
||||
}
|
||||
int end = subSpan.Length - 1;
|
||||
|
||||
@@ -28,6 +28,8 @@
|
||||
//
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
using StgSharp.Collections;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
@@ -49,9 +51,10 @@ namespace StgSharp.Script
|
||||
private Token[] _tokenArray = new Token[4];
|
||||
|
||||
private int _nodeCount,_tokenCount, _operatorCount;
|
||||
private Stack<CompileDepthMark> _depthStack = new Stack<CompileDepthMark>();
|
||||
|
||||
private Stack<bool> _isNode = new Stack<bool>();
|
||||
private RandomAccessibleStack<OperandIndex> _isNode = new RandomAccessibleStack<OperandIndex>(
|
||||
8 );
|
||||
private Stack<CompileDepthMark> _depthStack = new Stack<CompileDepthMark>();
|
||||
private Stack<Stack<TNode>> _statementCache = new Stack<Stack<TNode>>();
|
||||
private TNode _lastNode;
|
||||
|
||||
@@ -97,6 +100,43 @@ namespace StgSharp.Script
|
||||
Stack<TNode> statementsInDepth = _statementCache.Pop();
|
||||
}
|
||||
|
||||
public bool GetOperandAt( Index i, out TNode operandNode, out Token operandToken )
|
||||
{
|
||||
OperandIndex index = _isNode[ i ];
|
||||
if( index.IsNode )
|
||||
{
|
||||
operandNode = _nodeArray[ index.Index ];
|
||||
operandToken = Token.Empty;
|
||||
return true;
|
||||
} else
|
||||
{
|
||||
operandToken = _tokenArray[ index.Index ];
|
||||
operandNode = default!;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public bool GetOperandAt(
|
||||
CompileDepthMark depth,
|
||||
Index i,
|
||||
out Token operandToken,
|
||||
out TNode operandNode )
|
||||
{
|
||||
OperandIndex index = _isNode[ i ];
|
||||
_depthStack.Contains( depth );
|
||||
if( index.IsNode )
|
||||
{
|
||||
operandNode = _nodeArray[ index.Index ];
|
||||
operandToken = Token.Empty;
|
||||
return true;
|
||||
} else
|
||||
{
|
||||
operandToken = _tokenArray[ index.Index ];
|
||||
operandNode = default!;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public CompileDepthMark IncreaseDepth( int usage )
|
||||
{
|
||||
CompileDepthMark mark =
|
||||
@@ -131,7 +171,7 @@ namespace StgSharp.Script
|
||||
n = TNode.Empty;
|
||||
return false;
|
||||
}
|
||||
if( _isNode.Pop() )
|
||||
if( _isNode.Pop().IsNode )
|
||||
{
|
||||
t = Token.Empty;
|
||||
n = _nodeArray[ _nodeCount - 1 ];
|
||||
@@ -160,7 +200,7 @@ namespace StgSharp.Script
|
||||
n = TNode.Empty;
|
||||
return false;
|
||||
}
|
||||
if( _isNode.Pop() )
|
||||
if( _isNode.Pop().IsNode )
|
||||
{
|
||||
t = Token.Empty;
|
||||
n = _nodeArray[ --_nodeCount ];
|
||||
@@ -189,8 +229,8 @@ namespace StgSharp.Script
|
||||
Array.Resize( ref _nodeArray, _nodeArray.Length * 2 );
|
||||
}
|
||||
_nodeArray[ _nodeCount ] = node;
|
||||
_isNode.Push( new( true, _nodeCount ) );
|
||||
_nodeCount++;
|
||||
_isNode.Push( true );
|
||||
IsLastAddedOperator = false;
|
||||
}
|
||||
|
||||
@@ -200,8 +240,8 @@ namespace StgSharp.Script
|
||||
Array.Resize( ref _tokenArray, _tokenArray.Length * 2 );
|
||||
}
|
||||
_tokenArray[ _tokenCount ] = token;
|
||||
_isNode.Push( new( false, _tokenCount ) );
|
||||
_tokenCount++;
|
||||
_isNode.Push( false );
|
||||
IsLastAddedOperator = false;
|
||||
}
|
||||
|
||||
@@ -229,7 +269,7 @@ namespace StgSharp.Script
|
||||
isNode = false;
|
||||
return false;
|
||||
}
|
||||
if( _isNode.Pop() )
|
||||
if( _isNode.Pop().IsNode )
|
||||
{
|
||||
t = Token.Empty;
|
||||
n = _nodeArray[ _nodeCount - 1 ];
|
||||
@@ -264,7 +304,7 @@ namespace StgSharp.Script
|
||||
isNode = false;
|
||||
return false;
|
||||
}
|
||||
if( _isNode.Pop() )
|
||||
if( _isNode.Pop().IsNode )
|
||||
{
|
||||
t = Token.Empty;
|
||||
n = _nodeArray[ --_nodeCount ];
|
||||
@@ -290,5 +330,7 @@ namespace StgSharp.Script
|
||||
return false;
|
||||
}
|
||||
|
||||
private record struct OperandIndex( bool IsNode, int Index );
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,15 +37,9 @@ namespace StgSharp.Script
|
||||
public interface IScriptSourceProvider
|
||||
{
|
||||
|
||||
bool IsEmpty
|
||||
{
|
||||
get;
|
||||
}
|
||||
bool IsEmpty { get; }
|
||||
|
||||
int Location
|
||||
{
|
||||
get;
|
||||
}
|
||||
int Location { get; }
|
||||
|
||||
void EndWriting();
|
||||
|
||||
@@ -54,10 +48,14 @@ namespace StgSharp.Script
|
||||
string ReadLine( out int position );
|
||||
|
||||
/// <summary>
|
||||
/// Return part of current provider.
|
||||
/// Return part of current provider.
|
||||
/// </summary>
|
||||
/// <param name="count"> Count of lines to be sliced </param>
|
||||
/// <returns></returns>
|
||||
/// <param name="count">
|
||||
/// Count of lines to be sliced
|
||||
/// </param>
|
||||
/// <returns>
|
||||
///
|
||||
/// </returns>
|
||||
public IScriptSourceProvider Slice( int location, int count );
|
||||
|
||||
}
|
||||
|
||||
@@ -36,8 +36,7 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace StgSharp.Script
|
||||
{
|
||||
public interface ITypeSource<in TConvert>
|
||||
where TConvert: ITypeSource<TConvert>
|
||||
public interface ITypeSource<in TConvert> where TConvert: ITypeSource<TConvert>
|
||||
{
|
||||
|
||||
bool IsConvertable( TConvert targetType );
|
||||
|
||||
@@ -38,9 +38,9 @@ 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.
|
||||
/// 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
|
||||
{
|
||||
@@ -73,10 +73,7 @@ namespace StgSharp.Script
|
||||
_index = 0;
|
||||
}
|
||||
|
||||
public ScriptSourceTransmitter(
|
||||
string endMark,
|
||||
int start,
|
||||
int capacity )
|
||||
public ScriptSourceTransmitter( string endMark, int start, int capacity )
|
||||
{
|
||||
_cache = new List<string>( capacity );
|
||||
_completeMark = endMark;
|
||||
@@ -85,8 +82,7 @@ namespace StgSharp.Script
|
||||
}
|
||||
|
||||
public bool IsEmpty => _isWriting ?
|
||||
( _cache.Count == 0 ) : ( _buffer.Length == 0 ) || ( _index >=
|
||||
_buffer.Length );
|
||||
( _cache.Count == 0 ) : ( _buffer.Length == 0 ) || ( _index >= _buffer.Length );
|
||||
|
||||
public bool IsFrozen => !_isWriting;
|
||||
|
||||
@@ -107,8 +103,7 @@ namespace StgSharp.Script
|
||||
public string ReadLine()
|
||||
{
|
||||
if( _isWriting ) {
|
||||
throw new InvalidOperationException(
|
||||
"Cannot read before all writing operation." );
|
||||
throw new InvalidOperationException( "Cannot read before all writing operation." );
|
||||
}
|
||||
if( _index >= _buffer.Length ) {
|
||||
return string.Empty;
|
||||
@@ -121,10 +116,10 @@ namespace StgSharp.Script
|
||||
public string ReadLine( out int position )
|
||||
{
|
||||
if( _isWriting ) {
|
||||
throw new InvalidOperationException(
|
||||
"Cannot read before all writing operation." );
|
||||
throw new InvalidOperationException( "Cannot read before all writing operation." );
|
||||
}
|
||||
if( _index >= _buffer.Length ) {
|
||||
if( _index >= _buffer.Length )
|
||||
{
|
||||
position = -1;
|
||||
return string.Empty;
|
||||
}
|
||||
@@ -148,7 +143,8 @@ namespace StgSharp.Script
|
||||
if( !_isWriting ) {
|
||||
return;
|
||||
}
|
||||
if( string.Equals( _completeMark, line ) ) {
|
||||
if( string.Equals( _completeMark, line ) )
|
||||
{
|
||||
EndWriting();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
//-----------------------------------------------------------------------
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp.Script.Express
|
||||
@@ -46,13 +47,10 @@ namespace StgSharp.Script.Express
|
||||
public struct ExpLogic
|
||||
{
|
||||
|
||||
public static readonly ExpLogic False = new ExpLogic(
|
||||
ExpLogicValue.False );
|
||||
public static readonly ExpLogic False = new ExpLogic( ExpLogicValue.False );
|
||||
|
||||
public static readonly ExpLogic True = new ExpLogic(
|
||||
ExpLogicValue.True );
|
||||
public static readonly ExpLogic Unknown = new ExpLogic(
|
||||
ExpLogicValue.Unknown );
|
||||
public static readonly ExpLogic True = new ExpLogic( ExpLogicValue.True );
|
||||
public static readonly ExpLogic Unknown = new ExpLogic( ExpLogicValue.Unknown );
|
||||
|
||||
private readonly ExpLogicValue _value;
|
||||
|
||||
@@ -67,13 +65,18 @@ namespace StgSharp.Script.Express
|
||||
|
||||
public bool IsUnknown => _value == ExpLogicValue.Unknown;
|
||||
|
||||
[MethodImpl( MethodImplOptions.AggressiveInlining )]
|
||||
public bool ToBoolean()
|
||||
{
|
||||
return _value == ExpLogicValue.True;
|
||||
}
|
||||
|
||||
public override string ToString() => _value.ToString();
|
||||
|
||||
public static bool TryParse(
|
||||
ReadOnlySpan<char> value,
|
||||
out ExpLogic result )
|
||||
public static bool TryParse( ReadOnlySpan<char> value, out ExpLogic result )
|
||||
{
|
||||
if( Enum.TryParse<ExpLogicValue>( value, out ExpLogicValue e ) ) {
|
||||
if( Enum.TryParse<ExpLogicValue>( value, out ExpLogicValue e ) )
|
||||
{
|
||||
result = new ExpLogic( e );
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -73,8 +73,8 @@ namespace StgSharp.Script.Express
|
||||
left.EqualityTypeConvert.Name );
|
||||
}
|
||||
bool isFloat =
|
||||
( left._nodeFlag | ExpNodeFlag.BuiltinType_Real ) == 0 || ( right._nodeFlag | ExpNodeFlag.BuiltinType_Real ) ==
|
||||
0;
|
||||
( left._nodeFlag | ExpNodeFlag.BuiltinType_Real ) == 0 ||
|
||||
( right._nodeFlag | ExpNodeFlag.BuiltinType_Real ) == 0;
|
||||
return new ExpBinaryOperatorNode( source, left, right )
|
||||
{
|
||||
_returnType = isFloat ? ExpressCompile.ExpReal : ExpressCompile.ExpInt,
|
||||
@@ -158,8 +158,8 @@ namespace StgSharp.Script.Express
|
||||
left.EqualityTypeConvert.Name );
|
||||
}
|
||||
bool isFloat =
|
||||
( left._nodeFlag | ExpNodeFlag.BuiltinType_Real ) == 0 || ( right._nodeFlag | ExpNodeFlag.BuiltinType_Real ) ==
|
||||
0;
|
||||
( left._nodeFlag | ExpNodeFlag.BuiltinType_Real ) == 0 ||
|
||||
( right._nodeFlag | ExpNodeFlag.BuiltinType_Real ) == 0;
|
||||
return new ExpBinaryOperatorNode( source, left, right )
|
||||
{
|
||||
_returnType = isFloat ? ExpressCompile.ExpReal : ExpressCompile.ExpInt,
|
||||
@@ -229,8 +229,8 @@ namespace StgSharp.Script.Express
|
||||
left.EqualityTypeConvert.Name );
|
||||
}
|
||||
bool isFloat =
|
||||
( left._nodeFlag | ExpNodeFlag.BuiltinType_Real ) == 0 || ( right._nodeFlag | ExpNodeFlag.BuiltinType_Real ) ==
|
||||
0;
|
||||
( left._nodeFlag | ExpNodeFlag.BuiltinType_Real ) == 0 ||
|
||||
( right._nodeFlag | ExpNodeFlag.BuiltinType_Real ) == 0;
|
||||
return new ExpBinaryOperatorNode( source, left, right )
|
||||
{
|
||||
_returnType = isFloat ? ExpressCompile.ExpReal : ExpressCompile.ExpInt,
|
||||
@@ -283,8 +283,8 @@ namespace StgSharp.Script.Express
|
||||
left.EqualityTypeConvert.Name );
|
||||
}
|
||||
bool isFloat =
|
||||
( left._nodeFlag | ExpNodeFlag.BuiltinType_Real ) == 0 || ( right._nodeFlag | ExpNodeFlag.BuiltinType_Real ) ==
|
||||
0;
|
||||
( left._nodeFlag | ExpNodeFlag.BuiltinType_Real ) == 0 ||
|
||||
( right._nodeFlag | ExpNodeFlag.BuiltinType_Real ) == 0;
|
||||
return new ExpBinaryOperatorNode( source, left, right )
|
||||
{
|
||||
_returnType = isFloat ? ExpressCompile.ExpReal : ExpressCompile.ExpInt,
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
// file="ExpEnumLiteralNode.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;
|
||||
|
||||
namespace StgSharp.Script.Express
|
||||
{
|
||||
public class ExpEnumLiteralNode : ExpSyntaxNode
|
||||
{
|
||||
|
||||
private ExpEnumLiteralNode( Token t ) : base( t ) { }
|
||||
|
||||
public override ExpSyntaxNode Left => Empty;
|
||||
|
||||
public override ExpSyntaxNode Right => Empty;
|
||||
|
||||
public override IExpElementSource EqualityTypeConvert => ExpInstantiableElement.Void;
|
||||
|
||||
public string Literal { get; private set; }
|
||||
|
||||
public static ExpEnumLiteralNode Create( Token t, Func<string, string> parser )
|
||||
{
|
||||
string l;
|
||||
if( parser is null )
|
||||
{
|
||||
l = t.Value;
|
||||
} else
|
||||
{
|
||||
l = parser( t.Value );
|
||||
}
|
||||
return new ExpEnumLiteralNode( t )
|
||||
{
|
||||
Literal = l,
|
||||
CodeConvertTemplate = l
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -88,7 +88,14 @@ namespace StgSharp.Script.Express
|
||||
|
||||
}
|
||||
|
||||
public class ExpBoolNode : ExpElementInstance
|
||||
public interface IExpBooleanSyntax
|
||||
{
|
||||
|
||||
bool Value { get; }
|
||||
|
||||
}
|
||||
|
||||
public class ExpBoolNode : ExpElementInstance, IExpBooleanSyntax
|
||||
{
|
||||
|
||||
private readonly bool _value;
|
||||
@@ -152,7 +159,7 @@ namespace StgSharp.Script.Express
|
||||
|
||||
}
|
||||
|
||||
public class ExpLogicValueNode : ExpElementInstance
|
||||
public class ExpLogicValueNode : ExpElementInstance, IExpBooleanSyntax
|
||||
{
|
||||
|
||||
private readonly ExpLogic _value;
|
||||
@@ -166,7 +173,7 @@ namespace StgSharp.Script.Express
|
||||
CodeConvertTemplate = isLiteral ? value.ToString() : source.Value;
|
||||
}
|
||||
|
||||
public ExpLogic Value => _value;
|
||||
public ExpLogic LogicValue => _value;
|
||||
|
||||
public override IExpElementSource EqualityTypeConvert
|
||||
{
|
||||
@@ -177,5 +184,7 @@ namespace StgSharp.Script.Express
|
||||
|
||||
public override string TypeName => EqualityTypeConvert.Name;
|
||||
|
||||
bool IExpBooleanSyntax.Value => _value.ToBoolean();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
// file="ExpRangeAndIndexNode.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 ExpIndexNode : ExpInstanceReferenceNode
|
||||
{
|
||||
|
||||
internal ExpIndexNode( Token t, ExpSyntaxNode node ) : base( t ) { }
|
||||
|
||||
public override ExpSyntaxNode Left => throw new NotImplementedException();
|
||||
|
||||
public override ExpSyntaxNode Right => throw new NotImplementedException();
|
||||
|
||||
public override IExpElementSource EqualityTypeConvert => throw new NotImplementedException();
|
||||
|
||||
public static ExpIndexNode IndexAt( Token position, ExpSyntaxNode expression )
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull( expression );
|
||||
if( ExpNodeFlag.BuiltinType_Int.IsNotInFlag( expression.NodeFlag ) ) {
|
||||
throw new ExpInvalidTypeException(
|
||||
position, "Integer", expression.EqualityTypeConvert.Name );
|
||||
}
|
||||
return new ExpIndexNode( position, expression );
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -54,9 +54,9 @@ namespace StgSharp.Script.Express
|
||||
ExpSyntaxNode whileRule )
|
||||
: base( source )
|
||||
{
|
||||
if( variable.NodeFlag != begin.NodeFlag || begin.NodeFlag != end.NodeFlag || ( increment !=
|
||||
null && end.NodeFlag !=
|
||||
increment.NodeFlag ) ) {
|
||||
if( variable.NodeFlag != begin.NodeFlag ||
|
||||
begin.NodeFlag != end.NodeFlag ||
|
||||
( increment != null && end.NodeFlag != increment.NodeFlag ) ) {
|
||||
throw new InvalidCastException();
|
||||
}
|
||||
if( IsNullOrEmpty( increment ) )
|
||||
|
||||
@@ -60,9 +60,9 @@ namespace StgSharp.Script.Express
|
||||
return new ExpTupleNode( node );
|
||||
}
|
||||
|
||||
public ExpNodeNextEnumerator TupleAsEnumerator()
|
||||
public ExpNodePresidentEnumerator TupleAsEnumerator()
|
||||
{
|
||||
return node.ToEnumerator();
|
||||
return node.ToPresidentEnumerator();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -122,11 +122,12 @@ namespace StgSharp.Script.Express
|
||||
{
|
||||
IExpElementSource tLeft = left.EqualityTypeConvert,
|
||||
tRight = right.EqualityTypeConvert;
|
||||
if( tLeft is not ExpInstantiableElement tLeftIns || tRight is not ExpInstantiableElement tRightIns ) {
|
||||
if( tLeft is not ExpInstantiableElement tLeftIns ||
|
||||
tRight is not ExpInstantiableElement tRightIns ) {
|
||||
return false;
|
||||
}
|
||||
if( ExpInstantiableElement.IsNullOrVoid( tLeftIns ) || ExpInstantiableElement.IsNullOrVoid(
|
||||
tLeftIns ) ) {
|
||||
if( ExpInstantiableElement.IsNullOrVoid( tLeftIns ) ||
|
||||
ExpInstantiableElement.IsNullOrVoid( tLeftIns ) ) {
|
||||
return false;
|
||||
}
|
||||
return tLeft.IsConvertable( tRight );
|
||||
|
||||
@@ -30,12 +30,39 @@
|
||||
//-----------------------------------------------------------------------
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StgSharp.Script.Express
|
||||
{
|
||||
[EditorBrowsable( EditorBrowsableState.Never )]
|
||||
public static class ExpNodeFlagHelper
|
||||
{
|
||||
|
||||
public static bool IsInFlag( this ExpNodeFlag flag, long target )
|
||||
{
|
||||
return ( ( long )flag & target ) != 0;
|
||||
}
|
||||
|
||||
public static bool IsInFlag( this ExpNodeFlag flag, ExpNodeFlag target )
|
||||
{
|
||||
return ( long )( flag & target ) != 0;
|
||||
}
|
||||
|
||||
public static bool IsNotInFlag( this ExpNodeFlag flag, long target )
|
||||
{
|
||||
return ( ( long )flag & target ) == 0;
|
||||
}
|
||||
|
||||
public static bool IsNotInFlag( this ExpNodeFlag flag, ExpNodeFlag target )
|
||||
{
|
||||
return ( long )( flag & target ) == 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
[Flags]
|
||||
public enum ExpNodeFlag : long
|
||||
{
|
||||
|
||||
@@ -0,0 +1,200 @@
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
// file="ExpNodeTempEnumerator.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 Microsoft.CodeAnalysis.CSharp.Syntax;
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StgSharp.Script.Express
|
||||
{
|
||||
public static class ExpNodeNextEnumeratorExtensions
|
||||
{
|
||||
|
||||
public static ExpNodeTempEnumerator AsCollectionEnumerator(
|
||||
this ExpSyntaxNode token,
|
||||
bool unpack )
|
||||
{
|
||||
ExpNodeTempEnumerator enumerator = new ExpNodeTempEnumerator( token, unpack );
|
||||
IExpElementSource type = token.EqualityTypeConvert;
|
||||
while( enumerator.MoveNext() )
|
||||
{
|
||||
if( enumerator. Current != type ) {
|
||||
throw new InvalidCastException();
|
||||
}
|
||||
}
|
||||
return enumerator;
|
||||
}
|
||||
|
||||
[MethodImpl( MethodImplOptions.AggressiveInlining )]
|
||||
public static ExpNodePresidentEnumerator ToPresidentEnumerator( this ExpSyntaxNode node )
|
||||
{
|
||||
return new ExpNodePresidentEnumerator( node );
|
||||
}
|
||||
|
||||
public static ExpNodePresidentEnumerator TupleToPresidentEnumerator(
|
||||
this ExpSyntaxNode tuple )
|
||||
{
|
||||
return new ExpNodePresidentEnumerator( tuple.Right );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public class ExpNodePresidentEnumerator : IEnumerator<ExpSyntaxNode>
|
||||
{
|
||||
|
||||
private int _index = -1;
|
||||
private List<ExpSyntaxNode> _begin = new List<ExpSyntaxNode>();
|
||||
|
||||
public ExpNodePresidentEnumerator( ExpSyntaxNode token )
|
||||
{
|
||||
_begin.Add( token );
|
||||
ExpSyntaxNode t = token;
|
||||
while( !ReferenceEquals( t.Next, token ) && t.Next != null )
|
||||
{
|
||||
t = t.Next;
|
||||
_begin.Add( t );
|
||||
}
|
||||
}
|
||||
|
||||
public ExpSyntaxNode this[ int index ]
|
||||
{
|
||||
get
|
||||
{
|
||||
ArgumentOutOfRangeException.ThrowIfNegative( index );
|
||||
ArgumentOutOfRangeException.ThrowIfGreaterThan( index, _begin.Count );
|
||||
return _begin[ index ];
|
||||
}
|
||||
}
|
||||
|
||||
public ExpSyntaxNode Current => _begin[ _index ];
|
||||
|
||||
public int Count => _begin.Count;
|
||||
|
||||
public void AssertEnumeratorCount( int count )
|
||||
{
|
||||
if( _begin.Count != count ) {
|
||||
throw new InvalidOperationException(
|
||||
$"Enumerator count mismatch. Expected {count}, but got {_begin.Count}." );
|
||||
}
|
||||
}
|
||||
|
||||
public void AssertEnumeratorCount( int min, int max )
|
||||
{
|
||||
if( _begin.Count < min || _begin.Count > max ) {
|
||||
throw new InvalidOperationException(
|
||||
$"Enumerator count mismatch. Expected between {min} and {max}, but got {_begin.Count}." );
|
||||
}
|
||||
}
|
||||
|
||||
public Span<ExpSyntaxNode> AsSpan()
|
||||
{
|
||||
return CollectionsMarshal.AsSpan( _begin );
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
public bool MoveNext()
|
||||
{
|
||||
if( _index < _begin.Count - 1 )
|
||||
{
|
||||
_index++;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void Reset()
|
||||
{
|
||||
_index = -1;
|
||||
}
|
||||
|
||||
object IEnumerator.Current => this.Current;
|
||||
|
||||
}
|
||||
|
||||
public class ExpNodeTempEnumerator : IEnumerator<ExpSyntaxNode>
|
||||
{
|
||||
|
||||
private ExpSyntaxNode? _current,_begin;
|
||||
|
||||
public ExpNodeTempEnumerator( ExpSyntaxNode node )
|
||||
{
|
||||
_current = null;
|
||||
_begin = node;
|
||||
}
|
||||
|
||||
public ExpNodeTempEnumerator( ExpSyntaxNode node, bool unpack )
|
||||
{
|
||||
_current = null;
|
||||
_begin = unpack ? node.Right : node;
|
||||
}
|
||||
|
||||
public ExpSyntaxNode Current => _current!;
|
||||
|
||||
public bool MoveNext()
|
||||
{
|
||||
if( _current == null )
|
||||
{
|
||||
_current = _begin;
|
||||
return true;
|
||||
}
|
||||
ExpSyntaxNode next = _current.Next;
|
||||
if( ReferenceEquals( next, _begin ) || next == null ) {
|
||||
return false;
|
||||
}
|
||||
_current = next;
|
||||
return true;
|
||||
}
|
||||
|
||||
void IDisposable.Dispose()
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
void IEnumerator.Reset()
|
||||
{
|
||||
_current = null;
|
||||
}
|
||||
|
||||
object IEnumerator.Current => _current;
|
||||
|
||||
}
|
||||
}
|
||||
@@ -50,50 +50,47 @@ namespace StgSharp.Script.Express
|
||||
|
||||
public string Process( string filePath )
|
||||
{
|
||||
Dictionary<string, string> factoryMethods = new Dictionary<string, string>(
|
||||
);
|
||||
Dictionary<string, string> factoryMethods = new Dictionary<string, string>();
|
||||
|
||||
FileStream file = File.OpenRead( filePath );
|
||||
SyntaxTree syntaxTree = CSharpSyntaxTree.ParseText(
|
||||
File.ReadAllText( filePath ) );
|
||||
SyntaxTree syntaxTree = CSharpSyntaxTree.ParseText( File.ReadAllText( filePath ) );
|
||||
|
||||
CSharpCompilation compilation = CSharpCompilation.Create(
|
||||
"Analysis" )
|
||||
.AddSyntaxTrees( syntaxTree )
|
||||
.AddReferences(
|
||||
MetadataReference.CreateFromFile(
|
||||
typeof( object ).Assembly.Location ) );
|
||||
CSharpCompilation compilation = CSharpCompilation.Create( "Analysis" )
|
||||
.AddSyntaxTrees( syntaxTree )
|
||||
.AddReferences(
|
||||
MetadataReference.CreateFromFile(
|
||||
typeof( object ).Assembly.Location ) );
|
||||
|
||||
INamedTypeSymbol? interfaceSymbol = compilation.GetTypeByMetadataName(
|
||||
_interfaceName );
|
||||
INamedTypeSymbol? interfaceSymbol = compilation.GetTypeByMetadataName( _interfaceName );
|
||||
|
||||
if( interfaceSymbol == null ) {
|
||||
throw new InvalidOperationException(
|
||||
$"Interface '{_interfaceName}' not found." );
|
||||
throw new InvalidOperationException( $"Interface '{_interfaceName}' not found." );
|
||||
}
|
||||
|
||||
SemanticModel semanticModel = compilation.GetSemanticModel(
|
||||
syntaxTree );
|
||||
SemanticModel semanticModel = compilation.GetSemanticModel( syntaxTree );
|
||||
SyntaxNode root = syntaxTree.GetRoot();
|
||||
|
||||
IEnumerable<ClassDeclarationSyntax> classDeclarations = root.DescendantNodes(
|
||||
)
|
||||
.OfType<ClassDeclarationSyntax>()
|
||||
.Where(
|
||||
cls => cls.BaseList?.Types.Any(
|
||||
t => SymbolEqualityComparer.Default
|
||||
.Equals(
|
||||
semanticModel.GetTypeInfo( t.Type )
|
||||
.Type,
|
||||
interfaceSymbol ) ) ??
|
||||
false );
|
||||
IEnumerable<ClassDeclarationSyntax> classDeclarations = root.DescendantNodes()
|
||||
.OfType<ClassDeclarationSyntax>(
|
||||
)
|
||||
.Where(
|
||||
cls => cls.BaseList?.Types.Any(
|
||||
t => SymbolEqualityComparer.Default
|
||||
.Equals(
|
||||
semanticModel.GetTypeInfo(
|
||||
t.Type )
|
||||
.Type,
|
||||
interfaceSymbol ) ) ??
|
||||
false );
|
||||
|
||||
foreach( ClassDeclarationSyntax classDeclaration in classDeclarations ) {
|
||||
foreach( ClassDeclarationSyntax classDeclaration in classDeclarations )
|
||||
{
|
||||
string className = classDeclaration.Identifier.Text;
|
||||
IMethodSymbol? factoryMethod = interfaceSymbol.GetMembers()
|
||||
.OfType<IMethodSymbol>()
|
||||
.FirstOrDefault(
|
||||
m => m.IsStatic && m.Name == "CreateInstance" );
|
||||
.OfType<IMethodSymbol>()
|
||||
.FirstOrDefault(
|
||||
m => m.IsStatic &&
|
||||
m.Name == "CreateInstance" );
|
||||
|
||||
if( factoryMethod != null ) {
|
||||
factoryMethods[ className ] = $"() => {interfaceSymbol.Name}.CreateInstance()";
|
||||
@@ -102,9 +99,7 @@ namespace StgSharp.Script.Express
|
||||
|
||||
string code = "var factoryMethods = new Dictionary<string, Func<object>>\n{\n";
|
||||
code += string.Join(
|
||||
",\n",
|
||||
factoryMethods.Select(
|
||||
kvp => $" {{ \"{kvp.Key}\", {kvp.Value} }}" ) );
|
||||
",\n", factoryMethods.Select( kvp => $" {{ \"{kvp.Key}\", {kvp.Value} }}" ) );
|
||||
code += "\n};";
|
||||
|
||||
return code;
|
||||
|
||||
@@ -58,8 +58,7 @@ namespace StgSharp.Script.Express
|
||||
_ruleDefineBegin = GetRuleDefineBegin(),
|
||||
_ruleDefineEnd = GetRuleDefineEnd();
|
||||
|
||||
private readonly GeneratedExpSchema _compileResult = new GeneratedExpSchema(
|
||||
);
|
||||
private readonly GeneratedExpSchema _compileResult = new GeneratedExpSchema();
|
||||
|
||||
private List<IExpElementSource> _sourceCache = [];
|
||||
|
||||
@@ -92,15 +91,19 @@ namespace StgSharp.Script.Express
|
||||
}
|
||||
name = _schemaBegin.Match( line ).Groups[ "namespace" ].Value;
|
||||
|
||||
while( !_schemaEnd.IsMatch( line ) ) {
|
||||
if( TryReadConst( line, reader,
|
||||
out IExpElementSource source ) ) {
|
||||
while( !_schemaEnd.IsMatch( line ) )
|
||||
{
|
||||
if( TryReadConst( line, reader, out IExpElementSource source ) )
|
||||
{
|
||||
_sourceCache.Add( source );
|
||||
} else if( TryReadType( line, reader, out source ) ) {
|
||||
} else if( TryReadType( line, reader, out source ) )
|
||||
{
|
||||
_sourceCache.Add( source );
|
||||
} else if( TryReadEntity( line, reader, out source ) ) {
|
||||
} else if( TryReadEntity( line, reader, out source ) )
|
||||
{
|
||||
_sourceCache.Add( source );
|
||||
} else if( TryReadRule( line, reader, out source ) ) {
|
||||
} else if( TryReadRule( line, reader, out source ) )
|
||||
{
|
||||
_sourceCache.Add( source );
|
||||
} else if( TryReadFunction( line, reader, out source ) ) {
|
||||
_sourceCache.Add( source );
|
||||
@@ -110,33 +113,34 @@ namespace StgSharp.Script.Express
|
||||
}
|
||||
|
||||
public static bool TryReadSchema(
|
||||
string firstLine,
|
||||
ExpFileSource reader,
|
||||
out ExpSchemaSource source )
|
||||
string firstLine,
|
||||
ExpFileSource reader,
|
||||
out ExpSchemaSource source )
|
||||
{
|
||||
if( !_schemaBegin.IsMatch( firstLine ) ) {
|
||||
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 ) ) {
|
||||
while( !_schemaEnd.IsMatch( firstLine ) )
|
||||
{
|
||||
if( _source.TryReadConst( firstLine, reader,
|
||||
out IExpElementSource _elementSource ) )
|
||||
{
|
||||
_source._sourceCache.Add( _elementSource );
|
||||
} else if( _source.TryReadType(
|
||||
firstLine, reader, out _elementSource ) ) {
|
||||
} else if( _source.TryReadType( firstLine, reader, out _elementSource ) )
|
||||
{
|
||||
_source._sourceCache.Add( _elementSource );
|
||||
} else if( _source.TryReadEntity(
|
||||
firstLine, reader, out _elementSource ) ) {
|
||||
} else if( _source.TryReadEntity( firstLine, reader, out _elementSource ) )
|
||||
{
|
||||
_source._sourceCache.Add( _elementSource );
|
||||
} else if( _source.TryReadRule(
|
||||
firstLine, reader, out _elementSource ) ) {
|
||||
} else if( _source.TryReadRule( firstLine, reader, out _elementSource ) )
|
||||
{
|
||||
_source._sourceCache.Add( _elementSource );
|
||||
} else if( _source.TryReadFunction(
|
||||
firstLine, reader, out _elementSource ) ) {
|
||||
} else if( _source.TryReadFunction( firstLine, reader, out _elementSource ) ) {
|
||||
_source._sourceCache.Add( _elementSource );
|
||||
}
|
||||
firstLine = reader.ReadLine();
|
||||
@@ -151,9 +155,7 @@ namespace StgSharp.Script.Express
|
||||
[GeneratedRegex( @"\s*END_CONSTANT;" )]
|
||||
private static partial Regex GetConstDefineEnd();
|
||||
|
||||
[GeneratedRegex(
|
||||
@"\s*ENTITY\s*(?<TypeName>[A-Za-z0-9_]+)\s*",
|
||||
RegexOptions.Compiled )]
|
||||
[GeneratedRegex( @"\s*ENTITY\s*(?<TypeName>[A-Za-z0-9_]+)\s*", RegexOptions.Compiled )]
|
||||
private static partial Regex GetEntityDefineBegin();
|
||||
|
||||
[GeneratedRegex(
|
||||
@@ -184,9 +186,7 @@ namespace StgSharp.Script.Express
|
||||
[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 )]
|
||||
[GeneratedRegex( @"END_SCHEMA;\s*--\s*(?<namespace>[A-Za-z0-9_]+)", RegexOptions.Compiled )]
|
||||
private static partial Regex GetSchemaEnd();
|
||||
|
||||
[GeneratedRegex(
|
||||
@@ -200,18 +200,19 @@ namespace StgSharp.Script.Express
|
||||
private static partial Regex GetTypeDefineEnd();
|
||||
|
||||
private bool TryReadConst(
|
||||
string firstLine,
|
||||
ExpFileSource reader,
|
||||
out IExpElementSource source )
|
||||
string firstLine,
|
||||
ExpFileSource reader,
|
||||
out IExpElementSource source )
|
||||
{
|
||||
Match match = _constDefineBegin.Match( firstLine );
|
||||
if( match.Success ) {
|
||||
if( match.Success )
|
||||
{
|
||||
ScriptSourceTransmitter transmitter = new ScriptSourceTransmitter(
|
||||
"END_CONSTANT", reader.Location );
|
||||
ExpConstantCollectionSource _source = new ExpConstantCollectionSource(
|
||||
transmitter );
|
||||
ExpConstantCollectionSource _source = new ExpConstantCollectionSource( transmitter );
|
||||
string line = reader.ReadLine();
|
||||
while( !_constDefineEnd.IsMatch( line ) ) {
|
||||
while( !_constDefineEnd.IsMatch( line ) )
|
||||
{
|
||||
transmitter.WriteLine( line );
|
||||
line = reader.ReadLine();
|
||||
}
|
||||
@@ -224,27 +225,28 @@ namespace StgSharp.Script.Express
|
||||
}
|
||||
|
||||
private bool TryReadEntity(
|
||||
string firstLine,
|
||||
ExpFileSource reader,
|
||||
out IExpElementSource source )
|
||||
string firstLine,
|
||||
ExpFileSource reader,
|
||||
out IExpElementSource source )
|
||||
{
|
||||
Match match = _entityDefineBegin.Match( firstLine );
|
||||
if( match.Success ) {
|
||||
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 ) {
|
||||
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 ExpInvalidElementDeclareEndingExceptions(
|
||||
_source.Name, endedName );
|
||||
throw new ExpInvalidElementDeclareEndingExceptions( _source.Name, endedName );
|
||||
}
|
||||
transmitter.WriteLine( "END_ENTITY" );
|
||||
source = _source;
|
||||
@@ -255,12 +257,13 @@ namespace StgSharp.Script.Express
|
||||
}
|
||||
|
||||
private bool TryReadFunction(
|
||||
string firstLine,
|
||||
ExpFileSource reader,
|
||||
out IExpElementSource source )
|
||||
string firstLine,
|
||||
ExpFileSource reader,
|
||||
out IExpElementSource source )
|
||||
{
|
||||
Match match = _functionDefineBegin.Match( firstLine );
|
||||
if( match.Success ) {
|
||||
if( match.Success )
|
||||
{
|
||||
ScriptSourceTransmitter transmitter = new ScriptSourceTransmitter(
|
||||
"END_FUNCTION", reader.Location );
|
||||
ExpFunctionSource _source = new ExpFunctionSource(
|
||||
@@ -268,15 +271,15 @@ namespace StgSharp.Script.Express
|
||||
transmitter.WriteLine( match.Groups[ "Remaining" ].ToString() );
|
||||
string line = reader.ReadLine();
|
||||
match = _functionDefineEnd.Match( line );
|
||||
while( !match.Success ) {
|
||||
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 ExpInvalidElementDeclareEndingExceptions(
|
||||
_source.Name, endedName );
|
||||
throw new ExpInvalidElementDeclareEndingExceptions( _source.Name, endedName );
|
||||
}
|
||||
transmitter.WriteLine( "END_FUNCTION" );
|
||||
source = _source;
|
||||
@@ -287,12 +290,13 @@ namespace StgSharp.Script.Express
|
||||
}
|
||||
|
||||
private bool TryReadRule(
|
||||
string firstLine,
|
||||
ExpFileSource reader,
|
||||
out IExpElementSource source )
|
||||
string firstLine,
|
||||
ExpFileSource reader,
|
||||
out IExpElementSource source )
|
||||
{
|
||||
Match match = _ruleDefineBegin.Match( firstLine );
|
||||
if( match.Success ) {
|
||||
if( match.Success )
|
||||
{
|
||||
ScriptSourceTransmitter transmitter = new ScriptSourceTransmitter(
|
||||
"END_RULE", reader.Location );
|
||||
ExpRuleSource _source = new ExpRuleSource(
|
||||
@@ -303,15 +307,15 @@ namespace StgSharp.Script.Express
|
||||
}
|
||||
string line = reader.ReadLine();
|
||||
match = _ruleDefineEnd.Match( line );
|
||||
while( !match.Success ) {
|
||||
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 ExpInvalidElementDeclareEndingExceptions(
|
||||
_source.Name, endedName );
|
||||
throw new ExpInvalidElementDeclareEndingExceptions( _source.Name, endedName );
|
||||
}
|
||||
transmitter.WriteLine( "END_RULE" );
|
||||
source = _source;
|
||||
@@ -322,12 +326,13 @@ namespace StgSharp.Script.Express
|
||||
}
|
||||
|
||||
private bool TryReadType(
|
||||
string firstLine,
|
||||
ExpFileSource reader,
|
||||
out IExpElementSource source )
|
||||
string firstLine,
|
||||
ExpFileSource reader,
|
||||
out IExpElementSource source )
|
||||
{
|
||||
Match match = _typeDefineBegin.Match( firstLine );
|
||||
if( match.Success ) {
|
||||
if( match.Success )
|
||||
{
|
||||
ScriptSourceTransmitter transmitter = new ScriptSourceTransmitter(
|
||||
"END_ENTITY", reader.Location );
|
||||
ExpTypeSource _source = new ExpTypeSource(
|
||||
@@ -335,15 +340,15 @@ namespace StgSharp.Script.Express
|
||||
transmitter.WriteLine( match.Groups[ "Remaining" ].ToString() );
|
||||
string line = reader.ReadLine();
|
||||
match = _typeDefineEnd.Match( line );
|
||||
while( !match.Success ) {
|
||||
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 ExpInvalidElementDeclareEndingExceptions(
|
||||
_source.Name, endedName );
|
||||
throw new ExpInvalidElementDeclareEndingExceptions( _source.Name, endedName );
|
||||
}
|
||||
transmitter.WriteLine( "END_ENTITY" );
|
||||
source = _source;
|
||||
|
||||
@@ -51,14 +51,13 @@ namespace StgSharp.Script.Express
|
||||
|
||||
public ExpFileSource( string path )
|
||||
{
|
||||
if ( !File.Exists( path ) ) {
|
||||
if( !File.Exists( path ) ) {
|
||||
throw new FileNotFoundException();
|
||||
}
|
||||
_expFileStream = new FileStream(
|
||||
path, FileMode.Open, FileAccess.Read );
|
||||
_expFileStream = new FileStream( path, FileMode.Open, FileAccess.Read );
|
||||
_expMemoryMappedFile = MemoryMappedFile.CreateFromFile(
|
||||
_expFileStream, null, 0, MemoryMappedFileAccess.Read,
|
||||
HandleInheritability.None, true );
|
||||
_expFileStream, null, 0, MemoryMappedFileAccess.Read, HandleInheritability.None,
|
||||
true );
|
||||
_expMemoryMappedStream = _expMemoryMappedFile.CreateViewStream(
|
||||
offset: 0, size: 0, access: MemoryMappedFileAccess.Read );
|
||||
_memoryReader = new StreamReader( _expMemoryMappedStream );
|
||||
@@ -79,9 +78,7 @@ namespace StgSharp.Script.Express
|
||||
GC.SuppressFinalize( this );
|
||||
}
|
||||
|
||||
public void EndWriting()
|
||||
{
|
||||
}
|
||||
public void EndWriting() { }
|
||||
|
||||
public string ReadLine()
|
||||
{
|
||||
@@ -92,7 +89,7 @@ namespace StgSharp.Script.Express
|
||||
return line;
|
||||
}
|
||||
|
||||
public string ReadLine(out int position)
|
||||
public string ReadLine( out int position )
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
@@ -105,15 +102,12 @@ namespace StgSharp.Script.Express
|
||||
readLineSemaphore.Release();
|
||||
}
|
||||
|
||||
IScriptSourceProvider IScriptSourceProvider.Slice(int location, int count)
|
||||
{
|
||||
throw new NotSupportedException();
|
||||
}
|
||||
|
||||
protected virtual void Dispose( bool disposing )
|
||||
{
|
||||
if( !disposedValue ) {
|
||||
if( disposing ) {
|
||||
if( !disposedValue )
|
||||
{
|
||||
if( disposing )
|
||||
{
|
||||
_expFileStream.Dispose();
|
||||
_expMemoryMappedFile.Dispose();
|
||||
_expMemoryMappedStream.Dispose();
|
||||
@@ -123,5 +117,10 @@ namespace StgSharp.Script.Express
|
||||
}
|
||||
}
|
||||
|
||||
IScriptSourceProvider IScriptSourceProvider.Slice( int location, int count )
|
||||
{
|
||||
throw new NotSupportedException();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,8 +64,8 @@ namespace StgSharp.Script.Express
|
||||
return true;
|
||||
case ":":
|
||||
state = _cache.StateOfCurrentDepth<CaseOfStateCache>();
|
||||
if( state.CurrentState != ExpKeyword.Of && state.CurrentState !=
|
||||
ExpKeyword.Otherwise )
|
||||
if( state.CurrentState != ExpKeyword.Of &&
|
||||
state.CurrentState != ExpKeyword.Otherwise )
|
||||
{
|
||||
root = _cache.PackAllStatements();
|
||||
state.CloseCurrentCase( root );
|
||||
@@ -95,7 +95,7 @@ namespace StgSharp.Script.Express
|
||||
_cache.StatementsInDepth.Push( root );
|
||||
return true;
|
||||
default:
|
||||
AppendToken_common( t );
|
||||
AppendToken_Common( t );
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -249,7 +249,8 @@ namespace StgSharp.Script.Express
|
||||
private bool TryParseInstance( Token t )
|
||||
{
|
||||
if( _local.TryGetMember( t.Value,
|
||||
out ExpSyntaxNode? node ) && node is ExpElementInstance instance )
|
||||
out ExpSyntaxNode? node ) &&
|
||||
node is ExpElementInstance instance )
|
||||
{
|
||||
_cache.PushOperand( ExpInstanceReferenceNode.MakeReferenceFrom( t, instance ) );
|
||||
return true;
|
||||
@@ -260,7 +261,8 @@ namespace StgSharp.Script.Express
|
||||
} else if( _cache.IsLastAddedOperator )
|
||||
{
|
||||
if( _cache.PeekOperand( out _,
|
||||
out ExpSyntaxNode? typenode ) && typenode is ExpMetaRefNode typeRef )
|
||||
out ExpSyntaxNode? typenode ) &&
|
||||
typenode is ExpMetaRefNode typeRef )
|
||||
{
|
||||
_cache.PopOperand( out _, out _ );
|
||||
_local.AddMember( t.Value, typeRef.SourceRef.CreateInstanceNode( t ) );
|
||||
|
||||
@@ -107,7 +107,7 @@ namespace StgSharp.Script.Express
|
||||
_cache.StatementsInDepth.Push( ifNode );
|
||||
return true;
|
||||
default:
|
||||
AppendToken_common( t );
|
||||
AppendToken_Common( t );
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,123 @@
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
// file="ExpSyntaxAnalyzer.RangeAndIndex.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 Microsoft.CodeAnalysis.Operations;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using ExpKeyword = StgSharp.Script.Express.ExpressCompile.Keyword;
|
||||
|
||||
namespace StgSharp.Script.Express
|
||||
{
|
||||
public partial class ExpSyntaxAnalyzer
|
||||
{
|
||||
|
||||
private void AppendToken_RangeAndIndex( Token t )
|
||||
{
|
||||
ExpSyntaxNode root;
|
||||
switch( t.Value )
|
||||
{
|
||||
case "[":
|
||||
RangeAndIndexState state = new RangeAndIndexState();
|
||||
state.CurrentState = t.Value;
|
||||
_cache.CurrentDepthMark.StateCache = state;
|
||||
break;
|
||||
case "]":
|
||||
state = _cache.StateOfCurrentDepth<RangeAndIndexState>();
|
||||
|
||||
//Generate range or index object
|
||||
if( _cache.StatementsInDepth.Count != 0 )
|
||||
{
|
||||
throw new ExpInvalidSyntaxException(
|
||||
"Range and index syntax error: expected one statement to define range beginning." );
|
||||
}
|
||||
ReverseAnalyzeStatement();
|
||||
root = _cache.StatementsInDepth.Pop();
|
||||
if( ExpNodeFlag.BuiltinType_Int.IsNotInFlag( root.NodeFlag ) ) {
|
||||
throw new ExpInvalidTypeException(
|
||||
root, "integer", root.EqualityTypeConvert?.Name ?? string.Empty );
|
||||
}
|
||||
if( state.CurrentState == "[" ) { } else { }
|
||||
break;
|
||||
case ":":
|
||||
state = _cache.StateOfCurrentDepth<RangeAndIndexState>();
|
||||
if( state.CurrentState != "[" ) {
|
||||
throw new ExpInvalidSyntaxException(
|
||||
"Range and index syntax error: wrong position of :" );
|
||||
}
|
||||
if( _cache.StatementsInDepth.Count != 0 ) {
|
||||
throw new ExpInvalidSyntaxException(
|
||||
"Range and index syntax error: expected one statement to define range beginning." );
|
||||
}
|
||||
ReverseAnalyzeStatement();
|
||||
root = _cache.StatementsInDepth.Pop();
|
||||
if( ExpNodeFlag.BuiltinType_Int.IsNotInFlag( root.NodeFlag ) ) {
|
||||
throw new ExpInvalidTypeException(
|
||||
root, "integer", root.EqualityTypeConvert?.Name ?? string.Empty );
|
||||
}
|
||||
state.RangeStart = root;
|
||||
break;
|
||||
default:
|
||||
state = _cache.StateOfCurrentDepth<RangeAndIndexState>();
|
||||
if( t.Value == "?" )
|
||||
{
|
||||
switch( state.CurrentState )
|
||||
{
|
||||
case ":":
|
||||
_cache.PushOperand( new ExpIntNode( t, int.MaxValue, true ) );
|
||||
break;
|
||||
case "[":
|
||||
_cache.PushOperand( new ExpIntNode( t, int.MaxValue, true ) );
|
||||
break;
|
||||
default:
|
||||
throw new ExpInvalidSyntaxException(
|
||||
"Range and index syntax error: \"?\" can only be used in range or index" );
|
||||
}
|
||||
}
|
||||
AppendToken_Common( t );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private class RangeAndIndexState : ICompileDepthState
|
||||
{
|
||||
|
||||
public ExpSyntaxNode RangeStart { get; set; }
|
||||
|
||||
public string CurrentState { get; set; } = string.Empty;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -76,12 +76,12 @@ namespace StgSharp.Script.Express
|
||||
case ExpKeyword.Semicolon:
|
||||
if( t.Value != ExpKeyword.EndRepeat )
|
||||
{
|
||||
AppendToken_common( t );
|
||||
AppendToken_Common( t );
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
AppendToken_common( t );
|
||||
AppendToken_Common( t );
|
||||
return false;
|
||||
}
|
||||
ExpSyntaxNode root = _cache.PackAllStatements();
|
||||
@@ -118,7 +118,7 @@ namespace StgSharp.Script.Express
|
||||
state.Begin = root;
|
||||
return true;
|
||||
default:
|
||||
AppendToken_common( t );
|
||||
AppendToken_Common( t );
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -137,7 +137,7 @@ namespace StgSharp.Script.Express
|
||||
state.CurrentState = ExpKeyword.While;
|
||||
break;
|
||||
default:
|
||||
AppendToken_common( t );
|
||||
AppendToken_Common( t );
|
||||
return true;
|
||||
}
|
||||
while( _cache.TryPopOperator( out Token op ) ) {
|
||||
@@ -162,7 +162,7 @@ namespace StgSharp.Script.Express
|
||||
state.CurrentState = ExpKeyword.While;
|
||||
break;
|
||||
default:
|
||||
AppendToken_common( t );
|
||||
AppendToken_Common( t );
|
||||
return true;
|
||||
}
|
||||
while( _cache.TryPopOperator( out Token op ) ) {
|
||||
@@ -181,7 +181,7 @@ namespace StgSharp.Script.Express
|
||||
state.CurrentState = ExpKeyword.Semicolon;
|
||||
break;
|
||||
default:
|
||||
AppendToken_common( t );
|
||||
AppendToken_Common( t );
|
||||
return true;
|
||||
}
|
||||
while( _cache.TryPopOperator( out Token op ) ) {
|
||||
@@ -210,8 +210,9 @@ namespace StgSharp.Script.Express
|
||||
if( ExpTypeSource.IsNullOrVoid( state.IncrementVariableType ) )
|
||||
{
|
||||
if( ( _local.TryGetMember( t.Value,
|
||||
out ExpSyntaxNode? node ) && node is ExpElementInstance instance ) || _tempVariableInLoops.TryGetValue(
|
||||
t.Value, out instance ) )
|
||||
out ExpSyntaxNode? node ) &&
|
||||
node is ExpElementInstance instance ) ||
|
||||
_tempVariableInLoops.TryGetValue( t.Value, out instance ) )
|
||||
{
|
||||
state.IncrementVariable = ExpInstanceReferenceNode.MakeReferenceFrom(
|
||||
t, instance );
|
||||
@@ -241,7 +242,7 @@ namespace StgSharp.Script.Express
|
||||
state.CurrentState = ExpKeyword.Until;
|
||||
break;
|
||||
default:
|
||||
AppendToken_common( t );
|
||||
AppendToken_Common( t );
|
||||
return true;
|
||||
}
|
||||
while( _cache.TryPopOperator( out Token op ) ) {
|
||||
|
||||
@@ -0,0 +1,94 @@
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
// file="ExpSyntaxAnalyzer.ReverseAnalysing.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.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using ExpKeyword = StgSharp.Script.Express.ExpressCompile.Keyword;
|
||||
|
||||
namespace StgSharp.Script.Express
|
||||
{
|
||||
public partial class ExpSyntaxAnalyzer
|
||||
{
|
||||
|
||||
private void ClosePrefixReverse( Token rightSeparator )
|
||||
{
|
||||
ExpSyntaxNode root;
|
||||
ReverseAnalyzeStatement();
|
||||
root = _cache.PackAllStatements();
|
||||
if( rightSeparator.Value == ")" ) {
|
||||
root = ExpTupleNode.Pack( root );
|
||||
}
|
||||
_cache.DecreaseDepth();
|
||||
if( IsSeparatorMatch( _cache.PeekOperator(), rightSeparator ) )
|
||||
{
|
||||
_cache.PopOperator();
|
||||
_cache.PushOperand( root );
|
||||
} else
|
||||
{
|
||||
throw new ExpCompileException(
|
||||
rightSeparator, "Ending of block does not match its begging" );
|
||||
}
|
||||
}
|
||||
|
||||
private void ReverseAnalyzeStatement()
|
||||
{
|
||||
ExpSyntaxNode root;
|
||||
if( _cache.OperatorAheadOfDepth == 0 )
|
||||
{
|
||||
switch( _cache.OperandAheadOfDepth )
|
||||
{
|
||||
case 1:
|
||||
_cache.PopOperand( out _, out ExpSyntaxNode? statement );
|
||||
_cache.StatementsInDepth.Push( statement );
|
||||
break;
|
||||
case 0:
|
||||
_cache.StatementsInDepth.Push( ExpSyntaxNode.Empty );
|
||||
break;
|
||||
default:
|
||||
throw new ExpInvalidSyntaxException(
|
||||
"More than one operand but no operator provided." );
|
||||
}
|
||||
} else
|
||||
{
|
||||
while( _cache.TryPopOperator( out Token op ) ) {
|
||||
ConvertAndPushOneOperator( op );
|
||||
}
|
||||
_cache.PopOperand( out _, out root );
|
||||
_cache.StatementsInDepth.Push( root );
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -90,7 +90,7 @@ namespace StgSharp.Script.Express
|
||||
AppendToken_RepeatLoop( expToken );
|
||||
break;
|
||||
default:
|
||||
AppendToken_common( expToken );
|
||||
AppendToken_Common( expToken );
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -112,7 +112,7 @@ namespace StgSharp.Script.Express
|
||||
/// Append a token to top of cache. This method will automatically convert token to node
|
||||
/// if meets separators or operators.
|
||||
/// </summary>
|
||||
private void AppendToken_common( Token expToken )
|
||||
private void AppendToken_Common( Token expToken )
|
||||
{
|
||||
switch( expToken.Flag )
|
||||
{
|
||||
|
||||
@@ -71,7 +71,6 @@ namespace StgSharp.Script.Express
|
||||
private IScriptSourceProvider _provider;
|
||||
|
||||
private Regex
|
||||
_nextHashtagSymbolPattern = GetHashtagSymbolPattern() ,
|
||||
_nextWordTokenPattern = GetNextWordTokenPattern(),
|
||||
_nextStringLiteralPattern = GetStringLiteralPattern(),
|
||||
_nextNumberLiteralPattern = GetNumberLiteralPattern(),
|
||||
@@ -91,7 +90,8 @@ namespace StgSharp.Script.Express
|
||||
|
||||
public bool IsEmpty
|
||||
{
|
||||
get => ( ( string.IsNullOrEmpty( _lineCache ) || _current >= _lineCache.Length ) ) && _provider.IsEmpty;
|
||||
get => ( ( string.IsNullOrEmpty( _lineCache ) || _current >= _lineCache.Length ) ) &&
|
||||
_provider.IsEmpty;
|
||||
}
|
||||
|
||||
public ExpTokenReaderPreProcessor TokenReaderPreProcessor { get; set; } = ExpTokenReaderPreProcessor.Default;
|
||||
@@ -173,22 +173,6 @@ namespace StgSharp.Script.Express
|
||||
Match match;
|
||||
switch( c )
|
||||
{
|
||||
case '#':
|
||||
match = _nextHashtagSymbolPattern.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(
|
||||
ExpressCompile.PoolString( source[ 0..( end - begin ) ] ), _lineNum,
|
||||
begin, TokenFlag.Member );
|
||||
return _last;
|
||||
} else
|
||||
{
|
||||
throw new ExpInvalidCharException( '#' );
|
||||
}
|
||||
case '\'':
|
||||
char cNext = source[ 1 ];
|
||||
if( cNext == '\'' ) //empty string
|
||||
@@ -281,8 +265,9 @@ namespace StgSharp.Script.Express
|
||||
{
|
||||
begin = _current;
|
||||
_current++;
|
||||
if( _last.Flag == TokenFlag.Member || _last.Flag ==
|
||||
TokenFlag.Index_Right || _last.Flag == TokenFlag.Separator_Right )
|
||||
if( _last.Flag == TokenFlag.Member ||
|
||||
_last.Flag == TokenFlag.Index_Right ||
|
||||
_last.Flag == TokenFlag.Separator_Right )
|
||||
{
|
||||
_last = new(
|
||||
ExpressCompile.PoolString( source[ ..1 ] ), _lineNum, begin,
|
||||
@@ -406,11 +391,6 @@ namespace StgSharp.Script.Express
|
||||
return !IsEmpty;
|
||||
}
|
||||
|
||||
[GeneratedRegex(
|
||||
@"(?<token>#[0-9A-Za-z]+)(?<end>\s*?)(?<rest>\S|$)",
|
||||
RegexOptions.Singleline )]
|
||||
private static partial Regex GetHashtagSymbolPattern();
|
||||
|
||||
[GeneratedRegex(
|
||||
@"(?<token>[a-zA-Z][a-zA-Z0-9_]*)(?<end>\s*?)(?<rest>\S|$)",
|
||||
RegexOptions.Singleline )]
|
||||
@@ -435,7 +415,7 @@ namespace StgSharp.Script.Express
|
||||
private static partial Regex GetStringLiteralPatternWithSingle();
|
||||
|
||||
[GeneratedRegex(
|
||||
@"(?<token>[:<>=+\-*\/]+)(?<end>\s?)\s*?(?<rest>\S|$)",
|
||||
@"(?<token>[:<>=+\-*\/\.]+)(?<end>\s?)\s*?(?<rest>\S|$)",
|
||||
RegexOptions.Singleline )]
|
||||
private static partial Regex GetSymbolPattern();
|
||||
|
||||
|
||||
@@ -0,0 +1,303 @@
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
// file="IExpConvertableFrom.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
|
||||
{
|
||||
// Base interface with one generic parameter renamed to T0
|
||||
public interface IExpConvertableFrom<T0> where T0: IExpConvertableFrom<T0>
|
||||
{
|
||||
|
||||
void FromInstance( T0 entity );
|
||||
|
||||
bool IsConvertableTo( string entityTypeName );
|
||||
|
||||
}
|
||||
|
||||
// 2 generic parameters
|
||||
public interface IExpConvertableFrom<T0, T1> : IExpConvertableFrom<T0>
|
||||
where T0: IExpConvertableFrom<T0>
|
||||
where T1: IExpConvertableFrom<T1>
|
||||
{
|
||||
|
||||
void FromInstance( T1 entity );
|
||||
|
||||
}
|
||||
|
||||
// 3 generic parameters
|
||||
public interface IExpConvertableFrom<T0, T1, T2> : IExpConvertableFrom<T0, T1>
|
||||
where T0: IExpConvertableFrom<T0>
|
||||
where T1: IExpConvertableFrom<T1>
|
||||
where T2: IExpConvertableFrom<T2>
|
||||
{
|
||||
|
||||
void FromInstance( T2 entity );
|
||||
|
||||
}
|
||||
|
||||
// 4 generic parameters
|
||||
public interface IExpConvertableFrom<T0, T1, T2, T3> : IExpConvertableFrom<T0, T1, T2>
|
||||
where T0: IExpConvertableFrom<T0>
|
||||
where T1: IExpConvertableFrom<T1>
|
||||
where T2: IExpConvertableFrom<T2>
|
||||
where T3: IExpConvertableFrom<T3>
|
||||
{
|
||||
|
||||
void FromInstance( T3 entity );
|
||||
|
||||
}
|
||||
|
||||
// 5 generic parameters
|
||||
public interface IExpConvertableFrom<T0, T1, T2, T3, T4> : IExpConvertableFrom<T0, T1, T2, T3>
|
||||
where T0: IExpConvertableFrom<T0>
|
||||
where T1: IExpConvertableFrom<T1>
|
||||
where T2: IExpConvertableFrom<T2>
|
||||
where T3: IExpConvertableFrom<T3>
|
||||
where T4: IExpConvertableFrom<T4>
|
||||
{
|
||||
|
||||
void FromInstance( T4 entity );
|
||||
|
||||
}
|
||||
|
||||
// 6 generic parameters
|
||||
public interface IExpConvertableFrom<T0, T1, T2, T3, T4, T5> : IExpConvertableFrom<T0, T1, T2, T3, T4>
|
||||
where T0: IExpConvertableFrom<T0>
|
||||
where T1: IExpConvertableFrom<T1>
|
||||
where T2: IExpConvertableFrom<T2>
|
||||
where T3: IExpConvertableFrom<T3>
|
||||
where T4: IExpConvertableFrom<T4>
|
||||
where T5: IExpConvertableFrom<T5>
|
||||
{
|
||||
|
||||
void FromInstance( T5 entity );
|
||||
|
||||
}
|
||||
|
||||
// 7 generic parameters
|
||||
public interface IExpConvertableFrom<T0, T1, T2, T3, T4, T5, T6> : IExpConvertableFrom<T0, T1, T2, T3, T4, T5>
|
||||
where T0: IExpConvertableFrom<T0>
|
||||
where T1: IExpConvertableFrom<T1>
|
||||
where T2: IExpConvertableFrom<T2>
|
||||
where T3: IExpConvertableFrom<T3>
|
||||
where T4: IExpConvertableFrom<T4>
|
||||
where T5: IExpConvertableFrom<T5>
|
||||
where T6: IExpConvertableFrom<T6>
|
||||
{
|
||||
|
||||
void FromInstance( T6 entity );
|
||||
|
||||
}
|
||||
|
||||
// 8 generic parameters
|
||||
public interface IExpConvertableFrom<T0, T1, T2, T3, T4, T5, T6, T7> : IExpConvertableFrom<T0, T1, T2, T3, T4, T5, T6>
|
||||
where T0: IExpConvertableFrom<T0>
|
||||
where T1: IExpConvertableFrom<T1>
|
||||
where T2: IExpConvertableFrom<T2>
|
||||
where T3: IExpConvertableFrom<T3>
|
||||
where T4: IExpConvertableFrom<T4>
|
||||
where T5: IExpConvertableFrom<T5>
|
||||
where T6: IExpConvertableFrom<T6>
|
||||
where T7: IExpConvertableFrom<T7>
|
||||
{
|
||||
|
||||
void FromInstance( T7 entity );
|
||||
|
||||
}
|
||||
|
||||
// 9 generic parameters
|
||||
public interface IExpConvertableFrom<T0, T1, T2, T3, T4, T5, T6, T7, T8> : IExpConvertableFrom<T0, T1, T2, T3, T4, T5, T6, T7>
|
||||
where T0: IExpConvertableFrom<T0>
|
||||
where T1: IExpConvertableFrom<T1>
|
||||
where T2: IExpConvertableFrom<T2>
|
||||
where T3: IExpConvertableFrom<T3>
|
||||
where T4: IExpConvertableFrom<T4>
|
||||
where T5: IExpConvertableFrom<T5>
|
||||
where T6: IExpConvertableFrom<T6>
|
||||
where T7: IExpConvertableFrom<T7>
|
||||
where T8: IExpConvertableFrom<T8>
|
||||
{
|
||||
|
||||
void FromInstance( T8 entity );
|
||||
|
||||
}
|
||||
|
||||
// 10 generic parameters
|
||||
public interface IExpConvertableFrom<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9> : IExpConvertableFrom<T0, T1, T2, T3, T4, T5, T6, T7, T8>
|
||||
where T0: IExpConvertableFrom<T0>
|
||||
where T1: IExpConvertableFrom<T1>
|
||||
where T2: IExpConvertableFrom<T2>
|
||||
where T3: IExpConvertableFrom<T3>
|
||||
where T4: IExpConvertableFrom<T4>
|
||||
where T5: IExpConvertableFrom<T5>
|
||||
where T6: IExpConvertableFrom<T6>
|
||||
where T7: IExpConvertableFrom<T7>
|
||||
where T8: IExpConvertableFrom<T8>
|
||||
where T9: IExpConvertableFrom<T9>
|
||||
{
|
||||
|
||||
void FromInstance( T9 entity );
|
||||
|
||||
}
|
||||
|
||||
// 11 generic parameters
|
||||
public interface IExpConvertableFrom<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> : IExpConvertableFrom<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9>
|
||||
where T0: IExpConvertableFrom<T0>
|
||||
where T1: IExpConvertableFrom<T1>
|
||||
where T2: IExpConvertableFrom<T2>
|
||||
where T3: IExpConvertableFrom<T3>
|
||||
where T4: IExpConvertableFrom<T4>
|
||||
where T5: IExpConvertableFrom<T5>
|
||||
where T6: IExpConvertableFrom<T6>
|
||||
where T7: IExpConvertableFrom<T7>
|
||||
where T8: IExpConvertableFrom<T8>
|
||||
where T9: IExpConvertableFrom<T9>
|
||||
where T10: IExpConvertableFrom<T10>
|
||||
{
|
||||
|
||||
void FromInstance( T10 entity );
|
||||
|
||||
}
|
||||
|
||||
// 12 generic parameters
|
||||
public interface IExpConvertableFrom<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> : IExpConvertableFrom<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>
|
||||
where T0: IExpConvertableFrom<T0>
|
||||
where T1: IExpConvertableFrom<T1>
|
||||
where T2: IExpConvertableFrom<T2>
|
||||
where T3: IExpConvertableFrom<T3>
|
||||
where T4: IExpConvertableFrom<T4>
|
||||
where T5: IExpConvertableFrom<T5>
|
||||
where T6: IExpConvertableFrom<T6>
|
||||
where T7: IExpConvertableFrom<T7>
|
||||
where T8: IExpConvertableFrom<T8>
|
||||
where T9: IExpConvertableFrom<T9>
|
||||
where T10: IExpConvertableFrom<T10>
|
||||
where T11: IExpConvertableFrom<T11>
|
||||
{
|
||||
|
||||
void FromInstance( T11 entity );
|
||||
|
||||
}
|
||||
|
||||
// 13 generic parameters
|
||||
public interface IExpConvertableFrom<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> : IExpConvertableFrom<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>
|
||||
where T0: IExpConvertableFrom<T0>
|
||||
where T1: IExpConvertableFrom<T1>
|
||||
where T2: IExpConvertableFrom<T2>
|
||||
where T3: IExpConvertableFrom<T3>
|
||||
where T4: IExpConvertableFrom<T4>
|
||||
where T5: IExpConvertableFrom<T5>
|
||||
where T6: IExpConvertableFrom<T6>
|
||||
where T7: IExpConvertableFrom<T7>
|
||||
where T8: IExpConvertableFrom<T8>
|
||||
where T9: IExpConvertableFrom<T9>
|
||||
where T10: IExpConvertableFrom<T10>
|
||||
where T11: IExpConvertableFrom<T11>
|
||||
where T12: IExpConvertableFrom<T12>
|
||||
{
|
||||
|
||||
void FromInstance( T12 entity );
|
||||
|
||||
}
|
||||
|
||||
// 14 generic parameters
|
||||
public interface IExpConvertableFrom<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> : IExpConvertableFrom<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>
|
||||
where T0: IExpConvertableFrom<T0>
|
||||
where T1: IExpConvertableFrom<T1>
|
||||
where T2: IExpConvertableFrom<T2>
|
||||
where T3: IExpConvertableFrom<T3>
|
||||
where T4: IExpConvertableFrom<T4>
|
||||
where T5: IExpConvertableFrom<T5>
|
||||
where T6: IExpConvertableFrom<T6>
|
||||
where T7: IExpConvertableFrom<T7>
|
||||
where T8: IExpConvertableFrom<T8>
|
||||
where T9: IExpConvertableFrom<T9>
|
||||
where T10: IExpConvertableFrom<T10>
|
||||
where T11: IExpConvertableFrom<T11>
|
||||
where T12: IExpConvertableFrom<T12>
|
||||
where T13: IExpConvertableFrom<T13>
|
||||
{
|
||||
|
||||
void FromInstance( T13 entity );
|
||||
|
||||
}
|
||||
|
||||
// 15 generic parameters
|
||||
public interface IExpConvertableFrom<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14> : IExpConvertableFrom<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13>
|
||||
where T0: IExpConvertableFrom<T0>
|
||||
where T1: IExpConvertableFrom<T1>
|
||||
where T2: IExpConvertableFrom<T2>
|
||||
where T3: IExpConvertableFrom<T3>
|
||||
where T4: IExpConvertableFrom<T4>
|
||||
where T5: IExpConvertableFrom<T5>
|
||||
where T6: IExpConvertableFrom<T6>
|
||||
where T7: IExpConvertableFrom<T7>
|
||||
where T8: IExpConvertableFrom<T8>
|
||||
where T9: IExpConvertableFrom<T9>
|
||||
where T10: IExpConvertableFrom<T10>
|
||||
where T11: IExpConvertableFrom<T11>
|
||||
where T12: IExpConvertableFrom<T12>
|
||||
where T13: IExpConvertableFrom<T13>
|
||||
where T14: IExpConvertableFrom<T14>
|
||||
{
|
||||
|
||||
void FromInstance( T14 entity );
|
||||
|
||||
}
|
||||
|
||||
// 16 generic parameters
|
||||
public interface IExpConvertableFrom<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> : IExpConvertableFrom<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14>
|
||||
where T0: IExpConvertableFrom<T0>
|
||||
where T1: IExpConvertableFrom<T1>
|
||||
where T2: IExpConvertableFrom<T2>
|
||||
where T3: IExpConvertableFrom<T3>
|
||||
where T4: IExpConvertableFrom<T4>
|
||||
where T5: IExpConvertableFrom<T5>
|
||||
where T6: IExpConvertableFrom<T6>
|
||||
where T7: IExpConvertableFrom<T7>
|
||||
where T8: IExpConvertableFrom<T8>
|
||||
where T9: IExpConvertableFrom<T9>
|
||||
where T10: IExpConvertableFrom<T10>
|
||||
where T11: IExpConvertableFrom<T11>
|
||||
where T12: IExpConvertableFrom<T12>
|
||||
where T13: IExpConvertableFrom<T13>
|
||||
where T14: IExpConvertableFrom<T14>
|
||||
where T15: IExpConvertableFrom<T15>
|
||||
{
|
||||
|
||||
void FromInstance( T15 entity );
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,227 @@
|
||||
{
|
||||
"runtimeTarget": {
|
||||
"name": ".NETCoreApp,Version=v8.0",
|
||||
"signature": ""
|
||||
},
|
||||
"compilationOptions": {},
|
||||
"targets": {
|
||||
".NETCoreApp,Version=v8.0": {
|
||||
"StgSharp.Script/1.0.0": {
|
||||
"dependencies": {
|
||||
"CommunityToolkit.HighPerformance": "8.4.0",
|
||||
"Microsoft.CodeAnalysis.CSharp": "4.13.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.CodeAnalysis.Analyzers/3.11.0": {},
|
||||
"Microsoft.CodeAnalysis.Common/4.13.0": {
|
||||
"dependencies": {
|
||||
"Microsoft.CodeAnalysis.Analyzers": "3.11.0",
|
||||
"System.Collections.Immutable": "8.0.0",
|
||||
"System.Reflection.Metadata": "8.0.0"
|
||||
},
|
||||
"runtime": {
|
||||
"lib/net8.0/Microsoft.CodeAnalysis.dll": {
|
||||
"assemblyVersion": "4.13.0.0",
|
||||
"fileVersion": "4.1300.25.12011"
|
||||
}
|
||||
},
|
||||
"resources": {
|
||||
"lib/net8.0/cs/Microsoft.CodeAnalysis.resources.dll": {
|
||||
"locale": "cs"
|
||||
},
|
||||
"lib/net8.0/de/Microsoft.CodeAnalysis.resources.dll": {
|
||||
"locale": "de"
|
||||
},
|
||||
"lib/net8.0/es/Microsoft.CodeAnalysis.resources.dll": {
|
||||
"locale": "es"
|
||||
},
|
||||
"lib/net8.0/fr/Microsoft.CodeAnalysis.resources.dll": {
|
||||
"locale": "fr"
|
||||
},
|
||||
"lib/net8.0/it/Microsoft.CodeAnalysis.resources.dll": {
|
||||
"locale": "it"
|
||||
},
|
||||
"lib/net8.0/ja/Microsoft.CodeAnalysis.resources.dll": {
|
||||
"locale": "ja"
|
||||
},
|
||||
"lib/net8.0/ko/Microsoft.CodeAnalysis.resources.dll": {
|
||||
"locale": "ko"
|
||||
},
|
||||
"lib/net8.0/pl/Microsoft.CodeAnalysis.resources.dll": {
|
||||
"locale": "pl"
|
||||
},
|
||||
"lib/net8.0/pt-BR/Microsoft.CodeAnalysis.resources.dll": {
|
||||
"locale": "pt-BR"
|
||||
},
|
||||
"lib/net8.0/ru/Microsoft.CodeAnalysis.resources.dll": {
|
||||
"locale": "ru"
|
||||
},
|
||||
"lib/net8.0/tr/Microsoft.CodeAnalysis.resources.dll": {
|
||||
"locale": "tr"
|
||||
},
|
||||
"lib/net8.0/zh-Hans/Microsoft.CodeAnalysis.resources.dll": {
|
||||
"locale": "zh-Hans"
|
||||
},
|
||||
"lib/net8.0/zh-Hant/Microsoft.CodeAnalysis.resources.dll": {
|
||||
"locale": "zh-Hant"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Microsoft.CodeAnalysis.CSharp/4.13.0": {
|
||||
"dependencies": {
|
||||
"Microsoft.CodeAnalysis.Analyzers": "3.11.0",
|
||||
"Microsoft.CodeAnalysis.Common": "4.13.0",
|
||||
"System.Collections.Immutable": "8.0.0",
|
||||
"System.Reflection.Metadata": "8.0.0"
|
||||
},
|
||||
"runtime": {
|
||||
"lib/net8.0/Microsoft.CodeAnalysis.CSharp.dll": {
|
||||
"assemblyVersion": "4.13.0.0",
|
||||
"fileVersion": "4.1300.25.12011"
|
||||
}
|
||||
},
|
||||
"resources": {
|
||||
"lib/net8.0/cs/Microsoft.CodeAnalysis.CSharp.resources.dll": {
|
||||
"locale": "cs"
|
||||
},
|
||||
"lib/net8.0/de/Microsoft.CodeAnalysis.CSharp.resources.dll": {
|
||||
"locale": "de"
|
||||
},
|
||||
"lib/net8.0/es/Microsoft.CodeAnalysis.CSharp.resources.dll": {
|
||||
"locale": "es"
|
||||
},
|
||||
"lib/net8.0/fr/Microsoft.CodeAnalysis.CSharp.resources.dll": {
|
||||
"locale": "fr"
|
||||
},
|
||||
"lib/net8.0/it/Microsoft.CodeAnalysis.CSharp.resources.dll": {
|
||||
"locale": "it"
|
||||
},
|
||||
"lib/net8.0/ja/Microsoft.CodeAnalysis.CSharp.resources.dll": {
|
||||
"locale": "ja"
|
||||
},
|
||||
"lib/net8.0/ko/Microsoft.CodeAnalysis.CSharp.resources.dll": {
|
||||
"locale": "ko"
|
||||
},
|
||||
"lib/net8.0/pl/Microsoft.CodeAnalysis.CSharp.resources.dll": {
|
||||
"locale": "pl"
|
||||
},
|
||||
"lib/net8.0/pt-BR/Microsoft.CodeAnalysis.CSharp.resources.dll": {
|
||||
"locale": "pt-BR"
|
||||
},
|
||||
"lib/net8.0/ru/Microsoft.CodeAnalysis.CSharp.resources.dll": {
|
||||
"locale": "ru"
|
||||
},
|
||||
"lib/net8.0/tr/Microsoft.CodeAnalysis.CSharp.resources.dll": {
|
||||
"locale": "tr"
|
||||
},
|
||||
"lib/net8.0/zh-Hans/Microsoft.CodeAnalysis.CSharp.resources.dll": {
|
||||
"locale": "zh-Hans"
|
||||
},
|
||||
"lib/net8.0/zh-Hant/Microsoft.CodeAnalysis.CSharp.resources.dll": {
|
||||
"locale": "zh-Hant"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Microsoft.CSharp/4.7.0": {},
|
||||
"System.Collections.Immutable/8.0.0": {},
|
||||
"System.Reflection.Metadata/8.0.0": {
|
||||
"dependencies": {
|
||||
"System.Collections.Immutable": "8.0.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.CodeAnalysis.Analyzers/3.11.0": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-v/EW3UE8/lbEYHoC2Qq7AR/DnmvpgdtAMndfQNmpuIMx/Mto8L5JnuCfdBYtgvalQOtfNCnxFejxuRrryvUTsg==",
|
||||
"path": "microsoft.codeanalysis.analyzers/3.11.0",
|
||||
"hashPath": "microsoft.codeanalysis.analyzers.3.11.0.nupkg.sha512"
|
||||
},
|
||||
"Microsoft.CodeAnalysis.Common/4.13.0": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-T8nRl4mAUY4mhdYM4U2ra2vP2EL+ol8Yqwo0gwC/V55vmlXq9NxdIkZJynTpTL1uX/jHijJ90AeOEx4lf7OwzQ==",
|
||||
"path": "microsoft.codeanalysis.common/4.13.0",
|
||||
"hashPath": "microsoft.codeanalysis.common.4.13.0.nupkg.sha512"
|
||||
},
|
||||
"Microsoft.CodeAnalysis.CSharp/4.13.0": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-BsH7Vijbj9IL7Fj4k/ysZSVyLGFqr75wmdFGwCKWJvSjnA1xwPaQ3hkB2BQdHOt5CpEYA6Q0I6Oo5sDTDHqHsg==",
|
||||
"path": "microsoft.codeanalysis.csharp/4.13.0",
|
||||
"hashPath": "microsoft.codeanalysis.csharp.4.13.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.Collections.Immutable/8.0.0": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-AurL6Y5BA1WotzlEvVaIDpqzpIPvYnnldxru8oXJU2yFxFUy3+pNXjXd1ymO+RA0rq0+590Q8gaz2l3Sr7fmqg==",
|
||||
"path": "system.collections.immutable/8.0.0",
|
||||
"hashPath": "system.collections.immutable.8.0.0.nupkg.sha512"
|
||||
},
|
||||
"System.Reflection.Metadata/8.0.0": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-ptvgrFh7PvWI8bcVqG5rsA/weWM09EnthFHR5SCnS6IN+P4mj6rE1lBDC4U8HL9/57htKAqy4KQ3bBj84cfYyQ==",
|
||||
"path": "system.reflection.metadata/8.0.0",
|
||||
"hashPath": "system.reflection.metadata.8.0.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": ""
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -14,7 +14,7 @@ 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+a6411e2f25010961d278c5bcb4a929e21b176bba")]
|
||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+74c01effe4cabbc9d0e2e87b0d295bb29d7c62ba")]
|
||||
[assembly: System.Reflection.AssemblyProductAttribute("StgSharp.Script")]
|
||||
[assembly: System.Reflection.AssemblyTitleAttribute("StgSharp.Script")]
|
||||
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
// file=".NETCoreApp,Version=v8.0.AssemblyAttributes.cs"
|
||||
// Project: StgSharp
|
||||
// Project: World
|
||||
// AuthorGroup: Nitload Space
|
||||
// Copyright (c) Nitload Space. All rights reserved.
|
||||
//
|
||||
|
||||
@@ -14,7 +14,7 @@ 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+a6411e2f25010961d278c5bcb4a929e21b176bba")]
|
||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+74c01effe4cabbc9d0e2e87b0d295bb29d7c62ba")]
|
||||
[assembly: System.Reflection.AssemblyProductAttribute("StgSharp.Script")]
|
||||
[assembly: System.Reflection.AssemblyTitleAttribute("StgSharp.Script")]
|
||||
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
||||
|
||||
@@ -1 +1 @@
|
||||
{"documents":{"D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\内核源代码\\*":"https://raw.githubusercontent.com/Nitload-NSI/CCD_Github/a6411e2f25010961d278c5bcb4a929e21b176bba/*"}}
|
||||
{"documents":{"D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\内核源代码\\*":"https://raw.githubusercontent.com/Nitload-NSI/CCD_Github/74c01effe4cabbc9d0e2e87b0d295bb29d7c62ba/*"}}
|
||||
@@ -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,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+74c01effe4cabbc9d0e2e87b0d295bb29d7c62ba")]
|
||||
[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,16 @@
|
||||
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.Script\bin\x64\Release\net8.0\StgSharp.Script.deps.json
|
||||
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.Script\bin\x64\Release\net8.0\StgSharp.Script.dll
|
||||
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.Script\bin\x64\Release\net8.0\StgSharp.Script.pdb
|
||||
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.Script\bin\x64\Release\net8.0\StgSharp.Common.dll
|
||||
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.Script\bin\x64\Release\net8.0\StgSharp.Common.xml
|
||||
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.Script\obj\x64\Release\net8.0\StgSharp.Script.csproj.AssemblyReference.cache
|
||||
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.Script\obj\x64\Release\net8.0\StgSharp.Script.GeneratedMSBuildEditorConfig.editorconfig
|
||||
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.Script\obj\x64\Release\net8.0\StgSharp.Script.AssemblyInfoInputs.cache
|
||||
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.Script\obj\x64\Release\net8.0\StgSharp.Script.AssemblyInfo.cs
|
||||
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.Script\obj\x64\Release\net8.0\StgSharp.Script.csproj.CoreCompileInputs.cache
|
||||
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.Script\obj\x64\Release\net8.0\StgSharp.Script.sourcelink.json
|
||||
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.Script\obj\x64\Release\net8.0\StgSharp.D39FE6B0.Up2Date
|
||||
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.Script\obj\x64\Release\net8.0\StgSharp.Script.dll
|
||||
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.Script\obj\x64\Release\net8.0\refint\StgSharp.Script.dll
|
||||
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.Script\obj\x64\Release\net8.0\StgSharp.Script.pdb
|
||||
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.Script\obj\x64\Release\net8.0\ref\StgSharp.Script.dll
|
||||
@@ -0,0 +1 @@
|
||||
{"documents":{"D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\内核源代码\\*":"https://raw.githubusercontent.com/Nitload-NSI/CCD_Github/74c01effe4cabbc9d0e2e87b0d295bb29d7c62ba/*"}}
|
||||
Reference in New Issue
Block a user