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,14 +3,15 @@ FILE@[0; 31)
TYPE_KW@[0; 4)
WHITESPACE@[4; 5)
IDENT@[5; 8) "Foo"
WHITESPACE@[8; 9)
WHERE_KW@[9; 14)
WHITESPACE@[14; 15)
IDENT@[15; 18) "Foo"
COLON@[18; 19)
WHITESPACE@[19; 20)
IDENT@[20; 24) "Copy"
WHITESPACE@[24; 25)
WHERE_CLAUSE@[8; 25)
WHITESPACE@[8; 9)
WHERE_KW@[9; 14)
WHITESPACE@[14; 15)
IDENT@[15; 18) "Foo"
COLON@[18; 19)
WHITESPACE@[19; 20)
IDENT@[20; 24) "Copy"
WHITESPACE@[24; 25)
EQ@[25; 26)
WHITESPACE@[26; 27)
L_PAREN@[27; 28)