Parse DROP GRAPH statement
(tokens: &[Token])
| 2744 | |
| 2745 | /// Parse DROP GRAPH statement |
| 2746 | fn drop_graph_statement(tokens: &[Token]) -> IResult<&[Token], DropGraphStatement> { |
| 2747 | // Check if next token is Type - if so, fail early to let DROP GRAPH TYPE parse it |
| 2748 | if !tokens.is_empty() { |
| 2749 | // Skip DROP [PROPERTY] GRAPH tokens |
| 2750 | let mut skip_count = 1; // DROP |
| 2751 | if tokens.len() > skip_count && matches!(tokens[skip_count], Token::Property) { |
| 2752 | skip_count += 1; // PROPERTY |
| 2753 | } |
| 2754 | skip_count += 1; // GRAPH |
| 2755 | |
| 2756 | if tokens.len() > skip_count && matches!(tokens[skip_count], Token::Type) { |
| 2757 | // This is DROP GRAPH TYPE, not DROP GRAPH |
| 2758 | return Err(nom::Err::Error(nom::error::Error::new( |
| 2759 | tokens, |
| 2760 | nom::error::ErrorKind::Alt, |
| 2761 | ))); |
| 2762 | } |
| 2763 | } |
| 2764 | |
| 2765 | map( |
| 2766 | tuple(( |
| 2767 | expect_token(Token::Drop), |
| 2768 | opt(expect_token(Token::Property)), |
| 2769 | expect_token(Token::Graph), |
| 2770 | opt(tuple(( |
| 2771 | expect_token(Token::If), |
| 2772 | expect_token(Token::Exists), |
| 2773 | ))), |
| 2774 | catalog_path, |
| 2775 | opt(expect_token(Token::Cascade)), |
| 2776 | )), |
| 2777 | |(_, _, _, if_exists, graph_path, cascade)| DropGraphStatement { |
| 2778 | graph_path, |
| 2779 | if_exists: if_exists.is_some(), |
| 2780 | cascade: cascade.is_some(), |
| 2781 | location: Location::default(), |
| 2782 | }, |
| 2783 | )(tokens) |
| 2784 | } |
| 2785 | |
| 2786 | /// Parse TRUNCATE GRAPH statement |
| 2787 | fn truncate_graph_statement(tokens: &[Token]) -> IResult<&[Token], TruncateGraphStatement> { |
nothing calls this directly
no test coverage detected