Clean up cast syntax and rules

This commit is contained in:
nub31
2025-10-23 21:39:24 +02:00
parent a7c45784b9
commit 9f91e42d63
6 changed files with 142 additions and 145 deletions

View File

@@ -508,7 +508,7 @@ public sealed class Parser
{
var type = ParseType();
ExpectSymbol(Symbol.CloseParen);
return new SizeBuiltinSyntax(GetTokens(startIndex), type);
return new SizeSyntax(GetTokens(startIndex), type);
}
case "interpret":
{
@@ -516,15 +516,13 @@ public sealed class Parser
ExpectSymbol(Symbol.Comma);
var expression = ParseExpression();
ExpectSymbol(Symbol.CloseParen);
return new InterpretBuiltinSyntax(GetTokens(startIndex), type, expression);
return new InterpretSyntax(GetTokens(startIndex), type, expression);
}
case "floatToInt":
case "cast":
{
var type = ParseType();
ExpectSymbol(Symbol.Comma);
var expression = ParseExpression();
ExpectSymbol(Symbol.CloseParen);
return new FloatToIntBuiltinSyntax(GetTokens(startIndex), type, expression);
return new CastSyntax(GetTokens(startIndex), expression);
}
default:
{