-
Notifications
You must be signed in to change notification settings - Fork 98
/
Copy pathdml.rs
59 lines (46 loc) · 1.06 KB
/
dml.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
use pgt_lexer::SyntaxKind;
use super::{
Parser,
common::{parenthesis, unknown},
};
pub(crate) fn cte(p: &mut Parser) {
p.expect(SyntaxKind::With);
loop {
p.expect(SyntaxKind::Ident);
p.expect(SyntaxKind::As);
parenthesis(p);
if p.current().kind == SyntaxKind::Ascii44 {
p.advance();
} else {
break;
}
}
unknown(
p,
&[
SyntaxKind::Select,
SyntaxKind::Insert,
SyntaxKind::Update,
SyntaxKind::DeleteP,
SyntaxKind::Merge,
],
);
}
pub(crate) fn select(p: &mut Parser) {
p.expect(SyntaxKind::Select);
unknown(p, &[]);
}
pub(crate) fn insert(p: &mut Parser) {
p.expect(SyntaxKind::Insert);
p.expect(SyntaxKind::Into);
unknown(p, &[SyntaxKind::Select]);
}
pub(crate) fn update(p: &mut Parser) {
p.expect(SyntaxKind::Update);
unknown(p, &[]);
}
pub(crate) fn delete(p: &mut Parser) {
p.expect(SyntaxKind::DeleteP);
p.expect(SyntaxKind::From);
unknown(p, &[]);
}