This function can return null nodes and then still return nodes afterwards,
such as in the case of anytype and .... Caller must look for rparen to find
out when there are no more param decls left.
fn expectParamDecl(p: *Parse) !?Node.Index
fn expectParamDecl(p: *Parse) !?Node.Index {
_ = try p.eatDocComments();
switch (p.tokenTag(p.tok_i)) {
.keyword_noalias, .keyword_comptime => p.tok_i += 1,
.ellipsis3 => {
p.tok_i += 1;
return null;
},
else => {},
}
_ = p.eatTokens(&.{ .identifier, .colon });
if (p.eatToken(.keyword_anytype)) |_| {
return null;
} else {
return try p.expectTypeExpr();
}
}