MCPcopy Create free account
hub / github.com/GraphLite-AI/GraphLite / alter_index_statement

Function alter_index_statement

graphlite/src/ast/parser.rs:4943–4978  ·  view source on GitHub ↗

Parse ALTER INDEX statement

(tokens: &[Token])

Source from the content-addressed store, hash-verified

4941
4942/// Parse ALTER INDEX statement
4943fn alter_index_statement(tokens: &[Token]) -> IResult<&[Token], AlterIndexStatement> {
4944 let (tokens, _) = expect_token(Token::Alter)(tokens)?;
4945 let (tokens, _) = expect_identifier("INDEX")(tokens)?;
4946
4947 // Parse index name
4948 let (tokens, name) = identifier(tokens)?;
4949
4950 // Parse operation
4951 let (tokens, operation) = alt((
4952 map(expect_identifier("REBUILD"), |_| {
4953 AlterIndexOperation::Rebuild
4954 }),
4955 map(expect_identifier("OPTIMIZE"), |_| {
4956 AlterIndexOperation::Optimize
4957 }),
4958 map(
4959 preceded(
4960 tuple((expect_identifier("SET"), expect_identifier("OPTION"))),
4961 tuple((
4962 identifier,
4963 preceded(expect_token(Token::Equal), parse_value),
4964 )),
4965 ),
4966 |(key, value)| AlterIndexOperation::SetOption(key, value),
4967 ),
4968 ))(tokens)?;
4969
4970 Ok((
4971 tokens,
4972 AlterIndexStatement {
4973 name,
4974 operation,
4975 location: Location::default(),
4976 },
4977 ))
4978}
4979
4980/// Parse OPTIMIZE INDEX statement
4981fn optimize_index_statement(tokens: &[Token]) -> IResult<&[Token], OptimizeIndexStatement> {

Callers

nothing calls this directly

Calls 3

expect_tokenFunction · 0.85
expect_identifierFunction · 0.85
identifierFunction · 0.70

Tested by

no test coverage detected