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