G: where clause

This commit is contained in:
Aleksey Kladov 2018-02-10 12:53:07 +03:00
parent 2ef16a4121
commit dd6e5371eb
4 changed files with 14 additions and 8 deletions

View file

@ -114,6 +114,7 @@ Grammar(
"ALIAS",
"VISIBILITY",
"TYPE_PARAM_LIST",
"WHERE_CLAUSE",
"LIFETIME_PARAM",
"TYPE_PARAM",
"ABI",

View file

@ -70,9 +70,11 @@ pub(super) fn list(p: &mut Parser) {
pub(super) fn where_clause(p: &mut Parser) {
if p.at(WHERE_KW) {
let m = p.start();
p.bump();
p.expect(IDENT);
p.expect(COLON);
p.expect(IDENT);
m.complete(p, WHERE_CLAUSE);
}
}

View file

@ -112,6 +112,7 @@ pub enum SyntaxKind {
ALIAS,
VISIBILITY,
TYPE_PARAM_LIST,
WHERE_CLAUSE,
LIFETIME_PARAM,
TYPE_PARAM,
ABI,
@ -234,6 +235,7 @@ impl SyntaxKind {
ALIAS => &SyntaxInfo { name: "ALIAS" },
VISIBILITY => &SyntaxInfo { name: "VISIBILITY" },
TYPE_PARAM_LIST => &SyntaxInfo { name: "TYPE_PARAM_LIST" },
WHERE_CLAUSE => &SyntaxInfo { name: "WHERE_CLAUSE" },
LIFETIME_PARAM => &SyntaxInfo { name: "LIFETIME_PARAM" },
TYPE_PARAM => &SyntaxInfo { name: "TYPE_PARAM" },
ABI => &SyntaxInfo { name: "ABI" },

View file

@ -3,6 +3,7 @@ FILE@[0; 31)
TYPE_KW@[0; 4)
WHITESPACE@[4; 5)
IDENT@[5; 8) "Foo"
WHERE_CLAUSE@[8; 25)
WHITESPACE@[8; 9)
WHERE_KW@[9; 14)
WHITESPACE@[14; 15)