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
@@ -28,6 +28,7 @@
//
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
using StgSharp.Model.Step.SyntaxNode;
using StgSharp.Script;
using StgSharp.Script.Express;
@@ -39,7 +40,7 @@ using System.Threading.Tasks;
using ExpKeyword = StgSharp.Script.Express.ExpressCompile.Keyword;
namespace StgSharp.Model.Step
namespace StgSharp.Modeling.Step
{
internal partial class StepExpSyntaxAnalyzer
{
@@ -91,7 +92,7 @@ namespace StgSharp.Model.Step
_cache.PopOperand( out _, out ExpSyntaxNode? p );
StepEntityInitCaller caller = StepEntityInitCaller.CreateCaller( op.Value );
node = ExpFunctionCallingNode.CallFunction( op, caller, p );
_cache.StatementsInDepth.Push( node );
_cache.PushOperand( node );
return node;
default:
throw new NotImplementedException();
@@ -100,27 +101,43 @@ namespace StgSharp.Model.Step
private bool TryGenerateBinaryNode( Token t, out ExpSyntaxNode node )
{
/*
ExpSyntaxNode right = GetNextOperandCache();
ExpSyntaxNode left = GetNextOperandCache();
/**/
switch( t.Value )
{
case "=":
ExpSyntaxNode right = GetNextOperandCache();
ExpSyntaxNode left;
if( right is ExpTupleNode tuple )
{
right = StepComplexEntityNode.FromTuple( tuple );
left = GetNextOperandCache();
} else
{
left = right;
right = _cache.StatementsInDepth.Pop();
}
case ExpKeyword.Add:
node = ExpBinaryOperatorNode.Add( t, left, right );
return true;
case ExpKeyword.Sub:
node = ExpBinaryOperatorNode.Sub( t, left, right );
return true;
case ExpKeyword.Mul:
node = ExpBinaryOperatorNode.Mul( t, left, right );
return true;
case ExpKeyword.Div:
node = ExpBinaryOperatorNode.Div( t, left, right );
return true;
case ExpKeyword.Equal:
node = ExpBinaryOperatorNode.EqualTo( t, left, right );
return true;
case ExpKeyword.NotEqual:
node = ExpBinaryOperatorNode.NotEqualTo( t, left, right );
return true;
case ExpKeyword.GreaterThan:
node = ExpBinaryOperatorNode.GreaterThan( t, left, right );
return true;
case ExpKeyword.LessThan:
node = ExpBinaryOperatorNode.LessThan( t, left, right );
return true;
case ExpKeyword.Assignment:
node = ExpBinaryOperatorNode.Assign( t, left, right );
return true;
case ExpKeyword.InstanceEqual:
node = ExpBinaryOperatorNode.CompareInstanceEqual( t, left, right );
return true;
case ExpKeyword.InstanceNotEqual:
node = ExpBinaryOperatorNode.CompareInstanceNotEqual( t, left, right );
return true;
default:
node = ExpSyntaxNode.Empty;
return false;