diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/lexer/mod.rs | 20 | ||||
-rw-r--r-- | src/syntax_kinds.rs | 12 |
2 files changed, 31 insertions, 1 deletions
diff --git a/src/lexer/mod.rs b/src/lexer/mod.rs index d2d4aaa22..5255c3d56 100644 --- a/src/lexer/mod.rs +++ b/src/lexer/mod.rs | |||
@@ -52,6 +52,8 @@ fn next_token_inner(c: char, ptr: &mut Ptr) -> SyntaxKind { | |||
52 | '~' => return TILDE, | 52 | '~' => return TILDE, |
53 | '?' => return QUESTION, | 53 | '?' => return QUESTION, |
54 | '$' => return DOLLAR, | 54 | '$' => return DOLLAR, |
55 | |||
56 | // Multi-byte tokens. | ||
55 | '.' => return match (ptr.next(), ptr.nnext()) { | 57 | '.' => return match (ptr.next(), ptr.nnext()) { |
56 | (Some('.'), Some('.')) => { | 58 | (Some('.'), Some('.')) => { |
57 | ptr.bump(); | 59 | ptr.bump(); |
@@ -76,6 +78,24 @@ fn next_token_inner(c: char, ptr: &mut Ptr) -> SyntaxKind { | |||
76 | } | 78 | } |
77 | _ => COLON | 79 | _ => COLON |
78 | }, | 80 | }, |
81 | '=' => return match ptr.next() { | ||
82 | Some('=') => { | ||
83 | ptr.bump(); | ||
84 | EQEQ | ||
85 | } | ||
86 | Some('>') => { | ||
87 | ptr.bump(); | ||
88 | FAT_ARROW | ||
89 | } | ||
90 | _ => EQ, | ||
91 | }, | ||
92 | '!' => return match ptr.next() { | ||
93 | Some('=') => { | ||
94 | ptr.bump(); | ||
95 | NEQ | ||
96 | } | ||
97 | _ => NOT, | ||
98 | }, | ||
79 | _ => (), | 99 | _ => (), |
80 | } | 100 | } |
81 | ERROR | 101 | ERROR |
diff --git a/src/syntax_kinds.rs b/src/syntax_kinds.rs index 6982cba95..a922056ce 100644 --- a/src/syntax_kinds.rs +++ b/src/syntax_kinds.rs | |||
@@ -26,8 +26,13 @@ pub const QUESTION: SyntaxKind = SyntaxKind(21); | |||
26 | pub const COLON: SyntaxKind = SyntaxKind(22); | 26 | pub const COLON: SyntaxKind = SyntaxKind(22); |
27 | pub const COLONCOLON: SyntaxKind = SyntaxKind(23); | 27 | pub const COLONCOLON: SyntaxKind = SyntaxKind(23); |
28 | pub const DOLLAR: SyntaxKind = SyntaxKind(24); | 28 | pub const DOLLAR: SyntaxKind = SyntaxKind(24); |
29 | pub const EQ: SyntaxKind = SyntaxKind(25); | ||
30 | pub const EQEQ: SyntaxKind = SyntaxKind(26); | ||
31 | pub const FAT_ARROW: SyntaxKind = SyntaxKind(27); | ||
32 | pub const NEQ: SyntaxKind = SyntaxKind(28); | ||
33 | pub const NOT: SyntaxKind = SyntaxKind(29); | ||
29 | 34 | ||
30 | static INFOS: [SyntaxInfo; 25] = [ | 35 | static INFOS: [SyntaxInfo; 30] = [ |
31 | SyntaxInfo { name: "ERROR" }, | 36 | SyntaxInfo { name: "ERROR" }, |
32 | SyntaxInfo { name: "IDENT" }, | 37 | SyntaxInfo { name: "IDENT" }, |
33 | SyntaxInfo { name: "UNDERSCORE" }, | 38 | SyntaxInfo { name: "UNDERSCORE" }, |
@@ -53,6 +58,11 @@ static INFOS: [SyntaxInfo; 25] = [ | |||
53 | SyntaxInfo { name: "COLON" }, | 58 | SyntaxInfo { name: "COLON" }, |
54 | SyntaxInfo { name: "COLONCOLON" }, | 59 | SyntaxInfo { name: "COLONCOLON" }, |
55 | SyntaxInfo { name: "DOLLAR" }, | 60 | SyntaxInfo { name: "DOLLAR" }, |
61 | SyntaxInfo { name: "EQ" }, | ||
62 | SyntaxInfo { name: "EQEQ" }, | ||
63 | SyntaxInfo { name: "FAT_ARROW" }, | ||
64 | SyntaxInfo { name: "NEQ" }, | ||
65 | SyntaxInfo { name: "NOT" }, | ||
56 | ]; | 66 | ]; |
57 | 67 | ||
58 | pub(crate) fn syntax_info(kind: SyntaxKind) -> &'static SyntaxInfo { | 68 | pub(crate) fn syntax_info(kind: SyntaxKind) -> &'static SyntaxInfo { |