(&mut self)
| 103 | // ── CREATE ARRAY ───────────────────────────────────────────── |
| 104 | |
| 105 | pub(super) fn parse_create(&mut self) -> Result<CreateArrayAst> { |
| 106 | let name = self.expect_ident()?; |
| 107 | self.expect_kw("DIMS")?; |
| 108 | self.expect(&Tok::LParen)?; |
| 109 | let mut dims = Vec::new(); |
| 110 | loop { |
| 111 | dims.push(self.parse_dim()?); |
| 112 | if !self.match_token(&Tok::Comma) { |
| 113 | break; |
| 114 | } |
| 115 | } |
| 116 | self.expect(&Tok::RParen)?; |
| 117 | |
| 118 | self.expect_kw("ATTRS")?; |
| 119 | self.expect(&Tok::LParen)?; |
| 120 | let mut attrs = Vec::new(); |
| 121 | loop { |
| 122 | attrs.push(self.parse_attr()?); |
| 123 | if !self.match_token(&Tok::Comma) { |
| 124 | break; |
| 125 | } |
| 126 | } |
| 127 | self.expect(&Tok::RParen)?; |
| 128 | |
| 129 | self.expect_kw("TILE_EXTENTS")?; |
| 130 | self.expect(&Tok::LParen)?; |
| 131 | let mut tile_extents = Vec::new(); |
| 132 | loop { |
| 133 | tile_extents.push(self.expect_int()?); |
| 134 | if !self.match_token(&Tok::Comma) { |
| 135 | break; |
| 136 | } |
| 137 | } |
| 138 | self.expect(&Tok::RParen)?; |
| 139 | |
| 140 | let mut cell_order = ArrayCellOrderAst::default(); |
| 141 | let mut tile_order = ArrayTileOrderAst::default(); |
| 142 | if self.match_kw("CELL_ORDER") { |
| 143 | cell_order = self.parse_cell_order()?; |
| 144 | } |
| 145 | if self.match_kw("TILE_ORDER") { |
| 146 | tile_order = self.parse_tile_order()?; |
| 147 | } |
| 148 | |
| 149 | // Optional `WITH (key = value, ...)` clause. |
| 150 | let mut prefix_bits: u8 = 8; |
| 151 | let mut audit_retain_ms: Option<u64> = None; |
| 152 | let mut minimum_audit_retain_ms: Option<u64> = None; |
| 153 | if self.match_kw("WITH") { |
| 154 | self.expect(&Tok::LParen)?; |
| 155 | loop { |
| 156 | let key = self.expect_ident()?; |
| 157 | self.expect(&Tok::Eq)?; |
| 158 | match key.to_ascii_lowercase().as_str() { |
| 159 | "prefix_bits" => { |
| 160 | let n = self.expect_int()?; |
| 161 | if !(1..=16).contains(&n) { |
| 162 | return Err(self.err(format!("WITH (prefix_bits = {n}): must be 1–16"))); |
no test coverage detected