2018-02-03 12:05:25 +03:00
|
|
|
use super::*;
|
|
|
|
|
|
|
|
pub(super) fn static_item(p: &mut Parser) {
|
|
|
|
const_or_static(p, STATIC_KW)
|
|
|
|
}
|
|
|
|
|
|
|
|
pub(super) fn const_item(p: &mut Parser) {
|
|
|
|
const_or_static(p, CONST_KW)
|
|
|
|
}
|
|
|
|
|
|
|
|
fn const_or_static(p: &mut Parser, kw: SyntaxKind) {
|
|
|
|
assert!(p.at(kw));
|
|
|
|
p.bump();
|
|
|
|
p.eat(MUT_KW); // TODO: validator to forbid const mut
|
2018-02-10 14:08:46 +03:00
|
|
|
name(p);
|
2018-02-03 12:05:25 +03:00
|
|
|
p.expect(COLON);
|
2018-02-11 11:01:00 +03:00
|
|
|
types::type_(p);
|
2018-02-03 12:05:25 +03:00
|
|
|
p.expect(EQ);
|
|
|
|
expressions::expr(p);
|
|
|
|
p.expect(SEMI);
|
|
|
|
}
|