@elwood-lang/core 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/token.ts ADDED
@@ -0,0 +1,87 @@
1
+ export enum TokenKind {
2
+ // Literals
3
+ StringLiteral = 'StringLiteral',
4
+ NumberLiteral = 'NumberLiteral',
5
+ TrueLiteral = 'TrueLiteral',
6
+ FalseLiteral = 'FalseLiteral',
7
+ NullLiteral = 'NullLiteral',
8
+
9
+ // Identifiers & paths
10
+ Identifier = 'Identifier',
11
+ Dollar = 'Dollar',
12
+ DollarDot = 'DollarDot',
13
+ Dot = 'Dot',
14
+ DotDot = 'DotDot',
15
+
16
+ // Brackets
17
+ LeftBracket = 'LeftBracket',
18
+ RightBracket = 'RightBracket',
19
+ LeftParen = 'LeftParen',
20
+ RightParen = 'RightParen',
21
+ LeftBrace = 'LeftBrace',
22
+ RightBrace = 'RightBrace',
23
+
24
+ // Operators
25
+ Pipe = 'Pipe',
26
+ FatArrow = 'FatArrow',
27
+ Comma = 'Comma',
28
+ Colon = 'Colon',
29
+ Star = 'Star',
30
+ Spread = 'Spread',
31
+
32
+ // Arithmetic
33
+ Plus = 'Plus',
34
+ Minus = 'Minus',
35
+ Slash = 'Slash',
36
+
37
+ // Assignment
38
+ Assign = 'Assign',
39
+
40
+ // Comparison
41
+ EqualEqual = 'EqualEqual',
42
+ BangEqual = 'BangEqual',
43
+ LessThan = 'LessThan',
44
+ LessThanOrEqual = 'LessThanOrEqual',
45
+ GreaterThan = 'GreaterThan',
46
+ GreaterThanOrEqual = 'GreaterThanOrEqual',
47
+
48
+ // Logical
49
+ AmpersandAmpersand = 'AmpersandAmpersand',
50
+ PipePipe = 'PipePipe',
51
+ Bang = 'Bang',
52
+
53
+ // Keywords
54
+ Let = 'Let',
55
+ If = 'If',
56
+ Then = 'Then',
57
+ Else = 'Else',
58
+ Match = 'Match',
59
+ Return = 'Return',
60
+ From = 'From',
61
+ Asc = 'Asc',
62
+ Desc = 'Desc',
63
+ On = 'On',
64
+ Equals = 'Equals',
65
+ Into = 'Into',
66
+ Underscore = 'Underscore',
67
+ Memo = 'Memo',
68
+
69
+ // Interpolation
70
+ Backtick = 'Backtick',
71
+
72
+ // Special
73
+ Eof = 'Eof',
74
+ }
75
+
76
+ export interface SourceSpan {
77
+ start: number;
78
+ end: number;
79
+ line: number;
80
+ column: number;
81
+ }
82
+
83
+ export interface Token {
84
+ kind: TokenKind;
85
+ text: string;
86
+ span: SourceSpan;
87
+ }