zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

commit 237a05a2fcba5713093d169526ffb60a77882acc (tree)
parent 5bd533d40c825e33315c98a06d24263cb2afe980
Author: Motiejus Jakštys <motiejus@jakstys.lt>
Date:   Wed, 11 Feb 2026 13:21:34 +0000

sort forward declarations by name

Diffstat:
Mparser.c | 116++++++++++++++++++++++++++++++++++++++++----------------------------------------
1 file changed, 58 insertions(+), 58 deletions(-)

diff --git a/parser.c b/parser.c @@ -48,79 +48,79 @@ typedef struct { AstNodeIndex bit_range_end; } PtrModifiers; -static CleanupScratch initCleanupScratch(Parser*); +static AstNodeIndex addExtra(Parser*, const AstNodeIndex*, uint32_t); +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 expectExpr(Parser*); +static AstNodeIndex expectSemicolon(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 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 expectContainerField(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 AstTokenIndex parseBreakLabel(Parser*); static AstNodeIndex parseBuiltinCall(Parser*); +static AstNodeIndex parseByteAlign(Parser*); +static AstNodeIndex parseCallconv(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 expectSemicolon(Parser*); +static Members parseContainerMembers(Parser*); +static AstNodeIndex parseCurlySuffixExpr(Parser*); static AstNodeIndex parseErrorUnionExpr(Parser*); -static PtrModifiers parsePtrModifiers(Parser*); -static AstNodeIndex makePtrTypeNode( - Parser*, AstTokenIndex, AstNodeIndex, PtrModifiers, AstNodeIndex); -static AstNodeIndex parseTypeExpr(Parser*); -static uint32_t reserveNode(Parser*, AstNodeTag); +static AstNodeIndex parseExpr(Parser*); +static AstNodeIndex parseExprPrecedence(Parser*, int32_t); +static AstNodeIndex parseFieldInit(Parser*); static AstNodeIndex parseFnProto(Parser*); -static AstTokenIndex parseBlockLabel(Parser*); -static uint32_t forPrefix(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) {