sort forward declarations by name

This commit is contained in:
2026-02-11 13:21:34 +00:00
parent 5bd533d40c
commit 237a05a2fc

122
parser.c
View File

@@ -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) {