diff --git a/grammar.ron b/grammar.ron index 44826c779c62..e7acd3cb0313 100644 --- a/grammar.ron +++ b/grammar.ron @@ -21,7 +21,9 @@ Grammar( "loop", "while", "if", - "match" + "match", + "const", + "static", ], tokens: [ "ERROR", diff --git a/src/syntax_kinds.rs b/src/syntax_kinds.rs index 7577fa03713c..f5d01c6f3ece 100644 --- a/src/syntax_kinds.rs +++ b/src/syntax_kinds.rs @@ -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 { "while" => Some(WHILE_KW), "if" => Some(IF_KW), "match" => Some(MATCH_KW), + "const" => Some(CONST_KW), + "static" => Some(STATIC_KW), _ => None, } } diff --git a/tests/data/lexer/0011_keywords.rs b/tests/data/lexer/0011_keywords.rs index 02ca19089191..7a1000bb7f20 100644 --- a/tests/data/lexer/0011_keywords.rs +++ b/tests/data/lexer/0011_keywords.rs @@ -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 diff --git a/tests/data/lexer/0011_keywords.txt b/tests/data/lexer/0011_keywords.txt index 964e3475a3a0..b38b4bd644fb 100644 --- a/tests/data/lexer/0011_keywords.txt +++ b/tests/data/lexer/0011_keywords.txt @@ -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"