Remove hook concept

This commit is contained in:
nub31
2025-10-02 14:23:09 +02:00
parent 51b0cbde72
commit f937482c3d
6 changed files with 11 additions and 83 deletions

View File

@@ -198,19 +198,13 @@ public sealed class Parser
{
var memberStartIndex = _tokenIndex;
string? hook = null;
if (TryExpectSymbol(Symbol.At))
{
hook = ExpectIdentifier().Value;
}
if (TryExpectSymbol(Symbol.Func))
{
var funcName = ExpectIdentifier().Value;
var funcSignature = ParseFuncSignature();
var funcBody = ParseBlock();
funcs.Add(new StructFuncSyntax(GetTokens(memberStartIndex), funcName, hook, funcSignature, funcBody));
funcs.Add(new StructFuncSyntax(GetTokens(memberStartIndex), funcName, funcSignature, funcBody));
}
else
{

View File

@@ -14,7 +14,7 @@ public record FuncSyntax(List<Token> Tokens, string Name, bool Exported, string?
public record StructFieldSyntax(List<Token> Tokens, string Name, TypeSyntax Type, ExpressionSyntax? Value) : SyntaxNode(Tokens);
public record StructFuncSyntax(List<Token> Tokens, string Name, string? Hook, FuncSignatureSyntax Signature, BlockSyntax Body) : SyntaxNode(Tokens);
public record StructFuncSyntax(List<Token> Tokens, string Name, FuncSignatureSyntax Signature, BlockSyntax Body) : SyntaxNode(Tokens);
public record StructSyntax(List<Token> Tokens, string Name, bool Exported, List<StructFieldSyntax> Fields, List<StructFuncSyntax> Functions) : DefinitionSyntax(Tokens, Name, Exported);