MCPcopy Create free account
hub / github.com/NodeDB-Lab/nodedb / parse_dim

Method parse_dim

nodedb-sql/src/parser/array_stmt/parse_impl.rs:218–241  ·  view source on GitHub ↗
(&mut self)

Source from the content-addressed store, hash-verified

216 }
217
218 fn parse_dim(&mut self) -> Result<ArrayDimAst> {
219 let name = self.expect_ident()?;
220 let type_name = self.expect_ident()?;
221 let dtype = parse_dim_type(&type_name)
222 .ok_or_else(|| self.err(format!("unknown dim type `{type_name}`")))?;
223 // Domain bounds [lo..hi] are optional — omitting them defaults to the
224 // full representable range for the dim type.
225 let (lo, hi) = if self.match_token(&Tok::LBracket) {
226 let lo = self.parse_domain_bound(dtype)?;
227 self.expect(&Tok::DotDot)?;
228 let hi = self.parse_domain_bound(dtype)?;
229 self.expect(&Tok::RBracket)?;
230 (lo, hi)
231 } else {
232 let (lo, hi) = default_domain_bounds(dtype);
233 (lo, hi)
234 };
235 Ok(ArrayDimAst {
236 name,
237 dtype,
238 lo,
239 hi,
240 })
241 }
242
243 fn parse_domain_bound(&mut self, dtype: ArrayDimType) -> Result<ArrayDomainBound> {
244 match dtype {

Callers 1

parse_createMethod · 0.80

Calls 7

parse_dim_typeFunction · 0.85
default_domain_boundsFunction · 0.85
expect_identMethod · 0.80
match_tokenMethod · 0.80
parse_domain_boundMethod · 0.80
errMethod · 0.45
expectMethod · 0.45

Tested by

no test coverage detected