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