Daily update on 20250430-073804 by Nitload Youmu. Additional Message : full function of syntax analyze to STEP file
Signed-off-by: Nitload <YoumuLiu_NSI@whv0t.onmicrosoft.com>
This commit is contained in:
@@ -89,6 +89,8 @@ namespace StgSharp.Script
|
||||
get => _statementCache.Peek();
|
||||
}
|
||||
|
||||
public Stack<CompileDepthMark> DepthStack => _depthStack;
|
||||
|
||||
public void DecreaseDepth()
|
||||
{
|
||||
CompileDepthMark mark = _depthStack.Pop();
|
||||
@@ -110,9 +112,13 @@ namespace StgSharp.Script
|
||||
if( StatementsInDepth.Count == 0 ) {
|
||||
return TNode.Empty;
|
||||
}
|
||||
TNode first = StatementsInDepth.Peek();
|
||||
while( StatementsInDepth.Count > 0 ) {
|
||||
first.PrependNode( StatementsInDepth.Pop() );
|
||||
TNode end = StatementsInDepth.Peek();
|
||||
TNode first = end;
|
||||
while( StatementsInDepth.Count > 0 )
|
||||
{
|
||||
first = StatementsInDepth.Pop();
|
||||
end.PrependNode( first );
|
||||
end = first;
|
||||
}
|
||||
return first;
|
||||
}
|
||||
|
||||
@@ -69,7 +69,7 @@ namespace StgSharp.Script.Express
|
||||
Dot, Comma, Semicolon, Colon, Percent, Apostrophe,
|
||||
Backslash, IndexOf, RightBracket, LeftBrace,
|
||||
RightBrace, Pipe, LeftParen, RightParen, LeftAsterisk,
|
||||
Assignment, DoublePipe, ExpSymbole, CommentSingleLine,
|
||||
Assignment, DoublePipe, ExpSymbol, CommentSingleLine,
|
||||
CommentStart, CommentEnd, InstanceEqual, InstanceNotEqual
|
||||
];
|
||||
|
||||
@@ -342,7 +342,7 @@ namespace StgSharp.Script.Express
|
||||
public const string LeftAsterisk = "<*";
|
||||
public const string Assignment = ":=";
|
||||
public const string DoublePipe = "||";
|
||||
public const string ExpSymbole = "**";
|
||||
public const string ExpSymbol = "**";
|
||||
public const string CommentSingleLine = "--";
|
||||
public const string CommentStart = "(*";
|
||||
public const string CommentEnd = "*)";
|
||||
|
||||
@@ -54,7 +54,7 @@ namespace StgSharp.Script.Express
|
||||
|
||||
public override ExpElementType ElementType => ExpElementType.Function;
|
||||
|
||||
public IExpElementSource ReturningType { get; protected set; }
|
||||
public ExpInstantiableElement ReturningType { get; protected set; }
|
||||
|
||||
public override IScriptSourceProvider SourceProvider => _transmitter;
|
||||
|
||||
|
||||
@@ -69,7 +69,8 @@ namespace StgSharp.Script.Express
|
||||
ExpSyntaxNode right )
|
||||
{
|
||||
if( !left.IsNumber && !right.IsNumber ) {
|
||||
throw new ExpInvalidTypeException( "Number", left.EqualityTypeConvert.Name );
|
||||
throw new ExpInvalidTypeException( source, "Number",
|
||||
left.EqualityTypeConvert.Name );
|
||||
}
|
||||
bool isFloat =
|
||||
( left._nodeFlag | ExpNodeFlag.BuiltinType_Real ) == 0 || ( right._nodeFlag | ExpNodeFlag.BuiltinType_Real ) ==
|
||||
@@ -89,7 +90,7 @@ namespace StgSharp.Script.Express
|
||||
{
|
||||
if( left.EqualityTypeConvert != right.EqualityTypeConvert ) {
|
||||
throw new ExpInvalidTypeException(
|
||||
left.EqualityTypeConvert.Name, right.EqualityTypeConvert.Name );
|
||||
source, left.EqualityTypeConvert.Name, right.EqualityTypeConvert.Name );
|
||||
}
|
||||
return new ExpBinaryOperatorNode( source, left, right )
|
||||
{
|
||||
@@ -133,7 +134,7 @@ namespace StgSharp.Script.Express
|
||||
{
|
||||
if( right is not ExpMetaRefNode metaRef ) {
|
||||
throw new ExpInvalidTypeException(
|
||||
"<source of element>", right.EqualityTypeConvert.Name );
|
||||
source, "<source of element>", right.EqualityTypeConvert.Name );
|
||||
}
|
||||
return new ExpBinaryOperatorNode( source, left, right )
|
||||
{
|
||||
@@ -153,7 +154,8 @@ namespace StgSharp.Script.Express
|
||||
ExpSyntaxNode right )
|
||||
{
|
||||
if( !left.IsNumber && !right.IsNumber ) {
|
||||
throw new ExpInvalidTypeException( "Number", left.EqualityTypeConvert.Name );
|
||||
throw new ExpInvalidTypeException( source, "Number",
|
||||
left.EqualityTypeConvert.Name );
|
||||
}
|
||||
bool isFloat =
|
||||
( left._nodeFlag | ExpNodeFlag.BuiltinType_Real ) == 0 || ( right._nodeFlag | ExpNodeFlag.BuiltinType_Real ) ==
|
||||
@@ -173,7 +175,7 @@ namespace StgSharp.Script.Express
|
||||
{
|
||||
if( left.EqualityTypeConvert != right.EqualityTypeConvert ) {
|
||||
throw new ExpInvalidTypeException(
|
||||
left.EqualityTypeConvert.Name, right.EqualityTypeConvert.Name );
|
||||
source, left.EqualityTypeConvert.Name, right.EqualityTypeConvert.Name );
|
||||
}
|
||||
return new ExpBinaryOperatorNode( source, left, right )
|
||||
{
|
||||
@@ -189,7 +191,8 @@ namespace StgSharp.Script.Express
|
||||
ExpSyntaxNode right )
|
||||
{
|
||||
if( !left.IsNumber && !right.IsNumber ) {
|
||||
throw new ExpInvalidTypeException( "Number", left.EqualityTypeConvert.Name );
|
||||
throw new ExpInvalidTypeException( source, "Number",
|
||||
left.EqualityTypeConvert.Name );
|
||||
}
|
||||
return new ExpBinaryOperatorNode( source, left, right )
|
||||
{
|
||||
@@ -205,7 +208,8 @@ namespace StgSharp.Script.Express
|
||||
ExpSyntaxNode right )
|
||||
{
|
||||
if( !left.IsNumber && !right.IsNumber ) {
|
||||
throw new ExpInvalidTypeException( "Number", left.EqualityTypeConvert.Name );
|
||||
throw new ExpInvalidTypeException( source, "Number",
|
||||
left.EqualityTypeConvert.Name );
|
||||
}
|
||||
return new ExpBinaryOperatorNode( source, left, right )
|
||||
{
|
||||
@@ -221,7 +225,8 @@ namespace StgSharp.Script.Express
|
||||
ExpSyntaxNode right )
|
||||
{
|
||||
if( !left.IsNumber && !right.IsNumber ) {
|
||||
throw new ExpInvalidTypeException( "Number", left.EqualityTypeConvert.Name );
|
||||
throw new ExpInvalidTypeException( source, "Number",
|
||||
left.EqualityTypeConvert.Name );
|
||||
}
|
||||
bool isFloat =
|
||||
( left._nodeFlag | ExpNodeFlag.BuiltinType_Real ) == 0 || ( right._nodeFlag | ExpNodeFlag.BuiltinType_Real ) ==
|
||||
@@ -241,7 +246,7 @@ namespace StgSharp.Script.Express
|
||||
{
|
||||
if( left.EqualityTypeConvert != right.EqualityTypeConvert ) {
|
||||
throw new ExpInvalidTypeException(
|
||||
left.EqualityTypeConvert.Name, right.EqualityTypeConvert.Name );
|
||||
source, left.EqualityTypeConvert.Name, right.EqualityTypeConvert.Name );
|
||||
}
|
||||
return new ExpBinaryOperatorNode( source, left, right )
|
||||
{
|
||||
@@ -257,7 +262,8 @@ namespace StgSharp.Script.Express
|
||||
ExpSyntaxNode right )
|
||||
{
|
||||
if( !left.IsNumber && !right.IsNumber ) {
|
||||
throw new ExpInvalidTypeException( "Number", left.EqualityTypeConvert.Name );
|
||||
throw new ExpInvalidTypeException( source, "Number",
|
||||
left.EqualityTypeConvert.Name );
|
||||
}
|
||||
return new ExpBinaryOperatorNode( source, left, right )
|
||||
{
|
||||
@@ -273,7 +279,8 @@ namespace StgSharp.Script.Express
|
||||
ExpSyntaxNode right )
|
||||
{
|
||||
if( !left.IsNumber && !right.IsNumber ) {
|
||||
throw new ExpInvalidTypeException( "Number", left.EqualityTypeConvert.Name );
|
||||
throw new ExpInvalidTypeException( source, "Number",
|
||||
left.EqualityTypeConvert.Name );
|
||||
}
|
||||
bool isFloat =
|
||||
( left._nodeFlag | ExpNodeFlag.BuiltinType_Real ) == 0 || ( right._nodeFlag | ExpNodeFlag.BuiltinType_Real ) ==
|
||||
|
||||
@@ -67,7 +67,7 @@ namespace StgSharp.Script.Express
|
||||
{
|
||||
if( !indexExpression.IsNumber ) {
|
||||
throw new ExpInvalidTypeException(
|
||||
"Number", indexExpression.EqualityTypeConvert.Name );
|
||||
source, "Number", indexExpression.EqualityTypeConvert.Name );
|
||||
}
|
||||
return new ExpCollectionIndexNode( source, instance, indexExpression );
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ namespace StgSharp.Script.Express
|
||||
|
||||
public ExpFunctionSource FunctionCaller => _function;
|
||||
|
||||
public override ExpInstantiableElement EqualityTypeConvert => _function.;
|
||||
public override ExpInstantiableElement EqualityTypeConvert => _function.ReturningType;
|
||||
|
||||
public override ExpSyntaxNode Left => Empty;
|
||||
|
||||
|
||||
@@ -78,7 +78,7 @@ namespace StgSharp.Script.Express
|
||||
1, isLiteral: true );
|
||||
break;
|
||||
default:
|
||||
throw new ExpInvalidTypeException( "Int or Real", "otherwise" );
|
||||
throw new ExpInvalidTypeException( variable, "Int or Real", "otherwise" );
|
||||
}
|
||||
}
|
||||
_variable = variable;
|
||||
|
||||
@@ -58,7 +58,8 @@ namespace StgSharp.Script.Express
|
||||
public static ExpUnaryOperatorNode UnaryMinus( Token source, ExpSyntaxNode operand )
|
||||
{
|
||||
if( !operand.IsNumber ) {
|
||||
throw new ExpInvalidTypeException( "Number", operand.EqualityTypeConvert.Name );
|
||||
throw new ExpInvalidTypeException(
|
||||
source, "Number", operand.EqualityTypeConvert.Name );
|
||||
}
|
||||
bool isFloat =
|
||||
( operand._nodeFlag | ExpNodeFlag.BuiltinType_Real ) == 0;
|
||||
@@ -74,7 +75,7 @@ namespace StgSharp.Script.Express
|
||||
if( ( operand._nodeFlag | ( ExpNodeFlag.BuiltinType_Logic | ExpNodeFlag.BuiltinType_Logic ) ) ==
|
||||
0 ) {
|
||||
throw new ExpInvalidTypeException(
|
||||
"Bool or Logic", operand.EqualityTypeConvert.Name );
|
||||
source, "Bool or Logic", operand.EqualityTypeConvert.Name );
|
||||
}
|
||||
return new ExpUnaryOperatorNode( source )
|
||||
{
|
||||
@@ -86,7 +87,8 @@ namespace StgSharp.Script.Express
|
||||
public static ExpUnaryOperatorNode UnaryPlus( Token source, ExpSyntaxNode operand )
|
||||
{
|
||||
if( !operand.IsNumber ) {
|
||||
throw new ExpInvalidTypeException( "Number", operand.EqualityTypeConvert.Name );
|
||||
throw new ExpInvalidTypeException(
|
||||
source, "Number", operand.EqualityTypeConvert.Name );
|
||||
}
|
||||
bool isFloat =
|
||||
( operand._nodeFlag | ExpNodeFlag.BuiltinType_Real ) == 0;
|
||||
|
||||
@@ -42,8 +42,23 @@ namespace StgSharp.Script.Express
|
||||
public class ExpException : Exception
|
||||
{
|
||||
|
||||
private Token _pos;
|
||||
|
||||
public ExpException( string message ) : base( message ) { }
|
||||
|
||||
public ExpException( Token position, string message )
|
||||
: base( $"Express compile error at {position.Line}-{position.Column}:\n{message}" )
|
||||
{
|
||||
_pos = position;
|
||||
}
|
||||
|
||||
public ExpException( ExpSyntaxNode node, string message )
|
||||
: base(
|
||||
$"Express compile error at {node.Source.Line}-{node.Source.Column}:\n{message}" )
|
||||
{
|
||||
_pos = node._source;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public class ExpInvalidCharException : ExpException
|
||||
@@ -100,11 +115,17 @@ namespace StgSharp.Script.Express
|
||||
|
||||
}
|
||||
|
||||
public class ExpInvalidTypeException : InvalidCastException
|
||||
public class ExpInvalidTypeException : ExpException
|
||||
{
|
||||
|
||||
public ExpInvalidTypeException( string required, string provided )
|
||||
public ExpInvalidTypeException( ExpSyntaxNode node, string required, string provided )
|
||||
: base(
|
||||
node,
|
||||
$"Type {required} is required at position, but a {provided} instance is provided." ) { }
|
||||
|
||||
public ExpInvalidTypeException( Token t, string required, string provided )
|
||||
: base(
|
||||
t,
|
||||
$"Type {required} is required at position, but a {provided} instance is provided." ) { }
|
||||
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ namespace StgSharp.Script.Express
|
||||
_cache.StatementsInDepth.Push( statement );
|
||||
} else
|
||||
{
|
||||
ExpInvalidSyntaxException.ThrowNoOperator( rightSeparator );
|
||||
_cache.StatementsInDepth.Push( ExpSyntaxNode.Empty );
|
||||
}
|
||||
} else
|
||||
{
|
||||
|
||||
@@ -114,7 +114,7 @@ namespace StgSharp.Script.Express
|
||||
do
|
||||
{
|
||||
_lineCache = _provider.ReadLine( out _lineNum );
|
||||
} while (string.IsNullOrEmpty( _lineCache ));
|
||||
} while (string.IsNullOrEmpty( _lineCache ) && !_provider.IsEmpty);
|
||||
_current = 0;
|
||||
}
|
||||
if( _isReadingMultiLineComment )
|
||||
@@ -182,7 +182,7 @@ namespace StgSharp.Script.Express
|
||||
rest = match.Groups[ "rest" ].Index;
|
||||
_current = rest;
|
||||
_last = new(
|
||||
ExpressCompile.PoolString( source[ 1..( end - begin ) ] ), _lineNum,
|
||||
ExpressCompile.PoolString( source[ 0..( end - begin ) ] ), _lineNum,
|
||||
begin, TokenFlag.Member );
|
||||
return _last;
|
||||
} else
|
||||
@@ -236,21 +236,12 @@ namespace StgSharp.Script.Express
|
||||
throw new ExpInvalidCharException( '\"' );
|
||||
}
|
||||
case '(':
|
||||
cNext = source[ 1 ];
|
||||
if( cNext == '*' )
|
||||
{
|
||||
_isReadingMultiLineComment = true;
|
||||
_current += 2;
|
||||
goto readLine;
|
||||
} else
|
||||
{
|
||||
begin = _current;
|
||||
_current++;
|
||||
_last = new(
|
||||
ExpressCompile.PoolString( source[ ..1 ] ), _lineNum, begin,
|
||||
TokenFlag.Separator_Left );
|
||||
return _last;
|
||||
}
|
||||
begin = _current;
|
||||
_current++;
|
||||
_last = new(
|
||||
ExpressCompile.PoolString( source[ ..1 ] ), _lineNum, begin,
|
||||
TokenFlag.Separator_Left );
|
||||
return _last;
|
||||
case ')' or '}':
|
||||
begin = _current;
|
||||
_current++;
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// 此代码由工具生成。
|
||||
// 运行时版本:4.0.30319.42000
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// 对此文件的更改可能会导致不正确的行为,并且如果
|
||||
// 重新生成代码,这些更改将会丢失。
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
@@ -13,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+ccef0de6f686f94da655b0e7d854d0acaf907d04")]
|
||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+a6411e2f25010961d278c5bcb4a929e21b176bba")]
|
||||
[assembly: System.Reflection.AssemblyProductAttribute("StgSharp.Script")]
|
||||
[assembly: System.Reflection.AssemblyTitleAttribute("StgSharp.Script")]
|
||||
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
"restore":{"projectUniqueName":"D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\内核源代码\\StgSharp.Script\\StgSharp.Script.csproj","projectName":"StgSharp.Script","projectPath":"D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\内核源代码\\StgSharp.Script\\StgSharp.Script.csproj","outputPath":"D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\内核源代码\\StgSharp.Script\\obj\\","projectStyle":"PackageReference","fallbackFolders":["C:\\Program Files (x86)\\Microsoft Visual Studio\\Shared\\NuGetPackages"],"originalTargetFrameworks":["net8.0"],"sources":{"C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\":{},"C:\\Program Files\\dotnet\\library-packs":{},"https://api.nuget.org/v3/index.json":{}},"frameworks":{"net8.0":{"targetAlias":"net8.0","projectReferences":{"D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\内核源代码\\StgSharp.Common\\StgSharp.Common.csproj":{"projectPath":"D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\内核源代码\\StgSharp.Common\\StgSharp.Common.csproj"}}}},"warningProperties":{"warnAsError":["NU1605"]},"restoreAuditProperties":{"enableAudit":"true","auditLevel":"low","auditMode":"direct"}}"frameworks":{"net8.0":{"targetAlias":"net8.0","dependencies":{"CommunityToolkit.HighPerformance":{"target":"Package","version":"[8.4.0, )"},"Microsoft.CodeAnalysis.CSharp":{"target":"Package","version":"[4.13.0, )"}},"imports":["net461","net462","net47","net471","net472","net48","net481"],"assetTargetFallback":true,"warn":true,"frameworkReferences":{"Microsoft.NETCore.App":{"privateAssets":"all"}},"runtimeIdentifierGraphPath":"C:\\Program Files\\dotnet\\sdk\\8.0.400/PortableRuntimeIdentifierGraph.json"}}
|
||||
@@ -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+b618fdf7b5295b190dcc6b7168e038d1d5a11455")]
|
||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+a6411e2f25010961d278c5bcb4a929e21b176bba")]
|
||||
[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/b618fdf7b5295b190dcc6b7168e038d1d5a11455/*"}}
|
||||
{"documents":{"D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\内核源代码\\*":"https://raw.githubusercontent.com/Nitload-NSI/CCD_Github/a6411e2f25010961d278c5bcb4a929e21b176bba/*"}}
|
||||
Reference in New Issue
Block a user