Daily update on 20250410-000303 by Nitload Youmu. Additional Message : adding support to type operation, to operate
Signed-off-by: Nitload <YoumuLiu_NSI@whv0t.onmicrosoft.com>
This commit is contained in:
@@ -0,0 +1,64 @@
|
|||||||
|
//-----------------------------------------------------------------------
|
||||||
|
//-----------------------------------------------------------------------
|
||||||
|
// file="ExpProcedure.cs"
|
||||||
|
// Project: StgSharp
|
||||||
|
// AuthorGroup: Nitload Space
|
||||||
|
// Copyright (c) Nitload Space. All rights reserved.
|
||||||
|
//
|
||||||
|
// Permission is hereby granted, free of charge, to any person
|
||||||
|
// obtaining a copy of this software and associated documentation
|
||||||
|
// files (the “Software”), to deal in the Software without restriction,
|
||||||
|
// including without limitation the rights to use, copy, modify, merge,
|
||||||
|
// publish, distribute, sublicense, and/or sell copies of the Software,
|
||||||
|
// and to permit persons to whom the Software is furnished to do so,
|
||||||
|
// subject to the following conditions:
|
||||||
|
//
|
||||||
|
// The above copyright notice and
|
||||||
|
// this permission notice shall be included in all copies
|
||||||
|
// or substantial portions of the Software.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED “AS IS”,
|
||||||
|
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||||
|
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||||
|
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||||
|
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||||
|
// ARISING FROM, OUT OF OR IN CONNECTION WITH
|
||||||
|
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
//
|
||||||
|
//-----------------------------------------------------------------------
|
||||||
|
//-----------------------------------------------------------------------
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace StgSharp.Script.Express
|
||||||
|
{
|
||||||
|
public class ExpProcedure : ExpImmutableElement
|
||||||
|
{
|
||||||
|
|
||||||
|
public override ExpElementType ElementType => ExpElementType.Procedure;
|
||||||
|
|
||||||
|
public override IScriptSourceProvider SourceProvider => throw new NotImplementedException();
|
||||||
|
|
||||||
|
public override string Name => throw new NotImplementedException();
|
||||||
|
|
||||||
|
public override void Analyse()
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
public override ExpNode MakeReference( params object[] options )
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
public override bool TryGetMember( string name, out ExpNode memberNode )
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -89,6 +89,23 @@ namespace StgSharp.Script.Express
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static ExpBinaryOperatorNode ConvertElement( Token source, ExpNode left, ExpNode right )
|
||||||
|
{
|
||||||
|
if( right is not ExpMetaRefNode metaref ) {
|
||||||
|
throw new ExpInvalidTypeException( "<source of element>", right.EqualityTypeConvert.Name );
|
||||||
|
}
|
||||||
|
return new ExpBinaryOperatorNode( source, left, right )
|
||||||
|
{
|
||||||
|
_returnType = metaref.SourceRef,
|
||||||
|
_nodeFlag = ExpNodeFlag.Operator_Binary,
|
||||||
|
/*
|
||||||
|
* 0. instance to convert
|
||||||
|
* 1. target type
|
||||||
|
*/
|
||||||
|
CodeConvertTemplate = @"({0} as {1})"
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
public static ExpBinaryOperatorNode Div( Token source, ExpNode left, ExpNode right )
|
public static ExpBinaryOperatorNode Div( Token source, ExpNode left, ExpNode right )
|
||||||
{
|
{
|
||||||
if( !left.IsNumber && !right.IsNumber ) {
|
if( !left.IsNumber && !right.IsNumber ) {
|
||||||
|
|||||||
@@ -0,0 +1,74 @@
|
|||||||
|
//-----------------------------------------------------------------------
|
||||||
|
//-----------------------------------------------------------------------
|
||||||
|
// file="ExpCallProcedureNode.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.CompilerServices;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace StgSharp.Script.Express
|
||||||
|
{
|
||||||
|
public class ExpCallProcedureNode : ExpNode
|
||||||
|
{
|
||||||
|
|
||||||
|
private ExpNode _params;
|
||||||
|
|
||||||
|
public ExpCallProcedureNode( Token source, ExpProcedure caller, ExpNode param ) : base( source )
|
||||||
|
{
|
||||||
|
_params = param;
|
||||||
|
CalledProcedure = caller;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override ExpNode Left => Empty;
|
||||||
|
|
||||||
|
public override ExpNode Right => _params;
|
||||||
|
|
||||||
|
public ExpProcedure CalledProcedure { get; init; }
|
||||||
|
|
||||||
|
public override IExpElementSource EqualityTypeConvert => ExpInstantiableElement.Void;
|
||||||
|
|
||||||
|
public static ExpCallProcedureNode CallProcedure( Token postion, ExpProcedure caller, ExpNode input )
|
||||||
|
{
|
||||||
|
ExpCallProcedureNode node = new ExpCallProcedureNode( postion, caller, input )
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
* 0. parameters
|
||||||
|
*/
|
||||||
|
CodeConvertTemplate = $$"""
|
||||||
|
{{caller.Name}}( {0} )
|
||||||
|
"""
|
||||||
|
};
|
||||||
|
return node;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,83 @@
|
|||||||
|
//-----------------------------------------------------------------------
|
||||||
|
//-----------------------------------------------------------------------
|
||||||
|
// file="ExpMetaRefNode.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;
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace StgSharp.Script.Express
|
||||||
|
{
|
||||||
|
public class ExpMetaRefNode : ExpNode
|
||||||
|
{
|
||||||
|
|
||||||
|
internal ExpMetaRefNode( Token source, ExpInstantiableElement element ) : base( source )
|
||||||
|
{
|
||||||
|
SourceRef = element;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ExpInstantiableElement SourceRef { get; init; }
|
||||||
|
|
||||||
|
public override ExpNode Left => Empty;
|
||||||
|
|
||||||
|
public override ExpNode 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}" );
|
||||||
|
}
|
||||||
|
ExpMetaRefNode node = new ExpMetaRefNode( position, entity )
|
||||||
|
{
|
||||||
|
CodeConvertTemplate = entity.Name,
|
||||||
|
};
|
||||||
|
return node;
|
||||||
|
}
|
||||||
|
|
||||||
|
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}" );
|
||||||
|
}
|
||||||
|
ExpMetaRefNode node = new ExpMetaRefNode( position, type )
|
||||||
|
{
|
||||||
|
CodeConvertTemplate = type.Name,
|
||||||
|
};
|
||||||
|
;
|
||||||
|
return node;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,281 @@
|
|||||||
|
//-----------------------------------------------------------------------
|
||||||
|
//-----------------------------------------------------------------------
|
||||||
|
// file="ExpSyntaxAnalyzer.Common.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.Runtime.CompilerServices;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Xml.Schema;
|
||||||
|
|
||||||
|
using ExpKeyword = StgSharp.Script.Express.ExpressCompile.Keyword;
|
||||||
|
|
||||||
|
namespace StgSharp.Script.Express
|
||||||
|
{
|
||||||
|
public partial class ExpSyntaxAnalyzer
|
||||||
|
{
|
||||||
|
|
||||||
|
private bool IsSeparatorMatch( Token leftSperator, Token rightSeparator )
|
||||||
|
{
|
||||||
|
return leftSperator.Value switch
|
||||||
|
{
|
||||||
|
ExpKeyword.LeftBrace => rightSeparator.Value == ExpKeyword.RightBrace,
|
||||||
|
ExpKeyword.LeftParen => rightSeparator.Value == ExpKeyword.RightParen,
|
||||||
|
ExpKeyword.Comma => rightSeparator.Value == ExpKeyword.Comma,
|
||||||
|
ExpKeyword.Semicolon => rightSeparator.Value == ExpKeyword.Semicolon,
|
||||||
|
_ => false
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool TryAppendIndexLeft( Token t )
|
||||||
|
{
|
||||||
|
if( t.Flag != TokenFlag.Index_Left ) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if( _cache.TryPeekOperand( out bool isNode, out _, out ExpNode? node ) )
|
||||||
|
{
|
||||||
|
if( node.EqualityTypeConvert is not ExpCollectionBase ) {
|
||||||
|
ExpInvalidSyntaxException.ThrowNonCollectionIndex( t );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_cache.PushOperator( t );
|
||||||
|
_cache.IncreaseDepth( ( int )ExpCompileStateCode.CollectionIndex );
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool TryAppendIndexRight( Token t )
|
||||||
|
{
|
||||||
|
if( t.Flag != TokenFlag.Index_Right ) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
//reverse building
|
||||||
|
ClosePrefixReverse( t );
|
||||||
|
|
||||||
|
//make index node
|
||||||
|
_cache.PopOperand( out _, out ExpNode? expNode );
|
||||||
|
if( !_cache.PopOperand( out Token colleToken, out ExpNode? colleNode ) ) { }
|
||||||
|
_cache.PushOperand(
|
||||||
|
ExpCollectionIndexNode.Create(
|
||||||
|
t, ( colleNode as ExpCollectionInstanceBase )!, expNode ) );
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool TryAppendMember( Token t )
|
||||||
|
{
|
||||||
|
if( t.Flag != TokenFlag.Member ) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if( TryParseConstant( t ) ) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if( TryParseFunction( t ) ) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if( TryParseInstance( t ) ) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if( TryParseKeyword( t ) ) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if( TryParseElementName( t ) ) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Many thing miss here
|
||||||
|
|
||||||
|
_cache.PushOperand( ExpElementMemberNameNode.Create( t ) );
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool TryAppendMiddleSeparator( Token t )
|
||||||
|
{
|
||||||
|
if( t.Flag != TokenFlag.Separator_Middle ) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
while( _cache.OperatorAheadOfDepth > 0 )
|
||||||
|
{
|
||||||
|
_cache.TryPopOperator( out Token op );
|
||||||
|
ExpNode node = ConvertAndPushOneOperator( op );
|
||||||
|
}
|
||||||
|
switch( _cache.OperandAheadOfDepth )
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
if( t.Value == ";" ) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
_cache.StatementsInDepth.Push( ExpNode.Empty );
|
||||||
|
goto case 1;
|
||||||
|
case 1:
|
||||||
|
_cache.PopOperand( out _, out ExpNode? statement );
|
||||||
|
_cache.StatementsInDepth.Push( statement );
|
||||||
|
return true;
|
||||||
|
default:
|
||||||
|
ExpInvalidSyntaxException.ThrowNoOperator( t );
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool TryAppendNumAndStrLiteral( Token t )
|
||||||
|
{
|
||||||
|
if( ( t.Flag & ( TokenFlag.String | TokenFlag.Number ) ) == 0 ) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
_cache.PushOperand( ExpElementInstance.CreateLiteral( t ) );
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool TryAppendPrefixSeparator( Token t )
|
||||||
|
{
|
||||||
|
if( t.Flag != TokenFlag.Separator_Left ) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
_cache.PushOperator( t );
|
||||||
|
_cache.IncreaseDepth( ( int )ExpCompileStateCode.Common );
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool TryAppendPrefixSeparatorEnd( Token t )
|
||||||
|
{
|
||||||
|
if( t.Flag != TokenFlag.Separator_Right ) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
ClosePrefixReverse( t );
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool TryAppendSymbol( Token t )
|
||||||
|
{
|
||||||
|
if( ( t.Flag & ( TokenFlag.Symbol_Unary | TokenFlag.Symbol_Binary ) ) == 0 ) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
int cmp = -1;
|
||||||
|
processPrecedence:
|
||||||
|
if( _cache.TryPeekOperator( out Token tmp ) )
|
||||||
|
{
|
||||||
|
cmp = CompareOperatorPrecedence( t, tmp );
|
||||||
|
if( cmp >= 0 )
|
||||||
|
{
|
||||||
|
_cache.PopOperator();
|
||||||
|
ExpNode node = ConvertAndPushOneOperator( tmp );
|
||||||
|
goto processPrecedence;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_cache.PushOperator( t );
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool TryParseConstant( Token t )
|
||||||
|
{
|
||||||
|
switch( t.Value )
|
||||||
|
{
|
||||||
|
case ExpKeyword.E:
|
||||||
|
_cache.PushOperand( new ExpRealNumberNode( t, MathF.E, true ) );
|
||||||
|
return true;
|
||||||
|
case ExpKeyword.Pi:
|
||||||
|
_cache.PushOperand( new ExpRealNumberNode( t, MathF.PI, true ) );
|
||||||
|
return true;
|
||||||
|
default:
|
||||||
|
if( ExpElementInstance.TryCreateLiteral( t, out ExpElementInstance? node ) )
|
||||||
|
{
|
||||||
|
_cache.PushOperand( node );
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool TryParseElementName( Token t )
|
||||||
|
{
|
||||||
|
if( _context.TryGetType( t.Value, out ExpTypeSource? type ) )
|
||||||
|
{
|
||||||
|
_cache.PushOperand( ExpMetaRefNode.RefType( t, type ) );
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if( _context.TryGetEntity( t.Value, out ExpEntitySource? entity ) )
|
||||||
|
{
|
||||||
|
_cache.PushOperand( ExpMetaRefNode.RefEntity( t, entity ) );
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool TryParseFunction( Token t )
|
||||||
|
{
|
||||||
|
if( ExpKeyword.BuiltinFunctions.Contains( t.Value ) )
|
||||||
|
{
|
||||||
|
_cache.PushOperator( t );
|
||||||
|
return true;
|
||||||
|
} else if( _context.TryGetFunction( t.Value, out ExpFunctionSource? f ) )
|
||||||
|
{
|
||||||
|
_cache.PushOperand( t );
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool TryParseInstance( Token t )
|
||||||
|
{
|
||||||
|
if( _local.TryGetMember( t.Value,
|
||||||
|
out ExpNode? node ) && node is ExpElementInstance instance )
|
||||||
|
{
|
||||||
|
_cache.PushOperand( ExpInstanceReferenceNode.MakeReferenceFrom( t, instance ) );
|
||||||
|
return true;
|
||||||
|
} else if( _tempVariableInLoops.TryGetValue( t.Value, out instance! ) )
|
||||||
|
{
|
||||||
|
_cache.PushOperand( ExpInstanceReferenceNode.MakeReferenceFrom( t, instance ) );
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -14,7 +14,7 @@ using System.Reflection;
|
|||||||
[assembly: System.Reflection.AssemblyCompanyAttribute("StgSharp.Script")]
|
[assembly: System.Reflection.AssemblyCompanyAttribute("StgSharp.Script")]
|
||||||
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
||||||
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
||||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+d270b6b1f8220e14d01610bd55f11c0b4908af39")]
|
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+7b7b5ee475ba81a574fedf4772a213a798ba4c27")]
|
||||||
[assembly: System.Reflection.AssemblyProductAttribute("StgSharp.Script")]
|
[assembly: System.Reflection.AssemblyProductAttribute("StgSharp.Script")]
|
||||||
[assembly: System.Reflection.AssemblyTitleAttribute("StgSharp.Script")]
|
[assembly: System.Reflection.AssemblyTitleAttribute("StgSharp.Script")]
|
||||||
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
[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/d270b6b1f8220e14d01610bd55f11c0b4908af39/*"}}
|
{"documents":{"D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\内核源代码\\*":"https://raw.githubusercontent.com/Nitload-NSI/CCD_Github/7b7b5ee475ba81a574fedf4772a213a798ba4c27/*"}}
|
||||||
Reference in New Issue
Block a user