@@ -54,6 +54,16 @@ class TempVector
5454
5555class Parser
5656{
57+ template <typename Node, typename F>
58+ static ParseNodeResult<Node> runParse (
59+ const char * buffer,
60+ size_t bufferSize,
61+ AstNameTable& names,
62+ Allocator& allocator,
63+ ParseOptions options,
64+ F f
65+ );
66+
5767public:
5868 static ParseResult parse (
5969 const char * buffer,
@@ -63,14 +73,22 @@ class Parser
6373 ParseOptions options = ParseOptions()
6474 );
6575
66- static ParseExprResult parseExpr (
76+ static ParseNodeResult<AstExpr> parseExpr (
6777 const char * buffer,
6878 std::size_t bufferSize,
6979 AstNameTable& names,
7080 Allocator& allocator,
7181 ParseOptions options = ParseOptions()
7282 );
7383
84+ static ParseNodeResult<AstType> parseType (
85+ const char * buffer,
86+ std::size_t bufferSize,
87+ AstNameTable& names,
88+ Allocator& allocator,
89+ ParseOptions options = {}
90+ );
91+
7492private:
7593 struct Name ;
7694 struct Binding ;
@@ -285,6 +303,7 @@ class Parser
285303
286304 // primaryexp -> prefixexp { `.' NAME | `[' exp `]' | TypeInstantiation | `:' NAME [TypeInstantiation] funcargs | funcargs }
287305 AstExpr* parsePrimaryExpr (bool asStatement);
306+ AstExpr* parseMethodCall (Position start, AstExpr* expr);
288307
289308 // asexp -> simpleexp [`::' Type]
290309 AstExpr* parseAssertionExpr ();
@@ -311,10 +330,7 @@ class Parser
311330 AstExpr* parseInterpString ();
312331
313332 // TypeInstantiation ::= `<' `<' [TypeList] `>' `>'
314- AstArray<AstTypeOrPack> parseTypeInstantiationExpr (
315- CstTypeInstantiation* cstNodeOut = nullptr ,
316- Location* endLocationOut = nullptr
317- );
333+ AstArray<AstTypeOrPack> parseTypeInstantiationExpr (CstTypeInstantiation* cstNodeOut = nullptr , Location* endLocationOut = nullptr );
318334
319335 AstExpr* parseExplicitTypeInstantiationExpr (Position start, AstExpr& basedOnExpr);
320336
0 commit comments