| 223 | } |
| 224 | |
| 225 | MemType ParseContext::parse_memtype() { |
| 226 | MemType mt; |
| 227 | // Optional index-type keyword: i32 (default) or i64 (memory64) |
| 228 | Token tok = tok_.peek(); |
| 229 | if(tok.type == TokenType::Keyword && (tok.text == "i32" || tok.text == "i64")) { |
| 230 | tok_.consume(); |
| 231 | mt.is64 = (tok.text == "i64"); |
| 232 | } |
| 233 | mt.min = parse_u64(); |
| 234 | if(tok_.peek().type == TokenType::Integer) { |
| 235 | mt.max = parse_u64(); |
| 236 | if(mt.min > mt.max.value()) |
| 237 | throw Exception::Parse("limit min cannot exceed max", tok_.location()); |
| 238 | } |
| 239 | return mt; |
| 240 | } |
| 241 | |
| 242 | TableType ParseContext::parse_tabletype() { |
| 243 | TableType tt; |