From c8f426d2e8c045607e85dbb305948e5761d15deb Mon Sep 17 00:00:00 2001 From: Nitload Date: Sat, 5 Apr 2025 23:16:04 +0800 Subject: [PATCH] Daily update on 20250405-231604 by Nitload Youmu. Additional Message : most of repeat block analyzer complete Signed-off-by: Nitload --- StgSharp.Script/Common/CompileDepthState.cs | 7 +- .../Express/Builtin/ExpCollection.cs | 8 +- StgSharp.Script/Express/Element/ExpEntity.cs | 2 +- StgSharp.Script/Express/Element/ExpType.cs | 4 +- .../ExpAstNode/ExpProcedureControlNode.cs | 81 ++++++ .../Express/ExpAstNode/ExpRepeatNode.cs | 139 +++++++--- StgSharp.Script/Express/ExpElmentSource.cs | 58 +--- .../Express/ExpSchemaSource.Compile.cs | 6 +- .../Express/ExpSyntaxAnalyzer.RepeatLoop.cs | 257 ++++++++++++++++++ .../Express/ExpSyntaxAnalyzer.TokenSpliter.cs | 22 ++ .../net8.0/StgSharp.Script.AssemblyInfo.cs | 2 +- .../net8.0/StgSharp.Script.sourcelink.json | 2 +- 12 files changed, 498 insertions(+), 90 deletions(-) create mode 100644 StgSharp.Script/Express/ExpAstNode/ExpProcedureControlNode.cs create mode 100644 StgSharp.Script/Express/ExpSyntaxAnalyzer.RepeatLoop.cs diff --git a/StgSharp.Script/Common/CompileDepthState.cs b/StgSharp.Script/Common/CompileDepthState.cs index f5cdd038..dab93a61 100644 --- a/StgSharp.Script/Common/CompileDepthState.cs +++ b/StgSharp.Script/Common/CompileDepthState.cs @@ -37,7 +37,12 @@ using System.Threading.Tasks; namespace StgSharp.Script { - public interface ICompileDepthState { } + public interface ICompileDepthState + { + + string CurrentState { get; set; } + + } public class CompileDepthMark { diff --git a/StgSharp.Script/Express/Builtin/ExpCollection.cs b/StgSharp.Script/Express/Builtin/ExpCollection.cs index 817c380e..9661beda 100644 --- a/StgSharp.Script/Express/Builtin/ExpCollection.cs +++ b/StgSharp.Script/Express/Builtin/ExpCollection.cs @@ -101,7 +101,7 @@ namespace StgSharp.Script.Express public override string Name => ExpressCompile.PoolString( "ARRAY" ); - public override ExpNode CreateInstanceNode() + public override ExpNode 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() + public override ExpNode 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() + public override ExpNode CreateInstanceNode( Token t ) { throw new NotImplementedException(); } @@ -180,7 +180,7 @@ namespace StgSharp.Script.Express _collection.Add( token ); } - public override ExpNode CreateInstanceNode() + public override ExpNode CreateInstanceNode( Token t ) { throw new NotImplementedException(); } diff --git a/StgSharp.Script/Express/Element/ExpEntity.cs b/StgSharp.Script/Express/Element/ExpEntity.cs index 11db5689..94b5a379 100644 --- a/StgSharp.Script/Express/Element/ExpEntity.cs +++ b/StgSharp.Script/Express/Element/ExpEntity.cs @@ -58,7 +58,7 @@ namespace StgSharp.Script.Express throw new NotImplementedException(); } - public override ExpNode CreateInstanceNode() + public override ExpNode CreateInstanceNode( Token t ) { throw new NotImplementedException(); } diff --git a/StgSharp.Script/Express/Element/ExpType.cs b/StgSharp.Script/Express/Element/ExpType.cs index 69c81492..7fdb8f8a 100644 --- a/StgSharp.Script/Express/Element/ExpType.cs +++ b/StgSharp.Script/Express/Element/ExpType.cs @@ -63,7 +63,7 @@ namespace StgSharp.Script.Express public override ExpElementType ElementType => ExpElementType.Type; - public ExpTypeSource Void + public static ExpTypeSource Void { get => ExpVoidType.Only; } @@ -77,7 +77,7 @@ namespace StgSharp.Script.Express throw new NotImplementedException(); } - public override ExpElementInstance CreateInstanceNode() + public override ExpElementInstance CreateInstanceNode( Token t ) { throw new NotImplementedException(); } diff --git a/StgSharp.Script/Express/ExpAstNode/ExpProcedureControlNode.cs b/StgSharp.Script/Express/ExpAstNode/ExpProcedureControlNode.cs new file mode 100644 index 00000000..67a4ba07 --- /dev/null +++ b/StgSharp.Script/Express/ExpAstNode/ExpProcedureControlNode.cs @@ -0,0 +1,81 @@ +//----------------------------------------------------------------------- +//----------------------------------------------------------------------- +// file="ExpProcedureControlNode.cs" +// Project: StgSharp +// AuthorGroup: Nitload Space +// Copyright (c) Nitload Space. All rights reserved. +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the “Software”), to deal in the Software without restriction, +// including without limitation the rights to use, copy, modify, merge, +// publish, distribute, sublicense, and/or sell copies of the Software, +// and to permit persons to whom the Software is furnished to do so, +// subject to the following conditions: +// +// The above copyright notice and +// this permission notice shall be included in all copies +// or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED “AS IS”, +// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, +// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +// ARISING FROM, OUT OF OR IN CONNECTION WITH +// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// +//----------------------------------------------------------------------- +//----------------------------------------------------------------------- +using Microsoft.CodeAnalysis.CSharp.Syntax; + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +using ExpKeyword = StgSharp.Script.Express.ExpressCompile.Keyword; + +namespace StgSharp.Script.Express +{ + public class ExpProcedureControlNode : ExpNode + { + + private ExpNode _additional; + + internal ExpProcedureControlNode( Token source ) : base( source ) { } + + public override ExpNode Left => Empty; + + public override ExpNode Right => _additional; + + public override IExpElementSource EqualityTypeConvert => ExpTypeSource.Void; + + public static ExpProcedureControlNode Return( Token t, ExpNode valueToReturn ) + { + if( t.Value != ExpKeyword.Return ) { + throw new InvalidCastException(); + } + ExpProcedureControlNode ret = new ExpProcedureControlNode( t ) + { + _additional = valueToReturn ?? Empty, + CodeConvertTemplate = IsNullOrEmpty( valueToReturn! ) ? + ExpKeyword.Return : "return {0}", + }; + return ret; + } + + public static ExpProcedureControlNode Skip( Token t ) + { + ExpProcedureControlNode ret = new ExpProcedureControlNode( t ) + { + _additional = Empty, + CodeConvertTemplate = "break" + }; + return ret; + } + + } +} diff --git a/StgSharp.Script/Express/ExpAstNode/ExpRepeatNode.cs b/StgSharp.Script/Express/ExpAstNode/ExpRepeatNode.cs index ed8c5e83..e06ece26 100644 --- a/StgSharp.Script/Express/ExpAstNode/ExpRepeatNode.cs +++ b/StgSharp.Script/Express/ExpAstNode/ExpRepeatNode.cs @@ -39,19 +39,51 @@ namespace StgSharp.Script.Express public class ExpRepeatNode : ExpNode { - //TODO: Current code cannot represent full functionality defined in ISO10303, need rewrite. + private ExpElementInstance _variable; + private ExpNode _begin, _end, _increment, _operationBegin,_untilRule,_whileRule; - private ExpElementInstance _variable, _begin, _end, _increment; + internal ExpRepeatNode( + Token source, + ExpNode operationBegin, + ExpElementInstance variable, + ExpNode begin, + ExpNode end ) + : base( source ) + { + ExpNode increment; + switch( ( ExpNodeFlag )variable.NodeFlag | ExpNodeFlag.BuiltinType_Any ) + { + case ExpNodeFlag.BuiltinType_Real: + increment = new ExpRealNumberNode( + new Token( + ExpressCompile.PoolString( "1.0f" ), source.Line, -1, + TokenFlag.Number ), + 1.0f, isLiteral: true ); + break; + case ExpNodeFlag.BuiltinType_Int: + increment = new ExpIntNode( + new Token( + ExpressCompile.PoolString( "1" ), source.Line, -1, TokenFlag.Number ), + 1, isLiteral: true ); + break; + default: + throw new ExpInvalidTypeException( "Int or Real", "otherwise" ); + } + _begin = begin; + _variable = variable; + _end = end; + _increment = increment; + _nodeFlag = ExpNodeFlag.Branch_Repeat; + _operationBegin = operationBegin; + } - private ExpNode _operationBegin; - - public ExpRepeatNode( - Token source, - ExpNode operationBegin, - ExpElementInstance variable, - ExpElementInstance begin, - ExpElementInstance end, - ExpElementInstance increment ) + internal ExpRepeatNode( + Token source, + ExpNode operationBegin, + ExpElementInstance variable, + ExpNode begin, + ExpNode end, + ExpNode increment ) : base( source ) { if( variable.NodeFlag != begin.NodeFlag || begin.NodeFlag != end.NodeFlag || ( increment != @@ -59,28 +91,7 @@ namespace StgSharp.Script.Express increment.NodeFlag ) ) { throw new InvalidCastException(); } - if( increment == null ) - { - switch( ( ExpNodeFlag )variable.NodeFlag | ExpNodeFlag.BuiltinType_Any ) - { - case ExpNodeFlag.BuiltinType_Real: - increment = new ExpRealNumberNode( - new Token( - ExpressCompile.PoolString( "1.0f" ), source.Line, -1, - TokenFlag.Number ), - 1.0f, isLiteral: true ); - break; - case ExpNodeFlag.BuiltinType_Int: - increment = new ExpIntNode( - new Token( - ExpressCompile.PoolString( "1" ), source.Line, -1, - TokenFlag.Number ), - 1, isLiteral: true ); - break; - default: - throw new ExpInvalidTypeException( "Int or Real", "otherwise" ); - } - } + ArgumentNullException.ThrowIfNull( increment ); _begin = begin; _variable = variable; _end = end; @@ -100,5 +111,67 @@ namespace StgSharp.Script.Express _operationBegin.AppendNode( node ); } + public static ExpRepeatNode Create( + Token t, + ExpElementInstance repeatVariable, + ExpNode begin, + ExpNode end, + ExpNode repeatBody ) + { + string typename = repeatVariable.NodeFlag.ToString(); + ExpRepeatNode ret = new ExpRepeatNode( t, repeatBody, repeatVariable, begin, end, null ) + { + /* + * 0 increment variable type + * 1: variable name + * 2: beginning value + * 3: ending value + * 4: increment + * 5: body + */ + CodeConvertTemplate = $$""" + for({{0}} {{1}} = {{2}}; {{1}} <= {{3}}; {{1}} += {{4}}) + { + {{5}} + } + """ + }; + return ret; + } + + public static ExpRepeatNode Create( + Token t, + ExpElementInstance repeatVariable, + ExpNode begin, + ExpNode end, + ExpNode increment, + ExpNode whileRule, + ExpNode untilRule, + ExpNode body ) + { + ExpRepeatNode ret = new ExpRepeatNode( t, body, repeatVariable, begin, end, increment ) + { + /* + * 0 increment variable type + * 1: variable name + * 2: beginning value + * 3: ending value + * 4: increment + * 5: body + * 6: while + * 7: until + */ + CodeConvertTemplate = $$""" + for({{0}} {{1}} = {{2}}; {{1}} <= {{3}}; {{1}} += {{4}}) + { + if(!( {{6}} )) break; + {{5}} + if(!( {{7}} )) break; + } + """ + }; + return ret; + } + } } diff --git a/StgSharp.Script/Express/ExpElmentSource.cs b/StgSharp.Script/Express/ExpElmentSource.cs index 39b91ee0..4e1add85 100644 --- a/StgSharp.Script/Express/ExpElmentSource.cs +++ b/StgSharp.Script/Express/ExpElmentSource.cs @@ -39,20 +39,11 @@ namespace StgSharp.Script.Express public interface IExpElementSource : ITypeSource { - public ExpElementType ElementType - { - get; - } + public ExpElementType ElementType { get; } - IScriptSourceProvider SourceProvider - { - get; - } + IScriptSourceProvider SourceProvider { get; } - string Name - { - get; - } + string Name { get; } public void Analyse(); @@ -63,33 +54,23 @@ namespace StgSharp.Script.Express public abstract class ExpInstantiableElement : IExpElementSource { - private List _baseList = new List( - ), + private List _baseList = new List(), _derivationList = new List(); - public abstract ExpElementType ElementType - { - get; - } + public abstract ExpElementType ElementType { get; } public static ExpInstantiableElement Void { get => ExpVoidElement.Only; } - public abstract IScriptSourceProvider SourceProvider - { - get; - } + public abstract IScriptSourceProvider SourceProvider { get; } - public abstract string Name - { - get; - } + public abstract string Name { get; } public abstract void Analyse(); - public abstract ExpNode CreateInstanceNode(); + public abstract ExpNode CreateInstanceNode( Token t ); public bool IsConvertable( IExpElementSource targetType ) { @@ -124,14 +105,12 @@ namespace StgSharp.Script.Express return; } - public override ExpNode CreateInstanceNode() + public override ExpNode CreateInstanceNode( Token t ) { - return default!; + return ExpNode.Empty; } - public override bool TryGetMember( - string name, - out ExpNode memberNode ) + public override bool TryGetMember( string name, out ExpNode memberNode ) { memberNode = ExpNode.Empty; return false; @@ -144,20 +123,11 @@ namespace StgSharp.Script.Express public abstract class ExpImmutableElement : IExpElementSource { - public abstract ExpElementType ElementType - { - get; - } + public abstract ExpElementType ElementType { get; } - public abstract IScriptSourceProvider SourceProvider - { - get; - } + public abstract IScriptSourceProvider SourceProvider { get; } - public abstract string Name - { - get; - } + public abstract string Name { get; } public abstract void Analyse(); diff --git a/StgSharp.Script/Express/ExpSchemaSource.Compile.cs b/StgSharp.Script/Express/ExpSchemaSource.Compile.cs index 1eb0652a..950e0835 100644 --- a/StgSharp.Script/Express/ExpSchemaSource.Compile.cs +++ b/StgSharp.Script/Express/ExpSchemaSource.Compile.cs @@ -50,7 +50,8 @@ namespace StgSharp.Script.Express public ExpSchema Compile( ExpressCompileOption option ) { - switch( option ) { + switch( option ) + { case ExpressCompileOption.Default: return Compile_Translate( option ); case ExpressCompileOption.Translate: @@ -62,8 +63,7 @@ namespace StgSharp.Script.Express } } - internal GeneratedExpSchema Compile_Translate( - ExpressCompileOption option ) + internal GeneratedExpSchema Compile_Translate( ExpressCompileOption option ) { throw new NotImplementedException(); } diff --git a/StgSharp.Script/Express/ExpSyntaxAnalyzer.RepeatLoop.cs b/StgSharp.Script/Express/ExpSyntaxAnalyzer.RepeatLoop.cs new file mode 100644 index 00000000..f4ced073 --- /dev/null +++ b/StgSharp.Script/Express/ExpSyntaxAnalyzer.RepeatLoop.cs @@ -0,0 +1,257 @@ +//----------------------------------------------------------------------- +//----------------------------------------------------------------------- +// file="ExpSyntaxAnalyzer.RepeatLoop.cs" +// Project: StgSharp +// AuthorGroup: Nitload Space +// Copyright (c) Nitload Space. All rights reserved. +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the “Software”), to deal in the Software without restriction, +// including without limitation the rights to use, copy, modify, merge, +// publish, distribute, sublicense, and/or sell copies of the Software, +// and to permit persons to whom the Software is furnished to do so, +// subject to the following conditions: +// +// The above copyright notice and +// this permission notice shall be included in all copies +// or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED “AS IS”, +// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, +// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +// ARISING FROM, OUT OF OR IN CONNECTION WITH +// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// +//----------------------------------------------------------------------- +//----------------------------------------------------------------------- +using Microsoft.CodeAnalysis.CSharp.Syntax; + +using System; +using System.Collections.Generic; +using System.ComponentModel.Design.Serialization; +using System.Linq; +using System.Resources; +using System.Text; +using System.Threading; +using System.Threading.Tasks; + +using ExpKeyword = StgSharp.Script.Express.ExpressCompile.Keyword; + +namespace StgSharp.Script.Express +{ + public partial class ExpSyntaxAnalyzer + { + + private Dictionary _tempVariableInLoops { get; } + = new Dictionary(); + + private bool AppendToken_RepeatLoop( Token t ) + { + RepeatLoopState state = _cache.StateOfCurrentDepth(); + if( state == null ) + { + state = new RepeatLoopState( t ); + _cache.CurrentDepthMark.StateCache = state; + return true; + } + switch( state.CurrentState ) + { + case ExpKeyword.Repeat: + return TryParseRepeatVariable( state, t ); + case ExpKeyword.To: + return TryParseRepeatEnding( state, t ); + case ExpKeyword.By: + return TryParseRepeatVariable( state, t ); + case ExpKeyword.Until: + return TryParseRepeatUntilRegulation( state, t ); + case ExpKeyword.Assignment: + return TryParseRepeatBeginning( state, t ); + case ExpKeyword.While: + return TryParseRepeatWhileRegulation( state, t ); + case ExpKeyword.Semicolon: + if( t.Value != ExpKeyword.EndRepeat ) + { + AppendToken_common( t ); + return true; + } + break; + default: + AppendToken_common( t ); + return false; + } + ExpNode root = _cache.PackAllStatements(); + state.Body = root; + _cache.DecreaseDepth(); + root = ExpRepeatNode.Create( + state.Position, state.Body, state.Begin, state.End, state.IncrementVariable, + state.UntilExpression, state.WhileExpression ); + _cache.StatementsInDepth.Push( root ); + } + + private bool TryParseRepeatBeginning( RepeatLoopState state, Token t ) + { + switch( t.Value ) + { + case ExpKeyword.To: + state.CurrentState = ExpKeyword.To; + while( _cache.TryPopOperator( out Token op ) ) { + ConvertAndPushOneOperator( op ); + } + _cache.PopOperand( out _, out ExpNode? root ); + state.Begin = root; + return true; + default: + AppendToken_common( t ); + return true; + } + } + + private bool TryParseRepeatEnding( RepeatLoopState state, Token t ) + { + switch( t.Value ) + { + case ExpKeyword.By: + state.CurrentState = ExpKeyword.By; + break; + case ExpKeyword.Until: + state.CurrentState = ExpKeyword.Until; + break; + case ExpKeyword.While: + state.CurrentState = ExpKeyword.While; + break; + default: + AppendToken_common( t ); + return true; + } + while( _cache.TryPopOperator( out Token op ) ) { + ConvertAndPushOneOperator( op ); + } + _cache.PopOperand( out _, out ExpNode? root ); + state.End = root; + return true; + } + + private bool TryParseRepeatIncrement( RepeatLoopState state, Token t ) + { + switch( t.Value ) + { + case ExpKeyword.Semicolon: + state.CurrentState = ExpKeyword.Semicolon; + break; + case ExpKeyword.Until: + state.CurrentState = ExpKeyword.Until; + break; + case ExpKeyword.While: + state.CurrentState = ExpKeyword.While; + break; + default: + AppendToken_common( t ); + return true; + } + while( _cache.TryPopOperator( out Token op ) ) { + ConvertAndPushOneOperator( op ); + } + _cache.PopOperand( out _, out ExpNode? root ); + state.IncrementVariable = root; + return true; + } + + private bool TryParseRepeatUntilRegulation( RepeatLoopState state, Token t ) + { + switch( t.Value ) + { + case ExpKeyword.Semicolon: + state.CurrentState = ExpKeyword.Semicolon; + break; + default: + AppendToken_common( t ); + return true; + } + while( _cache.TryPopOperator( out Token op ) ) { + ConvertAndPushOneOperator( op ); + } + _cache.PopOperand( out _, out ExpNode? root ); + state.UntilExpression = root; + return true; + } + + private bool TryParseRepeatVariable( RepeatLoopState state, Token t ) + { + switch( t.Value ) + { + case ExpKeyword.Integer: + state.IncrementVariableType = ExpressCompile.ExpInt; + return true; + case + ExpKeyword.Real: + state.IncrementVariableType = ExpressCompile.ExpReal; + return true; + case ExpKeyword.Assignment: + state.CurrentState = ExpKeyword.Assignment; + return true; + default: + if( ExpTypeSource.IsNullOrVoid( state.IncrementVariableType ) ) + { + throw new ExpInvalidTypeException( "Numerical", t.Value ); + } else + { + state.IncrementVariable = state.IncrementVariableType + .CreateInstanceNode( t ); + return true; + } + } + } + + private bool TryParseRepeatWhileRegulation( RepeatLoopState state, Token t ) + { + switch( t.Value ) + { + case ExpKeyword.Until: + state.CurrentState = ExpKeyword.Until; + break; + default: + AppendToken_common( t ); + return true; + } + while( _cache.TryPopOperator( out Token op ) ) { + ConvertAndPushOneOperator( op ); + } + _cache.PopOperand( out _, out ExpNode? root ); + state.WhileExpression = root; + return true; + } + + private class RepeatLoopState : ICompileDepthState + { + + public RepeatLoopState( Token t ) + { + Position = t; + } + + public ExpNode IncrementVariable { get; set; } + + public ExpNode Begin { get; set; } + + public ExpNode End { get; set; } + + public ExpNode UntilExpression { get; set; } + + public ExpNode WhileExpression { get; set; } + + public ExpNode Body { get; set; } + + public ExpTypeSource IncrementVariableType { get; set; } + + public string CurrentState { get; set; } + + public Token Position { get; set; } + + } + + } +} diff --git a/StgSharp.Script/Express/ExpSyntaxAnalyzer.TokenSpliter.cs b/StgSharp.Script/Express/ExpSyntaxAnalyzer.TokenSpliter.cs index 48f8b68d..1bf28d40 100644 --- a/StgSharp.Script/Express/ExpSyntaxAnalyzer.TokenSpliter.cs +++ b/StgSharp.Script/Express/ExpSyntaxAnalyzer.TokenSpliter.cs @@ -28,6 +28,8 @@ // //----------------------------------------------------------------------- //----------------------------------------------------------------------- +using Microsoft.CodeAnalysis.CSharp.Syntax; + using System; using System.Collections.Generic; using System.Linq; @@ -102,6 +104,9 @@ namespace StgSharp.Script.Express if( TryParseInstance( t ) ) { return true; } + if( TryParseKeyword( t ) ) { + return true; + } //Many thing miss here @@ -230,9 +235,26 @@ namespace StgSharp.Script.Express { _cache.PushOperand( ExpInstanceReferenceNode.MakeReferenceFrom( t, instance ) ); return true; + } else if( _tempVariableInLoops.TryGetValue( t.Value, out instance ) ) { + _cache.PushOperand( ExpInstanceReferenceNode.MakeReferenceFrom( t, instance ) ); } return false; } + private bool TryParseKeyword( Token t ) + { + switch( t.Value ) + { + case ExpKeyword.Return: + _cache.PushOperator( t ); + return true; + case ExpKeyword.Skip: + _cache.PushOperand( ExpProcedureControlNode.Skip( t ) ); + return true; + default: + return false; + } + } + } } diff --git a/StgSharp.Script/obj/x64/Debug/net8.0/StgSharp.Script.AssemblyInfo.cs b/StgSharp.Script/obj/x64/Debug/net8.0/StgSharp.Script.AssemblyInfo.cs index 3fd63c86..3f57f3e0 100644 --- a/StgSharp.Script/obj/x64/Debug/net8.0/StgSharp.Script.AssemblyInfo.cs +++ b/StgSharp.Script/obj/x64/Debug/net8.0/StgSharp.Script.AssemblyInfo.cs @@ -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+17a226c20653a1c92f6a3b420d6388c31f6a8c1e")] +[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+1a1db3554b10ed4a707671695d5100eee621af75")] [assembly: System.Reflection.AssemblyProductAttribute("StgSharp.Script")] [assembly: System.Reflection.AssemblyTitleAttribute("StgSharp.Script")] [assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")] diff --git a/StgSharp.Script/obj/x64/Debug/net8.0/StgSharp.Script.sourcelink.json b/StgSharp.Script/obj/x64/Debug/net8.0/StgSharp.Script.sourcelink.json index 15b457c1..37e8070f 100644 --- a/StgSharp.Script/obj/x64/Debug/net8.0/StgSharp.Script.sourcelink.json +++ b/StgSharp.Script/obj/x64/Debug/net8.0/StgSharp.Script.sourcelink.json @@ -1 +1 @@ -{"documents":{"D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\内核源代码\\*":"https://raw.githubusercontent.com/Nitload-NSI/CCD_Github/17a226c20653a1c92f6a3b420d6388c31f6a8c1e/*"}} \ No newline at end of file +{"documents":{"D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\内核源代码\\*":"https://raw.githubusercontent.com/Nitload-NSI/CCD_Github/1a1db3554b10ed4a707671695d5100eee621af75/*"}} \ No newline at end of file