(&mut self)
| 317 | // ── INSERT INTO ARRAY ──────────────────────────────────────── |
| 318 | |
| 319 | pub(super) fn parse_insert(&mut self) -> Result<InsertArrayAst> { |
| 320 | let name = self.expect_ident()?; |
| 321 | let mut rows = Vec::new(); |
| 322 | loop { |
| 323 | self.expect_kw("COORDS")?; |
| 324 | self.expect(&Tok::LParen)?; |
| 325 | let mut coords = Vec::new(); |
| 326 | loop { |
| 327 | coords.push(self.parse_coord_literal()?); |
| 328 | if !self.match_token(&Tok::Comma) { |
| 329 | break; |
| 330 | } |
| 331 | } |
| 332 | self.expect(&Tok::RParen)?; |
| 333 | |
| 334 | self.expect_kw("VALUES")?; |
| 335 | self.expect(&Tok::LParen)?; |
| 336 | let mut attrs = Vec::new(); |
| 337 | loop { |
| 338 | attrs.push(self.parse_attr_literal()?); |
| 339 | if !self.match_token(&Tok::Comma) { |
| 340 | break; |
| 341 | } |
| 342 | } |
| 343 | self.expect(&Tok::RParen)?; |
| 344 | |
| 345 | rows.push(ArrayInsertRow { coords, attrs }); |
| 346 | if !self.match_token(&Tok::Comma) { |
| 347 | break; |
| 348 | } |
| 349 | } |
| 350 | if !self.at_end() { |
| 351 | return Err(self.err(format!( |
| 352 | "trailing tokens after INSERT INTO ARRAY: {:?}", |
| 353 | self.peek() |
| 354 | ))); |
| 355 | } |
| 356 | Ok(InsertArrayAst { name, rows }) |
| 357 | } |
| 358 | |
| 359 | fn parse_coord_literal(&mut self) -> Result<ArrayCoordLiteral> { |
| 360 | match self.bump().map(|t| &t.tok) { |
no test coverage detected