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", "ALIAS",
"VISIBILITY", "VISIBILITY",
"TYPE_PARAM_LIST", "TYPE_PARAM_LIST",
"WHERE_CLAUSE",
"LIFETIME_PARAM", "LIFETIME_PARAM",
"TYPE_PARAM", "TYPE_PARAM",
"ABI", "ABI",

View file

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

View file

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

View file

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