diff options
author | Florian Dold <florian.dold@gmail.com> | 2017-05-24 15:10:37 +0200 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2017-05-24 15:11:17 +0200 |
commit | 7a3df06eb573d36142bd1a8e03c5ce8752d300b3 (patch) | |
tree | 70bfaea8884c374876f607774850a3a51c0cb381 /node_modules/highlight.js/lib/languages/typescript.js | |
parent | aca1143cb9eed16cf37f04e475e4257418dd18ac (diff) | |
download | wallet-core-7a3df06eb573d36142bd1a8e03c5ce8752d300b3.tar.xz |
fix build issues and add typedoc
Diffstat (limited to 'node_modules/highlight.js/lib/languages/typescript.js')
-rw-r--r-- | node_modules/highlight.js/lib/languages/typescript.js | 155 |
1 files changed, 155 insertions, 0 deletions
diff --git a/node_modules/highlight.js/lib/languages/typescript.js b/node_modules/highlight.js/lib/languages/typescript.js new file mode 100644 index 000000000..e65fe04fa --- /dev/null +++ b/node_modules/highlight.js/lib/languages/typescript.js @@ -0,0 +1,155 @@ +module.exports = function(hljs) { + var KEYWORDS = { + keyword: + 'in if for while finally var new function do return void else break catch ' + + 'instanceof with throw case default try this switch continue typeof delete ' + + 'let yield const class public private protected get set super ' + + 'static implements enum export import declare type namespace abstract ' + + 'as from extends async await', + literal: + 'true false null undefined NaN Infinity', + built_in: + 'eval isFinite isNaN parseFloat parseInt decodeURI decodeURIComponent ' + + 'encodeURI encodeURIComponent escape unescape Object Function Boolean Error ' + + 'EvalError InternalError RangeError ReferenceError StopIteration SyntaxError ' + + 'TypeError URIError Number Math Date String RegExp Array Float32Array ' + + 'Float64Array Int16Array Int32Array Int8Array Uint16Array Uint32Array ' + + 'Uint8Array Uint8ClampedArray ArrayBuffer DataView JSON Intl arguments require ' + + 'module console window document any number boolean string void Promise' + }; + + return { + aliases: ['ts'], + keywords: KEYWORDS, + contains: [ + { + className: 'meta', + begin: /^\s*['"]use strict['"]/ + }, + hljs.APOS_STRING_MODE, + hljs.QUOTE_STRING_MODE, + { // template string + className: 'string', + begin: '`', end: '`', + contains: [ + hljs.BACKSLASH_ESCAPE, + { + className: 'subst', + begin: '\\$\\{', end: '\\}' + } + ] + }, + hljs.C_LINE_COMMENT_MODE, + hljs.C_BLOCK_COMMENT_MODE, + { + className: 'number', + variants: [ + { begin: '\\b(0[bB][01]+)' }, + { begin: '\\b(0[oO][0-7]+)' }, + { begin: hljs.C_NUMBER_RE } + ], + relevance: 0 + }, + { // "value" container + begin: '(' + hljs.RE_STARTERS_RE + '|\\b(case|return|throw)\\b)\\s*', + keywords: 'return throw case', + contains: [ + hljs.C_LINE_COMMENT_MODE, + hljs.C_BLOCK_COMMENT_MODE, + hljs.REGEXP_MODE, + { + className: 'function', + begin: '(\\(.*?\\)|' + hljs.IDENT_RE + ')\\s*=>', returnBegin: true, + end: '\\s*=>', + contains: [ + { + className: 'params', + variants: [ + { + begin: hljs.IDENT_RE + }, + { + begin: /\(\s*\)/, + }, + { + begin: /\(/, end: /\)/, + excludeBegin: true, excludeEnd: true, + keywords: KEYWORDS, + contains: [ + 'self', + hljs.C_LINE_COMMENT_MODE, + hljs.C_BLOCK_COMMENT_MODE + ] + } + ] + } + ] + } + ], + relevance: 0 + }, + { + className: 'function', + begin: 'function', end: /[\{;]/, excludeEnd: true, + keywords: KEYWORDS, + contains: [ + 'self', + hljs.inherit(hljs.TITLE_MODE, {begin: /[A-Za-z$_][0-9A-Za-z$_]*/}), + { + className: 'params', + begin: /\(/, end: /\)/, + excludeBegin: true, + excludeEnd: true, + keywords: KEYWORDS, + contains: [ + hljs.C_LINE_COMMENT_MODE, + hljs.C_BLOCK_COMMENT_MODE + ], + illegal: /["'\(]/ + } + ], + illegal: /%/, + relevance: 0 // () => {} is more typical in TypeScript + }, + { + beginKeywords: 'constructor', end: /\{/, excludeEnd: true, + contains: [ + 'self', + { + className: 'params', + begin: /\(/, end: /\)/, + excludeBegin: true, + excludeEnd: true, + keywords: KEYWORDS, + contains: [ + hljs.C_LINE_COMMENT_MODE, + hljs.C_BLOCK_COMMENT_MODE + ], + illegal: /["'\(]/ + } + ] + }, + { // prevent references like module.id from being higlighted as module definitions + begin: /module\./, + keywords: {built_in: 'module'}, + relevance: 0 + }, + { + beginKeywords: 'module', end: /\{/, excludeEnd: true + }, + { + beginKeywords: 'interface', end: /\{/, excludeEnd: true, + keywords: 'interface extends' + }, + { + begin: /\$[(.]/ // relevance booster for a pattern common to JS libs: `$(something)` and `$.something` + }, + { + begin: '\\.' + hljs.IDENT_RE, relevance: 0 // hack: prevents detection of keywords after dots + }, + { + className: 'meta', begin: '@[A-Za-z]+' + } + ] + }; +};
\ No newline at end of file |