Daily update on 20250420-041137 by Nitload Youmu. Additional Message : Change: pipeline nodes use port to connect instead of connctors, this make send to multi-ports and recieve from multi-ports possible.

Remove: Some types in Pipeline namepace removed sueto no need for connectors

Signed-off-by: Nitload <YoumuLiu_NSI@whv0t.onmicrosoft.com>
This commit is contained in:
Nitload
2025-04-20 04:11:37 +08:00
parent c29993fd84
commit b618fdf7b5
72 changed files with 1343 additions and 602 deletions
+12 -4
View File
@@ -39,7 +39,7 @@ using System.Threading.Tasks;
namespace StgSharp.Graphics
{
public class TexturePipeline : PipeLineConnectorArgs
public class TexturePipeline : IPipeLineConnectionPayload
{
private Image _value;
@@ -49,11 +49,19 @@ namespace StgSharp.Graphics
_value = i;
}
public new Image Value
public object? ValueDefault => null;
public object Value
{
get => _value;
set => _value = value ??
throw new ArgumentNullException( nameof( value ) );
set
{
ArgumentNullException.ThrowIfNull( value );
if( value is not Image image ) {
throw new ArgumentException( "Value must be of type Image" );
}
_value = image;
}
}
}
@@ -52,7 +52,7 @@ namespace StgSharp.PipeLine
MainExecution = startup;
this.cycleCount = ( cycleCount > 1 ) ?
cycleCount : throw new ArgumentException(
$"{$"The {typeof(CrossFrameOperation).Name} crosses only one cycle, "}{$"please use a {typeof(PipeLineNode).Name} instead."}" );
$"{$"The {typeof(CrossFrameOperation).Name} crosses only one cycle, "}{$"please use a {typeof(PipelineNode).Name} instead."}" );
this.cycleCount = cycleCount;
currentCount = cycleCount;
}
@@ -63,28 +63,30 @@ namespace StgSharp.PipeLine
private protected set => _mainExecution = value;
}
public BlueprintNodeOperation Operation
{
get => ExecuteMain;
}
public IEnumerable<string> InputInterfacesName => _inputName;
public IEnumerable<string> OutputInterfacesName => _outputName;
public void ExecuteMain(
in Dictionary<string, PipelineConnector> input,
in Dictionary<string, PipelineConnector> output )
public PipelineNodeOperation Operation
{
if( currentCount < cycleCount ) {
get => NodeMain;
}
public void NodeMain(
in Dictionary<string, PipelineNodeImport> input,
in Dictionary<string, PipelineNodeExport> output )
{
if( currentCount < cycleCount )
{
Interlocked.Increment( ref currentCount );
} else {
} else
{
Interlocked.Exchange( ref currentCount, 0 );
Task.Run( MainExecution );
}
//Console.WriteLine(currentCount);
PipelineConnector.SkipAll( output );
PipelineNodeExport.SkipAll( output );
}
}
@@ -35,27 +35,22 @@ using System.Text;
namespace StgSharp.PipeLine
{
public delegate void BlueprintNodeOperation(
in Dictionary<string, PipelineConnector> input,
in Dictionary<string, PipelineConnector> output );
public delegate void PipelineNodeOperation(
in Dictionary<string, PipelineNodeImport> input,
in Dictionary<string, PipelineNodeExport> output );
public interface IConvertableToBlueprintNode
{
BlueprintNodeOperation Operation
{
get;
}
PipelineNodeOperation Operation { get; }
public IEnumerable<string> InputInterfacesName
{
get;
}
public IEnumerable<string> InputInterfacesName { get; }
public IEnumerable<string> OutputInterfacesName
{
get;
}
public IEnumerable<string> OutputInterfacesName { get; }
void NodeMain(
in Dictionary<string, PipelineNodeImport> input,
in Dictionary<string, PipelineNodeExport> output );
}
@@ -64,23 +59,30 @@ namespace StgSharp.PipeLine
private string[] _input;
private string[] _output;
private BlueprintNodeOperation _execution;
private PipelineNodeOperation _execution;
public DefaultConvertableToBlueprintNode(
BlueprintNodeOperation execution,
string[] input,
string[] output )
PipelineNodeOperation execution,
string[] input,
string[] output )
{
_input = input;
_output = output;
_execution = execution;
}
public BlueprintNodeOperation Operation => _execution;
public PipelineNodeOperation Operation => _execution;
public IEnumerable<string> InputInterfacesName => _input;
public IEnumerable<string> OutputInterfacesName => _output;
public void NodeMain(
in Dictionary<string, PipelineNodeImport> input,
in Dictionary<string, PipelineNodeExport> output )
{
_execution.Invoke( input, output );
}
}
}
+56 -41
View File
@@ -46,19 +46,17 @@ namespace StgSharp.PipeLine
public static class PipeLineRunner
{
private static NodeRunner[] allAvailableTask = CreateBlueprintRunnerArray(
);
private static CancellationTokenSource cts = new CancellationTokenSource(
);
private static ConcurrentStack<BlueprintScheduler> blueprintInWaiting
= new ConcurrentStack<BlueprintScheduler>();
private static NodeRunner[] allAvailableTask = CreateBlueprintRunnerArray();
private static CancellationTokenSource cts = new CancellationTokenSource();
private static ConcurrentStack<PipelineScheduler> blueprintInWaiting
= new ConcurrentStack<PipelineScheduler>();
private static int _callingThread;
private static SemaphoreSlim bpLock = new SemaphoreSlim( 0, 1 );
/// <summary>
/// <para> Only the following occasions of calling are valid: </para> <para> 1. no bp is
/// running or the only bp is quitting. </para><para> 2. calling from the main thread or a
/// thread the current bp is running on.</para>
/// <para> Only the following occasions of calling are valid: </para> <para>1. no bp is
/// running or the only bp is quitting.</para><para>2. calling from the main thread or a
/// thread the current bp is running on. </para>
/// </summary>
internal static bool IsValidCalling
{
@@ -66,18 +64,22 @@ namespace StgSharp.PipeLine
{
if( ( NodeRunner.CurrentBlueprint == null ) || //no bp running at all
( ( blueprintInWaiting.IsEmpty ) && ( NodeRunner.CurrentBlueprint.IsRunning ==
false ) ) ) {
false ) ) )
{
// a bp is quitting
//in case no bp is running
return true;
}
int? id = Task.CurrentId;
if( id is null ) {
if( id is null )
{
// in case calling from main thread and current running bp
return _callingThread == Environment.CurrentManagedThreadId;
}
foreach( NodeRunner item in allAvailableTask ) {
if( item.Id == id ) {
foreach( NodeRunner item in allAvailableTask )
{
if( item.Id == id )
{
//if calling from any bp running task
return true;
}
@@ -86,25 +88,29 @@ namespace StgSharp.PipeLine
}
}
public static void Run( BlueprintScheduler blueprint )
public static void Run( PipelineScheduler blueprint )
{
//Console.WriteLine();
if( blueprint == null ) {
if( blueprint == null )
{
return;
}
if( blueprint.IsRunning ) {
throw new InvalidOperationException(
"Attempt to run a blueprint instance twice." );
throw new InvalidOperationException( "Attempt to run a blueprint instance twice." );
}
if( IsValidCalling ) {
if( IsValidCalling )
{
//Console.WriteLine("valid and run");
if( InterruptAndRunNewBp( blueprint ) ) {
if( InterruptAndRunNewBp( blueprint ) )
{
while( InterruptAndRunNewBp( NodeRunner.CurrentBlueprint ) ) { }
;
}
} else {
} else
{
bpLock.Wait();
if( InterruptAndRunNewBp( blueprint ) ) {
if( InterruptAndRunNewBp( blueprint ) )
{
while( InterruptAndRunNewBp( NodeRunner.CurrentBlueprint ) ) { }
}
@@ -118,8 +124,10 @@ namespace StgSharp.PipeLine
if( size < 1 ) {
size = 1;
}
if( allAvailableTask.Length >= size ) {
for( int i = size; i < allAvailableTask.Length; i++ ) {
if( allAvailableTask.Length >= size )
{
for( int i = size; i < allAvailableTask.Length; i++ )
{
if( allAvailableTask[ i ] != null ) {
allAvailableTask[ i ].Cancel();
}
@@ -135,44 +143,47 @@ namespace StgSharp.PipeLine
foreach( NodeRunner task in allAvailableTask ) {
task.Cts.Cancel();
}
foreach( BlueprintScheduler bp in blueprintInWaiting ) {
foreach( PipelineScheduler bp in blueprintInWaiting ) {
bp.Terminate();
}
blueprintInWaiting.Clear();
}
internal static bool InterruptAndRunNewBp( BlueprintScheduler newBp )
internal static bool InterruptAndRunNewBp( PipelineScheduler newBp )
{
Debug.Assert( newBp != null );
if( ( newBp != NodeRunner.CurrentBlueprint ) && ( NodeRunner.CurrentBlueprint !=
null ) ) {
if( ( newBp != NodeRunner.CurrentBlueprint ) && ( NodeRunner.CurrentBlueprint != null ) )
{
//if a running bp exists
blueprintInWaiting.Push( NodeRunner.CurrentBlueprint );
}
//load new bp to current bp
Interlocked.Exchange( ref NodeRunner.CurrentBlueprint!, newBp );
Interlocked.Exchange(
ref _callingThread, Environment.CurrentManagedThreadId );
Interlocked.Exchange( ref _callingThread, Environment.CurrentManagedThreadId );
//run beginning node to init it first.
if( !NodeRunner.CurrentBlueprint.IsRunning ) {
( NodeRunner.CurrentBlueprint.BeginLayer as BeginningNode )!.Run(
);
if( !NodeRunner.CurrentBlueprint.IsRunning )
{
( NodeRunner.CurrentBlueprint.BeginLayer as BeginningNode )!.Run();
}
//refresh all tasks
for( int i = 0; i < allAvailableTask.Length; i++ ) {
for( int i = 0; i < allAvailableTask.Length; i++ )
{
NodeRunner item = allAvailableTask[ i ];
if( ( item is null ) || item.IsCompleted ) {
allAvailableTask[ i ] = NodeRunner.Run();
}
}
PipeLineNode node;
PipelineNode node;
while( !cts.Token.IsCancellationRequested && NodeRunner.CurrentBlueprint
.RequestNextNativeNode( out node ) ) {
.RequestNextNativeNode(
out node ) )
{
node.Run();
if( !NodeRunner.CurrentBlueprint.IsRunning ) {
if( !NodeRunner.CurrentBlueprint.IsRunning )
{
break;
}
}
@@ -191,7 +202,7 @@ namespace StgSharp.PipeLine
internal class NodeRunner : CancellableTask
{
private static BlueprintScheduler _current;
private static PipelineScheduler _current;
internal NodeRunner()
: base()
@@ -199,14 +210,17 @@ namespace StgSharp.PipeLine
_startup = InternalRun;
}
internal static ref BlueprintScheduler CurrentBlueprint
internal static ref PipelineScheduler CurrentBlueprint
{
get => ref _current;
}
internal static NodeRunner Run()
{
NodeRunner ret = new NodeRunner { _startup = InternalRun };
NodeRunner ret = new NodeRunner
{
_startup = InternalRun
};
ret._internalTask = Task.Run( ret.InternalAction );
return ret;
}
@@ -214,9 +228,10 @@ namespace StgSharp.PipeLine
private static void InternalRun( CancellationToken token )
{
//Console.WriteLine("Task Begin");
PipeLineNode item;
PipelineNode item;
while( ( CurrentBlueprint != null ) && CurrentBlueprint.IsRunning && !token.IsCancellationRequested && CurrentBlueprint.RequestNexGlobalNode(
out item ) ) {
out item ) )
{
//Console.WriteLine($"Get node of {item.Name}, going to run.");
item.Run();
}
@@ -0,0 +1,157 @@
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
// file="PipelineNodePort.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.ExceptionServices;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace StgSharp.PipeLine
{
public class PipelineNodeExport
{
private HashSet<PipelineNodeImport> _linkerSet = new HashSet<PipelineNodeImport>();
private SemaphoreSlim formerCompleteSemaphore;
public PipelineNodeExport( PipelineNode container, string name )
{
Container = container;
Name = name;
formerCompleteSemaphore = new SemaphoreSlim( initialCount: 0, maxCount: 1 );
}
public PipelineNode Container { get; init; }
public SemaphoreSlim Waiter { get; init; }
public string Name { get; init; }
public void Connect( PipelineNodeImport port )
{
ArgumentNullException.ThrowIfNull( port );
if( _linkerSet.Add( port ) ) {
Container.Next.Add( port.Container );
}
}
public static void SkipAll( Dictionary<string, PipelineNodeExport> ports )
{
if( ports is null ) {
return;
}
foreach( PipelineNodeExport port in ports.Values ) {
port.Waiter.Release();
}
}
public void TransmitValue( IPipeLineConnectionPayload value )
{
foreach( PipelineNodeImport item in _linkerSet ) { }
}
public void WaitAll( IEnumerable<PipelineNodeExport> ports )
{
if( ports is null ) {
return;
}
foreach( PipelineNodeExport port in ports ) {
port.Waiter.Wait();
}
}
}
public class PipelineNodeImport
{
private HashSet<PipelineNodeExport> _linkerSet = new HashSet<PipelineNodeExport>();
public PipelineNodeImport( PipelineNode container, string name )
{
Container = container;
Name = name;
}
public IEnumerable<PipelineNodeExport> LinkedPorts => _linkerSet;
public PipelineNode Container { get; init; }
public SemaphoreSlim Waiter { get; init; }
public string Name { get; init; }
public void Connect( PipelineNodeExport port )
{
ArgumentNullException.ThrowIfNull( port );
if( _linkerSet.Add( port ) ) {
Container.Previous.Add( port.Container );
}
}
public IEnumerator<PipelineNode> GetFormerNodes()
{
foreach( PipelineNodeExport port in _linkerSet ) {
yield return port.Container;
}
}
public void Wait()
{
foreach( PipelineNodeExport connector in _linkerSet ) {
connector.Waiter.Wait();
}
}
public static void WaitAll( IDictionary<string, PipelineNodeImport> ports )
{
if( ports is null ) {
return;
}
foreach( PipelineNodeImport port in ports.Values ) {
port.Wait();
}
}
public static void WaitAll( IEnumerable<PipelineNodeImport> ports )
{
if( ports is null ) {
return;
}
foreach( PipelineNodeImport port in ports ) {
port.Wait();
}
}
}
}
@@ -0,0 +1,60 @@
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
// file="PipelineScheduler.NodeCraeater.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.PipeLine
{
public partial class PipelineScheduler
{
public PipelineNode CreateBlueprintNode(
string name,
PipelineNodeOperation operation,
string[] inputPort,
string[] outputPort,
bool isNative )
{
PipelineNode node = new PipelineNode( operation, name, isNative, inputPort,
outputPort );
if( isNative )
{
mainThreadNodeList.Add( node );
} else
{
globalNodeList.Add( node );
}
return node;
}
}
}
@@ -0,0 +1,230 @@
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
// file="PipelineScheduler.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.Stg;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Threading;
using System.Xml;
using System.Xml.Linq;
namespace StgSharp.PipeLine
{
/// <summary>
/// A sets of complex logic designed for running in multi threads environment. Warning: do not
/// run a <see cref="PipelineScheduler" /> instance in multi threads more than once.
/// </summary>
public partial class PipelineScheduler : IConvertableToBlueprintNode
{
private BeginningNode _beginning;
private Dictionary<string, PipelineNode> allNode;
private EndingNode _ending;
private List<PipelineNode>
_concurrentNodes = new List<PipelineNode>(),
_mainThreadNodes = new List<PipelineNode>();
private List<PipelineNode> globalNodeList;
private List<PipelineNode> mainThreadNodeList;
private SemaphoreSlim runningStat;
internal int currentGlobalNodeIndex;
internal int currentNativeNodeIndex;
public PipelineScheduler()
{
allNode = new Dictionary<string, PipelineNode>();
globalNodeList = new List<PipelineNode>();
mainThreadNodeList = new List<PipelineNode>();
runningStat = new SemaphoreSlim( 1, 1 );
_beginning = new BeginningNode( this );
_ending = new EndingNode( this );
}
public bool IsRunning
{
get => runningStat.CurrentCount == 0;
}
public IEnumerable<string> InputInterfacesName
{
get { return _beginning.OutputPorts.Keys; }
}
public IEnumerable<string> OutputInterfacesName
{
get { return _beginning.OutputPorts.Keys; }
}
public PipelineNode BeginLayer => _beginning;
public PipelineNode EndLayer => _ending;
public PipelineNodeOperation Operation
{
get => ( this as IConvertableToBlueprintNode ).NodeMain;
}
/**/
internal SemaphoreSlim RunningStat
{
get => runningStat;
}
/**/
public void AddNode( PipelineNode node, bool isNative )
{
ArgumentNullException.ThrowIfNull( node );
node.IsNative = isNative;
allNode.Add( node.Name, node );
}
public void ArrangeNodeOrder()
{
LinkedList<PipelineNode> _cache = new LinkedList<PipelineNode>();
foreach( PipelineNode node in _beginning.Next )
{
if( node.IsNative )
{
_mainThreadNodes.Add( node );
} else
{
_concurrentNodes.Add( node );
}
foreach( PipelineNode item in node.Next )
{
item.Previous.Remove( node );
_cache.AddLast( item );
}
}
while( _cache.Count > 0 )
{
LinkedListNode<PipelineNode> begin = _cache.First!,current = begin,zero;
do
{
PipelineNode node = current.Value;
if( current.Value.Previous.Count == 0 )
{
zero = current;
current = current.Next!;
if( node.IsNative )
{
_mainThreadNodes.Add( node );
} else
{
_concurrentNodes.Add( node );
}
foreach( PipelineNode item in node.Next )
{
item.Previous.Remove( node );
_cache.AddLast( item );
}
_cache.Remove( zero );
} else
{
current = current.Next!;
}
} while (current.Next != begin);
}
}
public void Init()
{
foreach( KeyValuePair<string, PipelineNode> item in allNode )
{
if( item.Value.IsNative )
{
mainThreadNodeList.Add( item.Value );
} else
{
globalNodeList.Add( item.Value );
}
}
mainThreadNodeList.Sort();
globalNodeList.Sort();
}
[MethodImpl( MethodImplOptions.AggressiveInlining )]
public void SetInput( params (string name, IPipeLineConnectionPayload arg)[] parameters )
{
_beginning.SetInputData( parameters );
}
public void Terminate()
{
Interlocked.Exchange( ref currentGlobalNodeIndex, int.MaxValue );
Interlocked.Exchange( ref currentNativeNodeIndex, int.MaxValue );
}
internal bool RequestNexGlobalNode( out PipelineNode node )
{
if( currentGlobalNodeIndex < globalNodeList.Count )
{
node = globalNodeList[ currentGlobalNodeIndex ];
Interlocked.Increment( ref currentGlobalNodeIndex );
return true;
}
node = default!;
return false;
}
internal bool RequestNextNativeNode( out PipelineNode node )
{
if( currentNativeNodeIndex < mainThreadNodeList.Count )
{
node = mainThreadNodeList[ currentNativeNodeIndex ];
Interlocked.Increment( ref currentNativeNodeIndex );
return true;
}
node = default!;
return false;
}
void IConvertableToBlueprintNode.NodeMain(
in Dictionary<string, PipelineNodeImport> input,
in Dictionary<string, PipelineNodeExport> output )
{
PipeLineRunner.Run( this );
PipelineNodeExport.SkipAll( output );
}
~PipelineScheduler()
{
runningStat.Dispose();
}
}
}
+126
View File
@@ -0,0 +1,126 @@
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
// file="PortArgs.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.Numerics;
using System.Runtime.CompilerServices;
using System.Security.Authentication.ExtendedProtection;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace StgSharp.PipeLine
{
public class PipelineConnector
{
private protected IPipeLineConnectionPayload args;
private protected PipelineNodeExport input;
private protected PipelineNodeImport output;
private protected SemaphoreSlim formerCompleteSemaphore;
public PipelineConnector( PipelineNodeExport former, PipelineNodeImport after )
{
this.input = former;
this.output = after;
formerCompleteSemaphore = new SemaphoreSlim( initialCount: 0, maxCount: 1 );
}
public IPipeLineConnectionPayload Args
{
get => args;
set => args = value;
}
public PipelineNodeExport Input => input;
public PipelineNodeImport Output => output;
public static void SkipAll( Dictionary<string, PipelineConnector> ports )
{
if( ports == null ) {
return;
}
foreach( KeyValuePair<string, PipelineConnector> item in ports )
{
if( item.Value != null ) {
item.Value.CompleteAndSkip();
}
}
}
public static void WaitAll( Dictionary<string, PipelineConnector> ports )
{
if( ports == null ) {
return;
}
foreach( KeyValuePair<string, PipelineConnector> item in ports )
{
if( item.Value != null ) {
item.Value.WaitForStart();
}
}
}
[MethodImpl( MethodImplOptions.AggressiveInlining )]
public virtual void WaitForStart()
{
//Console.WriteLine($"Waiting \t{input.ContextName}\t->\t{output.ContextName}");
formerCompleteSemaphore.Wait();
}
~PipelineConnector()
{
formerCompleteSemaphore.Dispose();
}
#region pipline op
[MethodImpl( MethodImplOptions.AggressiveInlining )]
public void CompleteAndSkip()
{
//Console.WriteLine($"Complete\t{input.Name}\t->\t{output.Name}");
formerCompleteSemaphore.Release();
}
[MethodImpl( MethodImplOptions.AggressiveInlining )]
public void CompleteAndWriteData( IPipeLineConnectionPayload args )
{
this.args = args;
CompleteAndSkip();
}
#endregion
}
public abstract class IPipeLineConnectionPayload { }
}
+17 -50
View File
@@ -33,93 +33,60 @@ using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Security.Principal;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace StgSharp.PipeLine
{
internal sealed class BeginningNode : PipeLineNode
internal sealed class BeginningNode : PipelineNode
{
private BlueprintScheduler _bp;
private PipelineScheduler _bp;
public BeginningNode( BlueprintScheduler bp )
: base(
DefaultOperation, name: "BeginningNode", true, ["default"],
["default"] )
public BeginningNode( PipelineScheduler bp )
: base( DefaultOperation, name: "BeginningNode", true, ["default"], ["default"] )
{
_bp = bp;
}
internal (string name, PipeLineConnectorArgs arg)[] InputData
{
set
{
if( value == null ) {
return;
}
foreach( (string name, PipeLineConnectorArgs arg) parameter in value ) {
OutputInterfaces[ parameter.name ].Args = parameter.arg;
}
}
}
public override void Run()
{
_bp.RunningStat.Wait();
PipelineConnector.SkipAll( _outputInterfaces );
PipelineNodeExport.SkipAll( _output );
}
public new void SetCertainOutputPort(
string name,
PipelineConnector pipeline )
internal void SetInputData( IEnumerable<(string, IPipeLineConnectionPayload)> data )
{
if( _outputInterfaces.ContainsKey( name ) ) {
_outputInterfaces[ name ] = pipeline;
if( data is null ) {
return;
}
foreach( (string, IPipeLineConnectionPayload) item in data ) {
OutputPorts[ item.Item1 ].TransmitValue( item.Item2 );
}
_outputInterfaces.Add( name, pipeline );
}
}
internal sealed class EndingNode : PipeLineNode
internal sealed class EndingNode : PipelineNode
{
private BlueprintScheduler _bp;
private PipelineScheduler _bp;
public EndingNode( BlueprintScheduler bp )
: base(
DefaultOperation, name: "EndingNode", true, ["default"],
["default"] )
public EndingNode( PipelineScheduler bp )
: base( DefaultOperation, name: "EndingNode", true, ["default"], ["default"] )
{
_bp = bp;
}
internal (string name, PipeLineConnectorArgs arg)[] OutputData
{
get { return InputInterfaces.Select(
key => (key.Key, key.Value.Args) )
.ToArray(); }
}
public override void Run()
{
PipelineConnector.WaitAll( _inputInterfaces );
PipelineNodeImport.WaitAll( _input );
Interlocked.Exchange( ref _bp.currentGlobalNodeIndex, 0 );
Interlocked.Exchange( ref _bp.currentNativeNodeIndex, 0 );
_bp.RunningStat.Release();
}
public new void SetCertainInputPort(
string name,
PipelineConnector pipeline )
{
if( _inputInterfaces.ContainsKey( name ) ) {
_inputInterfaces[ name ] = pipeline;
}
_inputInterfaces.Add( name, pipeline );
}
}
}
+3 -12
View File
@@ -39,10 +39,7 @@ namespace StgSharp
public interface IStateMachine<T> where T: Enum
{
public T LastStableState
{
get;
}
public T LastStableState { get; }
public bool TryEnterState();
@@ -56,15 +53,9 @@ namespace StgSharp
where TState: Enum
{
public bool IsInStabelState
{
get;
}
public bool IsInStabelState { get; }
public TState NextStableState
{
get;
}
public TState NextStableState { get; }
public bool TrySwitchState();
-4
View File
@@ -83,10 +83,6 @@
</None>
</ItemGroup>
<ItemGroup>
<Folder Include="Logic\" />
</ItemGroup>
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
</Target>
@@ -27,7 +27,6 @@
"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": {
-1
View File
@@ -151,7 +151,6 @@
"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": {
@@ -14,7 +14,7 @@ using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("StgSharp.Common")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+2692495dc8460e1f60a2d073f162c5f526e1ba1b")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+c29993fd8497704d2ddeab3e1a3f8bfa5caa8d90")]
[assembly: System.Reflection.AssemblyProductAttribute("StgSharp.Common")]
[assembly: System.Reflection.AssemblyTitleAttribute("StgSharp.Common")]
[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/2692495dc8460e1f60a2d073f162c5f526e1ba1b/*"}}
{"documents":{"D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\内核源代码\\*":"https://raw.githubusercontent.com/Nitload-NSI/CCD_Github/c29993fd8497704d2ddeab3e1a3f8bfa5caa8d90/*"}}
@@ -27,7 +27,6 @@
"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": {
@@ -1083,7 +1083,6 @@
"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": {
@@ -14,7 +14,7 @@ using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("StgSharp.Generator")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+2692495dc8460e1f60a2d073f162c5f526e1ba1b")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+c29993fd8497704d2ddeab3e1a3f8bfa5caa8d90")]
[assembly: System.Reflection.AssemblyProductAttribute("StgSharp.Generator")]
[assembly: System.Reflection.AssemblyTitleAttribute("StgSharp.Generator")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
@@ -0,0 +1,64 @@
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
// file="StepEntityInstanceNode.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.Modeling.Step;
using StgSharp.Script;
using StgSharp.Script.Express;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StgSharp.Modeling.Step
{
public class StepEntityInstanceNode : ExpSyntaxNode
{
private int id;
private StepModel _model;
public StepEntityInstanceNode( Token source, StepModel model ) : base( source ) { }
public override ExpSyntaxNode Left => Empty;
public override ExpSyntaxNode Right => Empty;
public override IExpElementSource EqualityTypeConvert => throw new NotImplementedException();
private void GetInstance()
{
_model
}
}
}
+4
View File
@@ -12,4 +12,8 @@
<ProjectReference Include="..\StgSharp.Script\StgSharp.Script.csproj" />
</ItemGroup>
<ItemGroup>
<Folder Include="STEP\SyntaxNode\" />
</ItemGroup>
</Project>
@@ -27,7 +27,6 @@
"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": {
@@ -103,7 +102,6 @@
"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": {
@@ -176,7 +174,6 @@
"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": {
-1
View File
@@ -1274,7 +1274,6 @@
"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": {
@@ -14,7 +14,7 @@ using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("StgSharp.Model")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+9457309c5ab188ce824a10ab60e572553986b6eb")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+c29993fd8497704d2ddeab3e1a3f8bfa5caa8d90")]
[assembly: System.Reflection.AssemblyProductAttribute("StgSharp.Model")]
[assembly: System.Reflection.AssemblyTitleAttribute("StgSharp.Model")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
+1 -2
View File
@@ -37,8 +37,7 @@ using System.Xml.Schema;
namespace StgSharp.Script
{
public sealed class AbstractSyntaxTree<TNode, TType>
where TNode: IASTNode<TNode, TType>
public sealed class AbstractSyntaxTree<TNode, TType> where TNode: ISyntaxNode<TNode, TType>
where TType: ITypeSource<TType>
{
+1 -1
View File
@@ -38,7 +38,7 @@ using System.Threading.Tasks;
namespace StgSharp.Script
{
public partial class CompileStack<TNode, TType> where TNode: IASTNode<TNode, TType>
public partial class CompileStack<TNode, TType> where TNode: ISyntaxNode<TNode, TType>
where TType: ITypeSource<TType>
{
+69
View File
@@ -0,0 +1,69 @@
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
// file="ISyntaxNode.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.Reflection;
using System.Text;
namespace StgSharp.Script
{
public interface ISyntaxNode<TNode, TType> where TNode: ISyntaxNode<TNode, TType>
where TType: ITypeSource<TType>
{
long NodeFlag { get; }
string CodeConvertTemplate { get; }
TNode Previous { get; set; }
TNode Next { get; set; }
TNode Left { get; }
TNode Right { get; }
static abstract TNode Empty { get; }
Token Source { get; }
TType EqualityTypeConvert { get; }
void AppendNode( TNode nextToken );
void PrependNode( TNode previusNode );
}
}
@@ -65,9 +65,9 @@ namespace StgSharp.Script.Express
public abstract IEnumerator<ExpElementInstance> GetEnumerator();
public override bool TryGetMember( string name, out ExpNode memberNode )
public override bool TryGetMember( string name, out ExpSyntaxNode memberNode )
{
memberNode = ExpNode.Empty;
memberNode = ExpSyntaxNode.Empty;
return false;
}
@@ -101,7 +101,7 @@ namespace StgSharp.Script.Express
public override string Name => ExpressCompile.PoolString( "ARRAY" );
public override ExpNode CreateInstanceNode( Token t )
public override ExpSyntaxNode CreateInstanceNode( Token t )
{
throw new NotImplementedException();
}
@@ -126,7 +126,7 @@ namespace StgSharp.Script.Express
public override string Name => ExpressCompile.PoolString( "BAG" );
public override ExpNode CreateInstanceNode( Token t )
public override ExpSyntaxNode CreateInstanceNode( Token t )
{
throw new NotImplementedException();
}
@@ -149,7 +149,7 @@ namespace StgSharp.Script.Express
public override string Name => ExpressCompile.PoolString( "LIST" );
public override ExpNode CreateInstanceNode( Token t )
public override ExpSyntaxNode CreateInstanceNode( Token t )
{
throw new NotImplementedException();
}
@@ -180,7 +180,7 @@ namespace StgSharp.Script.Express
_collection.Add( token );
}
public override ExpNode CreateInstanceNode( Token t )
public override ExpSyntaxNode CreateInstanceNode( Token t )
{
throw new NotImplementedException();
}
@@ -34,7 +34,7 @@ using System.Text;
namespace StgSharp.Script.Express
{
public abstract class ExpCollectionInstanceBase : ExpNode
public abstract class ExpCollectionInstanceBase : ExpSyntaxNode
{
protected internal (int min, int max) _range;
@@ -42,19 +42,16 @@ namespace StgSharp.Script.Express
protected ExpCollectionInstanceBase( Token source ) : base( source ) { }
public abstract ExpCollectionBase CollectionValue
{
get;
}
public abstract ExpCollectionBase CollectionValue { get; }
public ExpElementType MemberType
{
get => _memberType;
}
public override ExpNode Left => null!;
public override ExpSyntaxNode Left => null!;
public override ExpNode Right => null!;
public override ExpSyntaxNode Right => null!;
public int MinCapacity => _range.min;
+3 -3
View File
@@ -65,7 +65,7 @@ namespace StgSharp.Script.Express
throw new NotImplementedException();
}
public override ExpNode MakeReference( params object[] options )
public override ExpSyntaxNode MakeReference( params object[] options )
{
if( options.Length == 0 || options[ 0 ] is not string str ) {
return null!;
@@ -84,14 +84,14 @@ namespace StgSharp.Script.Express
return _constants.TryGetValue( name, out instance );
}
public override bool TryGetMember( string name, out ExpNode memberNode )
public override bool TryGetMember( string name, out ExpSyntaxNode memberNode )
{
if( _constants.TryGetValue( name, out ExpElementInstance? node ) )
{
memberNode = node;
return true;
}
memberNode = ExpNode.Empty;
memberNode = ExpSyntaxNode.Empty;
return false;
}
+3 -3
View File
@@ -37,7 +37,7 @@ namespace StgSharp.Script.Express
public class ExpEntitySource : ExpInstantiableElement
{
private AbstractSyntaxTree<ExpNode, IExpElementSource> _expressionTree;
private AbstractSyntaxTree<ExpSyntaxNode, IExpElementSource> _expressionTree;
private ScriptSourceTransmitter _source;
private string _name;
@@ -58,12 +58,12 @@ namespace StgSharp.Script.Express
throw new NotImplementedException();
}
public override ExpNode CreateInstanceNode( Token t )
public override ExpSyntaxNode CreateInstanceNode( Token t )
{
throw new NotImplementedException();
}
public override bool TryGetMember( string name, out ExpNode memberNode )
public override bool TryGetMember( string name, out ExpSyntaxNode memberNode )
{
throw new NotImplementedException();
}
@@ -70,12 +70,12 @@ namespace StgSharp.Script.Express
*/
}
public override ExpNode MakeReference( params object[] options )
public override ExpSyntaxNode MakeReference( params object[] options )
{
throw new NotImplementedException();
}
public override bool TryGetMember( string name, out ExpNode memberNode )
public override bool TryGetMember( string name, out ExpSyntaxNode memberNode )
{
if( FuncParams.TryGetValue( name, out ExpElementInstance? param ) )
{
@@ -87,7 +87,7 @@ namespace StgSharp.Script.Express
memberNode = variable;
return true;
}
memberNode = ExpNode.Empty;
memberNode = ExpSyntaxNode.Empty;
return false;
}
@@ -50,12 +50,12 @@ namespace StgSharp.Script.Express
throw new NotImplementedException();
}
public override ExpNode MakeReference( params object[] options )
public override ExpSyntaxNode MakeReference( params object[] options )
{
throw new NotImplementedException();
}
public override bool TryGetMember( string name, out ExpNode memberNode )
public override bool TryGetMember( string name, out ExpSyntaxNode memberNode )
{
throw new NotImplementedException();
}
+5 -5
View File
@@ -48,9 +48,9 @@ namespace StgSharp.Script.Express
public override ExpInstantiableElement EqualityTypeConvert => throw new NotImplementedException(
);
public override ExpNode Left => throw new NotImplementedException();
public override ExpSyntaxNode Left => throw new NotImplementedException();
public override ExpNode Right => throw new NotImplementedException();
public override ExpSyntaxNode Right => throw new NotImplementedException();
public override string TypeName => _source.Name;
@@ -79,14 +79,14 @@ namespace StgSharp.Script.Express
throw new NotImplementedException();
}
public override ExpNode MakeReference( params object[] options )
public override ExpSyntaxNode MakeReference( params object[] options )
{
throw new NotImplementedException();
}
public override bool TryGetMember( string name, out ExpNode memberNode )
public override bool TryGetMember( string name, out ExpSyntaxNode memberNode )
{
memberNode = ExpNode.Empty;
memberNode = ExpSyntaxNode.Empty;
return false;
}
+2 -2
View File
@@ -87,9 +87,9 @@ namespace StgSharp.Script.Express
return type == null || type == ExpVoidType.Only;
}
public override bool TryGetMember( string name, out ExpNode memberNode )
public override bool TryGetMember( string name, out ExpSyntaxNode memberNode )
{
memberNode = ExpNode.Empty;
memberNode = ExpSyntaxNode.Empty;
return false;
}
@@ -40,15 +40,15 @@ using System.Threading.Tasks;
namespace StgSharp.Script.Express
{
public class ExpBinaryOperatorNode : ExpNode
public class ExpBinaryOperatorNode : ExpSyntaxNode
{
private ExpInstantiableElement _returnType;
private ExpNode _left;
private ExpNode _right;
private ExpSyntaxNode _left;
private ExpSyntaxNode _right;
private ExpBinaryOperatorNode( Token source, ExpNode left, ExpNode right )
private ExpBinaryOperatorNode( Token source, ExpSyntaxNode left, ExpSyntaxNode right )
: base( source )
{
_left = left;
@@ -57,11 +57,14 @@ namespace StgSharp.Script.Express
public override ExpInstantiableElement EqualityTypeConvert => _returnType;
public override ExpNode Left => _left;
public override ExpSyntaxNode Left => _left;
public override ExpNode Right => _right;
public override ExpSyntaxNode Right => _right;
public static ExpBinaryOperatorNode Add( Token source, ExpNode left, ExpNode right )
public static ExpBinaryOperatorNode Add(
Token source,
ExpSyntaxNode left,
ExpSyntaxNode right )
{
if( !left.IsNumber && !right.IsNumber ) {
throw new ExpInvalidTypeException( "Number", left.EqualityTypeConvert.Name );
@@ -77,7 +80,10 @@ namespace StgSharp.Script.Express
};
}
public static ExpBinaryOperatorNode Assign( Token source, ExpNode left, ExpNode right )
public static ExpBinaryOperatorNode Assign(
Token source,
ExpSyntaxNode left,
ExpSyntaxNode right )
{
if( left.EqualityTypeConvert != right.EqualityTypeConvert ) {
throw new ExpInvalidTypeException(
@@ -93,8 +99,8 @@ namespace StgSharp.Script.Express
public static ExpBinaryOperatorNode CompareInstanceEqual(
Token source,
ExpNode left,
ExpNode right )
ExpSyntaxNode left,
ExpSyntaxNode right )
{
return new ExpBinaryOperatorNode( source, left, right )
{
@@ -106,8 +112,8 @@ namespace StgSharp.Script.Express
public static ExpBinaryOperatorNode CompareInstanceNotEqual(
Token nsource,
ExpNode left,
ExpNode right )
ExpSyntaxNode left,
ExpSyntaxNode right )
{
return new ExpBinaryOperatorNode( nsource, left, right )
{
@@ -119,8 +125,8 @@ namespace StgSharp.Script.Express
public static ExpBinaryOperatorNode ConvertElement(
Token source,
ExpNode left,
ExpNode right )
ExpSyntaxNode left,
ExpSyntaxNode right )
{
if( right is not ExpMetaRefNode metaref ) {
throw new ExpInvalidTypeException(
@@ -138,7 +144,10 @@ namespace StgSharp.Script.Express
};
}
public static ExpBinaryOperatorNode Div( Token source, ExpNode left, ExpNode right )
public static ExpBinaryOperatorNode Div(
Token source,
ExpSyntaxNode left,
ExpSyntaxNode right )
{
if( !left.IsNumber && !right.IsNumber ) {
throw new ExpInvalidTypeException( "Number", left.EqualityTypeConvert.Name );
@@ -154,7 +163,10 @@ namespace StgSharp.Script.Express
};
}
public static ExpBinaryOperatorNode EqualTo( Token source, ExpNode left, ExpNode right )
public static ExpBinaryOperatorNode EqualTo(
Token source,
ExpSyntaxNode left,
ExpSyntaxNode right )
{
if( left.EqualityTypeConvert != right.EqualityTypeConvert ) {
throw new ExpInvalidTypeException(
@@ -168,7 +180,10 @@ namespace StgSharp.Script.Express
};
}
public static ExpBinaryOperatorNode GreaterThan( Token source, ExpNode left, ExpNode right )
public static ExpBinaryOperatorNode GreaterThan(
Token source,
ExpSyntaxNode left,
ExpSyntaxNode right )
{
if( !left.IsNumber && !right.IsNumber ) {
throw new ExpInvalidTypeException( "Number", left.EqualityTypeConvert.Name );
@@ -181,7 +196,10 @@ namespace StgSharp.Script.Express
};
}
public static ExpBinaryOperatorNode LessThan( Token source, ExpNode left, ExpNode right )
public static ExpBinaryOperatorNode LessThan(
Token source,
ExpSyntaxNode left,
ExpSyntaxNode right )
{
if( !left.IsNumber && !right.IsNumber ) {
throw new ExpInvalidTypeException( "Number", left.EqualityTypeConvert.Name );
@@ -194,7 +212,10 @@ namespace StgSharp.Script.Express
};
}
public static ExpBinaryOperatorNode Mul( Token source, ExpNode left, ExpNode right )
public static ExpBinaryOperatorNode Mul(
Token source,
ExpSyntaxNode left,
ExpSyntaxNode right )
{
if( !left.IsNumber && !right.IsNumber ) {
throw new ExpInvalidTypeException( "Number", left.EqualityTypeConvert.Name );
@@ -210,7 +231,10 @@ namespace StgSharp.Script.Express
};
}
public static ExpBinaryOperatorNode NotEqualTo( Token source, ExpNode left, ExpNode right )
public static ExpBinaryOperatorNode NotEqualTo(
Token source,
ExpSyntaxNode left,
ExpSyntaxNode right )
{
if( left.EqualityTypeConvert != right.EqualityTypeConvert ) {
throw new ExpInvalidTypeException(
@@ -224,7 +248,10 @@ namespace StgSharp.Script.Express
};
}
public static ExpBinaryOperatorNode SmallerThan( Token source, ExpNode left, ExpNode right )
public static ExpBinaryOperatorNode SmallerThan(
Token source,
ExpSyntaxNode left,
ExpSyntaxNode right )
{
if( !left.IsNumber && !right.IsNumber ) {
throw new ExpInvalidTypeException( "Number", left.EqualityTypeConvert.Name );
@@ -237,7 +264,10 @@ namespace StgSharp.Script.Express
};
}
public static ExpBinaryOperatorNode Sub( Token source, ExpNode left, ExpNode right )
public static ExpBinaryOperatorNode Sub(
Token source,
ExpSyntaxNode left,
ExpSyntaxNode right )
{
if( !left.IsNumber && !right.IsNumber ) {
throw new ExpInvalidTypeException( "Number", left.EqualityTypeConvert.Name );
@@ -36,17 +36,17 @@ using System.Threading.Tasks;
namespace StgSharp.Script.Express
{
public class ExpCollectionIndexNode : ExpNode
public class ExpCollectionIndexNode : ExpSyntaxNode
{
private ExpCollectionInstanceBase _collection;
private ExpNode _indexExpression;
private ExpSyntaxNode _indexExpression;
private ExpCollectionIndexNode(
Token source,
ExpCollectionInstanceBase instance,
ExpNode indexExpression )
Token source,
ExpCollectionInstanceBase instance,
ExpSyntaxNode indexExpression )
: base( source )
{
_collection = instance;
@@ -54,23 +54,22 @@ namespace StgSharp.Script.Express
CodeConvertTemplate = @"{0}[{1}]";
}
public override ExpNode Left => _collection;
public override ExpSyntaxNode Left => _collection;
public override ExpNode Right => _indexExpression;
public override ExpSyntaxNode Right => _indexExpression;
public override IExpElementSource EqualityTypeConvert => _collection.EqualityTypeConvert;
public static ExpCollectionIndexNode Create(
Token source,
ExpCollectionInstanceBase instance,
ExpNode indexExpression )
Token source,
ExpCollectionInstanceBase instance,
ExpSyntaxNode indexExpression )
{
if( !indexExpression.IsNumber ) {
throw new ExpInvalidTypeException(
"Number", indexExpression.EqualityTypeConvert.Name );
}
return new ExpCollectionIndexNode(
source, instance, indexExpression );
return new ExpCollectionIndexNode( source, instance, indexExpression );
}
}
@@ -36,25 +36,25 @@ using System.Threading.Tasks;
namespace StgSharp.Script.Express
{
public class ExpElementInitializingNode : ExpNode
public class ExpElementInitializingNode : ExpSyntaxNode
{
private ExpMetaRefNode _type;
private ExpNode _init;
private ExpSyntaxNode _init;
public ExpElementInitializingNode(
Token source,
ExpMetaRefNode type,
ExpNode initParameter )
ExpSyntaxNode initParameter )
: base( source )
{
_type = type;
_init = initParameter;
}
public override ExpNode Left => _type;
public override ExpSyntaxNode Left => _type;
public override ExpNode Right => _init;
public override ExpSyntaxNode Right => _init;
public override IExpElementSource EqualityTypeConvert => _type.SourceRef;
@@ -36,7 +36,7 @@ using System.Threading.Tasks;
namespace StgSharp.Script.Express
{
public class ExpElementMemberNameNode : ExpNode
public class ExpElementMemberNameNode : ExpSyntaxNode
{
internal ExpElementMemberNameNode( Token source )
@@ -46,9 +46,9 @@ namespace StgSharp.Script.Express
CodeConvertTemplate = source.Value;
}
public override ExpNode Left => Empty;
public override ExpSyntaxNode Left => Empty;
public override ExpNode Right => Empty;
public override ExpSyntaxNode Right => Empty;
public override IExpElementSource EqualityTypeConvert
{
@@ -36,31 +36,33 @@ using System.Threading.Tasks;
namespace StgSharp.Script.Express
{
public class ExpFunctionCallingNode : ExpNode
public class ExpFunctionCallingNode : ExpSyntaxNode
{
private ExpFunctionSource _function;
private ExpNode _parameter;
private ExpSyntaxNode _parameter;
private ExpFunctionCallingNode(
Token source,
ExpFunctionSource function,
ExpNode firstParameter )
ExpSyntaxNode firstParameter )
: base( source )
{
_function = function;
_parameter = firstParameter;
}
public ExpFunctionSource FunctionCaller => _function;
public override ExpInstantiableElement EqualityTypeConvert => throw new NotImplementedException(
);
public override ExpNode Left => Empty;
public override ExpSyntaxNode Left => Empty;
public override ExpNode Right => _parameter;
public override ExpSyntaxNode Right => _parameter;
public void AppendParameter( ExpNode parameter )
public void AppendParameter( ExpSyntaxNode parameter )
{
_parameter.AppendNode( parameter );
}
@@ -68,7 +70,7 @@ namespace StgSharp.Script.Express
public static ExpFunctionCallingNode CallFunction(
Token source,
ExpFunctionSource function,
ExpNode param )
ExpSyntaxNode param )
{
return new ExpFunctionCallingNode( source, function, param );
}
+12 -12
View File
@@ -36,14 +36,14 @@ using System.Text;
namespace StgSharp.Script.Express
{
public sealed class ExpIfNode : ExpNode
public sealed class ExpIfNode : ExpSyntaxNode
{
private ExpNode _falseOpBegin;
private ExpNode _rule;
private ExpNode _trueOpBegin ;
private ExpSyntaxNode _falseOpBegin;
private ExpSyntaxNode _rule;
private ExpSyntaxNode _trueOpBegin ;
public ExpIfNode( Token source, ExpNode rule, ExpNode trueOpBegin )
public ExpIfNode( Token source, ExpSyntaxNode rule, ExpSyntaxNode trueOpBegin )
: base( source )
{
_rule = rule;
@@ -59,9 +59,9 @@ namespace StgSharp.Script.Express
public ExpIfNode(
Token source,
ExpNode rule,
ExpNode rootOperationIfTrue,
ExpNode rootOperationIfFalse )
ExpSyntaxNode rule,
ExpSyntaxNode rootOperationIfTrue,
ExpSyntaxNode rootOperationIfFalse )
: base( source )
{
_rule = rule;
@@ -78,18 +78,18 @@ namespace StgSharp.Script.Express
""" );
}
public override ExpNode Left => _trueOpBegin;
public override ExpSyntaxNode Left => _trueOpBegin;
public override ExpNode Right => _falseOpBegin;
public override ExpSyntaxNode Right => _falseOpBegin;
public override IExpElementSource EqualityTypeConvert => null!;
public void AppendFalseOperation( ExpNode expressionRoot )
public void AppendFalseOperation( ExpSyntaxNode expressionRoot )
{
_falseOpBegin.AppendNode( expressionRoot );
}
public void AppendTrueOperation( ExpNode expressionRoot )
public void AppendTrueOperation( ExpSyntaxNode expressionRoot )
{
_trueOpBegin.AppendNode( expressionRoot );
}
@@ -38,12 +38,12 @@ using System.Threading.Tasks;
namespace StgSharp.Script.Express
{
public class ExpInstanceMemberNode : ExpNode
public class ExpInstanceMemberNode : ExpSyntaxNode
{
private ExpElementInstance _instance;
private ExpElementMemberNameNode _memberName;
private ExpNode _member;
private ExpSyntaxNode _member;
public ExpInstanceMemberNode(
Token source,
@@ -56,9 +56,9 @@ namespace StgSharp.Script.Express
_instance.TryGetMember( memberName.CodeConvertTemplate, out _member );
}
public override ExpNode Left => _instance;
public override ExpSyntaxNode Left => _instance;
public override ExpNode Right => _memberName;
public override ExpSyntaxNode Right => _memberName;
public override IExpElementSource EqualityTypeConvert => _member.EqualityTypeConvert;
@@ -37,7 +37,7 @@ using System.Threading.Tasks;
namespace StgSharp.Script.Express
{
public class ExpInstanceReferenceNode : ExpNode
public class ExpInstanceReferenceNode : ExpSyntaxNode
{
internal ExpInstanceReferenceNode( Token source, ExpElementInstance instance )
@@ -58,9 +58,9 @@ namespace StgSharp.Script.Express
public ExpElementInstance OriginObject { get ; private set; }
public override ExpNode Left => Empty;
public override ExpSyntaxNode Left => Empty;
public override ExpNode Right => Empty;
public override ExpSyntaxNode Right => Empty;
public override IExpElementSource EqualityTypeConvert => OriginObject.EqualityTypeConvert;
@@ -38,26 +38,29 @@ using System.Threading.Tasks;
namespace StgSharp.Script.Express
{
public class ExpMetaRefNode : ExpNode
public class ExpMetaRefNode : ExpSyntaxNode
{
internal ExpMetaRefNode( Token source, ExpInstantiableElement element ) : base( source )
internal ExpMetaRefNode( Token source, ExpInstantiableElement element )
: base( source )
{
SourceRef = element;
}
public ExpInstantiableElement SourceRef { get; init; }
public override ExpNode Left => Empty;
public override ExpSyntaxNode Left => Empty;
public override ExpNode Right => Empty;
public override ExpSyntaxNode Right => Empty;
public override IExpElementSource EqualityTypeConvert => ExpInstantiableElement.Void;
public static ExpMetaRefNode RefEntity( Token position, ExpEntitySource entity )
{
if( position.Value != entity.Name ) {
throw new ExpCompileException( position, $"Meta data does not match, name of source to match is {entity.Name}, but token is {position.Value}" );
throw new ExpCompileException(
position,
$"Meta data does not match, name of source to match is {entity.Name}, but token is {position.Value}" );
}
ExpMetaRefNode node = new ExpMetaRefNode( position, entity )
{
@@ -69,7 +72,9 @@ namespace StgSharp.Script.Express
public static ExpMetaRefNode RefType( Token position, ExpTypeSource type )
{
if( position.Value != type.Name ) {
throw new ExpCompileException( position, $"Meta data does not match, name of source to match is {type.Name}, but token is {position.Value}" );
throw new ExpCompileException(
position,
$"Meta data does not match, name of source to match is {type.Name}, but token is {position.Value}" );
}
ExpMetaRefNode node = new ExpMetaRefNode( position, type )
{
@@ -37,30 +37,33 @@ using System.Threading.Tasks;
namespace StgSharp.Script.Express
{
public class ExpProcedureCallingNode : ExpNode
public class ExpProcedureCallingNode : ExpSyntaxNode
{
private ExpNode _params;
private ExpSyntaxNode _params;
public ExpProcedureCallingNode( Token source, ExpProcedureSource caller, ExpNode param )
public ExpProcedureCallingNode(
Token source,
ExpProcedureSource caller,
ExpSyntaxNode param )
: base( source )
{
_params = param;
CalledProcedure = caller;
}
public override ExpNode Left => Empty;
public override ExpNode Right => _params;
public ExpProcedureSource CalledProcedure { get; init; }
public override ExpSyntaxNode Left => Empty;
public override ExpSyntaxNode Right => _params;
public override IExpElementSource EqualityTypeConvert => ExpInstantiableElement.Void;
public static ExpProcedureCallingNode CallProcedure(
Token postion,
ExpProcedureSource caller,
ExpNode input )
ExpSyntaxNode input )
{
ExpProcedureCallingNode node = new ExpProcedureCallingNode( postion, caller, input )
{
@@ -40,20 +40,20 @@ using ExpKeyword = StgSharp.Script.Express.ExpressCompile.Keyword;
namespace StgSharp.Script.Express
{
public class ExpProcedureControlNode : ExpNode
public class ExpProcedureControlNode : ExpSyntaxNode
{
private ExpNode _additional;
private ExpSyntaxNode _additional;
internal ExpProcedureControlNode( Token source ) : base( source ) { }
public override ExpNode Left => Empty;
public override ExpSyntaxNode Left => Empty;
public override ExpNode Right => _additional;
public override ExpSyntaxNode Right => _additional;
public override IExpElementSource EqualityTypeConvert => ExpTypeSource.Void;
public static ExpProcedureControlNode Return( Token t, ExpNode valueToReturn )
public static ExpProcedureControlNode Return( Token t, ExpSyntaxNode valueToReturn )
{
if( t.Value != ExpKeyword.Return ) {
throw new InvalidCastException();
@@ -37,21 +37,21 @@ using System.Threading.Channels;
namespace StgSharp.Script.Express
{
public class ExpRepeatNode : ExpNode
public class ExpRepeatNode : ExpSyntaxNode
{
private ExpElementInstance _variable;
private ExpNode _begin, _end, _increment, _operationBegin,_untilRule,_whileRule;
private ExpSyntaxNode _begin, _end, _increment, _operationBegin,_untilRule,_whileRule;
internal ExpRepeatNode(
Token source,
ExpElementInstance variable,
ExpNode begin,
ExpNode end,
ExpNode increment,
ExpNode operationBegin,
ExpNode untilRule,
ExpNode whileRule )
ExpSyntaxNode begin,
ExpSyntaxNode end,
ExpSyntaxNode increment,
ExpSyntaxNode operationBegin,
ExpSyntaxNode untilRule,
ExpSyntaxNode whileRule )
: base( source )
{
if( variable.NodeFlag != begin.NodeFlag || begin.NodeFlag != end.NodeFlag || ( increment !=
@@ -90,13 +90,13 @@ namespace StgSharp.Script.Express
_whileRule = whileRule;
}
public override ExpNode Left => throw new NotImplementedException();
public override ExpSyntaxNode Left => throw new NotImplementedException();
public override ExpNode Right => _operationBegin;
public override ExpSyntaxNode Right => _operationBegin;
public override IExpElementSource EqualityTypeConvert => null!;
public void AppendRepeatedOperation( ExpNode node )
public void AppendRepeatedOperation( ExpSyntaxNode node )
{
_operationBegin.AppendNode( node );
}
@@ -126,12 +126,12 @@ namespace StgSharp.Script.Express
public static ExpRepeatNode Create(
Token t,
ExpInstanceReferenceNode repeatVariable,
ExpNode begin,
ExpNode end,
ExpNode increment,
ExpNode whileRule,
ExpNode untilRule,
ExpNode body )
ExpSyntaxNode begin,
ExpSyntaxNode end,
ExpSyntaxNode increment,
ExpSyntaxNode whileRule,
ExpSyntaxNode untilRule,
ExpSyntaxNode body )
{
untilRule = ExpBoolNode.False( null );
whileRule = ExpBoolNode.True( null );
@@ -163,12 +163,12 @@ namespace StgSharp.Script.Express
public static ExpRepeatNode Create(
Token t,
ExpElementInstance repeatVariable,
ExpNode begin,
ExpNode end,
ExpNode increment,
ExpNode whileRule,
ExpNode untilRule,
ExpNode body )
ExpSyntaxNode begin,
ExpSyntaxNode end,
ExpSyntaxNode increment,
ExpSyntaxNode whileRule,
ExpSyntaxNode untilRule,
ExpSyntaxNode body )
{
whileRule = IsNullOrEmpty( whileRule ) ? ExpBoolNode.True( t ) : whileRule;
untilRule = IsNullOrEmpty( untilRule ) ? ExpBoolNode.False( t ) : untilRule;
@@ -35,25 +35,26 @@ using System.Text;
namespace StgSharp.Script.Express
{
public class ExpSwitchNode : ExpNode
public class ExpSwitchNode : ExpSyntaxNode
{
private ExpNode _default;
private ExpNode _target;
private ExpSyntaxNode _default;
private ExpSyntaxNode _target;
private FrozenDictionary<ExpNode, ExpNode> _cases;
private FrozenDictionary<ExpSyntaxNode, ExpSyntaxNode> _cases;
public ExpSwitchNode(
Token source,
ExpNode target,
ExpNode defaultCase,
params (ExpNode label, ExpNode op)[] cases )
ExpSyntaxNode target,
ExpSyntaxNode defaultCase,
params (ExpSyntaxNode label, ExpSyntaxNode op)[] cases )
: base( source )
{
_target = target;
_default = defaultCase;
Dictionary<ExpNode, ExpNode> casesDic = new Dictionary<ExpNode, ExpNode>();
foreach( (ExpNode label, ExpNode op ) item in cases )
Dictionary<ExpSyntaxNode, ExpSyntaxNode> casesDic = new Dictionary<ExpSyntaxNode, ExpSyntaxNode>(
);
foreach( (ExpSyntaxNode label, ExpSyntaxNode op ) item in cases )
{
if( item.op == null )
{
@@ -84,9 +85,9 @@ namespace StgSharp.Script.Express
public ExpSwitchNode(
Token source,
ExpNode target,
ExpNode defaultCase,
IDictionary<ExpNode, ExpNode> cases )
ExpSyntaxNode target,
ExpSyntaxNode defaultCase,
IDictionary<ExpSyntaxNode, ExpSyntaxNode> cases )
: base( source )
{
_target = target;
@@ -109,24 +110,24 @@ namespace StgSharp.Script.Express
CodeConvertTemplate = codeFormatBuilder.ToString();
}
public ExpNode this[ ExpNode index ]
public ExpSyntaxNode this[ ExpSyntaxNode index ]
{
get
{
if( _cases.TryGetValue( index, out ExpNode? ret ) ) {
if( _cases.TryGetValue( index, out ExpSyntaxNode? ret ) ) {
return ret;
}
return _default;
}
}
public override ExpNode Left => Empty;
public override ExpSyntaxNode Left => Empty;
public override ExpNode Right => Empty;
public override ExpSyntaxNode Right => Empty;
public override IExpElementSource EqualityTypeConvert => null!;
public bool ContainsCase( ExpNode token )
public bool ContainsCase( ExpSyntaxNode token )
{
return _cases.ContainsKey( token );
}
@@ -36,35 +36,29 @@ using System.Threading.Tasks;
namespace StgSharp.Script.Express
{
public class ExpUnaryOperatorNode : ExpNode
public class ExpUnaryOperatorNode : ExpSyntaxNode
{
private ExpNode _operand;
private ExpSyntaxNode _operand;
private ExpUnaryOperatorNode( Token source ) : base( source ) { }
public ExpUnaryOperatorNode(
Token source,
ExpNode operand,
ExpSchema context )
public ExpUnaryOperatorNode( Token source, ExpSyntaxNode operand, ExpSchema context )
: base( source )
{
_operand = operand;
}
public override ExpNode Left => null!;
public override ExpSyntaxNode Left => null!;
public override ExpNode Right => _operand;
public override ExpSyntaxNode Right => _operand;
public override IExpElementSource EqualityTypeConvert => _operand.EqualityTypeConvert;
public static ExpUnaryOperatorNode UnaryMinus(
Token source,
ExpNode operand )
public static ExpUnaryOperatorNode UnaryMinus( Token source, ExpSyntaxNode operand )
{
if( !operand.IsNumber ) {
throw new ExpInvalidTypeException(
"Number", operand.EqualityTypeConvert.Name );
throw new ExpInvalidTypeException( "Number", operand.EqualityTypeConvert.Name );
}
bool isFloat =
( operand._nodeFlag | ExpNodeFlag.BuiltinType_Real ) == 0;
@@ -75,9 +69,7 @@ namespace StgSharp.Script.Express
};
}
public static ExpUnaryOperatorNode UnaryNot(
Token source,
ExpNode operand )
public static ExpUnaryOperatorNode UnaryNot( Token source, ExpSyntaxNode operand )
{
if( ( operand._nodeFlag | ( ExpNodeFlag.BuiltinType_Logic | ExpNodeFlag.BuiltinType_Logic ) ) ==
0 ) {
@@ -91,13 +83,10 @@ namespace StgSharp.Script.Express
};
}
public static ExpUnaryOperatorNode UnaryPlus(
Token source,
ExpNode operand )
public static ExpUnaryOperatorNode UnaryPlus( Token source, ExpSyntaxNode operand )
{
if( !operand.IsNumber ) {
throw new ExpInvalidTypeException(
"Number", operand.EqualityTypeConvert.Name );
throw new ExpInvalidTypeException( "Number", operand.EqualityTypeConvert.Name );
}
bool isFloat =
( operand._nodeFlag | ExpNodeFlag.BuiltinType_Real ) == 0;
+16 -16
View File
@@ -39,13 +39,13 @@ using System.Text;
namespace StgSharp.Script.Express
{
public abstract class ExpNode : IASTNode<ExpNode, IExpElementSource>
public abstract class ExpSyntaxNode : ISyntaxNode<ExpSyntaxNode, IExpElementSource>
{
protected internal ExpNodeFlag _nodeFlag;
protected internal Token _source;
protected ExpNode( Token source )
protected ExpSyntaxNode( Token source )
{
_source = source;
Next = this;
@@ -57,18 +57,18 @@ namespace StgSharp.Script.Express
get { return ( _nodeFlag | ExpNodeFlag.BuiltinType_Number ) != 0; }
}
public abstract ExpNode Left { get; }
public abstract ExpSyntaxNode Left { get; }
public static ExpNode Empty
public static ExpSyntaxNode Empty
{
get => ExpEmptyNode._only;
}
public ExpNode Next { get; set; }
public ExpSyntaxNode Next { get; set; }
public abstract ExpNode Right { get; }
public abstract ExpSyntaxNode Right { get; }
public ExpNode Previous { get; set; }
public ExpSyntaxNode Previous { get; set; }
public abstract IExpElementSource EqualityTypeConvert { get; }
@@ -85,7 +85,7 @@ namespace StgSharp.Script.Express
get => _source;
}
public void AppendNode( ExpNode nextNode )
public void AppendNode( ExpSyntaxNode nextNode )
{
Next.Previous = nextNode;
nextNode.Next = Next;
@@ -93,24 +93,24 @@ namespace StgSharp.Script.Express
Next.Previous = this;
}
public static bool IsNullOrEmpty( [AllowNull]ExpNode node )
public static bool IsNullOrEmpty( [AllowNull]ExpSyntaxNode node )
{
return node == ExpEmptyNode._only || node == null;
}
[MethodImpl( MethodImplOptions.AggressiveInlining )]
public static ExpNode NonOperation( Token source )
public static ExpSyntaxNode NonOperation( Token source )
{
return new ExpEmptyNode( source.Line, source.Column );
}
[MethodImpl( MethodImplOptions.AggressiveInlining )]
public static ExpNode NonOperation( int line, int column )
public static ExpSyntaxNode NonOperation( int line, int column )
{
return new ExpEmptyNode( line, column );
}
public void PrependNode( ExpNode previousNode )
public void PrependNode( ExpSyntaxNode previousNode )
{
Previous.Next = previousNode;
previousNode.Previous = Previous;
@@ -118,7 +118,7 @@ namespace StgSharp.Script.Express
previousNode.Next = this;
}
public static bool VerifyTypeConvertable( ExpNode left, ExpNode right )
public static bool VerifyTypeConvertable( ExpSyntaxNode left, ExpSyntaxNode right )
{
IExpElementSource tLeft = left.EqualityTypeConvert,
tRight = right.EqualityTypeConvert;
@@ -132,7 +132,7 @@ namespace StgSharp.Script.Express
return tLeft.IsConvertable( tRight );
}
private class ExpEmptyNode : ExpNode
private class ExpEmptyNode : ExpSyntaxNode
{
internal static readonly ExpEmptyNode _only = new();
@@ -144,9 +144,9 @@ namespace StgSharp.Script.Express
public override ExpInstantiableElement EqualityTypeConvert => ExpInstantiableElement.Void;
public override ExpNode Left => _only;
public override ExpSyntaxNode Left => _only;
public override ExpNode Right => _only;
public override ExpSyntaxNode Right => _only;
}
@@ -53,7 +53,7 @@ namespace StgSharp.Script.Express
}
public abstract class ExpElementInstance : ExpNode
public abstract class ExpElementInstance : ExpSyntaxNode
{
protected ExpElementInstance( Token source )
@@ -66,9 +66,9 @@ namespace StgSharp.Script.Express
public ExpElementType ElementType { get; }
public override ExpNode Left => Empty;
public override ExpSyntaxNode Left => Empty;
public override ExpNode Right => Empty;
public override ExpSyntaxNode Right => Empty;
public abstract string TypeName { get; }
@@ -124,7 +124,7 @@ namespace StgSharp.Script.Express
return false;
}
public bool TryGetMember( string name, out ExpNode node )
public bool TryGetMember( string name, out ExpSyntaxNode node )
{
return EqualityTypeConvert.TryGetMember( name, out node );
}
+12 -12
View File
@@ -45,11 +45,11 @@ namespace StgSharp.Script.Express
string Name { get; }
public void AddMember( string name, ExpNode memberNode );
public void AddMember( string name, ExpSyntaxNode memberNode );
public void Analyse();
public bool TryGetMember( string name, out ExpNode memberNode );
public bool TryGetMember( string name, out ExpSyntaxNode memberNode );
}
@@ -70,14 +70,14 @@ namespace StgSharp.Script.Express
public abstract string Name { get; }
public void AddMember( string name, ExpNode memberNode )
public void AddMember( string name, ExpSyntaxNode memberNode )
{
throw new NotImplementedException();
}
public abstract void Analyse();
public abstract ExpNode CreateInstanceNode( Token t );
public abstract ExpSyntaxNode CreateInstanceNode( Token t );
public bool IsConvertable( IExpElementSource targetType )
{
@@ -92,7 +92,7 @@ namespace StgSharp.Script.Express
return element == null || element == ExpVoidElement.Only;
}
public abstract bool TryGetMember( string name, out ExpNode memberNode );
public abstract bool TryGetMember( string name, out ExpSyntaxNode memberNode );
private sealed class ExpVoidElement : ExpInstantiableElement
{
@@ -112,14 +112,14 @@ namespace StgSharp.Script.Express
return;
}
public override ExpNode CreateInstanceNode( Token t )
public override ExpSyntaxNode CreateInstanceNode( Token t )
{
return ExpNode.Empty;
return ExpSyntaxNode.Empty;
}
public override bool TryGetMember( string name, out ExpNode memberNode )
public override bool TryGetMember( string name, out ExpSyntaxNode memberNode )
{
memberNode = ExpNode.Empty;
memberNode = ExpSyntaxNode.Empty;
return false;
}
@@ -136,7 +136,7 @@ namespace StgSharp.Script.Express
public abstract string Name { get; }
public void AddMember( string name, ExpNode memberNode )
public void AddMember( string name, ExpSyntaxNode memberNode )
{
throw new NotImplementedException();
}
@@ -148,9 +148,9 @@ namespace StgSharp.Script.Express
return false;
}
public abstract ExpNode MakeReference( params object[] options );
public abstract ExpSyntaxNode MakeReference( params object[] options );
public abstract bool TryGetMember( string name, out ExpNode memberNode );
public abstract bool TryGetMember( string name, out ExpSyntaxNode memberNode );
}
}
+1 -1
View File
@@ -112,7 +112,7 @@ namespace StgSharp.Script.Express
public class ExpCaseNotFoundException : ArgumentOutOfRangeException
{
public ExpCaseNotFoundException( ExpSwitchNode token, ExpNode label )
public ExpCaseNotFoundException( ExpSwitchNode token, ExpSyntaxNode label )
: base(
$"Attempt to read or write the label at ({token.Line},{token.Column}), that does not exist in SWITCH expression at ({token.Line},{token.Column})" ) { }
@@ -33,6 +33,7 @@ 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.Text;
@@ -43,26 +44,40 @@ namespace StgSharp.Script.Express
public static class ExpNodeNextEnumeratorExtensions
{
public static ExpNodeNextEnumerator AsCollectionEnumerator( this ExpSyntaxNode token )
{
ExpNodeNextEnumerator enumerator = new ExpNodeNextEnumerator( token );
enumerator.AssertEnumeratorCount( count );
IExpElementSource type = token.EqualityTypeConvert;
while( enumerator.MoveNext() )
{
if( enumerator. Current != type ) {
throw new InvalidCastException();
}
}
return enumerator;
}
[MethodImpl( MethodImplOptions.AggressiveInlining )]
public static ExpNodeNextEnumerator AsEnumerator( this ExpNode token )
public static ExpNodeNextEnumerator ToEnumerator( this ExpSyntaxNode token )
{
return new ExpNodeNextEnumerator( token );
}
}
public class ExpNodeNextEnumerator : IEnumerator<ExpNode>
public class ExpNodeNextEnumerator : IEnumerator<ExpSyntaxNode>
{
private ExpNode _current;
private ExpSyntaxNode _current;
private List<ExpNode> _begin = new List<ExpNode>();
private List<ExpSyntaxNode> _begin = new List<ExpSyntaxNode>();
public ExpNodeNextEnumerator( ExpNode token )
public ExpNodeNextEnumerator( ExpSyntaxNode token )
{
_begin[ 0 ] = token;
_current = token;
ExpNode t = token;
ExpSyntaxNode t = token;
while( !ReferenceEquals( t.Next, token ) && t.Next != null )
{
t = t.Next;
@@ -70,7 +85,7 @@ namespace StgSharp.Script.Express
}
}
public ExpNode this[ int index ]
public ExpSyntaxNode this[ int index ]
{
get
{
@@ -80,7 +95,9 @@ namespace StgSharp.Script.Express
}
}
public List<ExpNode> Values => _begin;
public ExpSyntaxNode Current => _current;
public List<ExpSyntaxNode> Values => _begin;
public void AssertEnumeratorCount( int count )
{
@@ -90,14 +107,9 @@ namespace StgSharp.Script.Express
}
}
void IDisposable.Dispose()
public bool MoveNext()
{
return;
}
bool IEnumerator.MoveNext()
{
ExpNode next = _current.Next;
ExpSyntaxNode next = _current.Next;
if( ReferenceEquals( next, _begin ) || next == null ) {
return false;
}
@@ -105,6 +117,11 @@ namespace StgSharp.Script.Express
return true;
}
void IDisposable.Dispose()
{
return;
}
void IEnumerator.Reset()
{
_current = _begin[ 0 ];
@@ -112,7 +129,5 @@ namespace StgSharp.Script.Express
object IEnumerator.Current => _current;
ExpNode IEnumerator<ExpNode>.Current => _current;
}
}
+169 -142
View File
@@ -50,7 +50,9 @@ namespace StgSharp.Script.Express
private int _current, _lineNum;
private IScriptSourceProvider _provider;
private Regex _nextWordTokenPattern = GetNextWordTokenPattern(),
private Regex
_nextHashtagSymbolPattern = GetHashtagSymbolPattern() ,
_nextWordTokenPattern = GetNextWordTokenPattern(),
_nextStringLiteralPattern = GetStringLiteralPattern(),
_nextNumberLiteralPattern = GetNumberLiteralPattern(),
_nextStringLiteralPatternWithSingle = GetStringLiteralPatternWithSingle(),
@@ -59,7 +61,7 @@ namespace StgSharp.Script.Express
private string _lineCache;
private Token _last;
public ExpSourceReader(IScriptSourceProvider provider)
public ExpSourceReader( IScriptSourceProvider provider )
{
_provider = provider;
_current = 0;
@@ -69,7 +71,7 @@ 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 int LineNumber
@@ -79,175 +81,201 @@ namespace StgSharp.Script.Express
public unsafe ReadOnlySpan<char> ReadLine()
{
bool lineOver = string.IsNullOrEmpty(_lineCache) || _current >= _lineCache.Length;
while (lineOver || _isReadingMultiLineComment)
bool lineOver = string.IsNullOrEmpty( _lineCache ) || _current >= _lineCache.Length;
while( lineOver || _isReadingMultiLineComment )
{
if (IsEmpty)
{
if( IsEmpty ) {
return ReadOnlySpan<char>.Empty;
}
if (lineOver)
if( lineOver )
{
do
{
_lineCache = _provider.ReadLine(out _lineNum);
} while (string.IsNullOrEmpty(_lineCache));
_lineCache = _provider.ReadLine( out _lineNum );
} while (string.IsNullOrEmpty( _lineCache ));
_current = 0;
}
if (_isReadingMultiLineComment)
if( _isReadingMultiLineComment )
{
int index;
fixed (char* cPtr = _lineCache.AsSpan(_current))
{
fixed( char* cPtr = _lineCache.AsSpan( _current ) ) {
index = UnsafeCompute.IndexOfCharPair(
cPtr, MultiLineEnd, _lineCache.Length);
cPtr, MultiLineEnd, _lineCache.Length );
}
if (index == -1)
if( index == -1 )
{
_lineCache = string.Empty;
}
else
} else
{
_isReadingMultiLineComment = false;
_current += index + 2;
}
}
lineOver = string.IsNullOrEmpty(_lineCache) || _current >= _lineCache.Length;
lineOver = string.IsNullOrEmpty( _lineCache ) || _current >= _lineCache.Length;
}
return _lineCache.AsSpan().Slice(_current);
return _lineCache.AsSpan().Slice( _current );
}
public unsafe Token ReadToken()
{
int begin, end, rest;
readLine:
readLine:
ReadOnlySpan<char> source;
if (!TryReadLine(out source))
{
if( !TryReadLine( out source ) ) {
return Token.Empty;
}
char c = source[0];
char c = source[ 0 ];
if (char.IsLetter(c))
if( char.IsLetter( c ) )
{
Match match = _nextWordTokenPattern.Match(_lineCache, _current);
if (match.Success)
Match match = _nextWordTokenPattern.Match( _lineCache, _current );
if( match.Success )
{
begin = match.Groups[TokenMark].Index;
end = match.Groups[EndMark].Index;
rest = match.Groups[RestMark].Index;
begin = match.Groups[ TokenMark ].Index;
end = match.Groups[ EndMark ].Index;
rest = match.Groups[ RestMark ].Index;
_current = rest;
_last = new(
ExpressCompile.PoolString(source[..(end - begin)]), _lineNum, begin,
TokenFlag.Member);
ExpressCompile.PoolString( source[ ..( end - begin ) ] ), _lineNum, begin,
TokenFlag.Member );
return _last;
}
else
} else
{
throw new ExpInvalidCharException(_current);
throw new ExpInvalidCharException( _current );
}
}
else if (char.IsPunctuation(c) || char.IsSymbol(c))
} else if( char.IsPunctuation( c ) || char.IsSymbol( c ) )
{
switch (c)
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[ 1..( end - begin ) ] ), _lineNum,
begin, TokenFlag.Member );
return _last;
} else
{
throw new ExpInvalidCharException( '#' );
}
case '\'':
case '"':
char cNext = source[1];
if (cNext == '\"') //empty string
char cNext = source[ 1 ];
if( cNext == '\'' ) //empty string
{
begin = _current;
_current += 2;
return new(string.Empty, _lineNum, begin, TokenFlag.String);
return new( string.Empty, _lineNum, begin, TokenFlag.String );
}
Match match = _nextStringLiteralPattern.Match(_lineCache, _current);
if (match.Success)
match = _nextStringLiteralPatternWithSingle.Match( _lineCache, _current );
if( match.Success )
{
begin = match.Groups["token"].Index;
end = match.Groups["end"].Index;
rest = match.Groups["rest"].Index;
begin = match.Groups[ "token" ].Index;
end = match.Groups[ "end" ].Index;
rest = match.Groups[ "rest" ].Index;
_current = rest;
_last = new(
ExpressCompile.PoolString(source[1..(end - begin)]), _lineNum,
begin, TokenFlag.String);
ExpressCompile.PoolString( source[ 1..( end - begin ) ] ), _lineNum,
begin, TokenFlag.String );
return _last;
}
else
} else
{
throw new ExpInvalidCharException('\"');
throw new ExpInvalidCharException( '\"' );
}
case '"':
cNext = source[ 1 ];
if( cNext == '\"' ) //empty string
{
begin = _current;
_current += 2;
return new( string.Empty, _lineNum, begin, TokenFlag.String );
}
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(
ExpressCompile.PoolString( source[ 1..( end - begin ) ] ), _lineNum,
begin, TokenFlag.String );
return _last;
} else
{
throw new ExpInvalidCharException( '\"' );
}
case '(':
cNext = source[1];
if (cNext == '*')
cNext = source[ 1 ];
if( cNext == '*' )
{
_isReadingMultiLineComment = true;
_current += 2;
goto readLine;
}
else
} else
{
begin = _current;
_current++;
_last = new(
ExpressCompile.PoolString(source[..1]), _lineNum, begin,
TokenFlag.Separator_Left);
ExpressCompile.PoolString( source[ ..1 ] ), _lineNum, begin,
TokenFlag.Separator_Left );
return _last;
}
case ')' or '}':
begin = _current;
_current++;
_last = new Token(
ExpressCompile.PoolString(source[..1]), _lineNum, begin,
TokenFlag.Separator_Right);
ExpressCompile.PoolString( source[ ..1 ] ), _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))
// 4. param - param(BINARY)
cNext = source[ 1 ];
if( char.IsNumber( cNext ) )
{
match = _nextNumberLiteralPattern.Match(_lineCache, _current);
if (match.Success)
match = _nextNumberLiteralPattern.Match( _lineCache, _current );
if( match.Success )
{
begin = match.Groups[TokenMark].Index;
end = match.Groups[EndMark].Index;
rest = match.Groups[RestMark].Index;
begin = match.Groups[ TokenMark ].Index;
end = match.Groups[ EndMark ].Index;
rest = match.Groups[ RestMark ].Index;
_current = rest;
return new(
ExpressCompile.PoolString(source[..(end - begin)]),
_lineNum, begin, TokenFlag.Number);
}
else
ExpressCompile.PoolString( source[ ..( end - begin ) ] ),
_lineNum, begin, TokenFlag.Number );
} else
{
throw new ExpInvalidCharException(_current);
throw new ExpInvalidCharException( _current );
}
}
else if (cNext == '-')
} else if( cNext == '-' )
{
_lineCache = string.Empty;
_current = 0;
goto readLine;
}
else
} else
{
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,
TokenFlag.Symbol_Binary);
}
else
ExpressCompile.PoolString( source[ ..1 ] ), _lineNum, begin,
TokenFlag.Symbol_Binary );
} else
{
_last = new(
ExpressCompile.PoolString(source[..1]), _lineNum, begin,
TokenFlag.Symbol_Unary);
ExpressCompile.PoolString( source[ ..1 ] ), _lineNum, begin,
TokenFlag.Symbol_Unary );
}
return _last;
}
@@ -255,145 +283,144 @@ namespace StgSharp.Script.Express
begin = _current;
_current++;
_last = new Token(
ExpressCompile.PoolString("{"), _lineNum, begin,
TokenFlag.Separator_Left);
ExpressCompile.PoolString( "{" ), _lineNum, begin,
TokenFlag.Separator_Left );
return _last;
case '[':
begin = _current;
_current++;
_last = new Token(
ExpressCompile.PoolString("["), _lineNum, begin,
TokenFlag.Index_Left);
ExpressCompile.PoolString( "[" ), _lineNum, begin,
TokenFlag.Index_Left );
return _last;
case ']':
begin = _current;
_current++;
_last = new Token(
ExpressCompile.PoolString("]"), _lineNum, begin,
TokenFlag.Index_Right);
ExpressCompile.PoolString( "]" ), _lineNum, begin,
TokenFlag.Index_Right );
return _last;
case ';' or ',':
begin = _current;
_current++;
_last = new Token(
ExpressCompile.PoolString(source[..1]), _lineNum, begin,
TokenFlag.Separator_Middle);
ExpressCompile.PoolString( source[ ..1 ] ), _lineNum, begin,
TokenFlag.Separator_Middle );
return _last;
case ':':
match = _nextSymbolPattern.Match(_lineCache, _current);
begin = match.Groups[TokenMark].Index;
end = match.Groups[EndMark].Index;
rest = match.Groups[RestMark].Index;
match = _nextSymbolPattern.Match( _lineCache, _current );
begin = match.Groups[ TokenMark ].Index;
end = match.Groups[ EndMark ].Index;
rest = match.Groups[ RestMark ].Index;
_current = rest;
if (end - begin == 1)
if( end - begin == 1 )
{
_last = new Token(
ExpressCompile.Keyword.Colon, _lineNum, begin,
TokenFlag.Separator_Middle);
}
else
TokenFlag.Separator_Middle );
} else
{
_last = new Token(
ExpressCompile.PoolString(source[..(end - begin)]), _lineNum,
begin, TokenFlag.Symbol_Binary);
ExpressCompile.PoolString( source[ ..( end - begin ) ] ), _lineNum,
begin, TokenFlag.Symbol_Binary );
}
return _last;
case '+' or '/' or '\\' or '*' or '.':
match = _nextSymbolPattern.Match(_lineCache, _current);
begin = match.Groups[TokenMark].Index;
end = match.Groups[EndMark].Index;
rest = match.Groups[RestMark].Index;
match = _nextSymbolPattern.Match( _lineCache, _current );
begin = match.Groups[ TokenMark ].Index;
end = match.Groups[ EndMark ].Index;
rest = match.Groups[ RestMark ].Index;
_current = rest;
_last = new Token(
ExpressCompile.PoolString(source[..(end - begin)]), _lineNum,
begin, TokenFlag.Symbol_Binary);
ExpressCompile.PoolString( source[ ..( end - begin ) ] ), _lineNum,
begin, TokenFlag.Symbol_Binary );
return _last;
case '=':
begin = _current;
_current++;
_last = new Token(
ExpressCompile.Keyword.Equal, _lineNum, begin,
TokenFlag.Symbol_Binary);
TokenFlag.Symbol_Binary );
return _last;
default:
throw new ExpInvalidCharException(c);
throw new ExpInvalidCharException( c );
}
}
else if (char.IsNumber(c))
} else if( char.IsNumber( c ) )
{
Match match = _nextNumberLiteralPattern.Match(_lineCache, _current);
if (match.Success)
Match match = _nextNumberLiteralPattern.Match( _lineCache, _current );
if( match.Success )
{
begin = match.Groups[TokenMark].Index;
end = match.Groups[EndMark].Index;
rest = match.Groups[RestMark].Index;
begin = match.Groups[ TokenMark ].Index;
end = match.Groups[ EndMark ].Index;
rest = match.Groups[ RestMark ].Index;
_current = rest;
string str = ExpressCompile.PoolString(source[..(end - begin)]);
return new(str, _lineNum, begin, TokenFlag.Number);
}
else
string str = ExpressCompile.PoolString( source[ ..( end - begin ) ] );
return new( str, _lineNum, begin, TokenFlag.Number );
} else
{
throw new ExpInvalidCharException(_current);
throw new ExpInvalidCharException( _current );
}
}
else if (char.IsWhiteSpace(c))
} else if( char.IsWhiteSpace( c ) )
{
Match match = _skipBlankPattern.Match(_lineCache, _current);
if (match.Success)
Match match = _skipBlankPattern.Match( _lineCache, _current );
if( match.Success )
{
rest = match.Groups[RestMark].Index;
rest = match.Groups[ RestMark ].Index;
_current = rest;
goto readLine;
}
else
} else
{
throw new ExpInvalidCharException(_current);
throw new ExpInvalidCharException( _current );
}
}
else
} else
{
throw new ExpInvalidCharException(c);
throw new ExpInvalidCharException( c );
}
}
public bool TryReadLine(out ReadOnlySpan<char> line)
public bool TryReadLine( out ReadOnlySpan<char> line )
{
line = ReadLine();
return line != ReadOnlySpan<char>.Empty;
}
public bool TryReadToken(out Token t)
public bool TryReadToken( out Token t )
{
t = ReadToken();
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)]
RegexOptions.Singleline )]
private static partial Regex GetNextWordTokenPattern();
[GeneratedRegex(
@"(?<token>-?\s*?[0-9]+(?:\.[0-9]*)?E?(?:[+-]?[0-9]+)?)(?<end>\s*?)(?<rest>\S|$)",
RegexOptions.Singleline)]
RegexOptions.Singleline )]
private static partial Regex GetNumberLiteralPattern();
[GeneratedRegex(@"(?:\s+?)(?<rest>\S|$)", RegexOptions.Singleline)]
[GeneratedRegex( @"(?:\s+?)(?<rest>\S|$)", RegexOptions.Singleline )]
private static partial Regex GetSkipBlankPattern();
[GeneratedRegex(
@"(?<token>"")(?>\\\\|\\""|(?!')[^""])*(?<end>""|$)\s*?(?<rest>\S|$)",
RegexOptions.Singleline)]
RegexOptions.Singleline )]
private static partial Regex GetStringLiteralPattern();
[GeneratedRegex(
@"(?<token>')(?>\\\\|\\'|''|(?!')[^'])*(?<end>')\s*?(?<rest>\S|$)",
RegexOptions.Singleline)]
RegexOptions.Singleline )]
private static partial Regex GetStringLiteralPatternWithSingle();
[GeneratedRegex(
@"(?<token>[:<>=+\-*\/]+)(?<end>\s?)\s*?(?<rest>\S|$)",
RegexOptions.Singleline)]
RegexOptions.Singleline )]
private static partial Regex GetSymbolPattern();
}
@@ -45,7 +45,7 @@ namespace StgSharp.Script.Express
private bool AppendToken_CaseOf( Token t )
{
Token op;
ExpNode root;
ExpSyntaxNode root;
switch( t.Value )
{
case ExpKeyword.Case:
@@ -108,19 +108,20 @@ namespace StgSharp.Script.Express
Begin = t;
}
public Dictionary<ExpNode, ExpNode> Cases { get; } = new Dictionary<ExpNode, ExpNode>();
public Dictionary<ExpSyntaxNode, ExpSyntaxNode> Cases { get; } = new Dictionary<ExpSyntaxNode, ExpSyntaxNode>(
);
public ExpNode CaseExpression { get; set; }
public ExpSyntaxNode CaseExpression { get; set; }
public ExpNode DefaultCase { get; set; }
public ExpSyntaxNode DefaultCase { get; set; }
public ExpNode CurrentCase { get; set; }
public ExpSyntaxNode CurrentCase { get; set; }
public string CurrentState { get; set; }
public Token Begin { get; init; }
public void CloseCurrentCase( ExpNode root )
public void CloseCurrentCase( ExpSyntaxNode root )
{
Cases.Add( CurrentCase, root );
}
@@ -62,7 +62,7 @@ namespace StgSharp.Script.Express
if( t.Flag != TokenFlag.Index_Left ) {
return false;
}
if( _cache.TryPeekOperand( out bool isNode, out _, out ExpNode? node ) )
if( _cache.TryPeekOperand( out bool isNode, out _, out ExpSyntaxNode? node ) )
{
if( node.EqualityTypeConvert is not ExpCollectionBase ) {
ExpInvalidSyntaxException.ThrowNonCollectionIndex( t );
@@ -83,8 +83,8 @@ namespace StgSharp.Script.Express
ClosePrefixReverse( t );
//make index node
_cache.PopOperand( out _, out ExpNode? expNode );
if( !_cache.PopOperand( out Token colleToken, out ExpNode? colleNode ) ) { }
_cache.PopOperand( out _, out ExpSyntaxNode? expNode );
if( !_cache.PopOperand( out Token colleToken, out ExpSyntaxNode? colleNode ) ) { }
_cache.PushOperand(
ExpCollectionIndexNode.Create(
t, ( colleNode as ExpCollectionInstanceBase )!, expNode ) );
@@ -126,7 +126,7 @@ namespace StgSharp.Script.Express
while( _cache.OperatorAheadOfDepth > 0 )
{
_cache.TryPopOperator( out Token op );
ExpNode node = ConvertAndPushOneOperator( op );
ExpSyntaxNode node = ConvertAndPushOneOperator( op );
}
switch( _cache.OperandAheadOfDepth )
{
@@ -134,10 +134,10 @@ namespace StgSharp.Script.Express
if( t.Value == ";" ) {
return true;
}
_cache.StatementsInDepth.Push( ExpNode.Empty );
_cache.StatementsInDepth.Push( ExpSyntaxNode.Empty );
goto case 1;
case 1:
_cache.PopOperand( out _, out ExpNode? statement );
_cache.PopOperand( out _, out ExpSyntaxNode? statement );
_cache.StatementsInDepth.Push( statement );
return true;
default:
@@ -189,7 +189,7 @@ namespace StgSharp.Script.Express
if( cmp >= 0 )
{
_cache.PopOperator();
ExpNode node = ConvertAndPushOneOperator( tmp );
ExpSyntaxNode node = ConvertAndPushOneOperator( tmp );
goto processPrecedence;
}
}
@@ -249,7 +249,7 @@ namespace StgSharp.Script.Express
private bool TryParseInstance( Token t )
{
if( _local.TryGetMember( t.Value,
out ExpNode? node ) && node is ExpElementInstance instance )
out ExpSyntaxNode? node ) && node is ExpElementInstance instance )
{
_cache.PushOperand( ExpInstanceReferenceNode.MakeReferenceFrom( t, instance ) );
return true;
@@ -260,7 +260,7 @@ namespace StgSharp.Script.Express
} else if( _cache.IsLastAddedOperator )
{
if( _cache.PeekOperand( out _,
out ExpNode? typenode ) && typenode is ExpMetaRefNode typeRef )
out ExpSyntaxNode? typenode ) && typenode is ExpMetaRefNode typeRef )
{
_cache.PopOperand( out _, out _ );
_local.AddMember( t.Value, typeRef.SourceRef.CreateInstanceNode( t ) );
@@ -58,7 +58,7 @@ namespace StgSharp.Script.Express
while( _cache.TryPopOperator( out Token op ) ) {
ConvertAndPushOneOperator( op );
}
_cache.PopOperand( out _, out ExpNode? node );
_cache.PopOperand( out _, out ExpSyntaxNode? node );
state.CurrentState = t.Value;
state.BoolExpression = node;
} else
@@ -71,7 +71,7 @@ namespace StgSharp.Script.Express
state = _cache.StateOfCurrentDepth<IfBranchStateCache>();
if( state.CurrentState == ExpKeyword.Then )
{
ExpNode node = _cache.PackAllStatements();
ExpSyntaxNode node = _cache.PackAllStatements();
state.CurrentState = t.Value;
state.ExpressionIfTrue = node;
} else
@@ -85,13 +85,13 @@ namespace StgSharp.Script.Express
state = _cache.StateOfCurrentDepth<IfBranchStateCache>();
if( state.CurrentState == ExpKeyword.Then )
{
ExpNode trueNode = _cache.PackAllStatements();
ExpSyntaxNode trueNode = _cache.PackAllStatements();
state.CurrentState = t.Value;
state.ExpressionIfTrue = trueNode;
state.ExpressionIfFalse = ExpNode.Empty;
state.ExpressionIfFalse = ExpSyntaxNode.Empty;
} else if( state.CurrentState == ExpKeyword.Else )
{
ExpNode falseNode = _cache.PackAllStatements();
ExpSyntaxNode falseNode = _cache.PackAllStatements();
state.CurrentState = t.Value;
state.ExpressionIfFalse = falseNode;
} else
@@ -115,11 +115,11 @@ namespace StgSharp.Script.Express
private class IfBranchStateCache : ICompileDepthState
{
public ExpNode BoolExpression { get; set; }
public ExpSyntaxNode BoolExpression { get; set; }
public ExpNode ExpressionIfTrue { get; set; }
public ExpSyntaxNode ExpressionIfTrue { get; set; }
public ExpNode ExpressionIfFalse { get; set; }
public ExpSyntaxNode ExpressionIfFalse { get; set; }
public string CurrentState { get; set; }
@@ -48,9 +48,9 @@ namespace StgSharp.Script.Express
return leftPrecedence - rightPrecedence;
}
public bool TryGenerateUnaryNode( Token t, out ExpNode node )
public bool TryGenerateUnaryNode( Token t, out ExpSyntaxNode node )
{
ExpNode operand = GetNextOperandCache();
ExpSyntaxNode operand = GetNextOperandCache();
switch( t.Value )
{
case ExpKeyword.UnaryPlus:
@@ -63,7 +63,7 @@ namespace StgSharp.Script.Express
node = ExpUnaryOperatorNode.UnaryNot( t, operand );
return true;
default:
node = ExpNode.Empty;
node = ExpSyntaxNode.Empty;
return false;
}
}
@@ -72,12 +72,12 @@ namespace StgSharp.Script.Express
/// WARNING: This method cannot process INDEXOF, FUNCTION CALLING, LOOP and any ENDING
/// SYMBOLS.
/// </summary>
private ExpNode ConvertAndPushOneOperator( Token op )
private ExpSyntaxNode ConvertAndPushOneOperator( Token op )
{
switch( op.Flag )
{
case TokenFlag.Symbol_Unary:
TryGenerateUnaryNode( op, out ExpNode? node );
TryGenerateUnaryNode( op, out ExpSyntaxNode? node );
_cache.PushOperand( node );
return node;
case TokenFlag.Symbol_Binary:
@@ -87,7 +87,7 @@ namespace StgSharp.Script.Express
case TokenFlag.Member:
if( _context.TryGetFunction( op.Value, out ExpFunctionSource? f ) )
{
if( !_cache.PopOperand( out Token t, out ExpNode? p ) )
if( !_cache.PopOperand( out Token t, out ExpSyntaxNode? p ) )
{
node = ExpFunctionCallingNode.CallFunction( op, f, p );
return node;
@@ -99,7 +99,7 @@ namespace StgSharp.Script.Express
}
} else if( _context.TryGetProcedure( op.Value, out ExpProcedureSource? p ) )
{
if( !_cache.PopOperand( out Token t, out ExpNode? param ) )
if( !_cache.PopOperand( out Token t, out ExpSyntaxNode? param ) )
{
node = ExpProcedureCallingNode.CallProcedure( op, p, param );
return node;
@@ -111,7 +111,7 @@ namespace StgSharp.Script.Express
}
} else if( ExpSchema.BuiltinSchema.TryGetFunction( op.Value, out f ) )
{
if( !_cache.PopOperand( out Token t, out ExpNode? param ) )
if( !_cache.PopOperand( out Token t, out ExpSyntaxNode? param ) )
{
node = ExpFunctionCallingNode.CallFunction( op, f, param );
return node;
@@ -132,10 +132,10 @@ namespace StgSharp.Script.Express
}
}
private bool TryGenerateBinaryNode( Token t, out ExpNode node )
private bool TryGenerateBinaryNode( Token t, out ExpSyntaxNode node )
{
ExpNode right = GetNextOperandCache();
ExpNode left = GetNextOperandCache();
ExpSyntaxNode right = GetNextOperandCache();
ExpSyntaxNode left = GetNextOperandCache();
switch( t.Value )
{
case ExpKeyword.Add:
@@ -172,7 +172,7 @@ namespace StgSharp.Script.Express
node = ExpBinaryOperatorNode.CompareInstanceNotEqual( t, left, right );
return true;
default:
node = ExpNode.Empty;
node = ExpSyntaxNode.Empty;
return false;
}
}
@@ -45,12 +45,12 @@ namespace StgSharp.Script.Express
private void ClosePrefixReverse( Token rightSeparator )
{
Token op;
ExpNode root;
ExpSyntaxNode root;
if( _cache.OperatorAheadOfDepth == 0 )
{
if( _cache.OperandAheadOfDepth == 1 )
{
_cache.PopOperand( out _, out ExpNode? statement );
_cache.PopOperand( out _, out ExpSyntaxNode? statement );
_cache.StatementsInDepth.Push( statement );
} else
{
@@ -84,7 +84,7 @@ namespace StgSharp.Script.Express
AppendToken_common( t );
return false;
}
ExpNode root = _cache.PackAllStatements();
ExpSyntaxNode root = _cache.PackAllStatements();
state.Body = root;
_cache.DecreaseDepth();
if( ExpTypeSource.IsNullOrVoid( state.IncrementVariableType ) )
@@ -114,7 +114,7 @@ namespace StgSharp.Script.Express
while( _cache.TryPopOperator( out Token op ) ) {
ConvertAndPushOneOperator( op );
}
_cache.PopOperand( out _, out ExpNode? root );
_cache.PopOperand( out _, out ExpSyntaxNode? root );
state.Begin = root;
return true;
default:
@@ -143,7 +143,7 @@ namespace StgSharp.Script.Express
while( _cache.TryPopOperator( out Token op ) ) {
ConvertAndPushOneOperator( op );
}
_cache.PopOperand( out _, out ExpNode? root );
_cache.PopOperand( out _, out ExpSyntaxNode? root );
state.End = root;
return true;
}
@@ -168,7 +168,7 @@ namespace StgSharp.Script.Express
while( _cache.TryPopOperator( out Token op ) ) {
ConvertAndPushOneOperator( op );
}
_cache.PopOperand( out _, out ExpNode? root );
_cache.PopOperand( out _, out ExpSyntaxNode? root );
state.StepIncrement = root;
return true;
}
@@ -187,7 +187,7 @@ namespace StgSharp.Script.Express
while( _cache.TryPopOperator( out Token op ) ) {
ConvertAndPushOneOperator( op );
}
_cache.PopOperand( out _, out ExpNode? root );
_cache.PopOperand( out _, out ExpSyntaxNode? root );
state.UntilExpression = root;
return true;
}
@@ -210,7 +210,7 @@ namespace StgSharp.Script.Express
if( ExpTypeSource.IsNullOrVoid( state.IncrementVariableType ) )
{
if( ( _local.TryGetMember( t.Value,
out ExpNode? node ) && node is ExpElementInstance instance ) || _tempVariableInLoops.TryGetValue(
out ExpSyntaxNode? node ) && node is ExpElementInstance instance ) || _tempVariableInLoops.TryGetValue(
t.Value, out instance ) )
{
state.IncrementVariable = ExpInstanceReferenceNode.MakeReferenceFrom(
@@ -247,7 +247,7 @@ namespace StgSharp.Script.Express
while( _cache.TryPopOperator( out Token op ) ) {
ConvertAndPushOneOperator( op );
}
_cache.PopOperand( out _, out ExpNode? root );
_cache.PopOperand( out _, out ExpSyntaxNode? root );
state.WhileExpression = root;
return true;
}
@@ -258,23 +258,23 @@ namespace StgSharp.Script.Express
public RepeatLoopState( Token t )
{
Position = t;
UntilExpression = ExpNode.Empty;
WhileExpression = ExpNode.Empty;
UntilExpression = ExpSyntaxNode.Empty;
WhileExpression = ExpSyntaxNode.Empty;
}
public ExpInstanceReferenceNode IncrementVariable { get; set; }
public ExpNode StepIncrement { get; set; }
public ExpSyntaxNode StepIncrement { get; set; }
public ExpNode Begin { get; set; }
public ExpSyntaxNode Begin { get; set; }
public ExpNode End { get; set; }
public ExpSyntaxNode End { get; set; }
public ExpNode UntilExpression { get; set; }
public ExpSyntaxNode UntilExpression { get; set; }
public ExpNode WhileExpression { get; set; }
public ExpSyntaxNode WhileExpression { get; set; }
public ExpNode Body { get; set; }
public ExpSyntaxNode Body { get; set; }
public ExpTypeSource IncrementVariableType { get; set; }
+6 -6
View File
@@ -51,19 +51,19 @@ namespace StgSharp.Script.Express
private const int TokenGenerated = 0;
private const int TokenTypeNotMatch = -1;
private CompileStack<ExpNode, IExpElementSource> _cache;
private ExpNode _lastStatement;
private CompileStack<ExpSyntaxNode, IExpElementSource> _cache;
private ExpSchema _context;
private ExpSyntaxNode _lastStatement;
private IExpElementSource _local;
public ExpSyntaxAnalyzer()
{
_cache = new CompileStack<ExpNode, IExpElementSource>();
_cache = new CompileStack<ExpSyntaxNode, IExpElementSource>();
}
public ExpSyntaxAnalyzer( ExpSchema context, IExpElementSource local )
{
_cache = new CompileStack<ExpNode, IExpElementSource>();
_cache = new CompileStack<ExpSyntaxNode, IExpElementSource>();
ArgumentNullException.ThrowIfNull( context );
if( context is not ExpSchema_Builtin )
{
@@ -95,9 +95,9 @@ namespace StgSharp.Script.Express
}
}
public ExpNode GetNextOperandCache()
public ExpSyntaxNode GetNextOperandCache()
{
if( _cache.PopOperand( out Token t, out ExpNode? n ) )
if( _cache.PopOperand( out Token t, out ExpSyntaxNode? n ) )
{
return n;
} else
+1 -1
View File
@@ -39,7 +39,7 @@ namespace StgSharp.Script.Express
public interface IExpMarshalType<TSelf>
{
static abstract TSelf Create( string name, ExpNode node );
static abstract TSelf Create( string name, ExpSyntaxNode node );
}
}
@@ -27,7 +27,6 @@
"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": {
@@ -103,7 +102,6 @@
"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": {
-1
View File
@@ -1255,7 +1255,6 @@
"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": {
@@ -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+9457309c5ab188ce824a10ab60e572553986b6eb")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+c29993fd8497704d2ddeab3e1a3f8bfa5caa8d90")]
[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/2692495dc8460e1f60a2d073f162c5f526e1ba1b/*"}}
{"documents":{"D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\内核源代码\\*":"https://raw.githubusercontent.com/Nitload-NSI/CCD_Github/c29993fd8497704d2ddeab3e1a3f8bfa5caa8d90/*"}}
@@ -27,7 +27,6 @@
"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": {
@@ -414,7 +414,6 @@
"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": {
@@ -14,7 +14,7 @@ using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("StgSharp.TerminalDialogue")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+148b0fed4a1abaaeaa3a28e7c7b088590805ebef")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+c29993fd8497704d2ddeab3e1a3f8bfa5caa8d90")]
[assembly: System.Reflection.AssemblyProductAttribute("StgSharp.TerminalDialogue")]
[assembly: System.Reflection.AssemblyTitleAttribute("StgSharp.TerminalDialogue")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
@@ -27,7 +27,6 @@
"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": {
@@ -103,7 +102,6 @@
"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": {
@@ -176,7 +174,6 @@
"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": {
@@ -256,7 +253,6 @@
"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": {
-1
View File
@@ -1294,7 +1294,6 @@
"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": {
@@ -14,7 +14,7 @@ using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("StgSharpDebug")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+2692495dc8460e1f60a2d073f162c5f526e1ba1b")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+c29993fd8497704d2ddeab3e1a3f8bfa5caa8d90")]
[assembly: System.Reflection.AssemblyProductAttribute("StgSharpDebug")]
[assembly: System.Reflection.AssemblyTitleAttribute("StgSharpDebug")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]