1 | /**
|
2 | * Distinguishes different types of Token objects.
|
3 | */
|
4 | export var TokenKind;
|
5 | (function (TokenKind) {
|
6 | /**
|
7 | * A token representing the end of the input. The Token.range will be an empty range
|
8 | * at the end of the provided input.
|
9 | */
|
10 | TokenKind[TokenKind["EndOfInput"] = 2001] = "EndOfInput";
|
11 | /**
|
12 | * A token representing a virtual newline.
|
13 | * The Token.range will be an empty range, because the actual newline character may
|
14 | * be noncontiguous due to the doc comment delimiter trimming.
|
15 | */
|
16 | TokenKind[TokenKind["Newline"] = 2002] = "Newline";
|
17 | /**
|
18 | * A token representing one or more spaces and tabs (but not newlines or end of input).
|
19 | */
|
20 | TokenKind[TokenKind["Spacing"] = 2003] = "Spacing";
|
21 | /**
|
22 | * A token representing one or more ASCII letters, numbers, and underscores.
|
23 | */
|
24 | TokenKind[TokenKind["AsciiWord"] = 2004] = "AsciiWord";
|
25 | /**
|
26 | * A single ASCII character that behaves like punctuation, e.g. doesn't need whitespace
|
27 | * around it when adjacent to a letter. The Token.range will always be a string of length 1.
|
28 | */
|
29 | TokenKind[TokenKind["OtherPunctuation"] = 2005] = "OtherPunctuation";
|
30 | /**
|
31 | * A token representing a sequence of non-ASCII printable characters that are not punctuation.
|
32 | */
|
33 | TokenKind[TokenKind["Other"] = 2006] = "Other";
|
34 | /**
|
35 | * The backslash character `\`.
|
36 | * The Token.range will always be a string of length 1.
|
37 | */
|
38 | TokenKind[TokenKind["Backslash"] = 2007] = "Backslash";
|
39 | /**
|
40 | * The less-than character `<`.
|
41 | * The Token.range will always be a string of length 1.
|
42 | */
|
43 | TokenKind[TokenKind["LessThan"] = 2008] = "LessThan";
|
44 | /**
|
45 | * The greater-than character `>`.
|
46 | * The Token.range will always be a string of length 1.
|
47 | */
|
48 | TokenKind[TokenKind["GreaterThan"] = 2009] = "GreaterThan";
|
49 | /**
|
50 | * The equals character `=`.
|
51 | * The Token.range will always be a string of length 1.
|
52 | */
|
53 | TokenKind[TokenKind["Equals"] = 2010] = "Equals";
|
54 | /**
|
55 | * The single-quote character `'`.
|
56 | * The Token.range will always be a string of length 1.
|
57 | */
|
58 | TokenKind[TokenKind["SingleQuote"] = 2011] = "SingleQuote";
|
59 | /**
|
60 | * The double-quote character `"`.
|
61 | * The Token.range will always be a string of length 1.
|
62 | */
|
63 | TokenKind[TokenKind["DoubleQuote"] = 2012] = "DoubleQuote";
|
64 | /**
|
65 | * The slash character `/`.
|
66 | * The Token.range will always be a string of length 1.
|
67 | */
|
68 | TokenKind[TokenKind["Slash"] = 2013] = "Slash";
|
69 | /**
|
70 | * The hyphen character `-`.
|
71 | * The Token.range will always be a string of length 1.
|
72 | */
|
73 | TokenKind[TokenKind["Hyphen"] = 2014] = "Hyphen";
|
74 | /**
|
75 | * The at-sign character `@`.
|
76 | * The Token.range will always be a string of length 1.
|
77 | */
|
78 | TokenKind[TokenKind["AtSign"] = 2015] = "AtSign";
|
79 | /**
|
80 | * The left curly bracket character `{`.
|
81 | * The Token.range will always be a string of length 1.
|
82 | */
|
83 | TokenKind[TokenKind["LeftCurlyBracket"] = 2016] = "LeftCurlyBracket";
|
84 | /**
|
85 | * The right curly bracket character `}`.
|
86 | * The Token.range will always be a string of length 1.
|
87 | */
|
88 | TokenKind[TokenKind["RightCurlyBracket"] = 2017] = "RightCurlyBracket";
|
89 | /**
|
90 | * The backtick character.
|
91 | * The Token.range will always be a string of length 1.
|
92 | */
|
93 | TokenKind[TokenKind["Backtick"] = 2018] = "Backtick";
|
94 | /**
|
95 | * The period character.
|
96 | * The Token.range will always be a string of length 1.
|
97 | */
|
98 | TokenKind[TokenKind["Period"] = 2019] = "Period";
|
99 | /**
|
100 | * The colon character.
|
101 | * The Token.range will always be a string of length 1.
|
102 | */
|
103 | TokenKind[TokenKind["Colon"] = 2020] = "Colon";
|
104 | /**
|
105 | * The comma character.
|
106 | * The Token.range will always be a string of length 1.
|
107 | */
|
108 | TokenKind[TokenKind["Comma"] = 2021] = "Comma";
|
109 | /**
|
110 | * The left square bracket character.
|
111 | * The Token.range will always be a string of length 1.
|
112 | */
|
113 | TokenKind[TokenKind["LeftSquareBracket"] = 2022] = "LeftSquareBracket";
|
114 | /**
|
115 | * The right square bracket character.
|
116 | * The Token.range will always be a string of length 1.
|
117 | */
|
118 | TokenKind[TokenKind["RightSquareBracket"] = 2023] = "RightSquareBracket";
|
119 | /**
|
120 | * The pipe character `|`.
|
121 | * The Token.range will always be a string of length 1.
|
122 | */
|
123 | TokenKind[TokenKind["Pipe"] = 2024] = "Pipe";
|
124 | /**
|
125 | * The left parenthesis character.
|
126 | * The Token.range will always be a string of length 1.
|
127 | */
|
128 | TokenKind[TokenKind["LeftParenthesis"] = 2025] = "LeftParenthesis";
|
129 | /**
|
130 | * The right parenthesis character.
|
131 | * The Token.range will always be a string of length 1.
|
132 | */
|
133 | TokenKind[TokenKind["RightParenthesis"] = 2026] = "RightParenthesis";
|
134 | /**
|
135 | * The pound character ("#").
|
136 | * The Token.range will always be a string of length 1.
|
137 | */
|
138 | TokenKind[TokenKind["PoundSymbol"] = 2027] = "PoundSymbol";
|
139 | /**
|
140 | * The plus character ("+").
|
141 | * The Token.range will always be a string of length 1.
|
142 | */
|
143 | TokenKind[TokenKind["Plus"] = 2028] = "Plus";
|
144 | /**
|
145 | * The dollar sign character ("$").
|
146 | * The Token.range will always be a string of length 1.
|
147 | */
|
148 | TokenKind[TokenKind["DollarSign"] = 2029] = "DollarSign";
|
149 | })(TokenKind || (TokenKind = {}));
|
150 | /**
|
151 | * Represents a contiguous range of characters extracted from one of the doc comment lines
|
152 | * being processed by the Tokenizer. There is a token representing a newline, but otherwise
|
153 | * a single token cannot span multiple lines.
|
154 | */
|
155 | var Token = /** @class */ (function () {
|
156 | function Token(kind, range, line) {
|
157 | this.kind = kind;
|
158 | this.range = range;
|
159 | this.line = line;
|
160 | }
|
161 | Token.prototype.toString = function () {
|
162 | if (this.kind === TokenKind.Newline) {
|
163 | return '\n';
|
164 | }
|
165 | return this.range.toString();
|
166 | };
|
167 | return Token;
|
168 | }());
|
169 | export { Token };
|
170 | //# sourceMappingURL=Token.js.map |
\ | No newline at end of file |