| 141 | // ── Valtype / FuncType / type sub-parsers ───────────────────────────────────── |
| 142 | |
| 143 | ValueType ParseContext::parse_valtype() { |
| 144 | Token t = tok_.expect(TokenType::Keyword, "valtype"); |
| 145 | if (t.text == "i32") return ValueType(ValueType::i32); |
| 146 | else if (t.text == "i64") return ValueType(ValueType::i64); |
| 147 | else if (t.text == "f32") return ValueType(ValueType::f32); |
| 148 | else if (t.text == "f64") return ValueType(ValueType::f64); |
| 149 | else if (t.text == "funcref") return ValueType(ValueType::funcref); |
| 150 | else if (t.text == "externref") return ValueType(ValueType::externref); |
| 151 | throw Exception::Parse("unknown valtype '" + t.text + "'", {t.line, t.column}); |
| 152 | } |
| 153 | |
| 154 | std::pair<FuncType, std::map<std::string, index_t>> ParseContext::parse_functype() { |
| 155 | tok_.expect(TokenType::LParen); |