aboutsummaryrefslogtreecommitdiff
path: root/src/grammar/items/consts.rs
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2018-07-31 21:38:19 +0100
committerAleksey Kladov <[email protected]>2018-07-31 21:44:31 +0100
commit7912189ec304b28c4df0030b5282cf3d21074154 (patch)
tree03a0a1b128439fdefbd1d012b392995ca8a6e264 /src/grammar/items/consts.rs
parentd1400e95d7ad701fcba1191cb00968c2eae8b394 (diff)
reorganize
Diffstat (limited to 'src/grammar/items/consts.rs')
-rw-r--r--src/grammar/items/consts.rs20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/grammar/items/consts.rs b/src/grammar/items/consts.rs
new file mode 100644
index 000000000..ca26a7814
--- /dev/null
+++ b/src/grammar/items/consts.rs
@@ -0,0 +1,20 @@
1use super::*;
2
3pub(super) fn static_item(p: &mut Parser) {
4 const_or_static(p, STATIC_KW)
5}
6
7pub(super) fn const_item(p: &mut Parser) {
8 const_or_static(p, CONST_KW)
9}
10
11fn const_or_static(p: &mut Parser, kw: SyntaxKind) {
12 assert!(p.at(kw));
13 p.bump();
14 p.eat(MUT_KW); // TODO: validator to forbid const mut
15 name(p);
16 types::ascription(p);
17 p.expect(EQ);
18 expressions::expr(p);
19 p.expect(SEMI);
20}