smart-column-indenter
Version:
A smart source code indenter that indent the code into columns
149 lines • 3.92 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const Token_1 = require("../Token");
const TypeScriptScanner_1 = require("./TypeScriptScanner");
class TypeScriptToken extends Token_1.default {
constructor(kind, content, level) {
super(getSyntaxKindName(kind), content, level);
this.syntaxKind = kind;
}
}
exports.default = TypeScriptToken;
function getSyntaxKindName(kind) {
const markers = {
FirstAssignment: "EqualsToken",
LastAssignment: "CaretEqualsToken",
FirstCompoundAssignment: "PlusEqualsToken",
LastCompoundAssignment: "CaretEqualsToken",
FirstReservedWord: "BreakKeyword",
LastReservedWord: "WithKeyword",
FirstKeyword: "BreakKeyword",
LastKeyword: "OfKeyword",
FirstFutureReservedWord: "ImplementsKeyword",
LastFutureReservedWord: "YieldKeyword",
FirstTypeNode: "TypePredicate",
LastTypeNode: "LiteralType",
FirstPunctuation: "OpenBraceToken",
LastPunctuation: "CaretEqualsToken",
FirstToken: "Unknown",
LastToken: "LastKeyword",
FirstTriviaToken: "SingleLineCommentTrivia",
LastTriviaToken: "ConflictMarkerTrivia",
FirstLiteralToken: "NumericLiteral",
LastLiteralToken: "NoSubstitutionTemplateLiteral",
FirstTemplateToken: "NoSubstitutionTemplateLiteral",
LastTemplateToken: "TemplateTail",
FirstBinaryOperator: "LessThanToken",
LastBinaryOperator: "CaretEqualsToken",
FirstNode: "QualifiedName",
FirstJSDocNode: "JSDocTypeExpression",
LastJSDocNode: "JSDocPropertyTag",
FirstJSDocTagNode: "JSDocTag",
LastJSDocTagNode: "JSDocPropertyTag",
FirstContextualKeyword: "AbstractKeyword",
LastContextualKeyword: "OfKeyword",
};
const name = TypeScriptScanner_1.SyntaxKind[kind];
return markers.hasOwnProperty(name) ? markers[name] : name;
}
exports.reservedWordType = {
"private": "access modifier",
"protected": "access modifier",
"public": "access modifier",
"var": "variable declaration",
"let": "variable declaration",
"const": "variable declaration",
"import": "import export",
"export": "import export",
"any": "object type",
"boolean": "object type",
"number": "object type",
"string": "object type",
"object": "object type",
"never": "object type",
"void": "object type",
"case": "switch option",
"default": "switch option",
"break": "loop control flow",
"continue": "loop control flow",
"false": "value",
"null": "value",
"true": "value",
"undefined": "value",
"in": "for iterator",
"of": "for iterator",
};
exports.reservedWords = [
"abstract",
"any",
"as",
"boolean",
"break",
"case",
"catch",
"class",
"continue",
"const",
"constructor",
"debugger",
"declare",
"default",
"delete",
"do",
"else",
"enum",
"export",
"extends",
"false",
"finally",
"for",
"from",
"function",
"get",
"if",
"implements",
"import",
"in",
"instanceof",
"interface",
"is",
"keyof",
"let",
"module",
"namespace",
"never",
"new",
"null",
"number",
"object",
"package",
"private",
"protected",
"public",
"readonly",
"require",
"global",
"return",
"set",
"static",
"string",
"super",
"switch",
"symbol",
"this",
"throw",
"true",
"try",
"type",
"typeof",
"undefined",
"var",
"void",
"while",
"with",
"yield",
"async",
"await",
"of",
];
//# sourceMappingURL=TypeScriptToken.js.map