From 237a05a2fcba5713093d169526ffb60a77882acc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Motiejus=20Jak=C5=A1tys?= Date: Wed, 11 Feb 2026 13:21:34 +0000 Subject: [PATCH] sort forward declarations by name --- parser.c | 122 +++++++++++++++++++++++++++---------------------------- 1 file changed, 61 insertions(+), 61 deletions(-) diff --git a/parser.c b/parser.c index 8e255e2aab..a2d643126c 100644 --- a/parser.c +++ b/parser.c @@ -48,79 +48,79 @@ typedef struct { AstNodeIndex bit_range_end; } PtrModifiers; -static CleanupScratch initCleanupScratch(Parser*); -static void cleanupScratch(CleanupScratch*); -static AstSubRange listToSpan(Parser*, const AstNodeIndex*, uint32_t); -static AstSubRange membersToSpan(const Members, Parser*); -static AstTokenIndex nextToken(Parser*); -static AstTokenIndex eatToken(Parser*, TokenizerTag); -static AstTokenIndex assertToken(Parser*, TokenizerTag); -static bool tokensOnSameLine(Parser*, AstTokenIndex, AstTokenIndex); -static AstTokenIndex eatDocComments(Parser*); -static AstNodeIndex setNode(Parser*, uint32_t, AstNodeItem); -static void astNodeListEnsureCapacity(AstNodeList*, uint32_t); -static AstNodeIndex addNode(AstNodeList*, AstNodeItem); static AstNodeIndex addExtra(Parser*, const AstNodeIndex*, uint32_t); -static AstNodeIndex parseByteAlign(Parser*); -static AstNodeIndex parseAddrSpace(Parser*); -static AstNodeIndex parseLinkSection(Parser*); -static AstNodeIndex parseCallconv(Parser*); +static AstNodeIndex addNode(AstNodeList*, AstNodeItem); +static AstNodeTag assignOpTag(TokenizerTag); +static AstTokenIndex assertToken(Parser*, TokenizerTag); +static void astNodeListEnsureCapacity(AstNodeList*, uint32_t); +static void cleanupScratch(CleanupScratch*); +static AstTokenIndex eatDocComments(Parser*); +static AstTokenIndex eatToken(Parser*, TokenizerTag); +static AstNodeIndex expectBlockExprStatement(Parser*); static AstNodeIndex expectContainerField(Parser*); -static AstNodeIndex parseBuiltinCall(Parser*); -static AstNodeIndex parseContainerDeclAuto(Parser*); -static AstNodeIndex parsePrimaryTypeExpr(Parser*); -static AstNodeIndex parseSuffixOp(Parser*, AstNodeIndex); -static AstNodeIndex parseSuffixExpr(Parser*); -static AstTokenIndex expectToken(Parser*, TokenizerTag); +static AstNodeIndex expectExpr(Parser*); static AstNodeIndex expectSemicolon(Parser*); -static AstNodeIndex parseErrorUnionExpr(Parser*); -static PtrModifiers parsePtrModifiers(Parser*); +static AstNodeIndex expectStatement(Parser*, bool); +static AstTokenIndex expectToken(Parser*, TokenizerTag); +static AstNodeIndex expectTopLevelDecl(Parser*); +static AstNodeIndex expectVarDeclExprStatement(Parser*, AstTokenIndex); +static void findNextContainerMember(Parser*); +static AstNodeIndex finishAssignExpr(Parser*, AstNodeIndex); +static uint32_t forPrefix(Parser*); +static CleanupScratch initCleanupScratch(Parser*); +static AstSubRange listToSpan(Parser*, const AstNodeIndex*, uint32_t); static AstNodeIndex makePtrTypeNode( Parser*, AstTokenIndex, AstNodeIndex, PtrModifiers, AstNodeIndex); -static AstNodeIndex parseTypeExpr(Parser*); -static uint32_t reserveNode(Parser*, AstNodeTag); -static AstNodeIndex parseFnProto(Parser*); +static AstSubRange membersToSpan(const Members, Parser*); +static AstTokenIndex nextToken(Parser*); +static AstNodeIndex parseAddrSpace(Parser*); +static AstNodeIndex parseAsmExpr(Parser*); +static AstNodeIndex parseAsmInputItem(Parser*); +static AstNodeIndex parseAsmOutputItem(Parser*); +static AstNodeIndex parseAssignExpr(Parser*); +static AstNodeIndex parseBlock(Parser*); +static AstNodeIndex parseBlockExpr(Parser*); static AstTokenIndex parseBlockLabel(Parser*); -static uint32_t forPrefix(Parser*); +static AstTokenIndex parseBreakLabel(Parser*); +static AstNodeIndex parseBuiltinCall(Parser*); +static AstNodeIndex parseByteAlign(Parser*); +static AstNodeIndex parseCallconv(Parser*); +static AstNodeIndex parseContainerDeclAuto(Parser*); +static Members parseContainerMembers(Parser*); +static AstNodeIndex parseCurlySuffixExpr(Parser*); +static AstNodeIndex parseErrorUnionExpr(Parser*); +static AstNodeIndex parseExpr(Parser*); +static AstNodeIndex parseExprPrecedence(Parser*, int32_t); +static AstNodeIndex parseFieldInit(Parser*); +static AstNodeIndex parseFnProto(Parser*); static AstNodeIndex parseForExpr(Parser*); static AstNodeIndex parseForStatement(Parser*); +static AstNodeIndex parseGlobalVarDecl(Parser*); +static AstNodeIndex parseIfExpr(Parser*); +static AstNodeIndex parseInitList(Parser*, AstNodeIndex, AstTokenIndex); +static AstNodeIndex parseLabeledStatement(Parser*); +static AstNodeIndex parseLinkSection(Parser*); +static AstNodeIndex parseLoopStatement(Parser*); +static void parsePayload(Parser*); +static AstNodeIndex parsePrefixExpr(Parser*); +static AstNodeIndex parsePrimaryExpr(Parser*); +static AstNodeIndex parsePrimaryTypeExpr(Parser*); +static PtrModifiers parsePtrModifiers(Parser*); +static void parsePtrPayload(Parser*); +static AstNodeIndex parseSuffixExpr(Parser*); +static AstNodeIndex parseSuffixOp(Parser*, AstNodeIndex); +static AstNodeIndex parseSwitchExpr(Parser*); +static AstNodeIndex parseSwitchItem(Parser*); +static AstNodeIndex parseSwitchProng(Parser*); +static AstNodeIndex parseTypeExpr(Parser*); +static AstNodeIndex parseVarDeclProto(Parser*); static AstNodeIndex parseWhileContinueExpr(Parser*); static AstNodeIndex parseWhileExpr(Parser*); static AstNodeIndex parseWhileStatement(Parser*); -static AstNodeIndex parseLoopStatement(Parser*); -static AstNodeIndex parseVarDeclProto(Parser*); -static AstTokenIndex parseBreakLabel(Parser*); -static AstNodeIndex parseFieldInit(Parser*); -static AstNodeIndex parseInitList(Parser*, AstNodeIndex, AstTokenIndex); -static AstNodeIndex parseCurlySuffixExpr(Parser*); +static uint32_t reserveNode(Parser*, AstNodeTag); +static AstNodeIndex setNode(Parser*, uint32_t, AstNodeItem); static uint32_t tokenTagLexemeLen(TokenizerTag); -static AstNodeIndex parseExprPrecedence(Parser*, int32_t); -static AstNodeIndex parseExpr(Parser*); -static AstNodeIndex expectExpr(Parser*); -static AstNodeIndex parseAsmOutputItem(Parser*); -static AstNodeIndex parseAsmInputItem(Parser*); -static AstNodeIndex parseAsmExpr(Parser*); -static AstNodeIndex parseSwitchItem(Parser*); -static AstNodeIndex parseSwitchProng(Parser*); -static AstNodeIndex parseSwitchExpr(Parser*); -static void parsePtrPayload(Parser*); -static void parsePayload(Parser*); -static AstNodeIndex parseIfExpr(Parser*); -static AstNodeIndex parsePrimaryExpr(Parser*); -static AstNodeIndex parsePrefixExpr(Parser*); -static AstNodeTag assignOpTag(TokenizerTag); -static AstNodeIndex finishAssignExpr(Parser*, AstNodeIndex); -static AstNodeIndex parseAssignExpr(Parser*); -static AstNodeIndex parseBlockExpr(Parser*); -static AstNodeIndex expectBlockExprStatement(Parser*); -static AstNodeIndex expectVarDeclExprStatement(Parser*, AstTokenIndex); -static AstNodeIndex expectStatement(Parser*, bool); -static AstNodeIndex parseBlock(Parser*); -static AstNodeIndex parseLabeledStatement(Parser*); -static AstNodeIndex parseGlobalVarDecl(Parser*); -static AstNodeIndex expectTopLevelDecl(Parser*); -static void findNextContainerMember(Parser*); -static Members parseContainerMembers(Parser*); +static bool tokensOnSameLine(Parser*, AstTokenIndex, AstTokenIndex); static CleanupScratch initCleanupScratch(Parser* p) { return (CleanupScratch) {