MCPcopy Create free account
hub / github.com/WasmVM/WasmVM / parse_param

Method parse_param

src/lib/parse/ParseContext.cpp:179–196  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

177}
178
179std::pair<std::string, std::vector<ValueType>> ParseContext::parse_param() {
180 tok_.expect(TokenType::LParen);
181 tok_.expect_keyword("param");
182 std::pair<std::string, std::vector<ValueType>> result;
183 if (tok_.peek().type == TokenType::Id) {
184 result.first = tok_.consume().text;
185 result.second.push_back(parse_valtype());
186 } else {
187 while (tok_.peek().type == TokenType::Keyword &&
188 (tok_.peek().text == "i32" || tok_.peek().text == "i64" ||
189 tok_.peek().text == "f32" || tok_.peek().text == "f64" ||
190 tok_.peek().text == "funcref" || tok_.peek().text == "externref")) {
191 result.second.push_back(parse_valtype());
192 }
193 }
194 tok_.expect(TokenType::RParen);
195 return result;
196}
197
198std::vector<ValueType> ParseContext::parse_result() {
199 tok_.expect(TokenType::LParen);

Callers

nothing calls this directly

Calls 4

expectMethod · 0.80
expect_keywordMethod · 0.80
peekMethod · 0.80
consumeMethod · 0.45

Tested by

no test coverage detected