L: const & static keywords

This commit is contained in:
Aleksey Kladov 2018-02-02 23:30:17 +03:00
parent f9ecc680f0
commit 049c9b60fb
4 changed files with 16 additions and 3 deletions

View file

@ -21,7 +21,9 @@ Grammar(
"loop",
"while",
"if",
"match"
"match",
"const",
"static",
],
tokens: [
"ERROR",

View file

@ -28,6 +28,8 @@ pub enum SyntaxKind {
WHILE_KW,
IF_KW,
MATCH_KW,
CONST_KW,
STATIC_KW,
ERROR,
IDENT,
UNDERSCORE,
@ -137,6 +139,8 @@ impl SyntaxKind {
WHILE_KW => &SyntaxInfo { name: "WHILE_KW" },
IF_KW => &SyntaxInfo { name: "IF_KW" },
MATCH_KW => &SyntaxInfo { name: "MATCH_KW" },
CONST_KW => &SyntaxInfo { name: "CONST_KW" },
STATIC_KW => &SyntaxInfo { name: "STATIC_KW" },
ERROR => &SyntaxInfo { name: "ERROR" },
IDENT => &SyntaxInfo { name: "IDENT" },
UNDERSCORE => &SyntaxInfo { name: "UNDERSCORE" },
@ -242,6 +246,8 @@ pub(crate) fn ident_to_keyword(ident: &str) -> Option<SyntaxKind> {
"while" => Some(WHILE_KW),
"if" => Some(IF_KW),
"match" => Some(MATCH_KW),
"const" => Some(CONST_KW),
"static" => Some(STATIC_KW),
_ => None,
}
}

View file

@ -1 +1,2 @@
fn use struct trait enum impl true false as extern crate mod pub self super in where for loop while if match
fn use struct trait enum impl true false as extern crate
mod pub self super in where for loop while if match const static

View file

@ -19,7 +19,7 @@ WHITESPACE 1 " "
EXTERN_KW 6 "extern"
WHITESPACE 1 " "
CRATE_KW 5 "crate"
WHITESPACE 1 " "
WHITESPACE 1 "\n"
MOD_KW 3 "mod"
WHITESPACE 1 " "
PUB_KW 3 "pub"
@ -41,4 +41,8 @@ WHITESPACE 1 " "
IF_KW 2 "if"
WHITESPACE 1 " "
MATCH_KW 5 "match"
WHITESPACE 1 " "
CONST_KW 5 "const"
WHITESPACE 1 " "
STATIC_KW 6 "static"
WHITESPACE 1 "\n"