Skip to main content

rigsql_parser/grammar/
ansi.rs

1use rigsql_core::Segment;
2
3use crate::context::ParseContext;
4
5use super::Grammar;
6
7/// ANSI SQL grammar — parses standard SQL statements only.
8pub struct AnsiGrammar;
9
10pub(super) const ANSI_STATEMENT_KEYWORDS: &[&str] = &[
11    "ALTER",
12    "BREAK",
13    "CLOSE",
14    "CONTINUE",
15    "CREATE",
16    "DEALLOCATE",
17    "DELETE",
18    "DROP",
19    "ELSE",
20    "END",
21    "FETCH",
22    "INSERT",
23    "MERGE",
24    "OPEN",
25    "SELECT",
26    "TRUNCATE",
27    "UPDATE",
28    "USE",
29    "WITH",
30];
31
32impl Grammar for AnsiGrammar {
33    fn statement_keywords(&self) -> &[&str] {
34        ANSI_STATEMENT_KEYWORDS
35    }
36
37    fn dispatch_statement(&self, ctx: &mut ParseContext) -> Option<Segment> {
38        self.dispatch_ansi_statement(ctx)
39    }
40}