This commit is contained in:
Nitload
2025-08-25 09:50:30 +08:00
parent bd0e31e922
commit 1359ff4ecc
1630 changed files with 738486 additions and 2399 deletions
@@ -43,7 +43,7 @@ namespace StgSharp.Model.Step
private ExpSyntaxNode _begin;
private StepComplexEntityNode( ExpSyntaxNode node )
public StepComplexEntityNode( ExpSyntaxNode node )
: base( node.Source )
{
_begin = node;
@@ -53,9 +53,9 @@ namespace StgSharp.Model.Step
public override ExpSyntaxNode Right => _begin;
public override IExpElementSource EqualityTypeConvert => StepEntityType.Source;
public override IExpElementSource EqualityTypeConvert => throw new NotImplementedException();
public static StepComplexEntityNode FromTuple( ExpSyntaxNode node )
public StepComplexEntityNode FromTuple( ExpSyntaxNode node )
{
if( node is not ExpTupleNode tuple ) {
throw new ExpInvalidSyntaxException( "Node to convert is not a complex" );
@@ -30,6 +30,7 @@
//-----------------------------------------------------------------------
using Microsoft.CodeAnalysis.CSharp.Syntax;
using StgSharp.Modeling.Step;
using StgSharp.Script;
using StgSharp.Script.Express;
@@ -40,7 +41,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StgSharp.Model.Step
namespace StgSharp.Model.Step.SyntaxNode
{
public class StepEntityInitCaller : ExpFunctionSource
{
@@ -28,78 +28,37 @@
//
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
using StgSharp.Model.Step;
using StgSharp.Modeling.Step;
using StgSharp.Script;
using StgSharp.Script.Express;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
namespace StgSharp.Model.Step
namespace StgSharp.Modeling.Step
{
public class StepEntityInstanceNode : ExpSyntaxNode
{
private StepEntityInstanceNode( Token source ) : base( source ) { }
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 => StepEntityType.Source;
public override IExpElementSource EqualityTypeConvert => throw new NotImplementedException();
public int Id { get; init; }
public static StepEntityInstanceNode Register( Token t )
private void GetInstance()
{
if( t.Value[ 0 ] != '#' ) {
throw new ExpInvalidSyntaxException( "Entity label in STEP should be # + number" );
}
StepEntityInstanceNode node = new StepEntityInstanceNode( t )
{
Id = int.Parse( t.Value.AsSpan( 1 ) ),
};
return node;
_model
}
public static StepEntityInstanceNode RegisterNull( Token t )
{
if( t.Value != "$" ) {
throw new ExpInvalidSyntaxException(
$"Token {t.Value} does not represent a null entity" );
}
StepEntityInstanceNode node = new StepEntityInstanceNode( t )
{
Id = 0,
};
return node;
}
public static StepEntityInstanceNode RegisterRuntimeInference( Token t )
{
if( t.Value != "*" ) {
throw new ExpInvalidSyntaxException(
$"Token {t.Value} does not represent a runtime inferences entity" );
}
StepEntityInstanceNode node = new StepEntityInstanceNode( t )
{
Id = -1,
};
return node;
}
}
internal class StepEntityType : ExpTypeSource
{
private StepEntityType( string typeName ) : base( typeName ) { }
public static StepEntityType Source { get; } = new StepEntityType( "ENTITY" );
}
}
@@ -37,7 +37,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StgSharp.Model.Step
namespace StgSharp.Modeling.Step
{
internal class StepExpEnumValueNode : ExpSyntaxNode
{