aboutsummaryrefslogtreecommitdiff
path: root/src/syntax_kinds/generated.rs.tera
diff options
context:
space:
mode:
Diffstat (limited to 'src/syntax_kinds/generated.rs.tera')
-rw-r--r--src/syntax_kinds/generated.rs.tera26
1 files changed, 24 insertions, 2 deletions
diff --git a/src/syntax_kinds/generated.rs.tera b/src/syntax_kinds/generated.rs.tera
index aa672d89a..21e471b71 100644
--- a/src/syntax_kinds/generated.rs.tera
+++ b/src/syntax_kinds/generated.rs.tera
@@ -5,7 +5,13 @@ use super::SyntaxInfo;
5/// The kind of syntax node, e.g. `IDENT`, `USE_KW`, or `STRUCT_DEF`. 5/// The kind of syntax node, e.g. `IDENT`, `USE_KW`, or `STRUCT_DEF`.
6#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)] 6#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
7pub enum SyntaxKind { 7pub enum SyntaxKind {
8{%- for t in tokens %} 8{%- for t in single_byte_tokens %}
9 {{t.1}},
10{%- endfor -%}
11{% for t in multi_byte_tokens %}
12 {{t.1}},
13{%- endfor -%}
14{% for t in tokens %}
9 {{t}}, 15 {{t}},
10{%- endfor -%} 16{%- endfor -%}
11{% for kw in keywords %} 17{% for kw in keywords %}
@@ -29,7 +35,13 @@ use self::SyntaxKind::*;
29impl SyntaxKind { 35impl SyntaxKind {
30 pub(crate) fn info(self) -> &'static SyntaxInfo { 36 pub(crate) fn info(self) -> &'static SyntaxInfo {
31 match self { 37 match self {
32{%- for t in tokens %} 38{%- for t in single_byte_tokens %}
39 {{t.1}} => &SyntaxInfo { name: "{{t.1}}" },
40{%- endfor -%}
41{% for t in multi_byte_tokens %}
42 {{t.1}} => &SyntaxInfo { name: "{{t.1}}" },
43{%- endfor -%}
44{% for t in tokens %}
33 {{t}} => &SyntaxInfo { name: "{{t}}" }, 45 {{t}} => &SyntaxInfo { name: "{{t}}" },
34{%- endfor -%} 46{%- endfor -%}
35{% for kw in keywords %} 47{% for kw in keywords %}
@@ -55,5 +67,15 @@ impl SyntaxKind {
55 }; 67 };
56 Some(kw) 68 Some(kw)
57 } 69 }
70
71 pub(crate) fn from_char(c: char) -> Option<SyntaxKind> {
72 let tok = match c {
73{%- for t in single_byte_tokens %}
74 '{{t.0}}' => {{t.1}},
75{%- endfor %}
76 _ => return None,
77 };
78 Some(tok)
79 }
58} 80}
59 81