From 7eb290dff49d83a998cab6b25a4d262cb6e0a956 Mon Sep 17 00:00:00 2001 From: Peng Lyu Date: Thu, 3 May 2018 14:33:48 -0700 Subject: [PATCH 001/133] Fix microsoft/monaco-editor#858 C++ includes --- src/cpp/cpp.test.ts | 14 ++++++++------ src/cpp/cpp.ts | 7 +++++++ 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/src/cpp/cpp.test.ts b/src/cpp/cpp.test.ts index 27e8d9da..a06892f0 100644 --- a/src/cpp/cpp.test.ts +++ b/src/cpp/cpp.test.ts @@ -391,17 +391,19 @@ testTokenization('cpp', [ [{ line: '#include', tokens: [ - { startIndex: 0, type: 'keyword.cpp' }, - { startIndex: 8, type: 'delimiter.angle.cpp' }, - { startIndex: 9, type: 'identifier.cpp' }, - { startIndex: 17, type: 'delimiter.angle.cpp' } + { startIndex: 0, type: 'keyword.directive.include.cpp' }, + { startIndex: 8, type: 'keyword.directive.include.begin.cpp' }, + { startIndex: 9, type: 'string.include.identifier.cpp' }, + { startIndex: 17, type: 'keyword.directive.include.end.cpp' } ] }, { line: '#include "/path/to/my/file.h"', tokens: [ - { startIndex: 0, type: 'keyword.cpp' }, + { startIndex: 0, type: 'keyword.directive.include.cpp' }, { startIndex: 8, type: '' }, - { startIndex: 9, type: 'string.cpp' } + { startIndex: 9, type: 'keyword.directive.include.begin.cpp' }, + { startIndex: 10, type: 'string.include.identifier.cpp' }, + { startIndex: 28, type: 'keyword.directive.include.end.cpp' } ] }, { line: '', diff --git a/src/cpp/cpp.ts b/src/cpp/cpp.ts index 7e631cbc..7683f63e 100644 --- a/src/cpp/cpp.ts +++ b/src/cpp/cpp.ts @@ -268,6 +268,8 @@ export const language = { // [[ attributes ]]. [/\[\[.*\]\]/, 'annotation'], + [/^\s*#include/, { token: 'keyword.directive.include', next: '@include' }], + // Preprocessor directive [/^\s*#\s*\w+/, 'keyword'], @@ -338,6 +340,11 @@ export const language = { } ], [/.*/, 'string.raw'] + ], + + include: [ + [/(\s*)(<)([^<>]*)(>)/, ['', 'keyword.directive.include.begin', 'string.include.identifier', { token: 'keyword.directive.include.end', next: '@pop'}]], + [/(\s*)(")([^"]*)(")/, ['', 'keyword.directive.include.begin', 'string.include.identifier', { token: 'keyword.directive.include.end', next: '@pop'}]] ] }, }; From 781bcdd267d76b3f8a6bdb8f6bea430045aa0e0d Mon Sep 17 00:00:00 2001 From: Peng Lyu Date: Fri, 11 May 2018 10:36:08 -0700 Subject: [PATCH 002/133] 1.3.0 --- package-lock.json | 8 ++++---- package.json | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/package-lock.json b/package-lock.json index 21ff4369..7d243bcd 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "monaco-languages", - "version": "1.2.0", + "version": "1.3.0", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -640,9 +640,9 @@ } }, "monaco-editor-core": { - "version": "0.12.0", - "resolved": "https://registry.npmjs.org/monaco-editor-core/-/monaco-editor-core-0.12.0.tgz", - "integrity": "sha512-wOoEVAoZtrarDRcQC32Fp0ocacpQd6/Nb0FmUZOHeD3swZuPZhDLOxTyoNLjKq3d+h/6g+IARBLnDaLT5OQD4g==", + "version": "0.13.0", + "resolved": "https://registry.npmjs.org/monaco-editor-core/-/monaco-editor-core-0.13.0.tgz", + "integrity": "sha512-xIs6yzj9juIfaN8nFn/odwEa0Ux/R6nm4BupXsgcU/3LU0ZRhd5j56ep0Ta5G6YLF9orGf5t5vXAh5ailjbGmw==", "dev": true }, "monaco-plugin-helpers": { diff --git a/package.json b/package.json index bb528288..ec7c16a2 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "monaco-languages", - "version": "1.2.0", + "version": "1.3.0", "description": "Bundle of many languages for the Monaco Editor.", "scripts": { "compile": "mrmdir ./release && tsc -p ./src/tsconfig.json && tsc -p ./src/tsconfig.esm.json", @@ -20,7 +20,7 @@ "devDependencies": { "jsdom-no-contextify": "^3.1.0", "mocha": "^3.4.2", - "monaco-editor-core": "0.12.0", + "monaco-editor-core": "0.13.0", "monaco-plugin-helpers": "^1.0.2", "requirejs": "^2.3.5", "typescript": "2.7.2", From 5c8480449be9577d0d738088ba4f70f42620f1a6 Mon Sep 17 00:00:00 2001 From: masad-frost Date: Wed, 16 May 2018 20:56:51 -0700 Subject: [PATCH 003/133] Add auto-indentation for python --- src/python/python.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/python/python.ts b/src/python/python.ts index 06c715ea..268769cd 100644 --- a/src/python/python.ts +++ b/src/python/python.ts @@ -8,6 +8,9 @@ import IRichLanguageConfiguration = monaco.languages.LanguageConfiguration; import ILanguage = monaco.languages.IMonarchLanguage; +// Allow for running under nodejs/requirejs in tests +const _monaco: typeof monaco = (typeof monaco === 'undefined' ? (self).monaco : monaco); + export const conf: IRichLanguageConfiguration = { comments: { lineComment: '#', @@ -32,6 +35,12 @@ export const conf: IRichLanguageConfiguration = { { open: '"', close: '"' }, { open: '\'', close: '\'' }, ], + onEnterRules: [ + { + beforeText: new RegExp("^\\s*(?:def|class|for|if|elif|else|while|try|with|finally|except|async).*?:\\s*$"), + action: { indentAction: _monaco.languages.IndentAction.Indent } + } + ], folding: { offSide: true, markers: { From 817ca5bd99882c977462f51480c132af542ede2a Mon Sep 17 00:00:00 2001 From: masad-frost Date: Mon, 21 May 2018 23:03:09 -0700 Subject: [PATCH 004/133] Add Scheme language --- scripts/bundle.js | 1 + src/monaco.contribution.ts | 1 + src/scheme/scheme.contribution.ts | 18 +++++ src/scheme/scheme.test.ts | 91 ++++++++++++++++++++++ src/scheme/scheme.ts | 124 ++++++++++++++++++++++++++++++ test/setup.js | 1 + 6 files changed, 236 insertions(+) create mode 100644 src/scheme/scheme.contribution.ts create mode 100644 src/scheme/scheme.test.ts create mode 100644 src/scheme/scheme.ts diff --git a/scripts/bundle.js b/scripts/bundle.js index 531a17c2..34f1527a 100644 --- a/scripts/bundle.js +++ b/scripts/bundle.js @@ -61,6 +61,7 @@ bundleOne('redshift/redshift'); bundleOne('pgsql/pgsql'); bundleOne('redis/redis'); bundleOne('csp/csp'); +bundleOne('scheme/scheme'); function bundleOne(moduleId, exclude) { requirejs.optimize({ diff --git a/src/monaco.contribution.ts b/src/monaco.contribution.ts index 340dddd3..f3fa2a34 100644 --- a/src/monaco.contribution.ts +++ b/src/monaco.contribution.ts @@ -44,3 +44,4 @@ import './swift/swift.contribution'; import './vb/vb.contribution'; import './xml/xml.contribution'; import './yaml/yaml.contribution'; +import './scheme/scheme.contribution'; diff --git a/src/scheme/scheme.contribution.ts b/src/scheme/scheme.contribution.ts new file mode 100644 index 00000000..ac8eb9b2 --- /dev/null +++ b/src/scheme/scheme.contribution.ts @@ -0,0 +1,18 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +'use strict'; + +import { registerLanguage } from '../_.contribution'; + +// Allow for running under nodejs/requirejs in tests +const _monaco: typeof monaco = + typeof monaco === 'undefined' ? (self).monaco : monaco; + +registerLanguage({ + id: 'scheme', + extensions: ['.scm', '.ss', '.sch', '.rkt'], + aliases: ['scheme', 'Scheme'], + loader: () => _monaco.Promise.wrap(import('./scheme')), +}); diff --git a/src/scheme/scheme.test.ts b/src/scheme/scheme.test.ts new file mode 100644 index 00000000..4aaa04aa --- /dev/null +++ b/src/scheme/scheme.test.ts @@ -0,0 +1,91 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +'use strict'; + +import { testTokenization } from '../test/testRunner'; + +testTokenization('scheme', [ + // Keywords + [ + { + line: 'define-macro some', + tokens: [ + { startIndex: 0, type: 'keyword.scheme' }, + { startIndex: 12, type: 'white.scheme' }, + { startIndex: 13, type: 'variable.scheme' }, + ], + }, + ], + + // comments + [ + { + line: '; comment', + tokens: [{ startIndex: 0, type: 'comment.scheme' }], + }, + ], + [ + { + line: '|# comment', + tokens: [{ startIndex: 0, type: 'comment.scheme' }], + }, + { + line: 'multiline', + tokens: [{ startIndex: 0, type: 'comment.scheme' }], + }, + { + line: '#| cons', + tokens: [ + { startIndex: 0, type: 'comment.scheme' }, + { startIndex: 2, type: 'white.scheme' }, + { startIndex: 3, type: 'keyword.scheme' }, + ], + }, + ], + + // strings + [ + { + line: '"\\n string "', + tokens: [ + { startIndex: 0, type: 'string.scheme' }, + { startIndex: 1, type: 'string.escape.scheme' }, + { startIndex: 3, type: 'string.scheme' }, + ], + }, + ], + [ + { + line: '" string \\', + tokens: [{ startIndex: 0, type: 'string.scheme' }], + }, + { + line: 'multiline', + tokens: [{ startIndex: 0, type: 'string.scheme' }], + }, + { + line: ' ', + tokens: [ + // previous line needs to be terminated with \ + { startIndex: 0, type: 'white.scheme' }, + ], + }, + ], + + // numbers + [ + { + line: '1e2', + tokens: [{ startIndex: 0, type: 'number.float.scheme' }], + }, + ], + [ + { + line: '#x03BB', + tokens: [{ startIndex: 0, type: 'number.hex.scheme' }], + }, + ], +]); diff --git a/src/scheme/scheme.ts b/src/scheme/scheme.ts new file mode 100644 index 00000000..328d81ea --- /dev/null +++ b/src/scheme/scheme.ts @@ -0,0 +1,124 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +'use strict'; + +import IRichLanguageConfiguration = monaco.languages.LanguageConfiguration; +import ILanguage = monaco.languages.IMonarchLanguage; + +export const conf: IRichLanguageConfiguration = { + comments: { + lineComment: ';', + blockComment: ['#|', '|#'], + }, + + brackets: [['(', ')'], ['{', '}'], ['[', ']']], + + autoClosingPairs: [ + { open: '{', close: '}' }, + { open: '[', close: ']' }, + { open: '(', close: ')' }, + { open: '"', close: '"' }, + ], + + surroundingPairs: [ + { open: '{', close: '}' }, + { open: '[', close: ']' }, + { open: '(', close: ')' }, + { open: '"', close: '"' }, + ], +}; + +export const language = { + defaultToken: '', + ignoreCase: true, + tokenPostfix: '.scheme', + + brackets: [ + { open: '(', close: ')', token: 'delimiter.parenthesis' }, + { open: '{', close: '}', token: 'delimiter.curly' }, + { open: '[', close: ']', token: 'delimiter.square' }, + ], + + keywords: [ + 'case', + 'do', + 'let', + 'loop', + 'if', + 'else', + 'when', + 'cons', + 'car', + 'cdr', + 'cond', + 'lambda', + 'lambda*', + 'syntax-rules', + 'format', + 'set!', + 'quote', + 'eval', + 'append', + 'list', + 'list?', + 'member?', + 'load', + ], + + constants: ['#t', '#f'], + + operators: ['eq?', 'eqv?', 'equal?', 'and', 'or', 'not', 'null?'], + + tokenizer: { + root: [ + [/#[xXoObB][0-9a-fA-F]+/, 'number.hex'], + [/[+-]?\d+(?:(?:\.\d*)?(?:[eE][+-]?\d+)?)?/, 'number.float'], + + [/(?:\b(?:(define|define-syntax|define-macro))\b)(\s+)((?:\w|\-|\!|\?)*)/, ['keyword', 'white', 'variable']], + + [ + /[a-zA-Z_#][a-zA-Z0-9_\-\?\!\*]*/, + { + cases: { + '@keywords': 'keyword', + '@constants': 'constant', + '@operators': 'operators', + '@default': 'identifier', + }, + }, + ], + + { include: '@whitespace' }, + { include: '@strings' }, + ], + + comment: [ + [/[^\|#]+/, 'comment'], + [/\|\#/, 'comment', '@push'], + [/#\|/, 'comment', '@pop'], + [/[\|#]/, 'comment'], + ], + + whitespace: [ + [/[ \t\r\n]+/, 'white'], + [/\|\#/, 'comment', '@comment'], + [/;.*$/, 'comment'], + ], + + strings: [ + [/"$/, 'string', '@popall'], + [/"(?=.)/, 'string', '@multiLineString'], + ], + + multiLineString: [ + [/\\./, 'string.escape'], + [/"/, 'string', '@popall'], + [/.(?=.*")/, 'string'], + [/.*\\$/, 'string'], + [/.*$/, 'string', '@popall'], + ], + }, +}; diff --git a/test/setup.js b/test/setup.js index d797c473..a4c957b7 100644 --- a/test/setup.js +++ b/test/setup.js @@ -65,6 +65,7 @@ define(['require'], function (require) { 'release/dev/redis/redis.test', 'release/dev/csp/csp.test', 'release/dev/st/st.test', + 'release/dev/scheme/scheme.test', ], function () { run(); // We can launch the tests! }, function (err) { From 7cc8adadecf2fe57ca716588c0a4c0bab48ee017 Mon Sep 17 00:00:00 2001 From: Avelino Date: Wed, 30 May 2018 09:22:29 -0300 Subject: [PATCH 005/133] upgrade all language support (today) When implementing a new language should be charged update README (keep project up to date) --- README.md | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index ba15e6a0..cf66a366 100644 --- a/README.md +++ b/README.md @@ -8,15 +8,22 @@ Colorization and configuration supports for multiple languages for the Monaco Ed * coffee script * cpp * csharp +* csp +* dockerfile * fsharp * go * handlebars * html * ini +* java * lua +* markdown +* msdax +* mysql * objective-c -* postiats +* pgsql * php +* postiats * powershell * pug * python @@ -24,11 +31,15 @@ Colorization and configuration supports for multiple languages for the Monaco Ed * razor * ruby * rust +* small basic +* scheme +* solidity * sql +* st * swift * vb * xml -* small basic +* yaml Also `css` dialects: From b8cf0d688ff755d4db72b29b0b0dd0b9c9d6d48c Mon Sep 17 00:00:00 2001 From: Avelino Date: Wed, 30 May 2018 11:26:52 -0300 Subject: [PATCH 006/133] added clojure support refs: https://github.com/Microsoft/monaco-editor/issues/828 https://github.com/theia-ide/theia/issues/1717 --- package-lock.json | 224 ++++++++++++++-------------- scripts/bundle.js | 1 + src/clojure/clojure.contribution.ts | 18 +++ src/clojure/clojure.test.ts | 96 ++++++++++++ src/clojure/clojure.ts | 165 ++++++++++++++++++++ src/monaco.contribution.ts | 1 + test/setup.js | 3 +- 7 files changed, 395 insertions(+), 113 deletions(-) create mode 100644 src/clojure/clojure.contribution.ts create mode 100644 src/clojure/clojure.test.ts create mode 100644 src/clojure/clojure.ts diff --git a/package-lock.json b/package-lock.json index 7d243bcd..9f03c410 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,10 +10,10 @@ "integrity": "sha1-c7Xuyj+rZT49P5Qis0GtQiBdyWU=", "dev": true, "requires": { - "co": "4.6.0", - "fast-deep-equal": "1.1.0", - "fast-json-stable-stringify": "2.0.0", - "json-schema-traverse": "0.3.1" + "co": "^4.6.0", + "fast-deep-equal": "^1.0.0", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.3.0" } }, "asn1": { @@ -59,7 +59,7 @@ "dev": true, "optional": true, "requires": { - "tweetnacl": "0.14.5" + "tweetnacl": "^0.14.3" } }, "boom": { @@ -68,7 +68,7 @@ "integrity": "sha1-T4owBctKfjiJ90kDD9JbluAdLjE=", "dev": true, "requires": { - "hoek": "4.2.1" + "hoek": "4.x.x" } }, "brace-expansion": { @@ -77,7 +77,7 @@ "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", "dev": true, "requires": { - "balanced-match": "1.0.0", + "balanced-match": "^1.0.0", "concat-map": "0.0.1" } }, @@ -111,7 +111,7 @@ "integrity": "sha1-cj599ugBrFYTETp+RFqbactjKBg=", "dev": true, "requires": { - "delayed-stream": "1.0.0" + "delayed-stream": "~1.0.0" } }, "commander": { @@ -120,7 +120,7 @@ "integrity": "sha1-nJkJQXbhIkDLItbFFGCYQA/g99Q=", "dev": true, "requires": { - "graceful-readlink": "1.0.1" + "graceful-readlink": ">= 1.0.0" } }, "concat-map": { @@ -141,7 +141,7 @@ "integrity": "sha1-qJ+7Ig9c4l7FboxKqKT9e1sNKf4=", "dev": true, "requires": { - "boom": "5.2.0" + "boom": "5.x.x" }, "dependencies": { "boom": { @@ -150,7 +150,7 @@ "integrity": "sha512-Z5BTk6ZRe4tXXQlkqftmsAUANpXmuwlsF5Oov8ThoMbQRzdGTA1ngYRW160GexgOgjsFOKJz0LYhoNi+2AMBUw==", "dev": true, "requires": { - "hoek": "4.2.1" + "hoek": "4.x.x" } } } @@ -167,7 +167,7 @@ "integrity": "sha1-VBCXI0yyUTyDzu06zdwn/yeYfVQ=", "dev": true, "requires": { - "cssom": "0.3.2" + "cssom": "0.3.x" } }, "dashdash": { @@ -176,7 +176,7 @@ "integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA=", "dev": true, "requires": { - "assert-plus": "1.0.0" + "assert-plus": "^1.0.0" } }, "debug": { @@ -206,8 +206,8 @@ "integrity": "sha1-BzxpdUbOB4DOI75KKOKT5AvDDII=", "dev": true, "requires": { - "domelementtype": "1.1.3", - "entities": "1.1.1" + "domelementtype": "~1.1.1", + "entities": "~1.1.1" }, "dependencies": { "domelementtype": { @@ -230,7 +230,7 @@ "integrity": "sha1-iS5HAAqZvlW783dP/qBWHYh5wlk=", "dev": true, "requires": { - "domelementtype": "1.3.0" + "domelementtype": "1" } }, "domutils": { @@ -239,8 +239,8 @@ "integrity": "sha512-Lgd2XcJ/NjEw+7tFvfKxOzCYKZsdct5lczQ2ZaQY8Djz7pfAD3Gbp8ySJWtreII/vDlMVmxwa6pHmdxIYgttDg==", "dev": true, "requires": { - "dom-serializer": "0.1.0", - "domelementtype": "1.3.0" + "dom-serializer": "0", + "domelementtype": "1" } }, "ecc-jsbn": { @@ -250,7 +250,7 @@ "dev": true, "optional": true, "requires": { - "jsbn": "0.1.1" + "jsbn": "~0.1.0" } }, "entities": { @@ -301,9 +301,9 @@ "integrity": "sha1-SXBJi+YEwgwAXU9cI67NIda0kJk=", "dev": true, "requires": { - "asynckit": "0.4.0", + "asynckit": "^0.4.0", "combined-stream": "1.0.6", - "mime-types": "2.1.18" + "mime-types": "^2.1.12" } }, "fs.realpath": { @@ -318,7 +318,7 @@ "integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=", "dev": true, "requires": { - "assert-plus": "1.0.0" + "assert-plus": "^1.0.0" } }, "glob": { @@ -327,12 +327,12 @@ "integrity": "sha1-gFIR3wT6rxxjo2ADBs31reULLsg=", "dev": true, "requires": { - "fs.realpath": "1.0.0", - "inflight": "1.0.6", - "inherits": "2.0.3", - "minimatch": "3.0.4", - "once": "1.4.0", - "path-is-absolute": "1.0.1" + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.2", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" } }, "graceful-readlink": { @@ -359,8 +359,8 @@ "integrity": "sha1-ukAsJmGU8VlW7xXg/PJCmT9qff0=", "dev": true, "requires": { - "ajv": "5.5.2", - "har-schema": "2.0.0" + "ajv": "^5.1.0", + "har-schema": "^2.0.0" } }, "has-flag": { @@ -375,10 +375,10 @@ "integrity": "sha512-miowhl2+U7Qle4vdLqDdPt9m09K6yZhkLDTWGoUiUzrQCn+mHHSmfJgAyGaLRZbPmTqfFFjRV1QWCW0VWUJBbQ==", "dev": true, "requires": { - "boom": "4.3.1", - "cryptiles": "3.1.2", - "hoek": "4.2.1", - "sntp": "2.1.0" + "boom": "4.x.x", + "cryptiles": "3.x.x", + "hoek": "4.x.x", + "sntp": "2.x.x" } }, "he": { @@ -399,12 +399,12 @@ "integrity": "sha1-G9+HrMoPP55T+k/M6w9LTLsAszg=", "dev": true, "requires": { - "domelementtype": "1.3.0", - "domhandler": "2.4.1", - "domutils": "1.7.0", - "entities": "1.1.1", - "inherits": "2.0.3", - "readable-stream": "2.3.5" + "domelementtype": "^1.3.0", + "domhandler": "^2.3.0", + "domutils": "^1.5.1", + "entities": "^1.1.1", + "inherits": "^2.0.1", + "readable-stream": "^2.0.2" } }, "http-signature": { @@ -413,9 +413,9 @@ "integrity": "sha1-muzZJRFHcvPZW2WmCruPfBj7rOE=", "dev": true, "requires": { - "assert-plus": "1.0.0", - "jsprim": "1.4.1", - "sshpk": "1.13.1" + "assert-plus": "^1.0.0", + "jsprim": "^1.2.2", + "sshpk": "^1.7.0" } }, "inflight": { @@ -424,8 +424,8 @@ "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", "dev": true, "requires": { - "once": "1.4.0", - "wrappy": "1.0.2" + "once": "^1.3.0", + "wrappy": "1" } }, "inherits": { @@ -465,15 +465,15 @@ "integrity": "sha1-DYvq9hDC/yOJT1Tfp/id0i/Q96s=", "dev": true, "requires": { - "browser-request": "0.3.3", - "cssom": "0.3.2", - "cssstyle": "0.2.37", - "htmlparser2": "3.9.2", - "nwmatcher": "1.4.3", - "parse5": "1.5.1", - "request": "2.85.0", - "xml-name-validator": "1.0.0", - "xmlhttprequest": "1.8.0" + "browser-request": ">= 0.3.1 < 0.4.0", + "cssom": ">= 0.3.0 < 0.4.0", + "cssstyle": ">= 0.2.21 < 0.3.0", + "htmlparser2": ">= 3.7.3 < 4.0.0", + "nwmatcher": ">= 1.3.4 < 2.0.0", + "parse5": ">= 1.3.1 < 2.0.0", + "request": ">= 2.44.0 < 3.0.0", + "xml-name-validator": "^1.0.0", + "xmlhttprequest": ">= 1.6.0 < 2.0.0" } }, "json-schema": { @@ -518,8 +518,8 @@ "integrity": "sha1-jDigmVAPIVrQnlnxci/QxSv+Ck4=", "dev": true, "requires": { - "lodash._basecopy": "3.0.1", - "lodash.keys": "3.1.2" + "lodash._basecopy": "^3.0.0", + "lodash.keys": "^3.0.0" } }, "lodash._basecopy": { @@ -552,9 +552,9 @@ "integrity": "sha1-1/KEnw29p+BGgruM1yqwIkYd6+c=", "dev": true, "requires": { - "lodash._baseassign": "3.2.0", - "lodash._basecreate": "3.0.3", - "lodash._isiterateecall": "3.0.9" + "lodash._baseassign": "^3.0.0", + "lodash._basecreate": "^3.0.0", + "lodash._isiterateecall": "^3.0.0" } }, "lodash.isarguments": { @@ -575,9 +575,9 @@ "integrity": "sha1-TbwEcrFWvlCgsoaFXRvQsMZWCYo=", "dev": true, "requires": { - "lodash._getnative": "3.9.1", - "lodash.isarguments": "3.1.0", - "lodash.isarray": "3.0.4" + "lodash._getnative": "^3.0.0", + "lodash.isarguments": "^3.0.0", + "lodash.isarray": "^3.0.0" } }, "mime-db": { @@ -592,7 +592,7 @@ "integrity": "sha512-lc/aahn+t4/SWV/qcmumYjymLsWfN3ELhpmVuUFjgsORruuZPVSwAQryq+HHGvO/SI2KVX26bx+En+zhM8g8hQ==", "dev": true, "requires": { - "mime-db": "1.33.0" + "mime-db": "~1.33.0" } }, "minimatch": { @@ -601,7 +601,7 @@ "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", "dev": true, "requires": { - "brace-expansion": "1.1.11" + "brace-expansion": "^1.1.7" } }, "minimist": { @@ -651,7 +651,7 @@ "integrity": "sha512-7kUx8dtd5qVNVgUARBRhnM8oftPglYwlINfigC4yGUiuzqtIN22u1tly8umiOCIPR0eFiBLjt6aN23oZh2QJgg==", "dev": true, "requires": { - "typescript": "2.7.2" + "typescript": "^2.7.2" } }, "ms": { @@ -678,7 +678,7 @@ "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", "dev": true, "requires": { - "wrappy": "1.0.2" + "wrappy": "1" } }, "parse5": { @@ -723,13 +723,13 @@ "integrity": "sha512-tK0yDhrkygt/knjowCUiWP9YdV7c5R+8cR0r/kt9ZhBU906Fs6RpQJCEilamRJj1Nx2rWI6LkW9gKqjTkshhEw==", "dev": true, "requires": { - "core-util-is": "1.0.2", - "inherits": "2.0.3", - "isarray": "1.0.0", - "process-nextick-args": "2.0.0", - "safe-buffer": "5.1.1", - "string_decoder": "1.0.3", - "util-deprecate": "1.0.2" + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.0.3", + "util-deprecate": "~1.0.1" } }, "request": { @@ -738,28 +738,28 @@ "integrity": "sha512-8H7Ehijd4js+s6wuVPLjwORxD4zeuyjYugprdOXlPSqaApmL/QOy+EB/beICHVCHkGMKNh5rvihb5ov+IDw4mg==", "dev": true, "requires": { - "aws-sign2": "0.7.0", - "aws4": "1.6.0", - "caseless": "0.12.0", - "combined-stream": "1.0.6", - "extend": "3.0.1", - "forever-agent": "0.6.1", - "form-data": "2.3.2", - "har-validator": "5.0.3", - "hawk": "6.0.2", - "http-signature": "1.2.0", - "is-typedarray": "1.0.0", - "isstream": "0.1.2", - "json-stringify-safe": "5.0.1", - "mime-types": "2.1.18", - "oauth-sign": "0.8.2", - "performance-now": "2.1.0", - "qs": "6.5.1", - "safe-buffer": "5.1.1", - "stringstream": "0.0.5", - "tough-cookie": "2.3.4", - "tunnel-agent": "0.6.0", - "uuid": "3.2.1" + "aws-sign2": "~0.7.0", + "aws4": "^1.6.0", + "caseless": "~0.12.0", + "combined-stream": "~1.0.5", + "extend": "~3.0.1", + "forever-agent": "~0.6.1", + "form-data": "~2.3.1", + "har-validator": "~5.0.3", + "hawk": "~6.0.2", + "http-signature": "~1.2.0", + "is-typedarray": "~1.0.0", + "isstream": "~0.1.2", + "json-stringify-safe": "~5.0.1", + "mime-types": "~2.1.17", + "oauth-sign": "~0.8.2", + "performance-now": "^2.1.0", + "qs": "~6.5.1", + "safe-buffer": "^5.1.1", + "stringstream": "~0.0.5", + "tough-cookie": "~2.3.3", + "tunnel-agent": "^0.6.0", + "uuid": "^3.1.0" } }, "requirejs": { @@ -780,7 +780,7 @@ "integrity": "sha512-FL1b58BDrqS3A11lJ0zEdnJ3UOKqVxawAkF3k7F0CVN7VQ34aZrV+G8BZ1WC9ZL7NyrwsW0oviwsWDgRuVYtJg==", "dev": true, "requires": { - "hoek": "4.2.1" + "hoek": "4.x.x" } }, "source-map": { @@ -795,14 +795,14 @@ "integrity": "sha1-US322mKHFEMW3EwY/hzx2UBzm+M=", "dev": true, "requires": { - "asn1": "0.2.3", - "assert-plus": "1.0.0", - "bcrypt-pbkdf": "1.0.1", - "dashdash": "1.14.1", - "ecc-jsbn": "0.1.1", - "getpass": "0.1.7", - "jsbn": "0.1.1", - "tweetnacl": "0.14.5" + "asn1": "~0.2.3", + "assert-plus": "^1.0.0", + "bcrypt-pbkdf": "^1.0.0", + "dashdash": "^1.12.0", + "ecc-jsbn": "~0.1.1", + "getpass": "^0.1.1", + "jsbn": "~0.1.0", + "tweetnacl": "~0.14.0" } }, "string_decoder": { @@ -811,7 +811,7 @@ "integrity": "sha512-4AH6Z5fzNNBcH+6XDMfA/BTt87skxqJlO0lAh3Dker5zThcAxG6mKz+iGu308UKoPPQ8Dcqx/4JhujzltRa+hQ==", "dev": true, "requires": { - "safe-buffer": "5.1.1" + "safe-buffer": "~5.1.0" } }, "stringstream": { @@ -826,7 +826,7 @@ "integrity": "sha1-cqJiiU2dQIuVbKBf83su2KbiotU=", "dev": true, "requires": { - "has-flag": "1.0.0" + "has-flag": "^1.0.0" } }, "tough-cookie": { @@ -835,7 +835,7 @@ "integrity": "sha512-TZ6TTfI5NtZnuyy/Kecv+CnoROnyXn2DN97LontgQpCwsX2XyLYCC0ENhYkehSOwAp8rTQKc/NUIF7BkQ5rKLA==", "dev": true, "requires": { - "punycode": "1.4.1" + "punycode": "^1.4.1" } }, "tunnel-agent": { @@ -844,7 +844,7 @@ "integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=", "dev": true, "requires": { - "safe-buffer": "5.1.1" + "safe-buffer": "^5.0.1" } }, "tweetnacl": { @@ -866,8 +866,8 @@ "integrity": "sha512-OY8VPQU25q09gQRbC+Ekk3xgEVBmYFEfVcgS47ksjTiNht2LmLlUkWutyi38ZsDSToJHwbe76kDGwmD226Z2Fg==", "dev": true, "requires": { - "commander": "2.14.1", - "source-map": "0.6.1" + "commander": "~2.14.1", + "source-map": "~0.6.1" }, "dependencies": { "commander": { @@ -896,9 +896,9 @@ "integrity": "sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=", "dev": true, "requires": { - "assert-plus": "1.0.0", + "assert-plus": "^1.0.0", "core-util-is": "1.0.2", - "extsprintf": "1.3.0" + "extsprintf": "^1.2.0" } }, "wrappy": { diff --git a/scripts/bundle.js b/scripts/bundle.js index 34f1527a..dde25d09 100644 --- a/scripts/bundle.js +++ b/scripts/bundle.js @@ -62,6 +62,7 @@ bundleOne('pgsql/pgsql'); bundleOne('redis/redis'); bundleOne('csp/csp'); bundleOne('scheme/scheme'); +// bundleOne('clojure/clojure'); function bundleOne(moduleId, exclude) { requirejs.optimize({ diff --git a/src/clojure/clojure.contribution.ts b/src/clojure/clojure.contribution.ts new file mode 100644 index 00000000..a8c72682 --- /dev/null +++ b/src/clojure/clojure.contribution.ts @@ -0,0 +1,18 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +'use strict'; + +import { registerLanguage } from '../_.contribution'; + +// Allow for running under nodejs/requirejs in tests +const _monaco: typeof monaco = + typeof monaco === 'undefined' ? (self).monaco : monaco; + +registerLanguage({ + id: 'clojure', + extensions: ['.clj', '.clojure'], + aliases: ['clojure', 'Clojure'], + loader: () => _monaco.Promise.wrap(import('./clojure')), +}); diff --git a/src/clojure/clojure.test.ts b/src/clojure/clojure.test.ts new file mode 100644 index 00000000..19eee593 --- /dev/null +++ b/src/clojure/clojure.test.ts @@ -0,0 +1,96 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +'use strict'; + +import { testTokenization } from '../test/testRunner'; + +testTokenization('clojure', [ + // Keywords + [ + { + line: 'defmacro some', + tokens: [ + { startIndex: 0, type: 'keyword.clj' }, + { startIndex: 8, type: 'white.clj' }, + { startIndex: 9, type: 'variable.clj' }, + ], + }, + + { + line: 'comment "text comment"', + tokens: [ + { startIndex: 0, type: 'keyword.clj' }, + { startIndex: 7, type: 'white.clj'}, + { startIndex: 8, type: 'string.clj'}, + ], + }, + ], + + // comments + [ + { + line: ';; comment', + tokens: [{ startIndex: 0, type: 'comment.clj' }], + }, + ], + [ + { + line: '(comment', + tokens: [{ startIndex: 0, type: 'comment.clj' }], + }, + { + line: '(comment let', + tokens: [ + { startIndex: 0, type: 'comment.clj' }, + { startIndex: 8, type: 'white.clj' }, + { startIndex: 9, type: 'keyword.clj' }, + ], + }, + ], + + // strings + [ + { + line: '"\\n string "', + tokens: [ + { startIndex: 0, type: 'string.clj' }, + { startIndex: 1, type: 'string.escape.clj' }, + { startIndex: 3, type: 'string.clj' }, + ], + }, + ], + [ + { + line: '" string \\', + tokens: [{ startIndex: 0, type: 'string.clj' }], + }, + { + line: 'multiline', + tokens: [{ startIndex: 0, type: 'string.clj' }], + }, + { + line: ' ', + tokens: [ + // previous line needs to be terminated with \ + { startIndex: 0, type: 'white.clj' }, + ], + }, + ], + + // numbers + [ + { + line: '1e2', + tokens: [{ startIndex: 0, type: 'number.float.clj' }], + }, + ], + [ + { + line: '#x03BB', + tokens: [{ startIndex: 0, type: 'number.hex.clj' }], + }, + ], +]); diff --git a/src/clojure/clojure.ts b/src/clojure/clojure.ts new file mode 100644 index 00000000..5b625428 --- /dev/null +++ b/src/clojure/clojure.ts @@ -0,0 +1,165 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +'use strict'; + +import IRichLanguageConfiguration = monaco.languages.LanguageConfiguration; +import ILanguage = monaco.languages.IMonarchLanguage; + +export const conf: IRichLanguageConfiguration = { + comments: { + lineComment: ';;', + blockComment: ['(comment', ')'], + }, + + brackets: [['(', ')'], ['{', '}'], ['[', ']']], + + autoClosingPairs: [ + { open: '{', close: '}' }, + { open: '[', close: ']' }, + { open: '(', close: ')' }, + { open: '"', close: '"' }, + ], + + surroundingPairs: [ + { open: '{', close: '}' }, + { open: '[', close: ']' }, + { open: '(', close: ')' }, + { open: '"', close: '"' }, + ], +}; + +export const language = { + defaultToken: '', + ignoreCase: true, + tokenPostfix: '.clj', + + brackets: [ + { open: '(', close: ')', token: 'delimiter.parenthesis' }, + { open: '{', close: '}', token: 'delimiter.curly' }, + { open: '[', close: ']', token: 'delimiter.square' }, + ], + + keywords: [ + 'ns', + 'ns-unmap', + 'fn', + 'def', + 'defn', + 'defmacro', + 'defmulti', + 'defonce', + 'bound\\-fn', + 'if', + 'if\\-not', + 'case,', + 'cond', + 'condp', + 'cond\\-\\>', + 'cond\\-\\>\\>', + 'when', + 'while', + 'when\\-not', + 'when\\-first', + 'do', + 'future', + 'comment', + 'doto', + 'locking', + 'proxy', + 'as\\-\\>', + 'reify', + 'deftype', + 'defrecord', + 'defprotocol', + 'extend', + 'extend-protocol', + 'extend-type', + 'specify', + 'specify\\!', + 'try', + 'catch', + 'finally', + 'let', + 'letfn', + 'binding', + 'loop', + 'for', + 'doseq', + 'dotimes', + 'when\\-let', + 'if\\-let', + 'when\\-some', + 'if\\-some', + 'this\\-as', + 'defmethod', + 'testing', + 'deftest', + 'are', + 'use\\-fixtures', + 'run', + 'run\\*', + 'fresh', + 'alt!', + 'alt!!', + 'go', + 'go\\-loop', + 'thread', + ], + + constants: ['true', 'false', 'nil'], + + operators: ['=', 'not=', '<', '<=', '>', '>=', 'and', 'or', 'not', 'inc', 'dec', 'max', 'min', 'rem', 'bit-and', 'bit-or', 'bit-xor', 'bit-not'], + + tokenizer: { + root: [ + [/#[xXoObB][0-9a-fA-F]+/, 'number.hex'], + [/[+-]?\d+(?:(?:\.\d*)?(?:[eE][+-]?\d+)?)?/, 'number.float'], + + [/(?:\b(?:(def|defn|defmacro|defmulti|defonce|ns|ns-unmap|fn))\b)(\s+)((?:\w|\-|\!|\?)*)/, ['keyword', 'white', 'variable']], + + [ + /[a-zA-Z_#][a-zA-Z0-9_\-\?\!\*]*/, + { + cases: { + '@keywords': 'keyword', + '@constants': 'constant', + '@operators': 'operators', + '@default': 'identifier', + }, + }, + ], + + { include: '@whitespace' }, + { include: '@strings' }, + ], + + comment: [ + [/[^\(comment]+/, 'comment'], + [/\)/, 'comment', '@push'], + [/\(comment/, 'comment', '@pop'], + [/[\)]/, 'comment'], + ], + + whitespace: [ + [/[ \t\r\n]+/, 'white'], + [/\(comment/, 'comment', '@comment'], + [/;;.*$/, 'comment'], + ], + + strings: [ + [/"$/, 'string', '@popall'], + [/"(?=.)/, 'string', '@multiLineString'], + ], + + multiLineString: [ + [/\\./, 'string.escape'], + [/"/, 'string', '@popall'], + [/.(?=.*")/, 'string'], + [/.*\\$/, 'string'], + [/.*$/, 'string', '@popall'], + ], + }, +}; diff --git a/src/monaco.contribution.ts b/src/monaco.contribution.ts index f3fa2a34..691fab63 100644 --- a/src/monaco.contribution.ts +++ b/src/monaco.contribution.ts @@ -45,3 +45,4 @@ import './vb/vb.contribution'; import './xml/xml.contribution'; import './yaml/yaml.contribution'; import './scheme/scheme.contribution'; +import './clojure/clojure.contribution'; diff --git a/test/setup.js b/test/setup.js index a4c957b7..e9a08312 100644 --- a/test/setup.js +++ b/test/setup.js @@ -65,7 +65,8 @@ define(['require'], function (require) { 'release/dev/redis/redis.test', 'release/dev/csp/csp.test', 'release/dev/st/st.test', - 'release/dev/scheme/scheme.test', + 'release/dev/scheme/scheme.test', + 'release/dev/clojure/clojure.test', ], function () { run(); // We can launch the tests! }, function (err) { From 05bb6c9204493ce7248cc4dbe1594f2f1156daa7 Mon Sep 17 00:00:00 2001 From: Avelino Date: Wed, 30 May 2018 11:32:39 -0300 Subject: [PATCH 007/133] append clojure on readme file --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index cf66a366..db72225b 100644 --- a/README.md +++ b/README.md @@ -5,6 +5,7 @@ Colorization and configuration supports for multiple languages for the Monaco Ed ![monaco-languages](https://cloud.githubusercontent.com/assets/5047891/15938606/1fd4bac6-2e74-11e6-8839-d455da8bc8a7.gif) * bat +* clojure * coffee script * cpp * csharp From 8bfec94690f2d0c5547490bab6367d09c72894af Mon Sep 17 00:00:00 2001 From: Avelino Date: Thu, 31 May 2018 06:23:20 -0300 Subject: [PATCH 008/133] added more keywords Clojure has many reserved words --- src/clojure/clojure.ts | 50 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 49 insertions(+), 1 deletion(-) diff --git a/src/clojure/clojure.ts b/src/clojure/clojure.ts index 5b625428..582eafb2 100644 --- a/src/clojure/clojure.ts +++ b/src/clojure/clojure.ts @@ -45,16 +45,56 @@ export const language = { keywords: [ 'ns', 'ns-unmap', + 'create-ns', + 'in-ns', 'fn', 'def', 'defn', 'defmacro', 'defmulti', 'defonce', + 'require', + 'import', + 'new', + 'refer', + 'pos', + 'pos\\?', + 'filter', + 'map', + 'reduce', + 'repeat', + 'key', + 'rest', + 'concat', + 'into', + 'reverse', + 'iterate', + 'range', + 'drop', + 'drop\\-while', + 'take', + 'take\\-while', + 'neg', + 'neg?', 'bound\\-fn', 'if', 'if\\-not', + 'if\\-let', 'case,', + 'contains', + 'conj', + 'disj', + 'sort', + 'get', + 'assoc', + 'merge', + 'keys', + 'vals', + 'nth', + 'first', + 'last', + 'count', + 'contains?', 'cond', 'condp', 'cond\\-\\>', @@ -62,6 +102,7 @@ export const language = { 'when', 'while', 'when\\-not', + 'when\\-let', 'when\\-first', 'do', 'future', @@ -69,6 +110,10 @@ export const language = { 'doto', 'locking', 'proxy', + 'println', + 'type', + 'meta', + 'var', 'as\\-\\>', 'reify', 'deftype', @@ -87,6 +132,7 @@ export const language = { 'binding', 'loop', 'for', + 'seq', 'doseq', 'dotimes', 'when\\-let', @@ -99,6 +145,8 @@ export const language = { 'deftest', 'are', 'use\\-fixtures', + 'use', + 'remove', 'run', 'run\\*', 'fresh', @@ -109,7 +157,7 @@ export const language = { 'thread', ], - constants: ['true', 'false', 'nil'], + constants: ['true', 'false', 'nil', 'boolean', 'str'], operators: ['=', 'not=', '<', '<=', '>', '>=', 'and', 'or', 'not', 'inc', 'dec', 'max', 'min', 'rem', 'bit-and', 'bit-or', 'bit-xor', 'bit-not'], From 380fe86dd8c413c8c1bbca24fe3e8b81fe0c3d97 Mon Sep 17 00:00:00 2001 From: Avelino Date: Thu, 31 May 2018 06:34:02 -0300 Subject: [PATCH 009/133] fixed keyword that contains `-` --- src/clojure/clojure.test.ts | 8 +++++++ src/clojure/clojure.ts | 46 ++++++++++++++++++------------------- 2 files changed, 31 insertions(+), 23 deletions(-) diff --git a/src/clojure/clojure.test.ts b/src/clojure/clojure.test.ts index 19eee593..ab1bc64e 100644 --- a/src/clojure/clojure.test.ts +++ b/src/clojure/clojure.test.ts @@ -27,6 +27,14 @@ testTokenization('clojure', [ { startIndex: 8, type: 'string.clj'}, ], }, + { + line: 'in-ns "user', + tokens: [ + { startIndex: 0, type: 'keyword.clj' }, + { startIndex: 5, type: 'white.clj' }, + { startIndex: 6, type: 'string.clj' }, + ], + }, ], // comments diff --git a/src/clojure/clojure.ts b/src/clojure/clojure.ts index 582eafb2..97748220 100644 --- a/src/clojure/clojure.ts +++ b/src/clojure/clojure.ts @@ -44,9 +44,9 @@ export const language = { keywords: [ 'ns', - 'ns-unmap', - 'create-ns', - 'in-ns', + 'ns\-unmap', + 'create\-ns', + 'in\-ns', 'fn', 'def', 'defn', @@ -71,15 +71,15 @@ export const language = { 'iterate', 'range', 'drop', - 'drop\\-while', + 'drop\-while', 'take', - 'take\\-while', + 'take\-while', 'neg', 'neg?', - 'bound\\-fn', + 'bound\-fn', 'if', - 'if\\-not', - 'if\\-let', + 'if\-not', + 'if\-let', 'case,', 'contains', 'conj', @@ -97,13 +97,13 @@ export const language = { 'contains?', 'cond', 'condp', - 'cond\\-\\>', - 'cond\\-\\>\\>', + 'cond\-\>', + 'cond\-\>\>', 'when', 'while', - 'when\\-not', - 'when\\-let', - 'when\\-first', + 'when\-not', + 'when\-let', + 'when\-first', 'do', 'future', 'comment', @@ -114,7 +114,7 @@ export const language = { 'type', 'meta', 'var', - 'as\\-\\>', + 'as\-\>', 'reify', 'deftype', 'defrecord', @@ -123,7 +123,7 @@ export const language = { 'extend-protocol', 'extend-type', 'specify', - 'specify\\!', + 'specify\!', 'try', 'catch', 'finally', @@ -135,25 +135,25 @@ export const language = { 'seq', 'doseq', 'dotimes', - 'when\\-let', - 'if\\-let', - 'when\\-some', - 'if\\-some', - 'this\\-as', + 'when\-let', + 'if\-let', + 'when\-some', + 'if\-some', + 'this\-as', 'defmethod', 'testing', 'deftest', 'are', - 'use\\-fixtures', + 'use\-fixtures', 'use', 'remove', 'run', - 'run\\*', + 'run\*', 'fresh', 'alt!', 'alt!!', 'go', - 'go\\-loop', + 'go\-loop', 'thread', ], From 32838abddd60574534b829c7ea10afa5ffb3b9ec Mon Sep 17 00:00:00 2001 From: Alex Dima Date: Thu, 31 May 2018 11:39:34 +0200 Subject: [PATCH 010/133] Minor cleanup --- scripts/bundle.js | 2 +- test/setup.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/bundle.js b/scripts/bundle.js index dde25d09..9b079c36 100644 --- a/scripts/bundle.js +++ b/scripts/bundle.js @@ -62,7 +62,7 @@ bundleOne('pgsql/pgsql'); bundleOne('redis/redis'); bundleOne('csp/csp'); bundleOne('scheme/scheme'); -// bundleOne('clojure/clojure'); +bundleOne('clojure/clojure'); function bundleOne(moduleId, exclude) { requirejs.optimize({ diff --git a/test/setup.js b/test/setup.js index e9a08312..c6490083 100644 --- a/test/setup.js +++ b/test/setup.js @@ -65,8 +65,8 @@ define(['require'], function (require) { 'release/dev/redis/redis.test', 'release/dev/csp/csp.test', 'release/dev/st/st.test', - 'release/dev/scheme/scheme.test', - 'release/dev/clojure/clojure.test', + 'release/dev/scheme/scheme.test', + 'release/dev/clojure/clojure.test', ], function () { run(); // We can launch the tests! }, function (err) { From 4f1958ac275efcf1f7c92a030ccbcfa10293943d Mon Sep 17 00:00:00 2001 From: Avelino Date: Thu, 31 May 2018 06:39:50 -0300 Subject: [PATCH 011/133] fixed clear \\ to \ on keywords --- src/clojure/clojure.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/clojure/clojure.ts b/src/clojure/clojure.ts index 97748220..010c6dec 100644 --- a/src/clojure/clojure.ts +++ b/src/clojure/clojure.ts @@ -58,7 +58,7 @@ export const language = { 'new', 'refer', 'pos', - 'pos\\?', + 'pos\?', 'filter', 'map', 'reduce', From 9987c4fd86705ba69e800409840badbd0ccf94be Mon Sep 17 00:00:00 2001 From: masad-frost Date: Fri, 8 Jun 2018 23:45:35 -0700 Subject: [PATCH 012/133] Prettier --- src/clojure/clojure.ts | 406 ++++++++++++++++++++++------------------- 1 file changed, 214 insertions(+), 192 deletions(-) diff --git a/src/clojure/clojure.ts b/src/clojure/clojure.ts index 010c6dec..5d58f315 100644 --- a/src/clojure/clojure.ts +++ b/src/clojure/clojure.ts @@ -9,205 +9,227 @@ import IRichLanguageConfiguration = monaco.languages.LanguageConfiguration; import ILanguage = monaco.languages.IMonarchLanguage; export const conf: IRichLanguageConfiguration = { - comments: { - lineComment: ';;', - blockComment: ['(comment', ')'], - }, - - brackets: [['(', ')'], ['{', '}'], ['[', ']']], - - autoClosingPairs: [ - { open: '{', close: '}' }, - { open: '[', close: ']' }, - { open: '(', close: ')' }, - { open: '"', close: '"' }, - ], - - surroundingPairs: [ - { open: '{', close: '}' }, - { open: '[', close: ']' }, - { open: '(', close: ')' }, - { open: '"', close: '"' }, - ], -}; - -export const language = { - defaultToken: '', - ignoreCase: true, - tokenPostfix: '.clj', - - brackets: [ - { open: '(', close: ')', token: 'delimiter.parenthesis' }, - { open: '{', close: '}', token: 'delimiter.curly' }, - { open: '[', close: ']', token: 'delimiter.square' }, - ], - - keywords: [ - 'ns', - 'ns\-unmap', - 'create\-ns', - 'in\-ns', - 'fn', - 'def', - 'defn', - 'defmacro', - 'defmulti', - 'defonce', - 'require', - 'import', - 'new', - 'refer', - 'pos', - 'pos\?', - 'filter', - 'map', - 'reduce', - 'repeat', - 'key', - 'rest', - 'concat', - 'into', - 'reverse', - 'iterate', - 'range', - 'drop', - 'drop\-while', - 'take', - 'take\-while', - 'neg', - 'neg?', - 'bound\-fn', - 'if', - 'if\-not', - 'if\-let', - 'case,', - 'contains', - 'conj', - 'disj', - 'sort', - 'get', - 'assoc', - 'merge', - 'keys', - 'vals', - 'nth', - 'first', - 'last', - 'count', - 'contains?', - 'cond', - 'condp', - 'cond\-\>', - 'cond\-\>\>', - 'when', - 'while', - 'when\-not', - 'when\-let', - 'when\-first', - 'do', - 'future', - 'comment', - 'doto', - 'locking', - 'proxy', - 'println', - 'type', - 'meta', - 'var', - 'as\-\>', - 'reify', - 'deftype', - 'defrecord', - 'defprotocol', - 'extend', - 'extend-protocol', - 'extend-type', - 'specify', - 'specify\!', - 'try', - 'catch', - 'finally', - 'let', - 'letfn', - 'binding', - 'loop', - 'for', - 'seq', - 'doseq', - 'dotimes', - 'when\-let', - 'if\-let', - 'when\-some', - 'if\-some', - 'this\-as', - 'defmethod', - 'testing', - 'deftest', - 'are', - 'use\-fixtures', - 'use', - 'remove', - 'run', - 'run\*', - 'fresh', - 'alt!', - 'alt!!', - 'go', - 'go\-loop', - 'thread', - ], - - constants: ['true', 'false', 'nil', 'boolean', 'str'], - - operators: ['=', 'not=', '<', '<=', '>', '>=', 'and', 'or', 'not', 'inc', 'dec', 'max', 'min', 'rem', 'bit-and', 'bit-or', 'bit-xor', 'bit-not'], - - tokenizer: { - root: [ - [/#[xXoObB][0-9a-fA-F]+/, 'number.hex'], - [/[+-]?\d+(?:(?:\.\d*)?(?:[eE][+-]?\d+)?)?/, 'number.float'], - - [/(?:\b(?:(def|defn|defmacro|defmulti|defonce|ns|ns-unmap|fn))\b)(\s+)((?:\w|\-|\!|\?)*)/, ['keyword', 'white', 'variable']], - - [ - /[a-zA-Z_#][a-zA-Z0-9_\-\?\!\*]*/, - { - cases: { - '@keywords': 'keyword', - '@constants': 'constant', - '@operators': 'operators', - '@default': 'identifier', - }, - }, - ], - - { include: '@whitespace' }, - { include: '@strings' }, + comments: { + lineComment: ';;', + blockComment: ['(comment', ')'], + }, + + brackets: [['(', ')'], ['{', '}'], ['[', ']']], + + autoClosingPairs: [ + { open: '{', close: '}' }, + { open: '[', close: ']' }, + { open: '(', close: ')' }, + { open: '"', close: '"' }, ], - comment: [ - [/[^\(comment]+/, 'comment'], - [/\)/, 'comment', '@push'], - [/\(comment/, 'comment', '@pop'], - [/[\)]/, 'comment'], + surroundingPairs: [ + { open: '{', close: '}' }, + { open: '[', close: ']' }, + { open: '(', close: ')' }, + { open: '"', close: '"' }, ], +}; - whitespace: [ - [/[ \t\r\n]+/, 'white'], - [/\(comment/, 'comment', '@comment'], - [/;;.*$/, 'comment'], +export const language = { + defaultToken: '', + ignoreCase: true, + tokenPostfix: '.clj', + + brackets: [ + { open: '(', close: ')', token: 'delimiter.parenthesis' }, + { open: '{', close: '}', token: 'delimiter.curly' }, + { open: '[', close: ']', token: 'delimiter.square' }, ], - strings: [ - [/"$/, 'string', '@popall'], - [/"(?=.)/, 'string', '@multiLineString'], + keywords: [ + 'ns', + 'ns-unmap', + 'create-ns', + 'in-ns', + 'fn', + 'def', + 'defn', + 'defmacro', + 'defmulti', + 'defonce', + 'require', + 'import', + 'new', + 'refer', + 'pos', + 'pos?', + 'filter', + 'map', + 'reduce', + 'repeat', + 'key', + 'rest', + 'concat', + 'into', + 'reverse', + 'iterate', + 'range', + 'drop', + 'drop-while', + 'take', + 'take-while', + 'neg', + 'neg?', + 'bound-fn', + 'if', + 'if-not', + 'if-let', + 'case,', + 'contains', + 'conj', + 'disj', + 'sort', + 'get', + 'assoc', + 'merge', + 'keys', + 'vals', + 'nth', + 'first', + 'last', + 'count', + 'contains?', + 'cond', + 'condp', + 'cond->', + 'cond->>', + 'when', + 'while', + 'when-not', + 'when-let', + 'when-first', + 'do', + 'future', + 'comment', + 'doto', + 'locking', + 'proxy', + 'println', + 'type', + 'meta', + 'var', + 'as->', + 'reify', + 'deftype', + 'defrecord', + 'defprotocol', + 'extend', + 'extend-protocol', + 'extend-type', + 'specify', + 'specify!', + 'try', + 'catch', + 'finally', + 'let', + 'letfn', + 'binding', + 'loop', + 'for', + 'seq', + 'doseq', + 'dotimes', + 'when-let', + 'if-let', + 'when-some', + 'if-some', + 'this-as', + 'defmethod', + 'testing', + 'deftest', + 'are', + 'use-fixtures', + 'use', + 'remove', + 'run', + 'run*', + 'fresh', + 'alt!', + 'alt!!', + 'go', + 'go-loop', + 'thread', ], - multiLineString: [ - [/\\./, 'string.escape'], - [/"/, 'string', '@popall'], - [/.(?=.*")/, 'string'], - [/.*\\$/, 'string'], - [/.*$/, 'string', '@popall'], + constants: ['true', 'false', 'nil', 'boolean', 'str'], + + operators: [ + '=', + 'not=', + '<', + '<=', + '>', + '>=', + 'and', + 'or', + 'not', + 'inc', + 'dec', + 'max', + 'min', + 'rem', + 'bit-and', + 'bit-or', + 'bit-xor', + 'bit-not', ], - }, + + tokenizer: { + root: [ + [/#[xXoObB][0-9a-fA-F]+/, 'number.hex'], + [/[+-]?\d+(?:(?:\.\d*)?(?:[eE][+-]?\d+)?)?/, 'number.float'], + + [ + /(?:\b(?:(def|defn|defmacro|defmulti|defonce|ns|ns-unmap|fn))\b)(\s+)((?:\w|\-|\!|\?)*)/, + ['keyword', 'white', 'variable'], + ], + + [ + /[a-zA-Z_#][a-zA-Z0-9_\-\?\!\*]*/, + { + cases: { + '@keywords': 'keyword', + '@constants': 'constant', + '@operators': 'operators', + '@default': 'identifier', + }, + }, + ], + + { include: '@whitespace' }, + { include: '@strings' }, + ], + + comment: [ + [/[^\(comment]+/, 'comment'], + [/\)/, 'comment', '@push'], + [/\(comment/, 'comment', '@pop'], + [/[\)]/, 'comment'], + ], + + whitespace: [ + [/[ \t\r\n]+/, 'white'], + [/\(comment/, 'comment', '@comment'], + [/;;.*$/, 'comment'], + ], + + strings: [ + [/"$/, 'string', '@popall'], + [/"(?=.)/, 'string', '@multiLineString'], + ], + + multiLineString: [ + [/\\./, 'string.escape'], + [/"/, 'string', '@popall'], + [/.(?=.*")/, 'string'], + [/.*\\$/, 'string'], + [/.*$/, 'string', '@popall'], + ], + }, }; From 6f3c349061217f04e1377f5a9be770c362dc4bde Mon Sep 17 00:00:00 2001 From: masad-frost Date: Fri, 8 Jun 2018 23:47:44 -0700 Subject: [PATCH 013/133] Fix hex numbers --- src/clojure/clojure.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/clojure/clojure.ts b/src/clojure/clojure.ts index 5d58f315..10ec5a3a 100644 --- a/src/clojure/clojure.ts +++ b/src/clojure/clojure.ts @@ -182,7 +182,7 @@ export const language = { tokenizer: { root: [ - [/#[xXoObB][0-9a-fA-F]+/, 'number.hex'], + [/0[xX][0-9a-fA-F]+/, 'number.hex'], [/[+-]?\d+(?:(?:\.\d*)?(?:[eE][+-]?\d+)?)?/, 'number.float'], [ From 79eaf088de931420d98f6d171b0583a015342f66 Mon Sep 17 00:00:00 2001 From: masad-frost Date: Fri, 8 Jun 2018 23:59:45 -0700 Subject: [PATCH 014/133] Add defn- and include hyphen in boundary --- src/clojure/clojure.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/clojure/clojure.ts b/src/clojure/clojure.ts index 10ec5a3a..952d1059 100644 --- a/src/clojure/clojure.ts +++ b/src/clojure/clojure.ts @@ -186,7 +186,7 @@ export const language = { [/[+-]?\d+(?:(?:\.\d*)?(?:[eE][+-]?\d+)?)?/, 'number.float'], [ - /(?:\b(?:(def|defn|defmacro|defmulti|defonce|ns|ns-unmap|fn))\b)(\s+)((?:\w|\-|\!|\?)*)/, + /(?:\b(?:(def|defn|defn-|defmacro|defmulti|defonce|ns|ns-unmap|fn))\b)(\s+)((?:\w|\-|\!|\?)*)/, ['keyword', 'white', 'variable'], ], From 6f38c8fe44917d7a274afb9871f694e72dd621a2 Mon Sep 17 00:00:00 2001 From: masad-frost Date: Sat, 9 Jun 2018 00:32:35 -0700 Subject: [PATCH 015/133] Move boolean and str to keywords --- src/clojure/clojure.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/clojure/clojure.ts b/src/clojure/clojure.ts index 952d1059..bc6176c3 100644 --- a/src/clojure/clojure.ts +++ b/src/clojure/clojure.ts @@ -155,9 +155,11 @@ export const language = { 'go', 'go-loop', 'thread', + 'boolean', + 'str', ], - constants: ['true', 'false', 'nil', 'boolean', 'str'], + constants: ['true', 'false', 'nil'], operators: [ '=', From 12294521e05e927b37228fea148358055c753482 Mon Sep 17 00:00:00 2001 From: masad-frost Date: Sat, 9 Jun 2018 00:33:14 -0700 Subject: [PATCH 016/133] Add ns and defn- to definitions --- src/clojure/clojure.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/clojure/clojure.ts b/src/clojure/clojure.ts index bc6176c3..738e39b2 100644 --- a/src/clojure/clojure.ts +++ b/src/clojure/clojure.ts @@ -188,7 +188,7 @@ export const language = { [/[+-]?\d+(?:(?:\.\d*)?(?:[eE][+-]?\d+)?)?/, 'number.float'], [ - /(?:\b(?:(def|defn|defn-|defmacro|defmulti|defonce|ns|ns-unmap|fn))\b)(\s+)((?:\w|\-|\!|\?)*)/, + /(?:\b(?:(ns|def|defn|defn-|defmacro|defmulti|defonce|ns|ns-unmap|fn))(?![\w-]))(\s+)((?:\w|\-|\!|\?)*)/, ['keyword', 'white', 'variable'], ], From 520915ef46b178b5af85c991ddc8aa90749713e7 Mon Sep 17 00:00:00 2001 From: masad-frost Date: Sat, 9 Jun 2018 00:33:26 -0700 Subject: [PATCH 017/133] Add regexp --- src/clojure/clojure.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/clojure/clojure.ts b/src/clojure/clojure.ts index 738e39b2..53c0473c 100644 --- a/src/clojure/clojure.ts +++ b/src/clojure/clojure.ts @@ -204,6 +204,8 @@ export const language = { }, ], + [/\/#"(?:\.|(?:\")|[^""\n])*"\/g/, 'regexp'], + { include: '@whitespace' }, { include: '@strings' }, ], From 29bee2f3efa88bcc57180f2ca3090c147db3f9a4 Mon Sep 17 00:00:00 2001 From: masad-frost Date: Sat, 9 Jun 2018 02:03:41 -0700 Subject: [PATCH 018/133] Fix scheme comments --- src/scheme/scheme.ts | 221 ++++++++++++++++++++++--------------------- 1 file changed, 112 insertions(+), 109 deletions(-) diff --git a/src/scheme/scheme.ts b/src/scheme/scheme.ts index 328d81ea..7c3129f3 100644 --- a/src/scheme/scheme.ts +++ b/src/scheme/scheme.ts @@ -9,116 +9,119 @@ import IRichLanguageConfiguration = monaco.languages.LanguageConfiguration; import ILanguage = monaco.languages.IMonarchLanguage; export const conf: IRichLanguageConfiguration = { - comments: { - lineComment: ';', - blockComment: ['#|', '|#'], - }, - - brackets: [['(', ')'], ['{', '}'], ['[', ']']], - - autoClosingPairs: [ - { open: '{', close: '}' }, - { open: '[', close: ']' }, - { open: '(', close: ')' }, - { open: '"', close: '"' }, - ], - - surroundingPairs: [ - { open: '{', close: '}' }, - { open: '[', close: ']' }, - { open: '(', close: ')' }, - { open: '"', close: '"' }, - ], + comments: { + lineComment: ';', + blockComment: ['#|', '|#'], + }, + + brackets: [['(', ')'], ['{', '}'], ['[', ']']], + + autoClosingPairs: [ + { open: '{', close: '}' }, + { open: '[', close: ']' }, + { open: '(', close: ')' }, + { open: '"', close: '"' }, + ], + + surroundingPairs: [ + { open: '{', close: '}' }, + { open: '[', close: ']' }, + { open: '(', close: ')' }, + { open: '"', close: '"' }, + ], }; export const language = { - defaultToken: '', - ignoreCase: true, - tokenPostfix: '.scheme', - - brackets: [ - { open: '(', close: ')', token: 'delimiter.parenthesis' }, - { open: '{', close: '}', token: 'delimiter.curly' }, - { open: '[', close: ']', token: 'delimiter.square' }, - ], - - keywords: [ - 'case', - 'do', - 'let', - 'loop', - 'if', - 'else', - 'when', - 'cons', - 'car', - 'cdr', - 'cond', - 'lambda', - 'lambda*', - 'syntax-rules', - 'format', - 'set!', - 'quote', - 'eval', - 'append', - 'list', - 'list?', - 'member?', - 'load', - ], - - constants: ['#t', '#f'], - - operators: ['eq?', 'eqv?', 'equal?', 'and', 'or', 'not', 'null?'], - - tokenizer: { - root: [ - [/#[xXoObB][0-9a-fA-F]+/, 'number.hex'], - [/[+-]?\d+(?:(?:\.\d*)?(?:[eE][+-]?\d+)?)?/, 'number.float'], - - [/(?:\b(?:(define|define-syntax|define-macro))\b)(\s+)((?:\w|\-|\!|\?)*)/, ['keyword', 'white', 'variable']], - - [ - /[a-zA-Z_#][a-zA-Z0-9_\-\?\!\*]*/, - { - cases: { - '@keywords': 'keyword', - '@constants': 'constant', - '@operators': 'operators', - '@default': 'identifier', - }, - }, - ], - - { include: '@whitespace' }, - { include: '@strings' }, - ], - - comment: [ - [/[^\|#]+/, 'comment'], - [/\|\#/, 'comment', '@push'], - [/#\|/, 'comment', '@pop'], - [/[\|#]/, 'comment'], - ], - - whitespace: [ - [/[ \t\r\n]+/, 'white'], - [/\|\#/, 'comment', '@comment'], - [/;.*$/, 'comment'], - ], - - strings: [ - [/"$/, 'string', '@popall'], - [/"(?=.)/, 'string', '@multiLineString'], - ], - - multiLineString: [ - [/\\./, 'string.escape'], - [/"/, 'string', '@popall'], - [/.(?=.*")/, 'string'], - [/.*\\$/, 'string'], - [/.*$/, 'string', '@popall'], - ], - }, + defaultToken: '', + ignoreCase: true, + tokenPostfix: '.scheme', + + brackets: [ + { open: '(', close: ')', token: 'delimiter.parenthesis' }, + { open: '{', close: '}', token: 'delimiter.curly' }, + { open: '[', close: ']', token: 'delimiter.square' }, + ], + + keywords: [ + 'case', + 'do', + 'let', + 'loop', + 'if', + 'else', + 'when', + 'cons', + 'car', + 'cdr', + 'cond', + 'lambda', + 'lambda*', + 'syntax-rules', + 'format', + 'set!', + 'quote', + 'eval', + 'append', + 'list', + 'list?', + 'member?', + 'load', + ], + + constants: ['#t', '#f'], + + operators: ['eq?', 'eqv?', 'equal?', 'and', 'or', 'not', 'null?'], + + tokenizer: { + root: [ + [/#[xXoObB][0-9a-fA-F]+/, 'number.hex'], + [/[+-]?\d+(?:(?:\.\d*)?(?:[eE][+-]?\d+)?)?/, 'number.float'], + + [ + /(?:\b(?:(define|define-syntax|define-macro))\b)(\s+)((?:\w|\-|\!|\?)*)/, + ['keyword', 'white', 'variable'], + ], + + { include: '@whitespace' }, + { include: '@strings' }, + + [ + /[a-zA-Z_#][a-zA-Z0-9_\-\?\!\*]*/, + { + cases: { + '@keywords': 'keyword', + '@constants': 'constant', + '@operators': 'operators', + '@default': 'identifier', + }, + }, + ], + ], + + comment: [ + [/[^\|#]+/, 'comment'], + [/#\|/, 'comment', '@push'], + [/\|#/, 'comment', '@pop'], + [/[\|#]/, 'comment'], + ], + + whitespace: [ + [/[ \t\r\n]+/, 'white'], + [/#\|/, 'comment', '@comment'], + [/;.*$/, 'comment'], + ], + + strings: [ + [/"$/, 'string', '@popall'], + [/"(?=.)/, 'string', '@multiLineString'], + ], + + multiLineString: [ + [/\\./, 'string.escape'], + [/"/, 'string', '@popall'], + [/.(?=.*")/, 'string'], + [/.*\\$/, 'string'], + [/.*$/, 'string', '@popall'], + ], + }, }; From 18e09b41006b270c9fc99f04ce03601b3182c5bd Mon Sep 17 00:00:00 2001 From: masad-frost Date: Sat, 9 Jun 2018 02:16:12 -0700 Subject: [PATCH 019/133] Fix broken comments --- src/clojure/clojure.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/clojure/clojure.ts b/src/clojure/clojure.ts index 53c0473c..142854d9 100644 --- a/src/clojure/clojure.ts +++ b/src/clojure/clojure.ts @@ -211,10 +211,10 @@ export const language = { ], comment: [ - [/[^\(comment]+/, 'comment'], - [/\)/, 'comment', '@push'], - [/\(comment/, 'comment', '@pop'], - [/[\)]/, 'comment'], + [/[^comment\(\)]+/, 'comment'], + [/\(comment/, 'comment', '@push'], + [/\)/, 'comment', '@pop'], + [/[comment\(\)]/, 'comment'], ], whitespace: [ From 0a0c14ab03a8b3b4e3fad749f835782920bd6a24 Mon Sep 17 00:00:00 2001 From: masad-frost Date: Sat, 9 Jun 2018 02:20:15 -0700 Subject: [PATCH 020/133] Use tabs --- src/clojure/clojure.ts | 448 ++++++++++++++++++++--------------------- 1 file changed, 224 insertions(+), 224 deletions(-) diff --git a/src/clojure/clojure.ts b/src/clojure/clojure.ts index 142854d9..82aef3b6 100644 --- a/src/clojure/clojure.ts +++ b/src/clojure/clojure.ts @@ -9,231 +9,231 @@ import IRichLanguageConfiguration = monaco.languages.LanguageConfiguration; import ILanguage = monaco.languages.IMonarchLanguage; export const conf: IRichLanguageConfiguration = { - comments: { - lineComment: ';;', - blockComment: ['(comment', ')'], - }, - - brackets: [['(', ')'], ['{', '}'], ['[', ']']], - - autoClosingPairs: [ - { open: '{', close: '}' }, - { open: '[', close: ']' }, - { open: '(', close: ')' }, - { open: '"', close: '"' }, - ], - - surroundingPairs: [ - { open: '{', close: '}' }, - { open: '[', close: ']' }, - { open: '(', close: ')' }, - { open: '"', close: '"' }, - ], + comments: { + lineComment: ';;', + blockComment: ['(comment', ')'], + }, + + brackets: [['(', ')'], ['{', '}'], ['[', ']']], + + autoClosingPairs: [ + { open: '{', close: '}' }, + { open: '[', close: ']' }, + { open: '(', close: ')' }, + { open: '"', close: '"' }, + ], + + surroundingPairs: [ + { open: '{', close: '}' }, + { open: '[', close: ']' }, + { open: '(', close: ')' }, + { open: '"', close: '"' }, + ], }; export const language = { - defaultToken: '', - ignoreCase: true, - tokenPostfix: '.clj', - - brackets: [ - { open: '(', close: ')', token: 'delimiter.parenthesis' }, - { open: '{', close: '}', token: 'delimiter.curly' }, - { open: '[', close: ']', token: 'delimiter.square' }, - ], - - keywords: [ - 'ns', - 'ns-unmap', - 'create-ns', - 'in-ns', - 'fn', - 'def', - 'defn', - 'defmacro', - 'defmulti', - 'defonce', - 'require', - 'import', - 'new', - 'refer', - 'pos', - 'pos?', - 'filter', - 'map', - 'reduce', - 'repeat', - 'key', - 'rest', - 'concat', - 'into', - 'reverse', - 'iterate', - 'range', - 'drop', - 'drop-while', - 'take', - 'take-while', - 'neg', - 'neg?', - 'bound-fn', - 'if', - 'if-not', - 'if-let', - 'case,', - 'contains', - 'conj', - 'disj', - 'sort', - 'get', - 'assoc', - 'merge', - 'keys', - 'vals', - 'nth', - 'first', - 'last', - 'count', - 'contains?', - 'cond', - 'condp', - 'cond->', - 'cond->>', - 'when', - 'while', - 'when-not', - 'when-let', - 'when-first', - 'do', - 'future', - 'comment', - 'doto', - 'locking', - 'proxy', - 'println', - 'type', - 'meta', - 'var', - 'as->', - 'reify', - 'deftype', - 'defrecord', - 'defprotocol', - 'extend', - 'extend-protocol', - 'extend-type', - 'specify', - 'specify!', - 'try', - 'catch', - 'finally', - 'let', - 'letfn', - 'binding', - 'loop', - 'for', - 'seq', - 'doseq', - 'dotimes', - 'when-let', - 'if-let', - 'when-some', - 'if-some', - 'this-as', - 'defmethod', - 'testing', - 'deftest', - 'are', - 'use-fixtures', - 'use', - 'remove', - 'run', - 'run*', - 'fresh', - 'alt!', - 'alt!!', - 'go', - 'go-loop', - 'thread', - 'boolean', - 'str', - ], - - constants: ['true', 'false', 'nil'], - - operators: [ - '=', - 'not=', - '<', - '<=', - '>', - '>=', - 'and', - 'or', - 'not', - 'inc', - 'dec', - 'max', - 'min', - 'rem', - 'bit-and', - 'bit-or', - 'bit-xor', - 'bit-not', - ], - - tokenizer: { - root: [ - [/0[xX][0-9a-fA-F]+/, 'number.hex'], - [/[+-]?\d+(?:(?:\.\d*)?(?:[eE][+-]?\d+)?)?/, 'number.float'], - - [ - /(?:\b(?:(ns|def|defn|defn-|defmacro|defmulti|defonce|ns|ns-unmap|fn))(?![\w-]))(\s+)((?:\w|\-|\!|\?)*)/, - ['keyword', 'white', 'variable'], - ], - - [ - /[a-zA-Z_#][a-zA-Z0-9_\-\?\!\*]*/, - { - cases: { - '@keywords': 'keyword', - '@constants': 'constant', - '@operators': 'operators', - '@default': 'identifier', - }, - }, - ], - - [/\/#"(?:\.|(?:\")|[^""\n])*"\/g/, 'regexp'], - - { include: '@whitespace' }, - { include: '@strings' }, - ], - - comment: [ - [/[^comment\(\)]+/, 'comment'], - [/\(comment/, 'comment', '@push'], - [/\)/, 'comment', '@pop'], - [/[comment\(\)]/, 'comment'], - ], - - whitespace: [ - [/[ \t\r\n]+/, 'white'], - [/\(comment/, 'comment', '@comment'], - [/;;.*$/, 'comment'], - ], - - strings: [ - [/"$/, 'string', '@popall'], - [/"(?=.)/, 'string', '@multiLineString'], - ], - - multiLineString: [ - [/\\./, 'string.escape'], - [/"/, 'string', '@popall'], - [/.(?=.*")/, 'string'], - [/.*\\$/, 'string'], - [/.*$/, 'string', '@popall'], - ], - }, + defaultToken: '', + ignoreCase: true, + tokenPostfix: '.clj', + + brackets: [ + { open: '(', close: ')', token: 'delimiter.parenthesis' }, + { open: '{', close: '}', token: 'delimiter.curly' }, + { open: '[', close: ']', token: 'delimiter.square' }, + ], + + keywords: [ + 'ns', + 'ns-unmap', + 'create-ns', + 'in-ns', + 'fn', + 'def', + 'defn', + 'defmacro', + 'defmulti', + 'defonce', + 'require', + 'import', + 'new', + 'refer', + 'pos', + 'pos?', + 'filter', + 'map', + 'reduce', + 'repeat', + 'key', + 'rest', + 'concat', + 'into', + 'reverse', + 'iterate', + 'range', + 'drop', + 'drop-while', + 'take', + 'take-while', + 'neg', + 'neg?', + 'bound-fn', + 'if', + 'if-not', + 'if-let', + 'case,', + 'contains', + 'conj', + 'disj', + 'sort', + 'get', + 'assoc', + 'merge', + 'keys', + 'vals', + 'nth', + 'first', + 'last', + 'count', + 'contains?', + 'cond', + 'condp', + 'cond->', + 'cond->>', + 'when', + 'while', + 'when-not', + 'when-let', + 'when-first', + 'do', + 'future', + 'comment', + 'doto', + 'locking', + 'proxy', + 'println', + 'type', + 'meta', + 'var', + 'as->', + 'reify', + 'deftype', + 'defrecord', + 'defprotocol', + 'extend', + 'extend-protocol', + 'extend-type', + 'specify', + 'specify!', + 'try', + 'catch', + 'finally', + 'let', + 'letfn', + 'binding', + 'loop', + 'for', + 'seq', + 'doseq', + 'dotimes', + 'when-let', + 'if-let', + 'when-some', + 'if-some', + 'this-as', + 'defmethod', + 'testing', + 'deftest', + 'are', + 'use-fixtures', + 'use', + 'remove', + 'run', + 'run*', + 'fresh', + 'alt!', + 'alt!!', + 'go', + 'go-loop', + 'thread', + 'boolean', + 'str', + ], + + constants: ['true', 'false', 'nil'], + + operators: [ + '=', + 'not=', + '<', + '<=', + '>', + '>=', + 'and', + 'or', + 'not', + 'inc', + 'dec', + 'max', + 'min', + 'rem', + 'bit-and', + 'bit-or', + 'bit-xor', + 'bit-not', + ], + + tokenizer: { + root: [ + [/0[xX][0-9a-fA-F]+/, 'number.hex'], + [/[+-]?\d+(?:(?:\.\d*)?(?:[eE][+-]?\d+)?)?/, 'number.float'], + + [ + /(?:\b(?:(ns|def|defn|defn-|defmacro|defmulti|defonce|ns|ns-unmap|fn))(?![\w-]))(\s+)((?:\w|\-|\!|\?)*)/, + ['keyword', 'white', 'variable'], + ], + + [ + /[a-zA-Z_#][a-zA-Z0-9_\-\?\!\*]*/, + { + cases: { + '@keywords': 'keyword', + '@constants': 'constant', + '@operators': 'operators', + '@default': 'identifier', + }, + }, + ], + + [/\/#"(?:\.|(?:\")|[^""\n])*"\/g/, 'regexp'], + + { include: '@whitespace' }, + { include: '@strings' }, + ], + + comment: [ + [/[^comment\(\)]+/, 'comment'], + [/\(comment/, 'comment', '@push'], + [/\)/, 'comment', '@pop'], + [/[comment\(\)]/, 'comment'], + ], + + whitespace: [ + [/[ \t\r\n]+/, 'white'], + [/\(comment/, 'comment', '@comment'], + [/;;.*$/, 'comment'], + ], + + strings: [ + [/"$/, 'string', '@popall'], + [/"(?=.)/, 'string', '@multiLineString'], + ], + + multiLineString: [ + [/\\./, 'string.escape'], + [/"/, 'string', '@popall'], + [/.(?=.*")/, 'string'], + [/.*\\$/, 'string'], + [/.*$/, 'string', '@popall'], + ], + }, }; From f46294da867082820993d4539ef3d8d7de1fdba7 Mon Sep 17 00:00:00 2001 From: masad-frost Date: Sat, 9 Jun 2018 02:22:35 -0700 Subject: [PATCH 021/133] Disable detectIndentation in .vscode --- .vscode/settings.json | 1 + 1 file changed, 1 insertion(+) diff --git a/.vscode/settings.json b/.vscode/settings.json index f945f18d..01aeb218 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -9,5 +9,6 @@ "files.insertFinalNewline": true, "editor.tabSize": 4, "editor.insertSpaces": false, + "editor.detectIndentation": false, "typescript.tsdk": "./node_modules/typescript/lib" } From be0d51046c7ca7607b6db4ba06cf790e03573a87 Mon Sep 17 00:00:00 2001 From: masad-frost Date: Sat, 9 Jun 2018 02:25:19 -0700 Subject: [PATCH 022/133] Use .editorConfig from Microsoft/vscode --- .editorconfig | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 .editorconfig diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 00000000..b4180a87 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,16 @@ +# EditorConfig is awesome: http://EditorConfig.org + +# top-most EditorConfig file +root = true + +# Tab indentation +[*] +indent_style = tab +indent_size = 4 +trim_trailing_whitespace = true + +# The indent size used in the `package.json` file cannot be changed +# https://github.com/npm/npm/pull/3180#issuecomment-16336516 +[{*.yml,*.yaml,package.json}] +indent_style = space +indent_size = 2 From 16f9c159f2492027049b1caa9d3016eec0e2a2e3 Mon Sep 17 00:00:00 2001 From: Zhiqiang Lu Date: Thu, 14 Jun 2018 10:40:13 +0800 Subject: [PATCH 023/133] Add Shell language --- scripts/bundle.js | 3 +- src/monaco.contribution.ts | 1 + src/shell/shell.contribution.ts | 18 ++ src/shell/shell.test.ts | 282 ++++++++++++++++++++++++++++++++ src/shell/shell.ts | 213 ++++++++++++++++++++++++ test/setup.js | 1 + 6 files changed, 517 insertions(+), 1 deletion(-) create mode 100644 src/shell/shell.contribution.ts create mode 100644 src/shell/shell.test.ts create mode 100644 src/shell/shell.ts diff --git a/scripts/bundle.js b/scripts/bundle.js index 9b079c36..fe87ee3d 100644 --- a/scripts/bundle.js +++ b/scripts/bundle.js @@ -63,6 +63,7 @@ bundleOne('redis/redis'); bundleOne('csp/csp'); bundleOne('scheme/scheme'); bundleOne('clojure/clojure'); +bundleOne('shell/shell'); function bundleOne(moduleId, exclude) { requirejs.optimize({ @@ -74,7 +75,7 @@ function bundleOne(moduleId, exclude) { 'vs/basic-languages': REPO_ROOT + '/release/dev' }, optimize: 'none' - }, function(buildResponse) { + }, function (buildResponse) { const filePath = path.join(REPO_ROOT, 'release/min/' + moduleId + '.js'); const fileContents = fs.readFileSync(filePath).toString(); console.log(); diff --git a/src/monaco.contribution.ts b/src/monaco.contribution.ts index 691fab63..0342ec3e 100644 --- a/src/monaco.contribution.ts +++ b/src/monaco.contribution.ts @@ -46,3 +46,4 @@ import './xml/xml.contribution'; import './yaml/yaml.contribution'; import './scheme/scheme.contribution'; import './clojure/clojure.contribution'; +import './shell/shell.contribution'; diff --git a/src/shell/shell.contribution.ts b/src/shell/shell.contribution.ts new file mode 100644 index 00000000..a73f71bc --- /dev/null +++ b/src/shell/shell.contribution.ts @@ -0,0 +1,18 @@ +/*--------------------------------------------------------------------------------------------- +* Copyright (c) Microsoft Corporation. All rights reserved. +* Licensed under the MIT License. See License.txt in the project root for license information. +*--------------------------------------------------------------------------------------------*/ +'use strict'; + +import { registerLanguage } from '../_.contribution'; + +// Allow for running under nodejs/requirejs in tests +const _monaco: typeof monaco = + typeof monaco === 'undefined' ? (self).monaco : monaco; + +registerLanguage({ + id: 'shell', + extensions: ['.sh', '.bash'], + aliases: ['Shell', 'sh'], + loader: () => _monaco.Promise.wrap(import('./shell')), +}); diff --git a/src/shell/shell.test.ts b/src/shell/shell.test.ts new file mode 100644 index 00000000..c34e3b9e --- /dev/null +++ b/src/shell/shell.test.ts @@ -0,0 +1,282 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +'use strict'; + +import { testTokenization } from '../test/testRunner'; + +testTokenization('shell', [ + // Keywords + [{ + line: 'if while', + tokens: [ + { startIndex: 0, type: 'keyword.shell' }, + { startIndex: 2, type: 'white.shell' }, + { startIndex: 3, type: 'keyword.shell' } + ] + }], + + // Predefined & attribute + [{ + line: 'ps -aux | grep code', + tokens: [ + { startIndex: 0, type: 'type.identifier.shell' }, + { startIndex: 2, type: 'white.shell' }, + { startIndex: 3, type: 'attribute.name.shell' }, + { startIndex: 7, type: 'white.shell' }, + { startIndex: 8, type: 'delimiter.shell' }, + { startIndex: 9, type: 'white.shell' }, + { startIndex: 10, type: 'type.identifier.shell' }, + { startIndex: 14, type: 'white.shell' }, + { startIndex: 15, type: '' }, + ] + }], + + [{ + line: '# comment', + tokens: [ + { startIndex: 0, type: 'comment.shell' } + ] + }, { + line: 'cd tree', + tokens: [ + { startIndex: 0, type: 'type.identifier.shell' }, + { startIndex: 2, type: 'white.shell' }, + { startIndex: 3, type: '' } + ] + }], + + // Shebang + [{ + line: '#!/bin/env bash', + tokens: [ + { startIndex: 0, type: 'metatag.shell' } + ] + }], + + // Comments + [{ + line: '#', + tokens: [ + { startIndex: 0, type: 'comment.shell' } + ] + }], + + [{ + line: '# a comment', + tokens: [ + { startIndex: 0, type: 'comment.shell' } + ] + }], + + [{ + line: ' # a comment', + tokens: [ + { startIndex: 0, type: 'white.shell' }, + { startIndex: 4, type: 'comment.shell' } + ] + }], + + // numbers + [{ + line: '0', + tokens: [ + { startIndex: 0, type: 'number.shell' } + ] + }], + + [{ + line: '0.0', + tokens: [ + { startIndex: 0, type: 'number.float.shell' } + ] + }], + + [{ + line: '0x123', + tokens: [ + { startIndex: 0, type: 'number.hex.shell' } + ] + }], + + [{ + line: '23.5', + tokens: [ + { startIndex: 0, type: 'number.float.shell' } + ] + }], + + [{ + line: '23.5e3', + tokens: [ + { startIndex: 0, type: 'number.float.shell' } + ] + }], + + [{ + line: '23.5E3', + tokens: [ + { startIndex: 0, type: 'number.float.shell' } + ] + }], + + [{ + line: '1.72e-3', + tokens: [ + { startIndex: 0, type: 'number.float.shell' } + ] + }], + + [{ + line: '0+0', + tokens: [ + { startIndex: 0, type: 'number.shell' }, + { startIndex: 1, type: 'delimiter.shell' }, + { startIndex: 2, type: 'number.shell' } + ] + }], + + [{ + line: '100+10', + tokens: [ + { startIndex: 0, type: 'number.shell' }, + { startIndex: 3, type: 'delimiter.shell' }, + { startIndex: 4, type: 'number.shell' } + ] + }], + + [{ + line: '0 + 0', + tokens: [ + { startIndex: 0, type: 'number.shell' }, + { startIndex: 1, type: 'white.shell' }, + { startIndex: 2, type: 'delimiter.shell' }, + { startIndex: 3, type: 'white.shell' }, + { startIndex: 4, type: 'number.shell' } + ] + }], + + // Strings + [{ + line: "'test string'", + tokens: [ + { startIndex: 0, type: 'string.shell' } + ] + }], + + [{ + line: '"test string"', + tokens: [ + { startIndex: 0, type: 'string.shell' } + ] + }], + + [{ + line: "'test", + tokens: [ + { startIndex: 0, type: 'string.shell' } + ], + }, { + line: '', + tokens: [ + + ] + }, { + line: "string'", + tokens: [ + { startIndex: 0, type: 'string.shell' } + ] + }], + + [{ + line: '"test', + tokens: [ + { startIndex: 0, type: 'string.shell' } + ], + }, { + line: '', + tokens: [ + + ] + }, { + line: 'string"', + tokens: [ + { startIndex: 0, type: 'string.shell' } + ] + }], + + // Parameters + [{ + line: '$1', + tokens: [ + { startIndex: 0, type: 'variable.predefined.shell' } + ] + }], + + [{ + line: '$a', + tokens: [ + { startIndex: 0, type: 'variable.shell' } + ] + }], + + [{ + line: '${string:position}', + tokens: [ + { startIndex: 0, type: 'variable.shell' }, + { startIndex: 8, type: 'delimiter.shell' }, + { startIndex: 9, type: 'variable.shell' } + ] + }], + + [{ + line: '$(pwd)', + tokens: [ + { startIndex: 0, type: 'variable.shell' }, + ] + }], + + [{ + line: 'echo $hello | less', + tokens: [ + { startIndex: 0, type: 'type.identifier.shell' }, + { startIndex: 4, type: 'white.shell' }, + { startIndex: 5, type: 'variable.shell' }, + { startIndex: 11, type: 'white.shell' }, + { startIndex: 12, type: 'delimiter.shell' }, + { startIndex: 13, type: 'white.shell' }, + { startIndex: 14, type: '' } + ] + }], + + // HereDoc + [{ + line: '<< word', + tokens: [ + { startIndex: 0, type: 'constants.shell' }, + { startIndex: 2, type: 'white.shell' }, + { startIndex: 3, type: 'string.heredoc.shell' } + ] + }], + + [{ + line: '<<- "word"', + tokens: [ + { startIndex: 0, type: 'constants.shell' }, + { startIndex: 3, type: 'white.shell' }, + { startIndex: 4, type: 'string.heredoc.delimiter.shell' }, + { startIndex: 5, type: 'string.heredoc.shell' }, + { startIndex: 9, type: 'string.heredoc.delimiter.shell' }, + ] + }], + + [{ + line: '<<< word', + tokens: [ + { startIndex: 0, type: 'constants.shell' }, + { startIndex: 3, type: 'white.shell' }, + { startIndex: 4, type: 'string.heredoc.shell' } + ] + }], +]) diff --git a/src/shell/shell.ts b/src/shell/shell.ts new file mode 100644 index 00000000..03c6197f --- /dev/null +++ b/src/shell/shell.ts @@ -0,0 +1,213 @@ +/*--------------------------------------------------------------------------------------------- +* Copyright (c) Microsoft Corporation. All rights reserved. +* Licensed under the MIT License. See License.txt in the project root for license information. +*--------------------------------------------------------------------------------------------*/ + +'use strict'; + +import IRichLanguageConfiguration = monaco.languages.LanguageConfiguration; +import ILanguage = monaco.languages.IMonarchLanguage; + +export const conf: IRichLanguageConfiguration = { + comments: { + lineComment: '#', + }, + brackets: [['{', '}'], ['[', ']'], ['(', ')']], + autoClosingPairs: [ + { open: '{', close: '}' }, + { open: '[', close: ']' }, + { open: '(', close: ')' }, + { open: '"', close: '"' }, + { open: "'", close: "'" }, + { open: '`', close: '`' }, + ], + surroundingPairs: [ + { open: '{', close: '}' }, + { open: '[', close: ']' }, + { open: '(', close: ')' }, + { open: '"', close: '"' }, + { open: "'", close: "'" }, + { open: '`', close: '`' }, + ], +}; + +export const language = { + defaultToken: '', + ignoreCase: true, + tokenPostfix: '.shell', + + brackets: [ + { token: 'delimiter.bracket', open: '{', close: '}' }, + { token: 'delimiter.parenthesis', open: '(', close: ')' }, + { token: 'delimiter.square', open: '[', close: ']' }, + ], + + keywords: [ + 'if', + 'then', + 'do', + 'else', + 'elif', + 'while', + 'until', + 'for', + 'in', + 'esac', + 'fi', + 'fin', + 'fil', + 'done', + 'exit', + 'set', + 'unset', + 'export', + 'function', + ], + + builtins: [ + 'ab', + 'awk', + 'bash', + 'beep', + 'cat', + 'cc', + 'cd', + 'chown', + 'chmod', + 'chroot', + 'clear', + 'cp', + 'curl', + 'cut', + 'diff', + 'echo', + 'find', + 'gawk', + 'gcc', + 'get', + 'git', + 'grep', + 'hg', + 'kill', + 'killall', + 'ln', + 'ls', + 'make', + 'mkdir', + 'openssl', + 'mv', + 'nc', + 'node', + 'npm', + 'ping', + 'ps', + 'restart', + 'rm', + 'rmdir', + 'sed', + 'service', + 'sh', + 'shopt', + 'shred', + 'source', + 'sort', + 'sleep', + 'ssh', + 'start', + 'stop', + 'su', + 'sudo', + 'svn', + 'tee', + 'telnet', + 'top', + 'touch', + 'vi', + 'vim', + 'wall', + 'wc', + 'wget', + 'who', + 'write', + 'yes', + 'zsh', + ], + + // we include these common regular expressions + symbols: /[=> Date: Fri, 15 Jun 2018 17:44:10 +0800 Subject: [PATCH 024/133] Add Perl language --- src/monaco.contribution.ts | 1 + src/perl/perl.contribution.ts | 17 + src/perl/perl.test.ts | 432 +++++++++++++++++++++++++ src/perl/perl.ts | 591 ++++++++++++++++++++++++++++++++++ test/setup.js | 3 +- 5 files changed, 1043 insertions(+), 1 deletion(-) create mode 100644 src/perl/perl.contribution.ts create mode 100644 src/perl/perl.test.ts create mode 100644 src/perl/perl.ts diff --git a/src/monaco.contribution.ts b/src/monaco.contribution.ts index 0342ec3e..8ac5bfa3 100644 --- a/src/monaco.contribution.ts +++ b/src/monaco.contribution.ts @@ -47,3 +47,4 @@ import './yaml/yaml.contribution'; import './scheme/scheme.contribution'; import './clojure/clojure.contribution'; import './shell/shell.contribution'; +import './perl/perl.contribution'; diff --git a/src/perl/perl.contribution.ts b/src/perl/perl.contribution.ts new file mode 100644 index 00000000..0f18b87f --- /dev/null +++ b/src/perl/perl.contribution.ts @@ -0,0 +1,17 @@ +/*--------------------------------------------------------------------------------------------- +* Copyright (c) Microsoft Corporation. All rights reserved. +* Licensed under the MIT License. See License.txt in the project root for license information. +*--------------------------------------------------------------------------------------------*/ +'use strict'; + +import { registerLanguage } from '../_.contribution'; + +// Allow for running under nodejs/requirejs in tests +const _monaco: typeof monaco = typeof monaco === 'undefined' ? (self).monaco : monaco; + +registerLanguage({ + id: 'perl', + extensions: ['.pl'], + aliases: ['Perl', 'pl'], + loader: () => _monaco.Promise.wrap(import('./perl')), +}); diff --git a/src/perl/perl.test.ts b/src/perl/perl.test.ts new file mode 100644 index 00000000..09db0d61 --- /dev/null +++ b/src/perl/perl.test.ts @@ -0,0 +1,432 @@ +/*--------------------------------------------------------------------------------------------- +* Copyright (c) Microsoft Corporation. All rights reserved. +* Licensed under the MIT License. See License.txt in the project root for license information. +*--------------------------------------------------------------------------------------------*/ +'use strict'; + +import { testTokenization } from '../test/testRunner'; + +testTokenization('perl', [ + // Keywords + [ + { + line: 'if $msg', + tokens: [ + { startIndex: 0, type: 'keyword.perl' }, + { startIndex: 2, type: 'white.perl' }, + { startIndex: 3, type: 'variable.perl' }, + ], + }, + ], + + // Builtins + [ + { + line: 'log $ARGV', + tokens: [ + { startIndex: 0, type: 'type.identifier.perl' }, + { startIndex: 3, type: 'white.perl' }, + { startIndex: 4, type: 'variable.predefined.perl' }, + ], + }, + ], + + // Shebang + [ + { + line: '#!/bin/env bash', + tokens: [{ startIndex: 0, type: 'metatag.perl' }], + }, + ], + + // Comments - single line + [ + { + line: '#', + tokens: [{ startIndex: 0, type: 'comment.perl' }], + }, + ], + + [ + { + line: ' # a comment', + tokens: [ + { startIndex: 0, type: 'white.perl' }, + { startIndex: 4, type: 'comment.perl' }, + ], + }, + ], + + [ + { + line: '# a comment', + tokens: [{ startIndex: 0, type: 'comment.perl' }], + }, + ], + + // number + [ + { + line: '0', + tokens: [{ startIndex: 0, type: 'number.perl' }], + }, + ], + + [ + { + line: '0.0', + tokens: [{ startIndex: 0, type: 'number.float.perl' }], + }, + ], + + [ + { + line: '0x123', + tokens: [{ startIndex: 0, type: 'number.hex.perl' }], + }, + ], + + [ + { + line: '23.5', + tokens: [{ startIndex: 0, type: 'number.float.perl' }], + }, + ], + + [ + { + line: '23.5e3', + tokens: [{ startIndex: 0, type: 'number.float.perl' }], + }, + ], + + [ + { + line: '23.5E3', + tokens: [{ startIndex: 0, type: 'number.float.perl' }], + }, + ], + + [ + { + line: '1.72e-3', + tokens: [{ startIndex: 0, type: 'number.float.perl' }], + }, + ], + + [ + { + line: '0+0', + tokens: [ + { startIndex: 0, type: 'number.perl' }, + { startIndex: 1, type: 'operators.perl' }, + { startIndex: 2, type: 'number.perl' }, + ], + }, + ], + + [ + { + line: '100+10', + tokens: [ + { startIndex: 0, type: 'number.perl' }, + { startIndex: 3, type: 'operators.perl' }, + { startIndex: 4, type: 'number.perl' }, + ], + }, + ], + + [ + { + line: '0 + 0', + tokens: [ + { startIndex: 0, type: 'number.perl' }, + { startIndex: 1, type: 'white.perl' }, + { startIndex: 2, type: 'operators.perl' }, + { startIndex: 3, type: 'white.perl' }, + { startIndex: 4, type: 'number.perl' }, + ], + }, + ], + + // Strings + + // Double quoted string + [ + { + line: '"string"', + tokens: [{ startIndex: 0, type: 'string.perl' }], + }, + ], + + [ + { + line: '"test $foo"', + tokens: [ + { startIndex: 0, type: 'string.perl' }, + { startIndex: 6, type: 'variable.perl' }, + { startIndex: 10, type: 'string.perl' }, + ], + }, + ], + + [ + { + line: '"test', + tokens: [{ startIndex: 0, type: 'string.perl' }], + }, + { + line: '', + tokens: [], + }, + { + line: 'string $foo string2"', + tokens: [ + { startIndex: 0, type: 'string.perl' }, + { startIndex: 7, type: 'variable.perl' }, + { startIndex: 11, type: 'string.perl' }, + ], + }, + ], + + [ + { + line: '"string\\t"', + tokens: [ + { startIndex: 0, type: 'string.perl' }, + { + startIndex: 7, + type: 'string.escape.perl', + }, + { startIndex: 9, type: 'string.perl' }, + ], + }, + ], + + // Single quoted string + [ + { + line: "'string'", + tokens: [{ startIndex: 0, type: 'string.perl' }], + }, + ], + + [ + { + line: "'test $foo'", + tokens: [{ startIndex: 0, type: 'string.perl' }], + }, + ], + + [ + { + line: "'test", + tokens: [{ startIndex: 0, type: 'string.perl' }], + }, + { + line: '', + tokens: [], + }, + { + line: "string $foo string2'", + tokens: [{ startIndex: 0, type: 'string.perl' }], + }, + ], + + [ + { + line: "'string\\t'", + tokens: [{ startIndex: 0, type: 'string.perl' }], + }, + ], + + [ + { + line: "'string\\'string2'", + tokens: [ + { startIndex: 0, type: 'string.perl' }, + { + startIndex: 7, + type: 'string.escape.perl', + }, + { startIndex: 9, type: 'string.perl' }, + ], + }, + ], + + // Variables + [ + { + line: '$msg $_ $1', + tokens: [ + { startIndex: 0, type: 'variable.perl' }, + { startIndex: 4, type: 'white.perl' }, + { startIndex: 5, type: 'variable.predefined.perl' }, + { startIndex: 7, type: 'white.perl' }, + { startIndex: 8, type: 'variable.perl' }, + ], + }, + ], + + [ + { + line: '@array1 @array2', + tokens: [ + { startIndex: 0, type: 'variable.perl' }, + { startIndex: 7, type: 'white.perl' }, + { + startIndex: 8, + type: 'variable.perl', + }, + ], + }, + ], + + [ + { + line: '%var1 %var2', + tokens: [ + { startIndex: 0, type: 'variable.perl' }, + { + startIndex: 5, + type: 'white.perl', + }, + { + startIndex: 6, + type: 'variable.perl', + }, + ], + }, + ], + + // RegExp + [ + { + line: '/abc/', + tokens: [{ startIndex: 0, type: 'regexp.perl' }], + }, + ], + + [ + { + line: 'm/abc/', + tokens: [{ startIndex: 0, type: 'regexp.perl' }], + }, + ], + + [ + { + line: 'm/[abc]+/e', + tokens: [{ startIndex: 0, type: 'regexp.perl' }], + }, + ], + + // Operators + [ + { + line: '$a + $b', + tokens: [ + { startIndex: 0, type: 'variable.predefined.perl' }, + { + startIndex: 2, + type: 'white.perl', + }, + { + startIndex: 3, + type: 'operators.perl', + }, + { startIndex: 4, type: 'white.perl' }, + { startIndex: 5, type: 'variable.predefined.perl' }, + ], + }, + ], + + // Embedded Doc + [ + { + line: '=begin', + tokens: [ + { + startIndex: 0, + type: 'comment.doc.perl', + }, + ], + }, + { + line: 'this is my doc', + tokens: [ + { + startIndex: 0, + type: 'comment.doc.perl', + }, + ], + }, + { + line: '=cut', + tokens: [{ startIndex: 0, type: 'type.identifier.perl' }], + }, + ], + + // Here Doc + [ + { + line: '<< HTML', + tokens: [{ startIndex: 0, type: 'string.heredoc.delimiter.perl' }], + }, + { + line: 'test here doc', + tokens: [ + { + startIndex: 0, + type: 'string.heredoc.perl', + }, + ], + }, + { + line: 'HTML', + tokens: [{ startIndex: 0, type: 'string.heredoc.delimiter.perl' }], + }, + { + line: 'my $msg', + tokens: [ + { startIndex: 0, type: 'type.identifier.perl' }, + { + startIndex: 2, + type: 'white.perl', + }, + { startIndex: 3, type: 'variable.perl' }, + ], + }, + ], + + [ + { + line: '<<"HTML"', + tokens: [{ startIndex: 0, type: 'string.heredoc.delimiter.perl' }], + }, + { + line: 'test here doc', + tokens: [ + { + startIndex: 0, + type: 'string.heredoc.perl', + }, + ], + }, + { + line: 'HTML', + tokens: [{ startIndex: 0, type: 'string.heredoc.delimiter.perl' }], + }, + { + line: 'my $msg', + tokens: [ + { startIndex: 0, type: 'type.identifier.perl' }, + { + startIndex: 2, + type: 'white.perl', + }, + { startIndex: 3, type: 'variable.perl' }, + ], + }, + ], +]); diff --git a/src/perl/perl.ts b/src/perl/perl.ts new file mode 100644 index 00000000..edacb28a --- /dev/null +++ b/src/perl/perl.ts @@ -0,0 +1,591 @@ +/*--------------------------------------------------------------------------------------------- +* Copyright (c) Microsoft Corporation. All rights reserved. +* Licensed under the MIT License. See License.txt in the project root for license information. +*--------------------------------------------------------------------------------------------*/ + +'use strict'; + +import IRichLanguageConfiguration = monaco.languages.LanguageConfiguration; +import ILanguage = monaco.languages.IMonarchLanguage; + +export const conf: IRichLanguageConfiguration = { + comments: { + lineComment: '#', + }, + brackets: [['{', '}'], ['[', ']'], ['(', ')']], + autoClosingPairs: [ + { open: '{', close: '}' }, + { open: '[', close: ']' }, + { open: '(', close: ')' }, + { open: '"', close: '"' }, + { open: "'", close: "'" }, + { open: '`', close: '`' }, + ], + surroundingPairs: [ + { open: '{', close: '}' }, + { open: '[', close: ']' }, + { open: '(', close: ')' }, + { open: '"', close: '"' }, + { open: "'", close: "'" }, + { open: '`', close: '`' }, + ], +}; + +export const language = { + defaultToken: '', + tokenPostfix: '.perl', + + brackets: [ + { token: 'delimiter.bracket', open: '{', close: '}' }, + { token: 'delimiter.parenthesis', open: '(', close: ')' }, + { token: 'delimiter.square', open: '[', close: ']' }, + ], + + // https://learn.perl.org/docs/keywords.html + + // Perl syntax + keywords: [ + '__DATA__', + 'else', + 'lock', + 'qw', + '__END__', + 'elsif', + 'lt', + 'qx', + '__FILE__', + 'eq', + 'm', + 's', + '__LINE__', + 'exp', + 'ne', + 'sub', + '__PACKAGE__', + 'for', + 'no', + 'tr', + 'and', + 'foreach', + 'or', + 'unless', + 'cmp', + 'ge', + 'package', + 'until', + 'continue', + 'gt', + 'q', + 'while', + 'CORE', + 'if', + 'qq', + 'xor', + 'do', + 'le', + 'qr', + 'y', + + '__DIE__', + '__WARN__', + ], + + // Perl functions + builtinFunctions: [ + '-A', + 'END', + 'length', + 'setpgrp', + '-B', + 'endgrent', + 'link', + 'setpriority', + '-b', + 'endhostent', + 'listen', + 'setprotoent', + '-C', + 'endnetent', + 'local', + 'setpwent', + '-c', + 'endprotoent', + 'localtime', + 'setservent', + '-d', + 'endpwent', + 'log', + 'setsockopt', + '-e', + 'endservent', + 'lstat', + 'shift', + '-f', + 'eof', + 'map', + 'shmctl', + '-g', + 'eval', + 'mkdir', + 'shmget', + '-k', + 'exec', + 'msgctl', + 'shmread', + '-l', + 'exists', + 'msgget', + 'shmwrite', + '-M', + 'exit', + 'msgrcv', + 'shutdown', + '-O', + 'fcntl', + 'msgsnd', + 'sin', + '-o', + 'fileno', + 'my', + 'sleep', + '-p', + 'flock', + 'next', + 'socket', + '-r', + 'fork', + 'not', + 'socketpair', + '-R', + 'format', + 'oct', + 'sort', + '-S', + 'formline', + 'open', + 'splice', + '-s', + 'getc', + 'opendir', + 'split', + '-T', + 'getgrent', + 'ord', + 'sprintf', + '-t', + 'getgrgid', + 'our', + 'sqrt', + '-u', + 'getgrnam', + 'pack', + 'srand', + '-w', + 'gethostbyaddr', + 'pipe', + 'stat', + '-W', + 'gethostbyname', + 'pop', + 'state', + '-X', + 'gethostent', + 'pos', + 'study', + '-x', + 'getlogin', + 'print', + 'substr', + '-z', + 'getnetbyaddr', + 'printf', + 'symlink', + 'abs', + 'getnetbyname', + 'prototype', + 'syscall', + 'accept', + 'getnetent', + 'push', + 'sysopen', + 'alarm', + 'getpeername', + 'quotemeta', + 'sysread', + 'atan2', + 'getpgrp', + 'rand', + 'sysseek', + 'AUTOLOAD', + 'getppid', + 'read', + 'system', + 'BEGIN', + 'getpriority', + 'readdir', + 'syswrite', + 'bind', + 'getprotobyname', + 'readline', + 'tell', + 'binmode', + 'getprotobynumber', + 'readlink', + 'telldir', + 'bless', + 'getprotoent', + 'readpipe', + 'tie', + 'break', + 'getpwent', + 'recv', + 'tied', + 'caller', + 'getpwnam', + 'redo', + 'time', + 'chdir', + 'getpwuid', + 'ref', + 'times', + 'CHECK', + 'getservbyname', + 'rename', + 'truncate', + 'chmod', + 'getservbyport', + 'require', + 'uc', + 'chomp', + 'getservent', + 'reset', + 'ucfirst', + 'chop', + 'getsockname', + 'return', + 'umask', + 'chown', + 'getsockopt', + 'reverse', + 'undef', + 'chr', + 'glob', + 'rewinddir', + 'UNITCHECK', + 'chroot', + 'gmtime', + 'rindex', + 'unlink', + 'close', + 'goto', + 'rmdir', + 'unpack', + 'closedir', + 'grep', + 'say', + 'unshift', + 'connect', + 'hex', + 'scalar', + 'untie', + 'cos', + 'index', + 'seek', + 'use', + 'crypt', + 'INIT', + 'seekdir', + 'utime', + 'dbmclose', + 'int', + 'select', + 'values', + 'dbmopen', + 'ioctl', + 'semctl', + 'vec', + 'defined', + 'join', + 'semget', + 'wait', + 'delete', + 'keys', + 'semop', + 'waitpid', + 'DESTROY', + 'kill', + 'send', + 'wantarray', + 'die', + 'last', + 'setgrent', + 'warn', + 'dump', + 'lc', + 'sethostent', + 'write', + 'each', + 'lcfirst', + 'setnetent', + ], + + // File handlers + builtinFileHandlers: ['ARGV', 'STDERR', 'STDOUT', 'ARGVOUT', 'STDIN', 'ENV'], + + // Perl variables + builtinVariables: [ + '$!', + '$^RE_TRIE_MAXBUF', + '$LAST_REGEXP_CODE_RESULT', + '$"', + '$^S', + '$LIST_SEPARATOR', + '$#', + '$^T', + '$MATCH', + '$$', + '$^TAINT', + '$MULTILINE_MATCHING', + '$%', + '$^UNICODE', + '$NR', + '$&', + '$^UTF8LOCALE', + '$OFMT', + "$'", + '$^V', + '$OFS', + '$(', + '$^W', + '$ORS', + '$)', + '$^WARNING_BITS', + '$OS_ERROR', + '$*', + '$^WIDE_SYSTEM_CALLS', + '$OSNAME', + '$+', + '$^X', + '$OUTPUT_AUTO_FLUSH', + '$,', + '$_', + '$OUTPUT_FIELD_SEPARATOR', + '$-', + '$`', + '$OUTPUT_RECORD_SEPARATOR', + '$.', + '$a', + '$PERL_VERSION', + '$/', + '$ACCUMULATOR', + '$PERLDB', + '$0', + '$ARG', + '$PID', + '$:', + '$ARGV', + '$POSTMATCH', + '$;', + '$b', + '$PREMATCH', + '$<', + '$BASETIME', + '$PROCESS_ID', + '$=', + '$CHILD_ERROR', + '$PROGRAM_NAME', + '$>', + '$COMPILING', + '$REAL_GROUP_ID', + '$?', + '$DEBUGGING', + '$REAL_USER_ID', + '$@', + '$EFFECTIVE_GROUP_ID', + '$RS', + '$[', + '$EFFECTIVE_USER_ID', + '$SUBSCRIPT_SEPARATOR', + '$\\', + '$EGID', + '$SUBSEP', + '$]', + '$ERRNO', + '$SYSTEM_FD_MAX', + '$^', + '$EUID', + '$UID', + '$^A', + '$EVAL_ERROR', + '$WARNING', + '$^C', + '$EXCEPTIONS_BEING_CAUGHT', + '$|', + '$^CHILD_ERROR_NATIVE', + '$EXECUTABLE_NAME', + '$~', + '$^D', + '$EXTENDED_OS_ERROR', + '%!', + '$^E', + '$FORMAT_FORMFEED', + '%^H', + '$^ENCODING', + '$FORMAT_LINE_BREAK_CHARACTERS', + '%ENV', + '$^F', + '$FORMAT_LINES_LEFT', + '%INC', + '$^H', + '$FORMAT_LINES_PER_PAGE', + '%OVERLOAD', + '$^I', + '$FORMAT_NAME', + '%SIG', + '$^L', + '$FORMAT_PAGE_NUMBER', + '@+', + '$^M', + '$FORMAT_TOP_NAME', + '@-', + '$^N', + '$GID', + '@_', + '$^O', + '$INPLACE_EDIT', + '@ARGV', + '$^OPEN', + '$INPUT_LINE_NUMBER', + '@INC', + '$^P', + '$INPUT_RECORD_SEPARATOR', + '@LAST_MATCH_START', + '$^R', + '$LAST_MATCH_END', + '$^RE_DEBUG_FLAGS', + '$LAST_PAREN_MATCH', + ], + + // operators + symbols: /[:+\-\^*$&%@=<>!?|\/~\.]/, + + escapes: /\\(?:[abfnrtv\\"']|x[0-9A-Fa-f]{1,4}|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8})/, + + // The main tokenizer for our languages + tokenizer: { + root: [ + { include: '@whitespace' }, + + [ + /[a-zA-Z\-_][\w\-_]+/, + { + cases: { + '@keywords': 'keyword', + '@builtinFunctions': 'type.identifier', + '@builtinFileHandlers': 'variable.predefined', + '@default': '', + }, + }, + ], + + // Perl variables + [ + /[\$@%][*@#?\+\-\$!\w\\\^><~:;\.]+/, + { + cases: { + '@builtinVariables': 'variable.predefined', + '@default': 'variable', + }, + }, + ], + + { include: '@strings' }, + { include: '@dblStrings' }, + + // Perl Doc + { include: '@perldoc' }, + + // Here Doc + { include: '@heredoc' }, + + [/[{}\[\]()]/, '@brackets'], + + // RegExp + [ + /[goseximacplud]*[\/](?:(?:\[(?:\\]|[^\]])+\])|(?:\\\/|[^\]\/]))*[\/]\w*\s*(?=[).,;]|$)/, + 'regexp', + ], + + [/@symbols/, 'operators'], + + { include: '@numbers' }, + + [/[,;]/, 'delimiter'], + ], + + whitespace: [ + [/\s+/, 'white'], + [/(^#!.*$)/, 'metatag'], + [/(^#.*$)/, 'comment'], + ], + + numbers: [ + [/\d*\.\d+([eE][\-+]?\d+)?/, 'number.float'], + [/0[xX][0-9a-fA-F_]*[0-9a-fA-F]/, 'number.hex'], + [/\d+/, 'number'], + ], + + // Single quote string + strings: [[/'/, 'string', '@stringBody']], + + stringBody: [ + [/'/, 'string', '@popall'], + [/\\'/, 'string.escape'], + [/./, 'string'], + ], + + // Double quote string + dblStrings: [[/"/, 'string', '@dblStringBody']], + + dblStringBody: [ + [/"/, 'string', '@popall'], + [/@escapes/, 'string.escape'], + [/\\./, 'string.escape.invalid'], + { include: '@variables' }, + [/./, 'string'], + ], + + heredoc: [ + [ + /<<\s*['"`]?([\w\-]+)['"`]?/, + { token: 'string.heredoc.delimiter', next: '@heredocBody.$1' }, + ], + ], + + heredocBody: [ + [ + /^([\w\-]+)$/, + { + cases: { + '$1==$S2': [{ token: 'string.heredoc.delimiter', next: '@popall' }], + '@default': 'string.heredoc', + }, + }, + ], + [/./, 'string.heredoc'], + ], + + perldoc: [[/^=\w/, 'comment.doc', '@perldocBody']], + + perldocBody: [ + [/^=cut\b/, 'type.identifier', '@popall'], + [/./, 'comment.doc'], + ], + + variables: [ + [/\$\w+/, 'variable'], // scalar + [/@\w+/, 'variable'], // array + [/%\w+/, 'variable'], // key/value + ], + }, +}; diff --git a/test/setup.js b/test/setup.js index e2f48733..1cbff462 100644 --- a/test/setup.js +++ b/test/setup.js @@ -67,7 +67,8 @@ define(['require'], function (require) { 'release/dev/st/st.test', 'release/dev/scheme/scheme.test', 'release/dev/clojure/clojure.test', - 'release/dev/shell/shell.test' + 'release/dev/shell/shell.test', + 'release/dev/perl/perl.test' ], function () { run(); // We can launch the tests! }, function (err) { From fdf97477a6754a602b4cb48d6994434fc0d27f75 Mon Sep 17 00:00:00 2001 From: Zhiqiang Lu Date: Fri, 15 Jun 2018 17:51:29 +0800 Subject: [PATCH 025/133] update perl test --- src/perl/perl.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/perl/perl.test.ts b/src/perl/perl.test.ts index 09db0d61..879c2b3c 100644 --- a/src/perl/perl.test.ts +++ b/src/perl/perl.test.ts @@ -34,7 +34,7 @@ testTokenization('perl', [ // Shebang [ { - line: '#!/bin/env bash', + line: '#!/bin/env perl', tokens: [{ startIndex: 0, type: 'metatag.perl' }], }, ], From 807111133c1054310b79b7ab652139b7bef66a65 Mon Sep 17 00:00:00 2001 From: Zhiqiang Lu Date: Tue, 19 Jun 2018 15:53:44 +0800 Subject: [PATCH 026/133] add perl to bundle.js --- scripts/bundle.js | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/bundle.js b/scripts/bundle.js index fe87ee3d..842166b3 100644 --- a/scripts/bundle.js +++ b/scripts/bundle.js @@ -64,6 +64,7 @@ bundleOne('csp/csp'); bundleOne('scheme/scheme'); bundleOne('clojure/clojure'); bundleOne('shell/shell'); +bundleOne('perl/perl') function bundleOne(moduleId, exclude) { requirejs.optimize({ From 76f0f15077c4e3b530d70ac6258025c41f2e1979 Mon Sep 17 00:00:00 2001 From: masad-frost Date: Mon, 2 Jul 2018 19:03:02 -0700 Subject: [PATCH 027/133] Remove code for comments --- src/clojure/clojure.contribution.ts | 10 +- src/clojure/clojure.test.ts | 164 +++++++++++++--------------- src/clojure/clojure.ts | 14 +-- 3 files changed, 81 insertions(+), 107 deletions(-) diff --git a/src/clojure/clojure.contribution.ts b/src/clojure/clojure.contribution.ts index a8c72682..fc0e885f 100644 --- a/src/clojure/clojure.contribution.ts +++ b/src/clojure/clojure.contribution.ts @@ -8,11 +8,11 @@ import { registerLanguage } from '../_.contribution'; // Allow for running under nodejs/requirejs in tests const _monaco: typeof monaco = - typeof monaco === 'undefined' ? (self).monaco : monaco; + typeof monaco === 'undefined' ? (self).monaco : monaco; registerLanguage({ - id: 'clojure', - extensions: ['.clj', '.clojure'], - aliases: ['clojure', 'Clojure'], - loader: () => _monaco.Promise.wrap(import('./clojure')), + id: 'clojure', + extensions: ['.clj', '.clojure'], + aliases: ['clojure', 'Clojure'], + loader: () => _monaco.Promise.wrap(import('./clojure')), }); diff --git a/src/clojure/clojure.test.ts b/src/clojure/clojure.test.ts index ab1bc64e..a4d1c1cb 100644 --- a/src/clojure/clojure.test.ts +++ b/src/clojure/clojure.test.ts @@ -8,97 +8,83 @@ import { testTokenization } from '../test/testRunner'; testTokenization('clojure', [ - // Keywords - [ - { - line: 'defmacro some', - tokens: [ - { startIndex: 0, type: 'keyword.clj' }, - { startIndex: 8, type: 'white.clj' }, - { startIndex: 9, type: 'variable.clj' }, - ], - }, + // Keywords + [ + { + line: 'defmacro some', + tokens: [ + { startIndex: 0, type: 'keyword.clj' }, + { startIndex: 8, type: 'white.clj' }, + { startIndex: 9, type: 'variable.clj' }, + ], + }, - { - line: 'comment "text comment"', - tokens: [ - { startIndex: 0, type: 'keyword.clj' }, - { startIndex: 7, type: 'white.clj'}, - { startIndex: 8, type: 'string.clj'}, - ], - }, - { - line: 'in-ns "user', - tokens: [ - { startIndex: 0, type: 'keyword.clj' }, - { startIndex: 5, type: 'white.clj' }, - { startIndex: 6, type: 'string.clj' }, - ], - }, - ], + { + line: 'comment "text comment"', + tokens: [ + { startIndex: 0, type: 'keyword.clj' }, + { startIndex: 7, type: 'white.clj' }, + { startIndex: 8, type: 'string.clj' }, + ], + }, + { + line: 'in-ns "user', + tokens: [ + { startIndex: 0, type: 'keyword.clj' }, + { startIndex: 5, type: 'white.clj' }, + { startIndex: 6, type: 'string.clj' }, + ], + }, + ], - // comments - [ - { - line: ';; comment', - tokens: [{ startIndex: 0, type: 'comment.clj' }], - }, - ], - [ - { - line: '(comment', - tokens: [{ startIndex: 0, type: 'comment.clj' }], - }, - { - line: '(comment let', - tokens: [ - { startIndex: 0, type: 'comment.clj' }, - { startIndex: 8, type: 'white.clj' }, - { startIndex: 9, type: 'keyword.clj' }, - ], - }, - ], + // comments + [ + { + line: ';; comment', + tokens: [{ startIndex: 0, type: 'comment.clj' }], + }, + ], - // strings - [ - { - line: '"\\n string "', - tokens: [ - { startIndex: 0, type: 'string.clj' }, - { startIndex: 1, type: 'string.escape.clj' }, - { startIndex: 3, type: 'string.clj' }, - ], - }, - ], - [ - { - line: '" string \\', - tokens: [{ startIndex: 0, type: 'string.clj' }], - }, - { - line: 'multiline', - tokens: [{ startIndex: 0, type: 'string.clj' }], - }, - { - line: ' ', - tokens: [ - // previous line needs to be terminated with \ - { startIndex: 0, type: 'white.clj' }, - ], - }, - ], + // strings + [ + { + line: '"\\n string "', + tokens: [ + { startIndex: 0, type: 'string.clj' }, + { startIndex: 1, type: 'string.escape.clj' }, + { startIndex: 3, type: 'string.clj' }, + ], + }, + ], + [ + { + line: '" string \\', + tokens: [{ startIndex: 0, type: 'string.clj' }], + }, + { + line: 'multiline', + tokens: [{ startIndex: 0, type: 'string.clj' }], + }, + { + line: ' ', + tokens: [ + // previous line needs to be terminated with \ + { startIndex: 0, type: 'white.clj' }, + ], + }, + ], - // numbers - [ - { - line: '1e2', - tokens: [{ startIndex: 0, type: 'number.float.clj' }], - }, - ], - [ - { - line: '#x03BB', - tokens: [{ startIndex: 0, type: 'number.hex.clj' }], - }, - ], + // numbers + [ + { + line: '1e2', + tokens: [{ startIndex: 0, type: 'number.float.clj' }], + }, + ], + [ + { + line: '#x03BB', + tokens: [{ startIndex: 0, type: 'number.hex.clj' }], + }, + ], ]); diff --git a/src/clojure/clojure.ts b/src/clojure/clojure.ts index 82aef3b6..3e099e98 100644 --- a/src/clojure/clojure.ts +++ b/src/clojure/clojure.ts @@ -11,7 +11,6 @@ import ILanguage = monaco.languages.IMonarchLanguage; export const conf: IRichLanguageConfiguration = { comments: { lineComment: ';;', - blockComment: ['(comment', ')'], }, brackets: [['(', ')'], ['{', '}'], ['[', ']']], @@ -210,18 +209,7 @@ export const language = { { include: '@strings' }, ], - comment: [ - [/[^comment\(\)]+/, 'comment'], - [/\(comment/, 'comment', '@push'], - [/\)/, 'comment', '@pop'], - [/[comment\(\)]/, 'comment'], - ], - - whitespace: [ - [/[ \t\r\n]+/, 'white'], - [/\(comment/, 'comment', '@comment'], - [/;;.*$/, 'comment'], - ], + whitespace: [[/[ \t\r\n]+/, 'white'], [/;;.*$/, 'comment']], strings: [ [/"$/, 'string', '@popall'], From 59cf966107cada1ef5f245feb6aae6be25dadee3 Mon Sep 17 00:00:00 2001 From: masad-frost Date: Mon, 2 Jul 2018 19:14:04 -0700 Subject: [PATCH 028/133] Fix tests --- src/clojure/clojure.test.ts | 2 +- src/scheme/scheme.test.ts | 154 ++++++++++++++++++------------------ 2 files changed, 78 insertions(+), 78 deletions(-) diff --git a/src/clojure/clojure.test.ts b/src/clojure/clojure.test.ts index a4d1c1cb..e039e5ab 100644 --- a/src/clojure/clojure.test.ts +++ b/src/clojure/clojure.test.ts @@ -83,7 +83,7 @@ testTokenization('clojure', [ ], [ { - line: '#x03BB', + line: '0xff', tokens: [{ startIndex: 0, type: 'number.hex.clj' }], }, ], diff --git a/src/scheme/scheme.test.ts b/src/scheme/scheme.test.ts index 4aaa04aa..52149bb1 100644 --- a/src/scheme/scheme.test.ts +++ b/src/scheme/scheme.test.ts @@ -8,84 +8,84 @@ import { testTokenization } from '../test/testRunner'; testTokenization('scheme', [ - // Keywords - [ - { - line: 'define-macro some', - tokens: [ - { startIndex: 0, type: 'keyword.scheme' }, - { startIndex: 12, type: 'white.scheme' }, - { startIndex: 13, type: 'variable.scheme' }, - ], - }, - ], + // Keywords + [ + { + line: 'define-macro some', + tokens: [ + { startIndex: 0, type: 'keyword.scheme' }, + { startIndex: 12, type: 'white.scheme' }, + { startIndex: 13, type: 'variable.scheme' }, + ], + }, + ], - // comments - [ - { - line: '; comment', - tokens: [{ startIndex: 0, type: 'comment.scheme' }], - }, - ], - [ - { - line: '|# comment', - tokens: [{ startIndex: 0, type: 'comment.scheme' }], - }, - { - line: 'multiline', - tokens: [{ startIndex: 0, type: 'comment.scheme' }], - }, - { - line: '#| cons', - tokens: [ - { startIndex: 0, type: 'comment.scheme' }, - { startIndex: 2, type: 'white.scheme' }, - { startIndex: 3, type: 'keyword.scheme' }, - ], - }, - ], + // comments + [ + { + line: '; comment', + tokens: [{ startIndex: 0, type: 'comment.scheme' }], + }, + ], + [ + { + line: '#| comment', + tokens: [{ startIndex: 0, type: 'comment.scheme' }], + }, + { + line: 'multiline', + tokens: [{ startIndex: 0, type: 'comment.scheme' }], + }, + { + line: '|# cons', + tokens: [ + { startIndex: 0, type: 'comment.scheme' }, + { startIndex: 2, type: 'white.scheme' }, + { startIndex: 3, type: 'keyword.scheme' }, + ], + }, + ], - // strings - [ - { - line: '"\\n string "', - tokens: [ - { startIndex: 0, type: 'string.scheme' }, - { startIndex: 1, type: 'string.escape.scheme' }, - { startIndex: 3, type: 'string.scheme' }, - ], - }, - ], - [ - { - line: '" string \\', - tokens: [{ startIndex: 0, type: 'string.scheme' }], - }, - { - line: 'multiline', - tokens: [{ startIndex: 0, type: 'string.scheme' }], - }, - { - line: ' ', - tokens: [ - // previous line needs to be terminated with \ - { startIndex: 0, type: 'white.scheme' }, - ], - }, - ], + // strings + [ + { + line: '"\\n string "', + tokens: [ + { startIndex: 0, type: 'string.scheme' }, + { startIndex: 1, type: 'string.escape.scheme' }, + { startIndex: 3, type: 'string.scheme' }, + ], + }, + ], + [ + { + line: '" string \\', + tokens: [{ startIndex: 0, type: 'string.scheme' }], + }, + { + line: 'multiline', + tokens: [{ startIndex: 0, type: 'string.scheme' }], + }, + { + line: ' ', + tokens: [ + // previous line needs to be terminated with \ + { startIndex: 0, type: 'white.scheme' }, + ], + }, + ], - // numbers - [ - { - line: '1e2', - tokens: [{ startIndex: 0, type: 'number.float.scheme' }], - }, - ], - [ - { - line: '#x03BB', - tokens: [{ startIndex: 0, type: 'number.hex.scheme' }], - }, - ], + // numbers + [ + { + line: '1e2', + tokens: [{ startIndex: 0, type: 'number.float.scheme' }], + }, + ], + [ + { + line: '#x03BB', + tokens: [{ startIndex: 0, type: 'number.hex.scheme' }], + }, + ], ]); From f0ef36333b51f8e60463f6639f2e238ee66572f4 Mon Sep 17 00:00:00 2001 From: Alex Dima Date: Tue, 3 Jul 2018 16:46:58 +0200 Subject: [PATCH 029/133] update mocha --- package-lock.json | 424 +++++++++++++++++++--------------------------- package.json | 2 +- 2 files changed, 172 insertions(+), 254 deletions(-) diff --git a/package-lock.json b/package-lock.json index 9f03c410..db22bfa4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,10 +10,10 @@ "integrity": "sha1-c7Xuyj+rZT49P5Qis0GtQiBdyWU=", "dev": true, "requires": { - "co": "^4.6.0", - "fast-deep-equal": "^1.0.0", - "fast-json-stable-stringify": "^2.0.0", - "json-schema-traverse": "^0.3.0" + "co": "4.6.0", + "fast-deep-equal": "1.1.0", + "fast-json-stable-stringify": "2.0.0", + "json-schema-traverse": "0.3.1" } }, "asn1": { @@ -59,7 +59,7 @@ "dev": true, "optional": true, "requires": { - "tweetnacl": "^0.14.3" + "tweetnacl": "0.14.5" } }, "boom": { @@ -68,7 +68,7 @@ "integrity": "sha1-T4owBctKfjiJ90kDD9JbluAdLjE=", "dev": true, "requires": { - "hoek": "4.x.x" + "hoek": "4.2.1" } }, "brace-expansion": { @@ -77,7 +77,7 @@ "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", "dev": true, "requires": { - "balanced-match": "^1.0.0", + "balanced-match": "1.0.0", "concat-map": "0.0.1" } }, @@ -87,12 +87,6 @@ "integrity": "sha1-ns5bWsqJopkyJC4Yv5M975h2zBc=", "dev": true }, - "browser-stdout": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.0.tgz", - "integrity": "sha1-81HTKWnTL6XXpVZxVCY9korjvR8=", - "dev": true - }, "caseless": { "version": "0.12.0", "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", @@ -111,16 +105,7 @@ "integrity": "sha1-cj599ugBrFYTETp+RFqbactjKBg=", "dev": true, "requires": { - "delayed-stream": "~1.0.0" - } - }, - "commander": { - "version": "2.9.0", - "resolved": "https://registry.npmjs.org/commander/-/commander-2.9.0.tgz", - "integrity": "sha1-nJkJQXbhIkDLItbFFGCYQA/g99Q=", - "dev": true, - "requires": { - "graceful-readlink": ">= 1.0.0" + "delayed-stream": "1.0.0" } }, "concat-map": { @@ -141,7 +126,7 @@ "integrity": "sha1-qJ+7Ig9c4l7FboxKqKT9e1sNKf4=", "dev": true, "requires": { - "boom": "5.x.x" + "boom": "5.2.0" }, "dependencies": { "boom": { @@ -150,7 +135,7 @@ "integrity": "sha512-Z5BTk6ZRe4tXXQlkqftmsAUANpXmuwlsF5Oov8ThoMbQRzdGTA1ngYRW160GexgOgjsFOKJz0LYhoNi+2AMBUw==", "dev": true, "requires": { - "hoek": "4.x.x" + "hoek": "4.2.1" } } } @@ -167,7 +152,7 @@ "integrity": "sha1-VBCXI0yyUTyDzu06zdwn/yeYfVQ=", "dev": true, "requires": { - "cssom": "0.3.x" + "cssom": "0.3.2" } }, "dashdash": { @@ -176,16 +161,7 @@ "integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA=", "dev": true, "requires": { - "assert-plus": "^1.0.0" - } - }, - "debug": { - "version": "2.6.8", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.8.tgz", - "integrity": "sha1-5zFTHKLt4n0YgiJCfaF4IdaP9Pw=", - "dev": true, - "requires": { - "ms": "2.0.0" + "assert-plus": "1.0.0" } }, "delayed-stream": { @@ -194,20 +170,14 @@ "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=", "dev": true }, - "diff": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/diff/-/diff-3.2.0.tgz", - "integrity": "sha1-yc45Okt8vQsFinJck98pkCeGj/k=", - "dev": true - }, "dom-serializer": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-0.1.0.tgz", "integrity": "sha1-BzxpdUbOB4DOI75KKOKT5AvDDII=", "dev": true, "requires": { - "domelementtype": "~1.1.1", - "entities": "~1.1.1" + "domelementtype": "1.1.3", + "entities": "1.1.1" }, "dependencies": { "domelementtype": { @@ -230,7 +200,7 @@ "integrity": "sha1-iS5HAAqZvlW783dP/qBWHYh5wlk=", "dev": true, "requires": { - "domelementtype": "1" + "domelementtype": "1.3.0" } }, "domutils": { @@ -239,8 +209,8 @@ "integrity": "sha512-Lgd2XcJ/NjEw+7tFvfKxOzCYKZsdct5lczQ2ZaQY8Djz7pfAD3Gbp8ySJWtreII/vDlMVmxwa6pHmdxIYgttDg==", "dev": true, "requires": { - "dom-serializer": "0", - "domelementtype": "1" + "dom-serializer": "0.1.0", + "domelementtype": "1.3.0" } }, "ecc-jsbn": { @@ -250,7 +220,7 @@ "dev": true, "optional": true, "requires": { - "jsbn": "~0.1.0" + "jsbn": "0.1.1" } }, "entities": { @@ -301,9 +271,9 @@ "integrity": "sha1-SXBJi+YEwgwAXU9cI67NIda0kJk=", "dev": true, "requires": { - "asynckit": "^0.4.0", + "asynckit": "0.4.0", "combined-stream": "1.0.6", - "mime-types": "^2.1.12" + "mime-types": "2.1.18" } }, "fs.realpath": { @@ -318,35 +288,9 @@ "integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=", "dev": true, "requires": { - "assert-plus": "^1.0.0" - } - }, - "glob": { - "version": "7.1.1", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.1.tgz", - "integrity": "sha1-gFIR3wT6rxxjo2ADBs31reULLsg=", - "dev": true, - "requires": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.0.2", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" + "assert-plus": "1.0.0" } }, - "graceful-readlink": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/graceful-readlink/-/graceful-readlink-1.0.1.tgz", - "integrity": "sha1-TK+tdrxi8C+gObL5Tpo906ORpyU=", - "dev": true - }, - "growl": { - "version": "1.9.2", - "resolved": "https://registry.npmjs.org/growl/-/growl-1.9.2.tgz", - "integrity": "sha1-Dqd0NxXbjY3ixe3hd14bRayFwC8=", - "dev": true - }, "har-schema": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz", @@ -359,26 +303,20 @@ "integrity": "sha1-ukAsJmGU8VlW7xXg/PJCmT9qff0=", "dev": true, "requires": { - "ajv": "^5.1.0", - "har-schema": "^2.0.0" + "ajv": "5.5.2", + "har-schema": "2.0.0" } }, - "has-flag": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-1.0.0.tgz", - "integrity": "sha1-nZ55MWXOAXoA8AQYxD+UKnsdEfo=", - "dev": true - }, "hawk": { "version": "6.0.2", "resolved": "https://registry.npmjs.org/hawk/-/hawk-6.0.2.tgz", "integrity": "sha512-miowhl2+U7Qle4vdLqDdPt9m09K6yZhkLDTWGoUiUzrQCn+mHHSmfJgAyGaLRZbPmTqfFFjRV1QWCW0VWUJBbQ==", "dev": true, "requires": { - "boom": "4.x.x", - "cryptiles": "3.x.x", - "hoek": "4.x.x", - "sntp": "2.x.x" + "boom": "4.3.1", + "cryptiles": "3.1.2", + "hoek": "4.2.1", + "sntp": "2.1.0" } }, "he": { @@ -399,12 +337,12 @@ "integrity": "sha1-G9+HrMoPP55T+k/M6w9LTLsAszg=", "dev": true, "requires": { - "domelementtype": "^1.3.0", - "domhandler": "^2.3.0", - "domutils": "^1.5.1", - "entities": "^1.1.1", - "inherits": "^2.0.1", - "readable-stream": "^2.0.2" + "domelementtype": "1.3.0", + "domhandler": "2.4.1", + "domutils": "1.7.0", + "entities": "1.1.1", + "inherits": "2.0.3", + "readable-stream": "2.3.5" } }, "http-signature": { @@ -413,9 +351,9 @@ "integrity": "sha1-muzZJRFHcvPZW2WmCruPfBj7rOE=", "dev": true, "requires": { - "assert-plus": "^1.0.0", - "jsprim": "^1.2.2", - "sshpk": "^1.7.0" + "assert-plus": "1.0.0", + "jsprim": "1.4.1", + "sshpk": "1.13.1" } }, "inflight": { @@ -424,8 +362,8 @@ "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", "dev": true, "requires": { - "once": "^1.3.0", - "wrappy": "1" + "once": "1.4.0", + "wrappy": "1.0.2" } }, "inherits": { @@ -465,15 +403,15 @@ "integrity": "sha1-DYvq9hDC/yOJT1Tfp/id0i/Q96s=", "dev": true, "requires": { - "browser-request": ">= 0.3.1 < 0.4.0", - "cssom": ">= 0.3.0 < 0.4.0", - "cssstyle": ">= 0.2.21 < 0.3.0", - "htmlparser2": ">= 3.7.3 < 4.0.0", - "nwmatcher": ">= 1.3.4 < 2.0.0", - "parse5": ">= 1.3.1 < 2.0.0", - "request": ">= 2.44.0 < 3.0.0", - "xml-name-validator": "^1.0.0", - "xmlhttprequest": ">= 1.6.0 < 2.0.0" + "browser-request": "0.3.3", + "cssom": "0.3.2", + "cssstyle": "0.2.37", + "htmlparser2": "3.9.2", + "nwmatcher": "1.4.3", + "parse5": "1.5.1", + "request": "2.85.0", + "xml-name-validator": "1.0.0", + "xmlhttprequest": "1.8.0" } }, "json-schema": { @@ -494,12 +432,6 @@ "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=", "dev": true }, - "json3": { - "version": "3.3.2", - "resolved": "https://registry.npmjs.org/json3/-/json3-3.3.2.tgz", - "integrity": "sha1-PAQ0dD35Pi9cQq7nsZvLSDV19OE=", - "dev": true - }, "jsprim": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz", @@ -512,74 +444,6 @@ "verror": "1.10.0" } }, - "lodash._baseassign": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/lodash._baseassign/-/lodash._baseassign-3.2.0.tgz", - "integrity": "sha1-jDigmVAPIVrQnlnxci/QxSv+Ck4=", - "dev": true, - "requires": { - "lodash._basecopy": "^3.0.0", - "lodash.keys": "^3.0.0" - } - }, - "lodash._basecopy": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/lodash._basecopy/-/lodash._basecopy-3.0.1.tgz", - "integrity": "sha1-jaDmqHbPNEwK2KVIghEd08XHyjY=", - "dev": true - }, - "lodash._basecreate": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/lodash._basecreate/-/lodash._basecreate-3.0.3.tgz", - "integrity": "sha1-G8ZhYU2qf8MRt9A78WgGoCE8+CE=", - "dev": true - }, - "lodash._getnative": { - "version": "3.9.1", - "resolved": "https://registry.npmjs.org/lodash._getnative/-/lodash._getnative-3.9.1.tgz", - "integrity": "sha1-VwvH3t5G1hzc3mh9ZdPuy6o6r/U=", - "dev": true - }, - "lodash._isiterateecall": { - "version": "3.0.9", - "resolved": "https://registry.npmjs.org/lodash._isiterateecall/-/lodash._isiterateecall-3.0.9.tgz", - "integrity": "sha1-UgOte6Ql+uhCRg5pbbnPPmqsBXw=", - "dev": true - }, - "lodash.create": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/lodash.create/-/lodash.create-3.1.1.tgz", - "integrity": "sha1-1/KEnw29p+BGgruM1yqwIkYd6+c=", - "dev": true, - "requires": { - "lodash._baseassign": "^3.0.0", - "lodash._basecreate": "^3.0.0", - "lodash._isiterateecall": "^3.0.0" - } - }, - "lodash.isarguments": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/lodash.isarguments/-/lodash.isarguments-3.1.0.tgz", - "integrity": "sha1-L1c9hcaiQon/AGY7SRwdM4/zRYo=", - "dev": true - }, - "lodash.isarray": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/lodash.isarray/-/lodash.isarray-3.0.4.tgz", - "integrity": "sha1-eeTriMNqgSKvhvhEqpvNhRtfu1U=", - "dev": true - }, - "lodash.keys": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/lodash.keys/-/lodash.keys-3.1.2.tgz", - "integrity": "sha1-TbwEcrFWvlCgsoaFXRvQsMZWCYo=", - "dev": true, - "requires": { - "lodash._getnative": "^3.0.0", - "lodash.isarguments": "^3.0.0", - "lodash.isarray": "^3.0.0" - } - }, "mime-db": { "version": "1.33.0", "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.33.0.tgz", @@ -592,7 +456,7 @@ "integrity": "sha512-lc/aahn+t4/SWV/qcmumYjymLsWfN3ELhpmVuUFjgsORruuZPVSwAQryq+HHGvO/SI2KVX26bx+En+zhM8g8hQ==", "dev": true, "requires": { - "mime-db": "~1.33.0" + "mime-db": "1.33.0" } }, "minimatch": { @@ -601,7 +465,7 @@ "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", "dev": true, "requires": { - "brace-expansion": "^1.1.7" + "brace-expansion": "1.1.11" } }, "minimist": { @@ -620,23 +484,86 @@ } }, "mocha": { - "version": "3.5.3", - "resolved": "https://registry.npmjs.org/mocha/-/mocha-3.5.3.tgz", - "integrity": "sha512-/6na001MJWEtYxHOV1WLfsmR4YIynkUEhBwzsb+fk2qmQ3iqsi258l/Q2MWHJMImAcNpZ8DEdYAK72NHoIQ9Eg==", + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/mocha/-/mocha-5.2.0.tgz", + "integrity": "sha512-2IUgKDhc3J7Uug+FxMXuqIyYzH7gJjXECKe/w43IGgQHTSj3InJi+yAA7T24L9bQMRKiUEHxEX37G5JpVUGLcQ==", "dev": true, "requires": { - "browser-stdout": "1.3.0", - "commander": "2.9.0", - "debug": "2.6.8", - "diff": "3.2.0", + "browser-stdout": "1.3.1", + "commander": "2.15.1", + "debug": "3.1.0", + "diff": "3.5.0", "escape-string-regexp": "1.0.5", - "glob": "7.1.1", - "growl": "1.9.2", + "glob": "7.1.2", + "growl": "1.10.5", "he": "1.1.1", - "json3": "3.3.2", - "lodash.create": "3.1.1", + "minimatch": "3.0.4", "mkdirp": "0.5.1", - "supports-color": "3.1.2" + "supports-color": "5.4.0" + }, + "dependencies": { + "browser-stdout": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.1.tgz", + "integrity": "sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==", + "dev": true + }, + "commander": { + "version": "2.15.1", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.15.1.tgz", + "integrity": "sha512-VlfT9F3V0v+jr4yxPc5gg9s62/fIVWsd2Bk2iD435um1NlGMYdVCq+MjcXnhYq2icNOizHr1kK+5TI6H0Hy0ag==", + "dev": true + }, + "debug": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", + "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", + "dev": true, + "requires": { + "ms": "2.0.0" + } + }, + "diff": { + "version": "3.5.0", + "resolved": "https://registry.npmjs.org/diff/-/diff-3.5.0.tgz", + "integrity": "sha512-A46qtFgd+g7pDZinpnwiRJtxbC1hpgf0uzP3iG89scHk0AUC7A1TGxf5OiiOUv/JMZR8GOt8hL900hV0bOy5xA==", + "dev": true + }, + "glob": { + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz", + "integrity": "sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ==", + "dev": true, + "requires": { + "fs.realpath": "1.0.0", + "inflight": "1.0.6", + "inherits": "2.0.3", + "minimatch": "3.0.4", + "once": "1.4.0", + "path-is-absolute": "1.0.1" + } + }, + "growl": { + "version": "1.10.5", + "resolved": "https://registry.npmjs.org/growl/-/growl-1.10.5.tgz", + "integrity": "sha512-qBr4OuELkhPenW6goKVXiv47US3clb3/IbuWF9KNKEijAy9oeHxU9IgzjvJhHkUzhaj7rOUD7+YGWqUjLp5oSA==", + "dev": true + }, + "has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "dev": true + }, + "supports-color": { + "version": "5.4.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.4.0.tgz", + "integrity": "sha512-zjaXglF5nnWpsq470jSv6P9DwPvgLkuapYmfDm3JWOm0vkNTVF2tI4UrN2r6jH1qM/uc/WtxYY1hYoA2dOKj5w==", + "dev": true, + "requires": { + "has-flag": "3.0.0" + } + } } }, "monaco-editor-core": { @@ -651,7 +578,7 @@ "integrity": "sha512-7kUx8dtd5qVNVgUARBRhnM8oftPglYwlINfigC4yGUiuzqtIN22u1tly8umiOCIPR0eFiBLjt6aN23oZh2QJgg==", "dev": true, "requires": { - "typescript": "^2.7.2" + "typescript": "2.7.2" } }, "ms": { @@ -678,7 +605,7 @@ "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", "dev": true, "requires": { - "wrappy": "1" + "wrappy": "1.0.2" } }, "parse5": { @@ -723,13 +650,13 @@ "integrity": "sha512-tK0yDhrkygt/knjowCUiWP9YdV7c5R+8cR0r/kt9ZhBU906Fs6RpQJCEilamRJj1Nx2rWI6LkW9gKqjTkshhEw==", "dev": true, "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.0.3", - "util-deprecate": "~1.0.1" + "core-util-is": "1.0.2", + "inherits": "2.0.3", + "isarray": "1.0.0", + "process-nextick-args": "2.0.0", + "safe-buffer": "5.1.1", + "string_decoder": "1.0.3", + "util-deprecate": "1.0.2" } }, "request": { @@ -738,28 +665,28 @@ "integrity": "sha512-8H7Ehijd4js+s6wuVPLjwORxD4zeuyjYugprdOXlPSqaApmL/QOy+EB/beICHVCHkGMKNh5rvihb5ov+IDw4mg==", "dev": true, "requires": { - "aws-sign2": "~0.7.0", - "aws4": "^1.6.0", - "caseless": "~0.12.0", - "combined-stream": "~1.0.5", - "extend": "~3.0.1", - "forever-agent": "~0.6.1", - "form-data": "~2.3.1", - "har-validator": "~5.0.3", - "hawk": "~6.0.2", - "http-signature": "~1.2.0", - "is-typedarray": "~1.0.0", - "isstream": "~0.1.2", - "json-stringify-safe": "~5.0.1", - "mime-types": "~2.1.17", - "oauth-sign": "~0.8.2", - "performance-now": "^2.1.0", - "qs": "~6.5.1", - "safe-buffer": "^5.1.1", - "stringstream": "~0.0.5", - "tough-cookie": "~2.3.3", - "tunnel-agent": "^0.6.0", - "uuid": "^3.1.0" + "aws-sign2": "0.7.0", + "aws4": "1.6.0", + "caseless": "0.12.0", + "combined-stream": "1.0.6", + "extend": "3.0.1", + "forever-agent": "0.6.1", + "form-data": "2.3.2", + "har-validator": "5.0.3", + "hawk": "6.0.2", + "http-signature": "1.2.0", + "is-typedarray": "1.0.0", + "isstream": "0.1.2", + "json-stringify-safe": "5.0.1", + "mime-types": "2.1.18", + "oauth-sign": "0.8.2", + "performance-now": "2.1.0", + "qs": "6.5.1", + "safe-buffer": "5.1.1", + "stringstream": "0.0.5", + "tough-cookie": "2.3.4", + "tunnel-agent": "0.6.0", + "uuid": "3.2.1" } }, "requirejs": { @@ -780,7 +707,7 @@ "integrity": "sha512-FL1b58BDrqS3A11lJ0zEdnJ3UOKqVxawAkF3k7F0CVN7VQ34aZrV+G8BZ1WC9ZL7NyrwsW0oviwsWDgRuVYtJg==", "dev": true, "requires": { - "hoek": "4.x.x" + "hoek": "4.2.1" } }, "source-map": { @@ -795,14 +722,14 @@ "integrity": "sha1-US322mKHFEMW3EwY/hzx2UBzm+M=", "dev": true, "requires": { - "asn1": "~0.2.3", - "assert-plus": "^1.0.0", - "bcrypt-pbkdf": "^1.0.0", - "dashdash": "^1.12.0", - "ecc-jsbn": "~0.1.1", - "getpass": "^0.1.1", - "jsbn": "~0.1.0", - "tweetnacl": "~0.14.0" + "asn1": "0.2.3", + "assert-plus": "1.0.0", + "bcrypt-pbkdf": "1.0.1", + "dashdash": "1.14.1", + "ecc-jsbn": "0.1.1", + "getpass": "0.1.7", + "jsbn": "0.1.1", + "tweetnacl": "0.14.5" } }, "string_decoder": { @@ -811,7 +738,7 @@ "integrity": "sha512-4AH6Z5fzNNBcH+6XDMfA/BTt87skxqJlO0lAh3Dker5zThcAxG6mKz+iGu308UKoPPQ8Dcqx/4JhujzltRa+hQ==", "dev": true, "requires": { - "safe-buffer": "~5.1.0" + "safe-buffer": "5.1.1" } }, "stringstream": { @@ -820,22 +747,13 @@ "integrity": "sha1-TkhM1N5aC7vuGORjB3EKioFiGHg=", "dev": true }, - "supports-color": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-3.1.2.tgz", - "integrity": "sha1-cqJiiU2dQIuVbKBf83su2KbiotU=", - "dev": true, - "requires": { - "has-flag": "^1.0.0" - } - }, "tough-cookie": { "version": "2.3.4", "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.3.4.tgz", "integrity": "sha512-TZ6TTfI5NtZnuyy/Kecv+CnoROnyXn2DN97LontgQpCwsX2XyLYCC0ENhYkehSOwAp8rTQKc/NUIF7BkQ5rKLA==", "dev": true, "requires": { - "punycode": "^1.4.1" + "punycode": "1.4.1" } }, "tunnel-agent": { @@ -844,7 +762,7 @@ "integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=", "dev": true, "requires": { - "safe-buffer": "^5.0.1" + "safe-buffer": "5.1.1" } }, "tweetnacl": { @@ -866,8 +784,8 @@ "integrity": "sha512-OY8VPQU25q09gQRbC+Ekk3xgEVBmYFEfVcgS47ksjTiNht2LmLlUkWutyi38ZsDSToJHwbe76kDGwmD226Z2Fg==", "dev": true, "requires": { - "commander": "~2.14.1", - "source-map": "~0.6.1" + "commander": "2.14.1", + "source-map": "0.6.1" }, "dependencies": { "commander": { @@ -896,9 +814,9 @@ "integrity": "sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=", "dev": true, "requires": { - "assert-plus": "^1.0.0", + "assert-plus": "1.0.0", "core-util-is": "1.0.2", - "extsprintf": "^1.2.0" + "extsprintf": "1.3.0" } }, "wrappy": { diff --git a/package.json b/package.json index ec7c16a2..5b7b0d62 100644 --- a/package.json +++ b/package.json @@ -19,7 +19,7 @@ }, "devDependencies": { "jsdom-no-contextify": "^3.1.0", - "mocha": "^3.4.2", + "mocha": "^5.2.0", "monaco-editor-core": "0.13.0", "monaco-plugin-helpers": "^1.0.2", "requirejs": "^2.3.5", From 79b5433bb4fc2a9e158d96fa87d50fab9d3befb4 Mon Sep 17 00:00:00 2001 From: Matt Masson Date: Tue, 10 Jul 2018 13:00:51 -0400 Subject: [PATCH 030/133] Initial commit of Power Query / M Language --- src/powerquery/powerquery.contribution.ts | 17 ++++ src/powerquery/powerquery.test.ts | 18 ++++ src/powerquery/powerquery.ts | 116 ++++++++++++++++++++++ 3 files changed, 151 insertions(+) create mode 100644 src/powerquery/powerquery.contribution.ts create mode 100644 src/powerquery/powerquery.test.ts create mode 100644 src/powerquery/powerquery.ts diff --git a/src/powerquery/powerquery.contribution.ts b/src/powerquery/powerquery.contribution.ts new file mode 100644 index 00000000..7ffdd692 --- /dev/null +++ b/src/powerquery/powerquery.contribution.ts @@ -0,0 +1,17 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +'use strict'; + +import { registerLanguage } from '../_.contribution'; + +// Allow for running under nodejs/requirejs in tests +const _monaco: typeof monaco = (typeof monaco === 'undefined' ? (self).monaco : monaco); + +registerLanguage({ + id: 'powerquery', + extensions: ['.pq', '.pqm'], + aliases: ['PQ', 'M', 'Power Query', 'Power Query M'], + loader: () => _monaco.Promise.wrap(import('./powerquery')) +}); diff --git a/src/powerquery/powerquery.test.ts b/src/powerquery/powerquery.test.ts new file mode 100644 index 00000000..eac0c4f5 --- /dev/null +++ b/src/powerquery/powerquery.test.ts @@ -0,0 +1,18 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +'use strict'; + +import { testTokenization } from '../test/testRunner'; + +testTokenization('powerquery', [ + // Comments + [{ + line: '// a comment', + tokens: [ + { startIndex: 0, type: 'comment.pq' } + ] + }], +]); diff --git a/src/powerquery/powerquery.ts b/src/powerquery/powerquery.ts new file mode 100644 index 00000000..2fb62b8f --- /dev/null +++ b/src/powerquery/powerquery.ts @@ -0,0 +1,116 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +'use strict'; + +import IRichLanguageConfiguration = monaco.languages.LanguageConfiguration; +import ILanguage = monaco.languages.IMonarchLanguage; + +export const conf: IRichLanguageConfiguration = { + comments: { + lineComment: '//', + blockComment: ['/*', '*/'], + }, + brackets: [['[', ']'], ['(', ')'], ['{', '}']], + autoClosingPairs: [ + { open: '"', close: '"', notIn: ['string', 'comment'] }, // quoted identifier? + { open: '[', close: ']', notIn: ['string', 'comment'] }, + { open: '(', close: ')', notIn: ['string', 'comment'] }, + { open: '{', close: '}', notIn: ['string', 'comment'] }, + ] +}; + +export const language = { + defaultToken: '', + tokenPostfix: '.pq', + ignoreCase: false, + + brackets: [ + { open: '[', close: ']', token: 'delimiter.square' }, + { open: '{', close: '}', token: 'delimiter.brackets' }, + { open: '(', close: ')', token: 'delimiter.parenthesis' } + ], + + keywords: [ + "and", "as", "each", "else", + "error", "false", "if", "in", + "is", "let", "meta", "not", + "otherwise", "or", "section", + "shared", "then", "true", + "try", "type", "#binary", + "#date", "#datetime", + "#datetimezone", "#duration", + "#infinity", "#nan", "#sections", + "#shared", "#table", "#time" + ], + + typeKeywords: [ + "null", + "logical", + "number", + "time", + "date", + "datetime", + "datetimezone", + "duration", + "text", + "binary", + "list", + "record", + "table", + "function" + ], + + wordDefinition: /([a-zA-Z_\.][a-zA-Z\._0-9]*)|([0-9][_\.a-zA-Z0-9]*[_\.a-zA-Z])/, + + tokenizer: { + root: [ + { include: "@comments" }, + + [/\d+(\.\d+)?/, "number"], + [/(([a-zA-Z_\.][a-zA-Z\._0-9]*)|([0-9][_\.a-zA-Z0-9]*[_\.a-zA-Z]))|(#["]([ \[\]_\.a-zA-Z0-9]+)["])/, + { + cases: { + "@keywords": "keyword", + "@default": "identifier" + } + }], + { include: "@strings" }, + [/[{}()\[\]]/, "@brackets"], + // Removed forward slash for now to allow comments + [/[,;=+<>\-*&@?]|([<>]=)|(<>)|([\.\.][\.]?)|(=>)/, "punctuator"], + + ], + comments: [ + ["\\/\\*", "comment", "@comment"], + ["\\/\\/+.*", "comment"] + ], + comment: [ + ["\\*\\/", "comment", "@pop"], + [".", "comment"] + ], + // Recognize strings, including those broken across lines with \ (but not without) + strings: [ + [/"$/, "string.escape", "@root"], + [/"/, "string.escape", "@stringBody"], + [/"$/, "string.escape", "@root"], + [/"/, "string.escape", "@dblStringBody"] + ], + stringBody: [ + [/\\./, "string"], + [/"/, "string.escape", "@root"], + [/.(?=.*")/, "string"], + [/.*\\$/, "string"], + [/.*$/, "string", "@root"] + ], + dblStringBody: [ + [/\\./, "string"], + [/"/, "string.escape", "@root"], + [/.(?=.*")/, "string"], + [/.*\\$/, "string"], + [/.*$/, "string", "@root"] + ] + } +}; From 8380da7fff2dcc3602d91cf8358d0ef109b6d3c3 Mon Sep 17 00:00:00 2001 From: Matt Masson Date: Tue, 10 Jul 2018 13:05:13 -0400 Subject: [PATCH 031/133] Tokenizer fixes for quoted identifiers, comments, strings, numbers --- src/powerquery/powerquery.ts | 71 +++++++++++++++++++++--------------- 1 file changed, 42 insertions(+), 29 deletions(-) diff --git a/src/powerquery/powerquery.ts b/src/powerquery/powerquery.ts index 2fb62b8f..85647774 100644 --- a/src/powerquery/powerquery.ts +++ b/src/powerquery/powerquery.ts @@ -15,10 +15,10 @@ export const conf: IRichLanguageConfiguration = { }, brackets: [['[', ']'], ['(', ')'], ['{', '}']], autoClosingPairs: [ - { open: '"', close: '"', notIn: ['string', 'comment'] }, // quoted identifier? - { open: '[', close: ']', notIn: ['string', 'comment'] }, - { open: '(', close: ')', notIn: ['string', 'comment'] }, - { open: '{', close: '}', notIn: ['string', 'comment'] }, + { open: '"', close: '"', notIn: ['string', 'comment', 'identifier'] }, + { open: '[', close: ']', notIn: ['string', 'comment', 'identifier'] }, + { open: '(', close: ')', notIn: ['string', 'comment', 'identifier'] }, + { open: '{', close: '}', notIn: ['string', 'comment', 'identifier'] }, ] }; @@ -47,6 +47,10 @@ export const language = { ], typeKeywords: [ + "action", + "any", + "anynonnull", + "none", "null", "logical", "number", @@ -63,54 +67,63 @@ export const language = { "function" ], - wordDefinition: /([a-zA-Z_\.][a-zA-Z\._0-9]*)|([0-9][_\.a-zA-Z0-9]*[_\.a-zA-Z])/, + // (identifier|keyword or type|quoted identifier) + wordDefinition: /([a-zA-Z_][\w\.]*)|(#?[a-z]+)|(#"[\w \.]+")/, tokenizer: { root: [ - { include: "@comments" }, + // escaped identifier + [/#"[\w \.]+"/, "identifier"], + + // numbers + [/\d*\.\d+([eE][\-+]?\d+)?/, "number.float"], + [/0[xX][0-9a-fA-F]+/, "number.hex"], + [/\d+([eE][\-+]?\d+)?/, "number"], - [/\d+(\.\d+)?/, "number"], - [/(([a-zA-Z_\.][a-zA-Z\._0-9]*)|([0-9][_\.a-zA-Z0-9]*[_\.a-zA-Z]))|(#["]([ \[\]_\.a-zA-Z0-9]+)["])/, + // keywords + [/(#?[a-z]+)/, { cases: { + "@typeKeywords": "keyword.type", "@keywords": "keyword", "@default": "identifier" } - }], + } + ], + + // other identifiers + [/([a-zA-Z_][\w\.]*)/, "identifier"], + + { include: "@whitespace" }, + { include: "@comments" }, { include: "@strings" }, + [/[{}()\[\]]/, "@brackets"], - // Removed forward slash for now to allow comments - [/[,;=+<>\-*&@?]|([<>]=)|(<>)|([\.\.][\.]?)|(=>)/, "punctuator"], + [/([,;=\+<>\-\*&@\?\/!])|([<>]=)|(<>)|(=>)|(\.\.\.)|(\.\.)/, "punctuator"], + ], + whitespace: [ + [/\s+/, "white"] ], + comments: [ ["\\/\\*", "comment", "@comment"], ["\\/\\/+.*", "comment"] ], + comment: [ ["\\*\\/", "comment", "@pop"], [".", "comment"] ], - // Recognize strings, including those broken across lines with \ (but not without) + strings: [ - [/"$/, "string.escape", "@root"], - [/"/, "string.escape", "@stringBody"], - [/"$/, "string.escape", "@root"], - [/"/, "string.escape", "@dblStringBody"] - ], - stringBody: [ - [/\\./, "string"], - [/"/, "string.escape", "@root"], - [/.(?=.*")/, "string"], - [/.*\\$/, "string"], - [/.*$/, "string", "@root"] + ["\"", "string", "@string"] ], - dblStringBody: [ - [/\\./, "string"], - [/"/, "string.escape", "@root"], - [/.(?=.*")/, "string"], - [/.*\\$/, "string"], - [/.*$/, "string", "@root"] + + string: [ + ["\"\"", "string.escape"], + ["\"", "string", "@pop"], + [".", "string"] ] } }; From eb48b847e51dee121eabeabd0af0b13a3a7936f3 Mon Sep 17 00:00:00 2001 From: Matt Masson Date: Tue, 10 Jul 2018 13:08:06 -0400 Subject: [PATCH 032/133] Remove old wordDefinition field --- src/powerquery/powerquery.ts | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/powerquery/powerquery.ts b/src/powerquery/powerquery.ts index 85647774..f6035903 100644 --- a/src/powerquery/powerquery.ts +++ b/src/powerquery/powerquery.ts @@ -67,9 +67,6 @@ export const language = { "function" ], - // (identifier|keyword or type|quoted identifier) - wordDefinition: /([a-zA-Z_][\w\.]*)|(#?[a-z]+)|(#"[\w \.]+")/, - tokenizer: { root: [ // escaped identifier From 134fe29df2a56fc078a65c17d8cc7e6c7e2cefb6 Mon Sep 17 00:00:00 2001 From: Matt Masson Date: Tue, 10 Jul 2018 13:11:13 -0400 Subject: [PATCH 033/133] add powerquery to distribution and test --- src/monaco.contribution.ts | 1 + test/setup.js | 1 + 2 files changed, 2 insertions(+) diff --git a/src/monaco.contribution.ts b/src/monaco.contribution.ts index 8ac5bfa3..ee5722c4 100644 --- a/src/monaco.contribution.ts +++ b/src/monaco.contribution.ts @@ -26,6 +26,7 @@ import './objective-c/objective-c.contribution'; import './pgsql/pgsql.contribution'; import './php/php.contribution'; import './postiats/postiats.contribution'; +import './powerquery/powerquery.contribution'; import './powershell/powershell.contribution'; import './pug/pug.contribution'; import './python/python.contribution'; diff --git a/test/setup.js b/test/setup.js index 1cbff462..b359acea 100644 --- a/test/setup.js +++ b/test/setup.js @@ -45,6 +45,7 @@ define(['require'], function (require) { 'release/dev/objective-c/objective-c.test', 'release/dev/php/php.test', 'release/dev/postiats/postiats.test', + 'release/dev/powerquery/powerquery.test', 'release/dev/powershell/powershell.test', 'release/dev/python/python.test', 'release/dev/r/r.test', From a63a94a9af8963391a2439c4a38ddf4d15c3ec6c Mon Sep 17 00:00:00 2001 From: Matt Masson Date: Tue, 10 Jul 2018 14:33:42 -0400 Subject: [PATCH 034/133] Separate operators from delimiters --- src/powerquery/powerquery.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/powerquery/powerquery.ts b/src/powerquery/powerquery.ts index f6035903..c01101ab 100644 --- a/src/powerquery/powerquery.ts +++ b/src/powerquery/powerquery.ts @@ -96,7 +96,8 @@ export const language = { { include: "@strings" }, [/[{}()\[\]]/, "@brackets"], - [/([,;=\+<>\-\*&@\?\/!])|([<>]=)|(<>)|(=>)|(\.\.\.)|(\.\.)/, "punctuator"], + [/([=\+<>\-\*&@\?\/!])|([<>]=)|(<>)|(=>)|(\.\.\.)|(\.\.)/, "operator"], + [/[,;]/, "delimiter"], ], whitespace: [ From 56df5af3e51e2a76e78b46ba4e9d811d34c3dec3 Mon Sep 17 00:00:00 2001 From: Matt Masson Date: Tue, 10 Jul 2018 14:33:51 -0400 Subject: [PATCH 035/133] Add tests --- src/powerquery/powerquery.test.ts | 207 ++++++++++++++++++++++++++++++ 1 file changed, 207 insertions(+) diff --git a/src/powerquery/powerquery.test.ts b/src/powerquery/powerquery.test.ts index eac0c4f5..4b4265bf 100644 --- a/src/powerquery/powerquery.test.ts +++ b/src/powerquery/powerquery.test.ts @@ -15,4 +15,211 @@ testTokenization('powerquery', [ { startIndex: 0, type: 'comment.pq' } ] }], + + [{ + line: ' // a comment */', + tokens: [ + { startIndex: 0, type: 'white.pq' }, + { startIndex: 4, type: 'comment.pq' } + ] + }], + + [{ + line: '// a comment', + tokens: [ + { startIndex: 0, type: 'comment.pq' } + ] + }], + + [{ + line: '// /* #A */', + tokens: [ + { startIndex: 0, type: 'comment.pq' } + ] + }], + + [{ + line: '/*ABCD12$!()\\u000D%%%%%*/', + tokens: [ + { startIndex: 0, type: 'comment.pq' } + ] + }], + + [{ + line: '42 /* + 45 */ /*', + tokens: [ + { startIndex: 0, type: 'number.pq' }, + { startIndex: 2, type: 'white.pq' }, + { startIndex: 3, type: 'comment.pq' }, + { startIndex: 13, type: 'white.pq' }, + { startIndex: 14, type: 'comment.pq' } + ] + }], + + [{ + line: '/* //*/ a', + tokens: [ + { startIndex: 0, type: 'comment.pq' }, + { startIndex: 7, type: 'white.pq' }, + { startIndex: 8, type: 'identifier.pq' } + ] + }], + + [{ + line: '1 / 2; /* comment', + tokens: [ + { startIndex: 0, type: 'number.pq' }, + { startIndex: 1, type: 'white.pq' }, + { startIndex: 2, type: 'operator.pq' }, + { startIndex: 3, type: 'white.pq' }, + { startIndex: 4, type: 'number.pq' }, + { startIndex: 5, type: 'delimiter.pq' }, + { startIndex: 6, type: 'white.pq' }, + { startIndex: 7, type: 'comment.pq' } + ] + }], + + // Escaped Identifiers + [{ + line: '#"Change Types"', + tokens: [ + { startIndex: 0, type: 'identifier.pq' } + ] + }], + + [{ + line: '#"A B" = 1+2,', + tokens: [ + { startIndex: 0, type: 'identifier.pq' }, + { startIndex: 7, type: 'white.pq' }, + { startIndex: 8, type: 'operator.pq' }, + { startIndex: 9, type: 'white.pq' }, + { startIndex: 10, type: 'number.pq' }, + { startIndex: 11, type: 'operator.pq' }, + { startIndex: 12, type: 'number.pq' }, + { startIndex: 13, type: 'delimiter.pq' }, + ] + }], + + [{ + line: 'a = #"escap ed"+ 1', + tokens: [ + { startIndex: 0, type: 'identifier.pq' }, + { startIndex: 1, type: 'white.pq' }, + { startIndex: 2, type: 'operator.pq' }, + { startIndex: 3, type: 'white.pq' }, + { startIndex: 4, type: 'identifier.pq' }, + { startIndex: 15, type: 'operator.pq' }, + { startIndex: 16, type: 'white.pq' }, + { startIndex: 17, type: 'number.pq' } + ] + }], + + // Number formats + [{ + line: '5 / 1.2e+2 + 0x1234abc', + tokens: [ + { startIndex: 0, type: 'number.pq' }, + { startIndex: 1, type: 'white.pq' }, + { startIndex: 2, type: 'operator.pq' }, + { startIndex: 3, type: 'white.pq' }, + { startIndex: 4, type: 'number.float.pq' }, + { startIndex: 10, type: 'white.pq' }, + { startIndex: 11, type: 'operator.pq' }, + { startIndex: 12, type: 'white.pq'}, + { startIndex: 13, type: 'number.hex.pq'} + ] + }], + + [{ + line: '0xb *(.2)', + tokens: [ + { startIndex: 0, type: 'number.hex.pq' }, + { startIndex: 3, type: 'white.pq' }, + { startIndex: 4, type: 'operator.pq' }, + { startIndex: 5, type: 'delimiter.parenthesis.pq' }, + { startIndex: 6, type: 'number.float.pq' }, + { startIndex: 8, type: 'delimiter.parenthesis.pq' } + ] + }], + + [{ + line: '1.23e34+1.2e-2-.3e2', + tokens: [ + { startIndex: 0, type: 'number.float.pq' }, + { startIndex: 7, type: 'operator.pq' }, + { startIndex: 8, type: 'number.float.pq' }, + { startIndex: 14, type: 'operator.pq' }, + { startIndex: 15, type: 'number.float.pq' } + ] + }], + + // strings + [{ + line: ' "string"', + tokens: [ + { startIndex: 0, type: 'white.pq' }, + { startIndex: 2, type: 'string.pq' } + ] + }], + + [{ + line: '"string" & "another"', + tokens: [ + { startIndex: 0, type: 'string.pq' }, + { startIndex: 8, type: 'white.pq' }, + { startIndex: 9, type: 'operator.pq' }, + { startIndex: 10, type: 'white.pq' }, + { startIndex: 11, type: 'string.pq' } + ] + }], + + [{ + line: '"with ""escaped "" \'text', + tokens: [ + { startIndex: 0, type: 'string.pq' }, + { startIndex: 7, type: 'string.escape.pq' }, + { startIndex: 9, type: 'string.pq' }, + { startIndex: 17, type: 'string.escape.pq' }, + { startIndex: 19, type: 'string.pq' } + ] + }], + + // keywords and identifiers + [{ + line: 'And as Each each _', + tokens: [ + { startIndex: 0, type: 'identifier.pq' }, + { startIndex: 3, type: 'white.pq' }, + { startIndex: 4, type: 'keyword.pq' }, + { startIndex: 6, type: 'white.pq' }, + { startIndex: 7, type: 'identifier.pq' }, + { startIndex: 11, type: 'white.pq' }, + { startIndex: 12, type: 'keyword.pq' }, + { startIndex: 16, type: 'white.pq' }, + { startIndex: 17, type: 'identifier.pq' } + ] + }], + + [{ + line: ' #table({})', + tokens: [ + { startIndex: 0, type: 'white.pq' }, + { startIndex: 2, type: 'keyword.pq' }, + { startIndex: 8, type: "delimiter.parenthesis.pq" }, + { startIndex: 9, type: "delimiter.brackets.pq" }, + { startIndex: 11, type: "delimiter.parenthesis.pq" } + ] + }], + + [{ + line: 'param as number', + tokens: [ + { startIndex: 0, type: 'identifier.pq' }, + { startIndex: 5, type: 'white.pq' }, + { startIndex: 6, type: 'keyword.pq' }, + { startIndex: 8, type: 'white.pq' }, + { startIndex: 9, type: 'keyword.type.pq' } + ] + }], ]); From 985b1bdc11c3a4c4e84ad97ebaed5371cf148dfb Mon Sep 17 00:00:00 2001 From: Matt Masson Date: Tue, 10 Jul 2018 14:37:50 -0400 Subject: [PATCH 036/133] Add definition for identifier.quote (to match dax syntax) --- src/powerquery/powerquery.test.ts | 8 ++++---- src/powerquery/powerquery.ts | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/powerquery/powerquery.test.ts b/src/powerquery/powerquery.test.ts index 4b4265bf..a8c5a064 100644 --- a/src/powerquery/powerquery.test.ts +++ b/src/powerquery/powerquery.test.ts @@ -79,18 +79,18 @@ testTokenization('powerquery', [ ] }], - // Escaped Identifiers + // Quoted Identifiers [{ line: '#"Change Types"', tokens: [ - { startIndex: 0, type: 'identifier.pq' } + { startIndex: 0, type: 'identifier.quote.pq' } ] }], [{ line: '#"A B" = 1+2,', tokens: [ - { startIndex: 0, type: 'identifier.pq' }, + { startIndex: 0, type: 'identifier.quote.pq' }, { startIndex: 7, type: 'white.pq' }, { startIndex: 8, type: 'operator.pq' }, { startIndex: 9, type: 'white.pq' }, @@ -108,7 +108,7 @@ testTokenization('powerquery', [ { startIndex: 1, type: 'white.pq' }, { startIndex: 2, type: 'operator.pq' }, { startIndex: 3, type: 'white.pq' }, - { startIndex: 4, type: 'identifier.pq' }, + { startIndex: 4, type: 'identifier.quote.pq' }, { startIndex: 15, type: 'operator.pq' }, { startIndex: 16, type: 'white.pq' }, { startIndex: 17, type: 'number.pq' } diff --git a/src/powerquery/powerquery.ts b/src/powerquery/powerquery.ts index c01101ab..48579d6f 100644 --- a/src/powerquery/powerquery.ts +++ b/src/powerquery/powerquery.ts @@ -69,8 +69,8 @@ export const language = { tokenizer: { root: [ - // escaped identifier - [/#"[\w \.]+"/, "identifier"], + // quoted identifier + [/#"[\w \.]+"/, "identifier.quote"], // numbers [/\d*\.\d+([eE][\-+]?\d+)?/, "number.float"], From b261c99d53b6949dfb3ac74d580ce016c6e30f3b Mon Sep 17 00:00:00 2001 From: Matt Masson Date: Tue, 10 Jul 2018 15:04:43 -0400 Subject: [PATCH 037/133] Separate constructors and constants from keywords --- src/powerquery/powerquery.test.ts | 38 ++++++++++++++++++++++++++++--- src/powerquery/powerquery.ts | 27 +++++++++++++++++----- 2 files changed, 56 insertions(+), 9 deletions(-) diff --git a/src/powerquery/powerquery.test.ts b/src/powerquery/powerquery.test.ts index a8c5a064..5a202e87 100644 --- a/src/powerquery/powerquery.test.ts +++ b/src/powerquery/powerquery.test.ts @@ -185,7 +185,7 @@ testTokenization('powerquery', [ ] }], - // keywords and identifiers + // built-in keywords/identifiers [{ line: 'And as Each each _', tokens: [ @@ -205,7 +205,7 @@ testTokenization('powerquery', [ line: ' #table({})', tokens: [ { startIndex: 0, type: 'white.pq' }, - { startIndex: 2, type: 'keyword.pq' }, + { startIndex: 2, type: 'constructor.pq' }, { startIndex: 8, type: "delimiter.parenthesis.pq" }, { startIndex: 9, type: "delimiter.brackets.pq" }, { startIndex: 11, type: "delimiter.parenthesis.pq" } @@ -219,7 +219,39 @@ testTokenization('powerquery', [ { startIndex: 5, type: 'white.pq' }, { startIndex: 6, type: 'keyword.pq' }, { startIndex: 8, type: 'white.pq' }, - { startIndex: 9, type: 'keyword.type.pq' } + { startIndex: 9, type: 'type.pq' } + ] + }], + + [{ + line: 'type table', + tokens: [ + { startIndex: 0, type: 'keyword.pq' }, + { startIndex: 4, type: 'white.pq' }, + { startIndex: 5, type: 'type.pq' } + ] + }], + + [{ + line: 'if (a = #nan) then null else a', + tokens: [ + { startIndex: 0, type: "keyword.pq" }, + { startIndex: 2, type: "white.pq" }, + { startIndex: 3, type: "delimiter.parenthesis.pq"}, + { startIndex: 4, type: "identifier.pq" }, + { startIndex: 5, type: "white.pq" }, + { startIndex: 6, type: "operator.pq" }, + { startIndex: 7, type: "white.pq" }, + { startIndex: 8, type: "constant.pq" }, + { startIndex: 12, type: "delimiter.parenthesis.pq"}, + { startIndex: 13, type: "white.pq" }, + { startIndex: 14, type: "keyword.pq" }, + { startIndex: 18, type: "white.pq" }, + { startIndex: 19, type: "type.pq" }, + { startIndex: 23, type: "white.pq" }, + { startIndex: 24, type: "keyword.pq" }, + { startIndex: 28, type: "white.pq" }, + { startIndex: 29, type: "identifier.pq" }, ] }], ]); diff --git a/src/powerquery/powerquery.ts b/src/powerquery/powerquery.ts index 48579d6f..86187d76 100644 --- a/src/powerquery/powerquery.ts +++ b/src/powerquery/powerquery.ts @@ -39,11 +39,24 @@ export const language = { "is", "let", "meta", "not", "otherwise", "or", "section", "shared", "then", "true", - "try", "type", "#binary", - "#date", "#datetime", - "#datetimezone", "#duration", - "#infinity", "#nan", "#sections", - "#shared", "#table", "#time" + "try", "type" + ], + + constructors: [ + "#binary", + "#date", + "#datetime", + "#datetimezone", + "#duration", + "#table", + "#time" + ], + + constants: [ + "#infinity", + "#nan", + "#sections", + "#shared" ], typeKeywords: [ @@ -81,8 +94,10 @@ export const language = { [/(#?[a-z]+)/, { cases: { - "@typeKeywords": "keyword.type", + "@typeKeywords": "type", "@keywords": "keyword", + "@constants": "constant", + "@constructors": "constructor", "@default": "identifier" } } From 250f5d42d82044002acb91c47277b54faf9be4ec Mon Sep 17 00:00:00 2001 From: Matt Masson Date: Tue, 10 Jul 2018 15:25:10 -0400 Subject: [PATCH 038/133] Split operator keywords and fix "operators" typo --- src/powerquery/powerquery.test.ts | 50 +++++++++++++++++++++++-------- src/powerquery/powerquery.ts | 15 +++++++--- 2 files changed, 49 insertions(+), 16 deletions(-) diff --git a/src/powerquery/powerquery.test.ts b/src/powerquery/powerquery.test.ts index 5a202e87..4fe0f2bc 100644 --- a/src/powerquery/powerquery.test.ts +++ b/src/powerquery/powerquery.test.ts @@ -70,7 +70,7 @@ testTokenization('powerquery', [ tokens: [ { startIndex: 0, type: 'number.pq' }, { startIndex: 1, type: 'white.pq' }, - { startIndex: 2, type: 'operator.pq' }, + { startIndex: 2, type: 'operators.pq' }, { startIndex: 3, type: 'white.pq' }, { startIndex: 4, type: 'number.pq' }, { startIndex: 5, type: 'delimiter.pq' }, @@ -92,10 +92,10 @@ testTokenization('powerquery', [ tokens: [ { startIndex: 0, type: 'identifier.quote.pq' }, { startIndex: 7, type: 'white.pq' }, - { startIndex: 8, type: 'operator.pq' }, + { startIndex: 8, type: 'operators.pq' }, { startIndex: 9, type: 'white.pq' }, { startIndex: 10, type: 'number.pq' }, - { startIndex: 11, type: 'operator.pq' }, + { startIndex: 11, type: 'operators.pq' }, { startIndex: 12, type: 'number.pq' }, { startIndex: 13, type: 'delimiter.pq' }, ] @@ -106,10 +106,10 @@ testTokenization('powerquery', [ tokens: [ { startIndex: 0, type: 'identifier.pq' }, { startIndex: 1, type: 'white.pq' }, - { startIndex: 2, type: 'operator.pq' }, + { startIndex: 2, type: 'operators.pq' }, { startIndex: 3, type: 'white.pq' }, { startIndex: 4, type: 'identifier.quote.pq' }, - { startIndex: 15, type: 'operator.pq' }, + { startIndex: 15, type: 'operators.pq' }, { startIndex: 16, type: 'white.pq' }, { startIndex: 17, type: 'number.pq' } ] @@ -121,11 +121,11 @@ testTokenization('powerquery', [ tokens: [ { startIndex: 0, type: 'number.pq' }, { startIndex: 1, type: 'white.pq' }, - { startIndex: 2, type: 'operator.pq' }, + { startIndex: 2, type: 'operators.pq' }, { startIndex: 3, type: 'white.pq' }, { startIndex: 4, type: 'number.float.pq' }, { startIndex: 10, type: 'white.pq' }, - { startIndex: 11, type: 'operator.pq' }, + { startIndex: 11, type: 'operators.pq' }, { startIndex: 12, type: 'white.pq'}, { startIndex: 13, type: 'number.hex.pq'} ] @@ -136,7 +136,7 @@ testTokenization('powerquery', [ tokens: [ { startIndex: 0, type: 'number.hex.pq' }, { startIndex: 3, type: 'white.pq' }, - { startIndex: 4, type: 'operator.pq' }, + { startIndex: 4, type: 'operators.pq' }, { startIndex: 5, type: 'delimiter.parenthesis.pq' }, { startIndex: 6, type: 'number.float.pq' }, { startIndex: 8, type: 'delimiter.parenthesis.pq' } @@ -147,9 +147,9 @@ testTokenization('powerquery', [ line: '1.23e34+1.2e-2-.3e2', tokens: [ { startIndex: 0, type: 'number.float.pq' }, - { startIndex: 7, type: 'operator.pq' }, + { startIndex: 7, type: 'operators.pq' }, { startIndex: 8, type: 'number.float.pq' }, - { startIndex: 14, type: 'operator.pq' }, + { startIndex: 14, type: 'operators.pq' }, { startIndex: 15, type: 'number.float.pq' } ] }], @@ -168,7 +168,7 @@ testTokenization('powerquery', [ tokens: [ { startIndex: 0, type: 'string.pq' }, { startIndex: 8, type: 'white.pq' }, - { startIndex: 9, type: 'operator.pq' }, + { startIndex: 9, type: 'operators.pq' }, { startIndex: 10, type: 'white.pq' }, { startIndex: 11, type: 'string.pq' } ] @@ -240,7 +240,7 @@ testTokenization('powerquery', [ { startIndex: 3, type: "delimiter.parenthesis.pq"}, { startIndex: 4, type: "identifier.pq" }, { startIndex: 5, type: "white.pq" }, - { startIndex: 6, type: "operator.pq" }, + { startIndex: 6, type: "operators.pq" }, { startIndex: 7, type: "white.pq" }, { startIndex: 8, type: "constant.pq" }, { startIndex: 12, type: "delimiter.parenthesis.pq"}, @@ -254,4 +254,30 @@ testTokenization('powerquery', [ { startIndex: 29, type: "identifier.pq" }, ] }], + + // statements + [{ + line: '[version="1.0.0.1"] section Foo; shared Member.Name = 1;', + tokens: [ + { startIndex: 0, type: "delimiter.square.pq" }, + { startIndex: 1, type: "identifier.pq" }, + { startIndex: 8, type: "operators.pq" }, + { startIndex: 9, type: "string.pq" }, + { startIndex: 18, type: "delimiter.square.pq" }, + { startIndex: 19, type: "white.pq" }, + { startIndex: 20, type: "keyword.pq" }, + { startIndex: 27, type: "white.pq" }, + { startIndex: 28, type: "identifier.pq" }, + { startIndex: 31, type: "delimiter.pq" }, + { startIndex: 32, type: "white.pq" }, + { startIndex: 33, type: "keyword.pq" }, + { startIndex: 39, type: "white.pq" }, + { startIndex: 40, type: "identifier.pq" }, + { startIndex: 51, type: "white.pq" }, + { startIndex: 52, type: "operators.pq" }, + { startIndex: 53, type: "white.pq" }, + { startIndex: 54, type: "number.pq" }, + { startIndex: 55, type: "delimiter.pq" } + ] + }], ]); diff --git a/src/powerquery/powerquery.ts b/src/powerquery/powerquery.ts index 86187d76..d72fea34 100644 --- a/src/powerquery/powerquery.ts +++ b/src/powerquery/powerquery.ts @@ -33,11 +33,17 @@ export const language = { { open: '(', close: ')', token: 'delimiter.parenthesis' } ], + operatorKeywords: [ + "and", + "not", + "or" + ], + keywords: [ - "and", "as", "each", "else", + "as", "each", "else", "error", "false", "if", "in", - "is", "let", "meta", "not", - "otherwise", "or", "section", + "is", "let", "meta", + "otherwise", "section", "shared", "then", "true", "try", "type" ], @@ -98,6 +104,7 @@ export const language = { "@keywords": "keyword", "@constants": "constant", "@constructors": "constructor", + "@operatorKeywords": "operators", "@default": "identifier" } } @@ -111,7 +118,7 @@ export const language = { { include: "@strings" }, [/[{}()\[\]]/, "@brackets"], - [/([=\+<>\-\*&@\?\/!])|([<>]=)|(<>)|(=>)|(\.\.\.)|(\.\.)/, "operator"], + [/([=\+<>\-\*&@\?\/!])|([<>]=)|(<>)|(=>)|(\.\.\.)|(\.\.)/, "operators"], [/[,;]/, "delimiter"], ], From 7c6fe3b1bf41ab9ef719aceca2e3e939b86f20b5 Mon Sep 17 00:00:00 2001 From: Matt Masson Date: Tue, 10 Jul 2018 15:41:19 -0400 Subject: [PATCH 039/133] FIx word breaker for keyword identifiers --- src/powerquery/powerquery.test.ts | 34 +++++++++++++++++++++++++++++++ src/powerquery/powerquery.ts | 4 ++-- 2 files changed, 36 insertions(+), 2 deletions(-) diff --git a/src/powerquery/powerquery.test.ts b/src/powerquery/powerquery.test.ts index 4fe0f2bc..87eff8e5 100644 --- a/src/powerquery/powerquery.test.ts +++ b/src/powerquery/powerquery.test.ts @@ -116,6 +116,27 @@ testTokenization('powerquery', [ }], // Number formats + [{ + line: '0Xabc', + tokens: [ + { startIndex: 0, type: 'number.hex.pq' } + ] + }], + + [{ + line: '0xA', + tokens: [ + { startIndex: 0, type: 'number.hex.pq' } + ] + }], + + [{ + line: '1e1', + tokens: [ + { startIndex: 0, type: 'number.pq' } + ] + }], + [{ line: '5 / 1.2e+2 + 0x1234abc', tokens: [ @@ -280,4 +301,17 @@ testTokenization('powerquery', [ { startIndex: 55, type: "delimiter.pq" } ] }], + + [{ + line: 'isFunctionthen = 1;// comment', + tokens: [ + { startIndex: 0, type: 'identifier.pq' }, + { startIndex: 14, type: 'white.pq' }, + { startIndex: 15, type: 'operators.pq' }, + { startIndex: 16, type: 'white.pq' }, + { startIndex: 17, type: 'number.pq' }, + { startIndex: 18, type: 'delimiter.pq' }, + { startIndex: 19, type: 'comment.pq' }, + ] + }], ]); diff --git a/src/powerquery/powerquery.ts b/src/powerquery/powerquery.ts index d72fea34..821be411 100644 --- a/src/powerquery/powerquery.ts +++ b/src/powerquery/powerquery.ts @@ -97,7 +97,7 @@ export const language = { [/\d+([eE][\-+]?\d+)?/, "number"], // keywords - [/(#?[a-z]+)/, + [/(#?[a-z]+)\b/, { cases: { "@typeKeywords": "type", @@ -111,7 +111,7 @@ export const language = { ], // other identifiers - [/([a-zA-Z_][\w\.]*)/, "identifier"], + [/\b([a-zA-Z_][\w\.]*)\b/, "identifier"], { include: "@whitespace" }, { include: "@comments" }, From d94b2f8c4140c7f381c0c8eb6d22132574f817b8 Mon Sep 17 00:00:00 2001 From: Matt Masson Date: Tue, 10 Jul 2018 17:35:02 -0400 Subject: [PATCH 040/133] Add built-in constants, functions, and types --- src/powerquery/powerquery.test.ts | 63 ++- src/powerquery/powerquery.ts | 797 +++++++++++++++++++++++++++++- 2 files changed, 851 insertions(+), 9 deletions(-) diff --git a/src/powerquery/powerquery.test.ts b/src/powerquery/powerquery.test.ts index 87eff8e5..90d44af5 100644 --- a/src/powerquery/powerquery.test.ts +++ b/src/powerquery/powerquery.test.ts @@ -227,8 +227,8 @@ testTokenization('powerquery', [ tokens: [ { startIndex: 0, type: 'white.pq' }, { startIndex: 2, type: 'constructor.pq' }, - { startIndex: 8, type: "delimiter.parenthesis.pq" }, - { startIndex: 9, type: "delimiter.brackets.pq" }, + { startIndex: 8, type: 'delimiter.parenthesis.pq' }, + { startIndex: 9, type: 'delimiter.brackets.pq' }, { startIndex: 11, type: "delimiter.parenthesis.pq" } ] }], @@ -276,7 +276,52 @@ testTokenization('powerquery', [ ] }], - // statements + // built-ins + [{ + line: 'Text.From(1)', + tokens: [ + { startIndex: 0, type: 'keyword.function.pq' }, + { startIndex: 9, type: 'delimiter.parenthesis.pq'}, + { startIndex: 10, type: 'number.pq' }, + { startIndex: 11, type: 'delimiter.parenthesis.pq'} + ] + }], + + [{ + line: 'Text.ToBinary("123", BinaryEncoding.Base64)', + tokens: [ + { startIndex: 0, type: 'keyword.function.pq' }, + { startIndex: 13, type: 'delimiter.parenthesis.pq' }, + { startIndex: 14, type: 'string.pq' }, + { startIndex: 19, type: 'delimiter.pq' }, + { startIndex: 20, type: 'white.pq' }, + { startIndex: 21, type: 'constant.pq' }, + { startIndex: 42, type: 'delimiter.parenthesis.pq' } + ] + }], + + [{ + line: 'Int8.Type', + tokens: [ + { startIndex: 0, type: 'type.pq' } + ] + }], + + [{ + line: 'DB2.Database', + tokens: [ + { startIndex: 0, type: 'keyword.function.pq' } + ] + }], + + [{ + line: 'RelativePosition.Type', + tokens: [ + { startIndex: 0, type: 'type.pq' } + ] + }], + + // other statements [{ line: '[version="1.0.0.1"] section Foo; shared Member.Name = 1;', tokens: [ @@ -314,4 +359,16 @@ testTokenization('powerquery', [ { startIndex: 19, type: 'comment.pq' }, ] }], + + [{ + line: '@RecursiveFunction()+@Rec.Func()', + tokens: [ + { startIndex: 0, type: 'operators.pq' }, + { startIndex: 1, type: 'identifier.pq' }, + { startIndex: 18, type: "delimiter.parenthesis.pq"}, + { startIndex: 20, type: 'operators.pq' }, + { startIndex: 22, type: 'identifier.pq' }, + { startIndex: 30, type: "delimiter.parenthesis.pq"}, + ] + }], ]); diff --git a/src/powerquery/powerquery.ts b/src/powerquery/powerquery.ts index 821be411..5c0da9d5 100644 --- a/src/powerquery/powerquery.ts +++ b/src/powerquery/powerquery.ts @@ -40,12 +40,23 @@ export const language = { ], keywords: [ - "as", "each", "else", - "error", "false", "if", "in", - "is", "let", "meta", - "otherwise", "section", - "shared", "then", "true", - "try", "type" + "as", + "each", + "else", + "error", + "false", + "if", + "in", + "is", + "let", + "meta", + "otherwise", + "section", + "shared", + "then", + "true", + "try", + "type" ], constructors: [ @@ -86,6 +97,759 @@ export const language = { "function" ], + builtinFunctions: [ + "Access.Database", + "Action.Return", + "Action.Sequence", + "Action.Try", + "ActiveDirectory.Domains", + "AdoDotNet.DataSource", + "AdoDotNet.Query", + "AdobeAnalytics.Cubes", + "AnalysisServices.Database", + "AnalysisServices.Databases", + "AzureStorage.BlobContents", + "AzureStorage.Blobs", + "AzureStorage.Tables", + "Binary.Buffer", + "Binary.Combine", + "Binary.Compress", + "Binary.Decompress", + "Binary.End", + "Binary.From", + "Binary.FromList", + "Binary.FromText", + "Binary.InferContentType", + "Binary.Length", + "Binary.ToList", + "Binary.ToText", + "BinaryFormat.7BitEncodedSignedInteger", + "BinaryFormat.7BitEncodedUnsignedInteger", + "BinaryFormat.Binary", + "BinaryFormat.Byte", + "BinaryFormat.ByteOrder", + "BinaryFormat.Choice", + "BinaryFormat.Decimal", + "BinaryFormat.Double", + "BinaryFormat.Group", + "BinaryFormat.Length", + "BinaryFormat.List", + "BinaryFormat.Null", + "BinaryFormat.Record", + "BinaryFormat.SignedInteger16", + "BinaryFormat.SignedInteger32", + "BinaryFormat.SignedInteger64", + "BinaryFormat.Single", + "BinaryFormat.Text", + "BinaryFormat.Transform", + "BinaryFormat.UnsignedInteger16", + "BinaryFormat.UnsignedInteger32", + "BinaryFormat.UnsignedInteger64", + "Byte.From", + "Character.FromNumber", + "Character.ToNumber", + "Combiner.CombineTextByDelimiter", + "Combiner.CombineTextByEachDelimiter", + "Combiner.CombineTextByLengths", + "Combiner.CombineTextByPositions", + "Combiner.CombineTextByRanges", + "Comparer.Equals", + "Comparer.FromCulture", + "Comparer.Ordinal", + "Comparer.OrdinalIgnoreCase", + "Csv.Document", + "Cube.AddAndExpandDimensionColumn", + "Cube.AddMeasureColumn", + "Cube.ApplyParameter", + "Cube.AttributeMemberId", + "Cube.AttributeMemberProperty", + "Cube.CollapseAndRemoveColumns", + "Cube.Dimensions", + "Cube.DisplayFolders", + "Cube.Measures", + "Cube.Parameters", + "Cube.Properties", + "Cube.PropertyKey", + "Cube.ReplaceDimensions", + "Cube.Transform", + "Currency.From", + "DB2.Database", + "Date.AddDays", + "Date.AddMonths", + "Date.AddQuarters", + "Date.AddWeeks", + "Date.AddYears", + "Date.Day", + "Date.DayOfWeek", + "Date.DayOfWeekName", + "Date.DayOfYear", + "Date.DaysInMonth", + "Date.EndOfDay", + "Date.EndOfMonth", + "Date.EndOfQuarter", + "Date.EndOfWeek", + "Date.EndOfYear", + "Date.From", + "Date.FromText", + "Date.IsInCurrentDay", + "Date.IsInCurrentMonth", + "Date.IsInCurrentQuarter", + "Date.IsInCurrentWeek", + "Date.IsInCurrentYear", + "Date.IsInNextDay", + "Date.IsInNextMonth", + "Date.IsInNextNDays", + "Date.IsInNextNMonths", + "Date.IsInNextNQuarters", + "Date.IsInNextNWeeks", + "Date.IsInNextNYears", + "Date.IsInNextQuarter", + "Date.IsInNextWeek", + "Date.IsInNextYear", + "Date.IsInPreviousDay", + "Date.IsInPreviousMonth", + "Date.IsInPreviousNDays", + "Date.IsInPreviousNMonths", + "Date.IsInPreviousNQuarters", + "Date.IsInPreviousNWeeks", + "Date.IsInPreviousNYears", + "Date.IsInPreviousQuarter", + "Date.IsInPreviousWeek", + "Date.IsInPreviousYear", + "Date.IsInYearToDate", + "Date.IsLeapYear", + "Date.Month", + "Date.MonthName", + "Date.QuarterOfYear", + "Date.StartOfDay", + "Date.StartOfMonth", + "Date.StartOfQuarter", + "Date.StartOfWeek", + "Date.StartOfYear", + "Date.ToRecord", + "Date.ToText", + "Date.WeekOfMonth", + "Date.WeekOfYear", + "Date.Year", + "DateTime.AddZone", + "DateTime.Date", + "DateTime.FixedLocalNow", + "DateTime.From", + "DateTime.FromFileTime", + "DateTime.FromText", + "DateTime.IsInCurrentHour", + "DateTime.IsInCurrentMinute", + "DateTime.IsInCurrentSecond", + "DateTime.IsInNextHour", + "DateTime.IsInNextMinute", + "DateTime.IsInNextNHours", + "DateTime.IsInNextNMinutes", + "DateTime.IsInNextNSeconds", + "DateTime.IsInNextSecond", + "DateTime.IsInPreviousHour", + "DateTime.IsInPreviousMinute", + "DateTime.IsInPreviousNHours", + "DateTime.IsInPreviousNMinutes", + "DateTime.IsInPreviousNSeconds", + "DateTime.IsInPreviousSecond", + "DateTime.LocalNow", + "DateTime.Time", + "DateTime.ToRecord", + "DateTime.ToText", + "DateTimeZone.FixedLocalNow", + "DateTimeZone.FixedUtcNow", + "DateTimeZone.From", + "DateTimeZone.FromFileTime", + "DateTimeZone.FromText", + "DateTimeZone.LocalNow", + "DateTimeZone.RemoveZone", + "DateTimeZone.SwitchZone", + "DateTimeZone.ToLocal", + "DateTimeZone.ToRecord", + "DateTimeZone.ToText", + "DateTimeZone.ToUtc", + "DateTimeZone.UtcNow", + "DateTimeZone.ZoneHours", + "DateTimeZone.ZoneMinutes", + "Decimal.From", + "Diagnostics.ActivityId", + "Diagnostics.Trace", + "DirectQueryCapabilities.From", + "Double.From", + "Duration.Days", + "Duration.From", + "Duration.FromText", + "Duration.Hours", + "Duration.Minutes", + "Duration.Seconds", + "Duration.ToRecord", + "Duration.ToText", + "Duration.TotalDays", + "Duration.TotalHours", + "Duration.TotalMinutes", + "Duration.TotalSeconds", + "Embedded.Value", + "Error.Record", + "Excel.CurrentWorkbook", + "Excel.Workbook", + "Exchange.Contents", + "Expression.Constant", + "Expression.Evaluate", + "Expression.Identifier", + "Facebook.Graph", + "File.Contents", + "Folder.Contents", + "Folder.Files", + "Function.From", + "Function.Invoke", + "Function.InvokeAfter", + "Function.IsDataSource", + "GoogleAnalytics.Accounts", + "Guid.From", + "HdInsight.Containers", + "HdInsight.Contents", + "HdInsight.Files", + "Hdfs.Contents", + "Hdfs.Files", + "Informix.Database", + "Int16.From", + "Int32.From", + "Int64.From", + "Int8.From", + "ItemExpression.From", + "Json.Document", + "Json.FromValue", + "Lines.FromBinary", + "Lines.FromText", + "Lines.ToBinary", + "Lines.ToText", + "List.Accumulate", + "List.AllTrue", + "List.Alternate", + "List.AnyTrue", + "List.Average", + "List.Buffer", + "List.Combine", + "List.Contains", + "List.ContainsAll", + "List.ContainsAny", + "List.Count", + "List.Covariance", + "List.DateTimeZones", + "List.DateTimes", + "List.Dates", + "List.Difference", + "List.Distinct", + "List.Durations", + "List.FindText", + "List.First", + "List.FirstN", + "List.Generate", + "List.InsertRange", + "List.Intersect", + "List.IsDistinct", + "List.IsEmpty", + "List.Last", + "List.LastN", + "List.MatchesAll", + "List.MatchesAny", + "List.Max", + "List.MaxN", + "List.Median", + "List.Min", + "List.MinN", + "List.Mode", + "List.Modes", + "List.NonNullCount", + "List.Numbers", + "List.PositionOf", + "List.PositionOfAny", + "List.Positions", + "List.Product", + "List.Random", + "List.Range", + "List.RemoveFirstN", + "List.RemoveItems", + "List.RemoveLastN", + "List.RemoveMatchingItems", + "List.RemoveNulls", + "List.RemoveRange", + "List.Repeat", + "List.ReplaceMatchingItems", + "List.ReplaceRange", + "List.ReplaceValue", + "List.Reverse", + "List.Select", + "List.Single", + "List.SingleOrDefault", + "List.Skip", + "List.Sort", + "List.StandardDeviation", + "List.Sum", + "List.Times", + "List.Transform", + "List.TransformMany", + "List.Union", + "List.Zip", + "Logical.From", + "Logical.FromText", + "Logical.ToText", + "MQ.Queue", + "MySQL.Database", + "Number.Abs", + "Number.Acos", + "Number.Asin", + "Number.Atan", + "Number.Atan2", + "Number.BitwiseAnd", + "Number.BitwiseNot", + "Number.BitwiseOr", + "Number.BitwiseShiftLeft", + "Number.BitwiseShiftRight", + "Number.BitwiseXor", + "Number.Combinations", + "Number.Cos", + "Number.Cosh", + "Number.Exp", + "Number.Factorial", + "Number.From", + "Number.FromText", + "Number.IntegerDivide", + "Number.IsEven", + "Number.IsNaN", + "Number.IsOdd", + "Number.Ln", + "Number.Log", + "Number.Log10", + "Number.Mod", + "Number.Permutations", + "Number.Power", + "Number.Random", + "Number.RandomBetween", + "Number.Round", + "Number.RoundAwayFromZero", + "Number.RoundDown", + "Number.RoundTowardZero", + "Number.RoundUp", + "Number.Sign", + "Number.Sin", + "Number.Sinh", + "Number.Sqrt", + "Number.Tan", + "Number.Tanh", + "Number.ToText", + "OData.Feed", + "Odbc.DataSource", + "Odbc.Query", + "OleDb.DataSource", + "OleDb.Query", + "Oracle.Database", + "Percentage.From", + "PostgreSQL.Database", + "RData.FromBinary", + "Record.AddField", + "Record.Combine", + "Record.Field", + "Record.FieldCount", + "Record.FieldNames", + "Record.FieldOrDefault", + "Record.FieldValues", + "Record.FromList", + "Record.FromTable", + "Record.HasFields", + "Record.RemoveFields", + "Record.RenameFields", + "Record.ReorderFields", + "Record.SelectFields", + "Record.ToList", + "Record.ToTable", + "Record.TransformFields", + "Replacer.ReplaceText", + "Replacer.ReplaceValue", + "RowExpression.Column", + "RowExpression.From", + "Salesforce.Data", + "Salesforce.Reports", + "SapBusinessWarehouse.Cubes", + "SapHana.Database", + "SharePoint.Contents", + "SharePoint.Files", + "SharePoint.Tables", + "Single.From", + "Soda.Feed", + "Splitter.SplitByNothing", + "Splitter.SplitTextByAnyDelimiter", + "Splitter.SplitTextByDelimiter", + "Splitter.SplitTextByEachDelimiter", + "Splitter.SplitTextByLengths", + "Splitter.SplitTextByPositions", + "Splitter.SplitTextByRanges", + "Splitter.SplitTextByRepeatedLengths", + "Splitter.SplitTextByWhitespace", + "Sql.Database", + "Sql.Databases", + "SqlExpression.SchemaFrom", + "SqlExpression.ToExpression", + "Sybase.Database", + "Table.AddColumn", + "Table.AddIndexColumn", + "Table.AddJoinColumn", + "Table.AddKey", + "Table.AggregateTableColumn", + "Table.AlternateRows", + "Table.Buffer", + "Table.Column", + "Table.ColumnCount", + "Table.ColumnNames", + "Table.ColumnsOfType", + "Table.Combine", + "Table.CombineColumns", + "Table.Contains", + "Table.ContainsAll", + "Table.ContainsAny", + "Table.DemoteHeaders", + "Table.Distinct", + "Table.DuplicateColumn", + "Table.ExpandListColumn", + "Table.ExpandRecordColumn", + "Table.ExpandTableColumn", + "Table.FillDown", + "Table.FillUp", + "Table.FilterWithDataTable", + "Table.FindText", + "Table.First", + "Table.FirstN", + "Table.FirstValue", + "Table.FromColumns", + "Table.FromList", + "Table.FromPartitions", + "Table.FromRecords", + "Table.FromRows", + "Table.FromValue", + "Table.Group", + "Table.HasColumns", + "Table.InsertRows", + "Table.IsDistinct", + "Table.IsEmpty", + "Table.Join", + "Table.Keys", + "Table.Last", + "Table.LastN", + "Table.MatchesAllRows", + "Table.MatchesAnyRows", + "Table.Max", + "Table.MaxN", + "Table.Min", + "Table.MinN", + "Table.NestedJoin", + "Table.Partition", + "Table.PartitionValues", + "Table.Pivot", + "Table.PositionOf", + "Table.PositionOfAny", + "Table.PrefixColumns", + "Table.Profile", + "Table.PromoteHeaders", + "Table.Range", + "Table.RemoveColumns", + "Table.RemoveFirstN", + "Table.RemoveLastN", + "Table.RemoveMatchingRows", + "Table.RemoveRows", + "Table.RemoveRowsWithErrors", + "Table.RenameColumns", + "Table.ReorderColumns", + "Table.Repeat", + "Table.ReplaceErrorValues", + "Table.ReplaceKeys", + "Table.ReplaceMatchingRows", + "Table.ReplaceRelationshipIdentity", + "Table.ReplaceRows", + "Table.ReplaceValue", + "Table.ReverseRows", + "Table.RowCount", + "Table.Schema", + "Table.SelectColumns", + "Table.SelectRows", + "Table.SelectRowsWithErrors", + "Table.SingleRow", + "Table.Skip", + "Table.Sort", + "Table.SplitColumn", + "Table.ToColumns", + "Table.ToList", + "Table.ToRecords", + "Table.ToRows", + "Table.TransformColumnNames", + "Table.TransformColumnTypes", + "Table.TransformColumns", + "Table.TransformRows", + "Table.Transpose", + "Table.Unpivot", + "Table.UnpivotOtherColumns", + "Table.View", + "Table.ViewFunction", + "TableAction.DeleteRows", + "TableAction.InsertRows", + "TableAction.UpdateRows", + "Tables.GetRelationships", + "Teradata.Database", + "Text.AfterDelimiter", + "Text.At", + "Text.BeforeDelimiter", + "Text.BetweenDelimiters", + "Text.Clean", + "Text.Combine", + "Text.Contains", + "Text.End", + "Text.EndsWith", + "Text.Format", + "Text.From", + "Text.FromBinary", + "Text.Insert", + "Text.Length", + "Text.Lower", + "Text.Middle", + "Text.NewGuid", + "Text.PadEnd", + "Text.PadStart", + "Text.PositionOf", + "Text.PositionOfAny", + "Text.Proper", + "Text.Range", + "Text.Remove", + "Text.RemoveRange", + "Text.Repeat", + "Text.Replace", + "Text.ReplaceRange", + "Text.Select", + "Text.Split", + "Text.SplitAny", + "Text.Start", + "Text.StartsWith", + "Text.ToBinary", + "Text.ToList", + "Text.Trim", + "Text.TrimEnd", + "Text.TrimStart", + "Text.Upper", + "Time.EndOfHour", + "Time.From", + "Time.FromText", + "Time.Hour", + "Time.Minute", + "Time.Second", + "Time.StartOfHour", + "Time.ToRecord", + "Time.ToText", + "Type.AddTableKey", + "Type.ClosedRecord", + "Type.Facets", + "Type.ForFunction", + "Type.ForRecord", + "Type.FunctionParameters", + "Type.FunctionRequiredParameters", + "Type.FunctionReturn", + "Type.Is", + "Type.IsNullable", + "Type.IsOpenRecord", + "Type.ListItem", + "Type.NonNullable", + "Type.OpenRecord", + "Type.RecordFields", + "Type.ReplaceFacets", + "Type.ReplaceTableKeys", + "Type.TableColumn", + "Type.TableKeys", + "Type.TableRow", + "Type.TableSchema", + "Type.Union", + "Uri.BuildQueryString", + "Uri.Combine", + "Uri.EscapeDataString", + "Uri.Parts", + "Value.Add", + "Value.As", + "Value.Compare", + "Value.Divide", + "Value.Equals", + "Value.Firewall", + "Value.FromText", + "Value.Is", + "Value.Metadata", + "Value.Multiply", + "Value.NativeQuery", + "Value.NullableEquals", + "Value.RemoveMetadata", + "Value.ReplaceMetadata", + "Value.ReplaceType", + "Value.Subtract", + "Value.Type", + "ValueAction.NativeStatement", + "ValueAction.Replace", + "Variable.Value", + "Web.Contents", + "Web.Page", + "WebAction.Request", + "Xml.Document", + "Xml.Tables" + ], + + builtinConstants: [ + "BinaryEncoding.Base64", + "BinaryEncoding.Hex", + "BinaryOccurrence.Optional", + "BinaryOccurrence.Repeating", + "BinaryOccurrence.Required", + "ByteOrder.BigEndian", + "ByteOrder.LittleEndian", + "Compression.Deflate", + "Compression.GZip", + "CsvStyle.QuoteAfterDelimiter", + "CsvStyle.QuoteAlways", + "Culture.Current", + "Day.Friday", + "Day.Monday", + "Day.Saturday", + "Day.Sunday", + "Day.Thursday", + "Day.Tuesday", + "Day.Wednesday", + "ExtraValues.Error", + "ExtraValues.Ignore", + "ExtraValues.List", + "GroupKind.Global", + "GroupKind.Local", + "JoinAlgorithm.Dynamic", + "JoinAlgorithm.LeftHash", + "JoinAlgorithm.LeftIndex", + "JoinAlgorithm.PairwiseHash", + "JoinAlgorithm.RightHash", + "JoinAlgorithm.RightIndex", + "JoinAlgorithm.SortMerge", + "JoinKind.FullOuter", + "JoinKind.Inner", + "JoinKind.LeftAnti", + "JoinKind.LeftOuter", + "JoinKind.RightAnti", + "JoinKind.RightOuter", + "JoinSide.Left", + "JoinSide.Right", + "MissingField.Error", + "MissingField.Ignore", + "MissingField.UseNull", + "Number.E", + "Number.Epsilon", + "Number.NaN", + "Number.NegativeInfinity", + "Number.PI", + "Number.PositiveInfinity", + "Occurrence.All", + "Occurrence.First", + "Occurrence.Last", + "Occurrence.Optional", + "Occurrence.Repeating", + "Occurrence.Required", + "Order.Ascending", + "Order.Descending", + "Precision.Decimal", + "Precision.Double", + "QuoteStyle.Csv", + "QuoteStyle.None", + "RelativePosition.FromEnd", + "RelativePosition.FromStart", + "RoundingMode.AwayFromZero", + "RoundingMode.Down", + "RoundingMode.ToEven", + "RoundingMode.TowardZero", + "RoundingMode.Up", + "SapHanaDistribution.All", + "SapHanaDistribution.Connection", + "SapHanaDistribution.Off", + "SapHanaDistribution.Statement", + "SapHanaRangeOperator.Equals", + "SapHanaRangeOperator.GreaterThan", + "SapHanaRangeOperator.GreaterThanOrEquals", + "SapHanaRangeOperator.LessThan", + "SapHanaRangeOperator.LessThanOrEquals", + "SapHanaRangeOperator.NotEquals", + "TextEncoding.Ascii", + "TextEncoding.BigEndianUnicode", + "TextEncoding.Unicode", + "TextEncoding.Utf16", + "TextEncoding.Utf8", + "TextEncoding.Windows", + "TraceLevel.Critical", + "TraceLevel.Error", + "TraceLevel.Information", + "TraceLevel.Verbose", + "TraceLevel.Warning", + "WebMethod.Delete", + "WebMethod.Get", + "WebMethod.Head", + "WebMethod.Patch", + "WebMethod.Post", + "WebMethod.Put" + ], + + builtinTypes: [ + "Action.Type", + "Any.Type", + "Binary.Type", + "BinaryEncoding.Type", + "BinaryOccurrence.Type", + "Byte.Type", + "ByteOrder.Type", + "Character.Type", + "Compression.Type", + "CsvStyle.Type", + "Currency.Type", + "Date.Type", + "DateTime.Type", + "DateTimeZone.Type", + "Day.Type", + "Decimal.Type", + "Double.Type", + "Duration.Type", + "ExtraValues.Type", + "Function.Type", + "GroupKind.Type", + "Guid.Type", + "Int16.Type", + "Int32.Type", + "Int64.Type", + "Int8.Type", + "JoinAlgorithm.Type", + "JoinKind.Type", + "JoinSide.Type", + "List.Type", + "Logical.Type", + "MissingField.Type", + "None.Type", + "Null.Type", + "Number.Type", + "Occurrence.Type", + "Order.Type", + "Password.Type", + "Percentage.Type", + "Precision.Type", + "QuoteStyle.Type", + "Record.Type", + "RelativePosition.Type", + "RoundingMode.Type", + "SapHanaDistribution.Type", + "SapHanaRangeOperator.Type", + "Single.Type", + "Table.Type", + "Text.Type", + "TextEncoding.Type", + "Time.Type", + "TraceLevel.Type", + "Type.Type", + "Uri.Type", + "WebMethod.Type" + ], + tokenizer: { root: [ // quoted identifier @@ -110,6 +874,27 @@ export const language = { } ], + // built-in types + [/\b([A-Z][a-zA-Z0-9]+\.Type)\b/, + { + cases: { + "@builtinTypes": "type", + "@default": "identifier" + } + } + ], + + // other built-ins + [/\b([A-Z][a-zA-Z0-9]+\.[A-Z][a-zA-Z0-9]+)\b/, + { + cases: { + "@builtinFunctions": "keyword.function", + "@builtinConstants": "constant", + "@default": "identifier" + } + } + ], + // other identifiers [/\b([a-zA-Z_][\w\.]*)\b/, "identifier"], From 5d86ca2aa7f926cacf8287daccb712753bd8cf4c Mon Sep 17 00:00:00 2001 From: Matt Masson Date: Tue, 10 Jul 2018 17:38:55 -0400 Subject: [PATCH 041/133] Add powerquery to bundle --- scripts/bundle.js | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/bundle.js b/scripts/bundle.js index 842166b3..d4183347 100644 --- a/scripts/bundle.js +++ b/scripts/bundle.js @@ -65,6 +65,7 @@ bundleOne('scheme/scheme'); bundleOne('clojure/clojure'); bundleOne('shell/shell'); bundleOne('perl/perl') +bundleOne('powerquery/powerquery') function bundleOne(moduleId, exclude) { requirejs.optimize({ From e0ecde06179888897a2c909993fb724923c8ed6d Mon Sep 17 00:00:00 2001 From: Viktar Pakanechny Date: Thu, 12 Jul 2018 18:04:23 +0300 Subject: [PATCH 042/133] Added azcli --- README.md | 1 + scripts/bundle.js | 3 +- src/azcli/azcli.contribution.ts | 17 ++++ src/azcli/azcli.test.ts | 157 ++++++++++++++++++++++++++++++++ src/azcli/azcli.ts | 65 +++++++++++++ src/monaco.contribution.ts | 1 + test/setup.js | 3 +- 7 files changed, 245 insertions(+), 2 deletions(-) create mode 100644 src/azcli/azcli.contribution.ts create mode 100644 src/azcli/azcli.test.ts create mode 100644 src/azcli/azcli.ts diff --git a/README.md b/README.md index db72225b..a766cc0a 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,7 @@ Colorization and configuration supports for multiple languages for the Monaco Ed ![monaco-languages](https://cloud.githubusercontent.com/assets/5047891/15938606/1fd4bac6-2e74-11e6-8839-d455da8bc8a7.gif) +* azcli * bat * clojure * coffee script diff --git a/scripts/bundle.js b/scripts/bundle.js index 842166b3..698a70c5 100644 --- a/scripts/bundle.js +++ b/scripts/bundle.js @@ -64,7 +64,8 @@ bundleOne('csp/csp'); bundleOne('scheme/scheme'); bundleOne('clojure/clojure'); bundleOne('shell/shell'); -bundleOne('perl/perl') +bundleOne('perl/perl'), +bundleOne('azcli/azcli') function bundleOne(moduleId, exclude) { requirejs.optimize({ diff --git a/src/azcli/azcli.contribution.ts b/src/azcli/azcli.contribution.ts new file mode 100644 index 00000000..c94c07bd --- /dev/null +++ b/src/azcli/azcli.contribution.ts @@ -0,0 +1,17 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +'use strict'; + +import { registerLanguage } from '../_.contribution'; + +// Allow for running under nodejs/requirejs in tests +const _monaco: typeof monaco = (typeof monaco === 'undefined' ? (self).monaco : monaco); + +registerLanguage({ + id: 'azcli', + extensions: ['.azcli'], + aliases: ['Azure CLI', 'azcli'], + loader: () => _monaco.Promise.wrap(import('./azcli')) +}); diff --git a/src/azcli/azcli.test.ts b/src/azcli/azcli.test.ts new file mode 100644 index 00000000..d1ae3bd3 --- /dev/null +++ b/src/azcli/azcli.test.ts @@ -0,0 +1,157 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +'use strict'; + +import { testTokenization as actualTestTokenization, ITestItem } from '../test/testRunner'; + +function testTokenization(_language: string | string[], tests: ITestItem[][]): void { + tests = tests.map(t => { + return t.map(t => { + return { + line: t.line.replace(/\n/g, ' '), + tokens: t.tokens + }; + }); + }); + actualTestTokenization(_language, tests); +} + +testTokenization('azcli', [ + // Comment single line + [{ + line: '#', + tokens: [ + { startIndex: 0, type: 'comment.azcli' } + ] + }], + [{ + line: '# az find -q secret', + tokens: [ + { startIndex: 0, type: 'comment.azcli' } + ] + }], + [{ + line: ' # az find -q secret', + tokens: [ + { startIndex: 0, type: 'keyword.azcli' }, + { startIndex: 4, type: 'comment.azcli' } + ] + }], + [{ + line: '#az find -q secret', + tokens: [ + { startIndex: 0, type: 'comment.azcli' } + ] + }], + + // Other cases + [{ + line: 'az find -q secret', + tokens: [ + { startIndex: 0, type: 'keyword.azcli' }, + { startIndex: 7, type: 'key.identifier.azcli' }, + { startIndex: 11, type: 'string.azcli' } + ] + }], + [{ + line: '', + tokens: [ + ] + }], + [{ + line: ' ', + tokens: [ + { startIndex: 0, type: 'keyword.azcli' } + ] + }], + [{ + line: '--assignee', + tokens: [ + { startIndex: 0, type: 'key.identifier.azcli' } + ] + }], + [{ + line: ' --service-principal', + tokens: [ + { startIndex: 0, type: 'keyword.azcli' }, + { startIndex: 3, type: 'key.identifier.azcli' } + ] + }], + [{ + line: 'az ad sp create-for-rb --name ServicePrincipalName --password PASSWORD', + tokens: [ + { startIndex: 0, type: 'keyword.azcli' }, + { startIndex: 23, type: 'key.identifier.azcli' }, + { startIndex: 31, type: 'string.azcli' }, + { startIndex: 52, type: 'key.identifier.azcli' }, + { startIndex: 63, type: 'string.azcli' } + ] + }], + [{ + line: '--name!~`\"$%^&*(|\/\.,-=+', + tokens: [ + { startIndex: 0, type: 'key.identifier.azcli' } + ] + }], + [{ + line: '--name#some comment', + tokens: [ + { startIndex: 0, type: 'key.identifier.azcli' }, + { startIndex: 6, type: 'comment.azcli' } + ] + }], + [{ + line: '--query osPro ``````', + tokens: [ + { startIndex: 0, type: 'key.identifier.azcli' }, + { startIndex: 8, type: 'string.azcli' } + ] + }], + [{ + line: 'az ad sp create-for-rbac', + tokens: [ + { startIndex: 0, type: 'keyword.azcli' } + ] + }], + [{ + line: '123456789', + tokens: [ + { startIndex: 0, type: 'keyword.azcli' } + ] + }], + [{ + line: '- abc', + tokens: [ + { startIndex: 0, type: 'key.identifier.azcli' }, + { startIndex: 2, type: 'string.azcli' } + ] + }], + [{ + line: '- @!$()', + tokens: [ + { startIndex: 0, type: 'key.identifier.azcli' }, + { startIndex: 2, type: 'string.azcli' } + ] + }], + [{ + line: '""', + tokens: [ + { startIndex: 0, type: 'keyword.azcli' } + ] + }], + [{ + line: '// some text', + tokens: [ + { startIndex: 0, type: 'keyword.azcli' } + ] + }], + [{ + line: `'APP_ID'`, + tokens: [ + { startIndex: 0, type: 'keyword.azcli' } + ] + }] +]); diff --git a/src/azcli/azcli.ts b/src/azcli/azcli.ts new file mode 100644 index 00000000..62bf5740 --- /dev/null +++ b/src/azcli/azcli.ts @@ -0,0 +1,65 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +'use strict'; + +import IRichLanguageConfiguration = monaco.languages.LanguageConfiguration; +import ILanguage = monaco.languages.IMonarchLanguage; + +export const conf: IRichLanguageConfiguration = { + comments: { + lineComment: '#', + } +}; + +export const language = { + defaultToken: 'keyword', + ignoreCase: true, + tokenPostfix: '.azcli', + + str: /[^#\s]/, + + tokenizer: { + root: [ + {include: '@comment'}, + [/\s-+@str*\s*/, { + cases: { + '@eos': { token: 'key.identifier', next: '@popall' }, + '@default': { token: 'key.identifier', next: '@type' } + } + }], + [/^-+@str*\s*/, { + cases: { + '@eos': { token: 'key.identifier', next: '@popall' }, + '@default': { token: 'key.identifier', next: '@type' } + } + }] + ], + + type: [ + {include: '@comment'}, + [/-+@str*\s*/, { + cases: { + '@eos': { token: 'key.identifier', next: '@popall' }, + '@default': 'key.identifier' + } + }], + [/@str+\s*/, { + cases: { + '@eos': { token: 'string', next: '@popall' }, + '@default': 'string' + } + }] + ], + + comment: [ + [/#.*$/, { + cases: { + '@eos': { token: 'comment', next: '@popall' } + } + }] + ] + } +}; diff --git a/src/monaco.contribution.ts b/src/monaco.contribution.ts index 8ac5bfa3..2cc332e5 100644 --- a/src/monaco.contribution.ts +++ b/src/monaco.contribution.ts @@ -48,3 +48,4 @@ import './scheme/scheme.contribution'; import './clojure/clojure.contribution'; import './shell/shell.contribution'; import './perl/perl.contribution'; +import './azcli/azcli.contribution'; diff --git a/test/setup.js b/test/setup.js index 1cbff462..422296b2 100644 --- a/test/setup.js +++ b/test/setup.js @@ -68,7 +68,8 @@ define(['require'], function (require) { 'release/dev/scheme/scheme.test', 'release/dev/clojure/clojure.test', 'release/dev/shell/shell.test', - 'release/dev/perl/perl.test' + 'release/dev/perl/perl.test', + 'release/dev/azcli/azcli.test' ], function () { run(); // We can launch the tests! }, function (err) { From 63639e2ec5c73f845b415568c79f26e727d2f227 Mon Sep 17 00:00:00 2001 From: Alex Dima Date: Tue, 7 Aug 2018 15:15:01 +0200 Subject: [PATCH 043/133] Add TypeScript coloring --- README.md | 1 + scripts/bundle.js | 1 + src/monaco.contribution.ts | 1 + src/typescript/typescript.contribution.ts | 18 + src/typescript/typescript.test.ts | 553 ++++++++++++++++++++++ src/typescript/typescript.ts | 205 ++++++++ test/setup.js | 1 + 7 files changed, 780 insertions(+) create mode 100644 src/typescript/typescript.contribution.ts create mode 100644 src/typescript/typescript.test.ts create mode 100644 src/typescript/typescript.ts diff --git a/README.md b/README.md index db72225b..a46dc3ea 100644 --- a/README.md +++ b/README.md @@ -38,6 +38,7 @@ Colorization and configuration supports for multiple languages for the Monaco Ed * sql * st * swift +* typescript * vb * xml * yaml diff --git a/scripts/bundle.js b/scripts/bundle.js index 842166b3..4eb30949 100644 --- a/scripts/bundle.js +++ b/scripts/bundle.js @@ -51,6 +51,7 @@ bundleOne('scss/scss'); bundleOne('sql/sql'); bundleOne('st/st'); bundleOne('swift/swift'); +bundleOne('typescript/typescript'); bundleOne('vb/vb'); bundleOne('xml/xml'); bundleOne('yaml/yaml'); diff --git a/src/monaco.contribution.ts b/src/monaco.contribution.ts index 8ac5bfa3..9148aa98 100644 --- a/src/monaco.contribution.ts +++ b/src/monaco.contribution.ts @@ -41,6 +41,7 @@ import './solidity/solidity.contribution'; import './sql/sql.contribution'; import './st/st.contribution'; import './swift/swift.contribution'; +import './typescript/typescript.contribution'; import './vb/vb.contribution'; import './xml/xml.contribution'; import './yaml/yaml.contribution'; diff --git a/src/typescript/typescript.contribution.ts b/src/typescript/typescript.contribution.ts new file mode 100644 index 00000000..a205093a --- /dev/null +++ b/src/typescript/typescript.contribution.ts @@ -0,0 +1,18 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +'use strict'; + +import { registerLanguage } from '../_.contribution'; + +// Allow for running under nodejs/requirejs in tests +const _monaco: typeof monaco = (typeof monaco === 'undefined' ? (self).monaco : monaco); + +registerLanguage({ + id: 'typescript', + extensions: ['.ts', '.tsx'], + aliases: ['TypeScript', 'ts', 'typescript'], + mimetypes: ['text/typescript'], + loader: () => _monaco.Promise.wrap(import('./typescript')) +}); diff --git a/src/typescript/typescript.test.ts b/src/typescript/typescript.test.ts new file mode 100644 index 00000000..b783377c --- /dev/null +++ b/src/typescript/typescript.test.ts @@ -0,0 +1,553 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +'use strict'; + +import { testTokenization } from '../test/testRunner'; + +testTokenization('typescript', [ + // Keywords + [{ + line: 'var x = function() { };', + tokens: [ + { startIndex: 0, type: 'keyword.ts' }, + { startIndex: 3, type: '' }, + { startIndex: 4, type: 'identifier.ts' }, + { startIndex: 5, type: '' }, + { startIndex: 6, type: 'delimiter.ts' }, + { startIndex: 7, type: '' }, + { startIndex: 8, type: 'keyword.ts' }, + { startIndex: 16, type: 'delimiter.parenthesis.ts' }, + { startIndex: 18, type: '' }, + { startIndex: 19, type: 'delimiter.bracket.ts' }, + { startIndex: 20, type: '' }, + { startIndex: 21, type: 'delimiter.bracket.ts' }, + { startIndex: 22, type: 'delimiter.ts' } + ] + }], + + [{ + line: ' var ', + tokens: [ + { startIndex: 0, type: '' }, + { startIndex: 4, type: 'keyword.ts' }, + { startIndex: 7, type: '' } + ] + }], + + // Comments - single line + [{ + line: '//', + tokens: [ + { startIndex: 0, type: 'comment.ts' } + ] + }], + + [{ + line: ' // a comment', + tokens: [ + { startIndex: 0, type: '' }, + { startIndex: 4, type: 'comment.ts' } + ] + }], + + [{ + line: '// a comment', + tokens: [ + { startIndex: 0, type: 'comment.ts' } + ] + }], + + [{ + line: '// a comment /*', + tokens: [ + { startIndex: 0, type: 'comment.ts' } + ] + }], + + [{ + line: '// a comment /**', + tokens: [ + { startIndex: 0, type: 'comment.ts' } + ] + }], + + [{ + line: '//sticky comment', + tokens: [ + { startIndex: 0, type: 'comment.ts' } + ] + }], + + [{ + line: 'var x = 1; // my comment // is a nice one', + tokens: [ + { startIndex: 0, type: 'keyword.ts' }, + { startIndex: 3, type: '' }, + { startIndex: 4, type: 'identifier.ts' }, + { startIndex: 5, type: '' }, + { startIndex: 6, type: 'delimiter.ts' }, + { startIndex: 7, type: '' }, + { startIndex: 8, type: 'number.ts' }, + { startIndex: 9, type: 'delimiter.ts' }, + { startIndex: 10, type: '' }, + { startIndex: 11, type: 'comment.ts' } + ] + }], + + // Comments - range comment, single line + [{ + line: '/* a simple comment */', + tokens: [ + { startIndex: 0, type: 'comment.ts' } + ] + }], + + [{ + line: 'var x = /* a simple comment */ 1;', + tokens: [ + { startIndex: 0, type: 'keyword.ts' }, + { startIndex: 3, type: '' }, + { startIndex: 4, type: 'identifier.ts' }, + { startIndex: 5, type: '' }, + { startIndex: 6, type: 'delimiter.ts' }, + { startIndex: 7, type: '' }, + { startIndex: 8, type: 'comment.ts' }, + { startIndex: 30, type: '' }, + { startIndex: 31, type: 'number.ts' }, + { startIndex: 32, type: 'delimiter.ts' } + ] + }], + + [{ + line: 'x = /**/;', + tokens: [ + { startIndex: 0, type: 'identifier.ts' }, + { startIndex: 1, type: '' }, + { startIndex: 2, type: 'delimiter.ts' }, + { startIndex: 3, type: '' }, + { startIndex: 4, type: 'comment.ts' }, + { startIndex: 8, type: 'delimiter.ts' } + ] + }], + + [{ + line: 'x = /*/;', + tokens: [ + { startIndex: 0, type: 'identifier.ts' }, + { startIndex: 1, type: '' }, + { startIndex: 2, type: 'delimiter.ts' }, + { startIndex: 3, type: '' }, + { startIndex: 4, type: 'comment.ts' } + ] + }], + + // Comments - range comment, multi lines + [{ + line: '/* a multiline comment', + tokens: [ + { startIndex: 0, type: 'comment.ts' } + ] + }, { + line: 'can actually span', + tokens: [ + { startIndex: 0, type: 'comment.ts' } + ] + }, { + line: 'multiple lines */', + tokens: [ + { startIndex: 0, type: 'comment.ts' } + ] + }], + + [{ + line: 'var x = /* start a comment', + tokens: [ + { startIndex: 0, type: 'keyword.ts' }, + { startIndex: 3, type: '' }, + { startIndex: 4, type: 'identifier.ts' }, + { startIndex: 5, type: '' }, + { startIndex: 6, type: 'delimiter.ts' }, + { startIndex: 7, type: '' }, + { startIndex: 8, type: 'comment.ts' } + ] + }, { + line: ' a ', + tokens: [ + { startIndex: 0, type: 'comment.ts' } + ] + }, { + line: 'and end it */ var a = 2;', + tokens: [ + { startIndex: 0, type: 'comment.ts' }, + { startIndex: 13, type: '' }, + { startIndex: 14, type: 'keyword.ts' }, + { startIndex: 17, type: '' }, + { startIndex: 18, type: 'identifier.ts' }, + { startIndex: 19, type: '' }, + { startIndex: 20, type: 'delimiter.ts' }, + { startIndex: 21, type: '' }, + { startIndex: 22, type: 'number.ts' }, + { startIndex: 23, type: 'delimiter.ts' } + ] + }], + + // Strings + [{ + line: 'var a = \'a\';', + tokens: [ + { startIndex: 0, type: 'keyword.ts' }, + { startIndex: 3, type: '' }, + { startIndex: 4, type: 'identifier.ts' }, + { startIndex: 5, type: '' }, + { startIndex: 6, type: 'delimiter.ts' }, + { startIndex: 7, type: '' }, + { startIndex: 8, type: 'string.ts' }, + { startIndex: 11, type: 'delimiter.ts' } + ] + }], + + [{ + line: '"use strict";', + tokens: [ + { startIndex: 0, type: 'string.ts' }, + { startIndex: 12, type: 'delimiter.ts' } + ] + }], + + [{ + line: 'b = a + " \'cool\' "', + tokens: [ + { startIndex: 0, type: 'identifier.ts' }, + { startIndex: 1, type: '' }, + { startIndex: 2, type: 'delimiter.ts' }, + { startIndex: 3, type: '' }, + { startIndex: 4, type: 'identifier.ts' }, + { startIndex: 5, type: '' }, + { startIndex: 6, type: 'delimiter.ts' }, + { startIndex: 7, type: '' }, + { startIndex: 8, type: 'string.ts' } + ] + }], + + [{ + line: '"escaping \\"quotes\\" is cool"', + tokens: [ + { startIndex: 0, type: 'string.ts' }, + { startIndex: 10, type: 'string.escape.ts' }, + { startIndex: 12, type: 'string.ts' }, + { startIndex: 18, type: 'string.escape.ts' }, + { startIndex: 20, type: 'string.ts' }, + ] + }], + + [{ + line: '\'\'\'', + tokens: [ + { startIndex: 0, type: 'string.ts' }, + { startIndex: 2, type: 'string.invalid.ts' }, + ] + }], + + [{ + line: '\'\\\'\'', + tokens: [ + { startIndex: 0, type: 'string.ts' }, + { startIndex: 1, type: 'string.escape.ts' }, + { startIndex: 3, type: 'string.ts' }, + ] + }], + + [{ + line: '\'be careful \\not to escape\'', + tokens: [ + { startIndex: 0, type: 'string.ts' }, + { startIndex: 12, type: 'string.escape.ts' }, + { startIndex: 14, type: 'string.ts' }, + ] + }], + + // Numbers + [{ + line: '0', + tokens: [ + { startIndex: 0, type: 'number.ts' } + ] + }], + + [{ + line: ' 0', + tokens: [ + { startIndex: 0, type: '' }, + { startIndex: 1, type: 'number.ts' } + ] + }], + + [{ + line: ' 0 ', + tokens: [ + { startIndex: 0, type: '' }, + { startIndex: 1, type: 'number.ts' }, + { startIndex: 2, type: '' } + ] + }], + + [{ + line: '0 ', + tokens: [ + { startIndex: 0, type: 'number.ts' }, + { startIndex: 1, type: '' } + ] + }], + + [{ + line: '0+0', + tokens: [ + { startIndex: 0, type: 'number.ts' }, + { startIndex: 1, type: 'delimiter.ts' }, + { startIndex: 2, type: 'number.ts' } + ] + }], + + [{ + line: '100+10', + tokens: [ + { startIndex: 0, type: 'number.ts' }, + { startIndex: 3, type: 'delimiter.ts' }, + { startIndex: 4, type: 'number.ts' } + ] + }], + + [{ + line: '0 + 0', + tokens: [ + { startIndex: 0, type: 'number.ts' }, + { startIndex: 1, type: '' }, + { startIndex: 2, type: 'delimiter.ts' }, + { startIndex: 3, type: '' }, + { startIndex: 4, type: 'number.ts' } + ] + }], + + [{ + line: '0123', + tokens: [ + { startIndex: 0, type: 'number.octal.ts' } + ] + }], + + [{ + line: '01239', + tokens: [ + { startIndex: 0, type: 'number.octal.ts' }, + { startIndex: 4, type: 'number.ts' } + ] + }], + + [{ + line: '0x', + tokens: [ + { startIndex: 0, type: 'number.ts' }, + { startIndex: 1, type: 'identifier.ts' } + ] + }], + + [{ + line: '0x123', + tokens: [ + { startIndex: 0, type: 'number.hex.ts' } + ] + }], + + // Regular Expressions + [{ + line: '//', + tokens: [ + { startIndex: 0, type: 'comment.ts' } + ] + }], + + [{ + line: '/**/', + tokens: [ + { startIndex: 0, type: 'comment.ts' } + ] + }], + + [{ + line: '/***/', + tokens: [ + { startIndex: 0, type: 'comment.doc.ts' } + ] + }], + + [{ + line: '5 / 3;', + tokens: [ + { startIndex: 0, type: 'number.ts' }, + { startIndex: 1, type: '' }, + { startIndex: 2, type: 'delimiter.ts' }, + { startIndex: 3, type: '' }, + { startIndex: 4, type: 'number.ts' }, + { startIndex: 5, type: 'delimiter.ts' } + ] + }], + + // Advanced regular expressions + [{ + line: '1 / 2; /* comment', + tokens: [ + { startIndex: 0, type: 'number.ts' }, + { startIndex: 1, type: '' }, + { startIndex: 2, type: 'delimiter.ts' }, + { startIndex: 3, type: '' }, + { startIndex: 4, type: 'number.ts' }, + { startIndex: 5, type: 'delimiter.ts' }, + { startIndex: 6, type: '' }, + { startIndex: 7, type: 'comment.ts' } + ] + }], + + [{ + line: '1 / 2 / x / b;', + tokens: [ + { startIndex: 0, type: 'number.ts' }, + { startIndex: 1, type: '' }, + { startIndex: 2, type: 'delimiter.ts' }, + { startIndex: 3, type: '' }, + { startIndex: 4, type: 'number.ts' }, + { startIndex: 5, type: '' }, + { startIndex: 6, type: 'delimiter.ts' }, + { startIndex: 7, type: '' }, + { startIndex: 8, type: 'identifier.ts' }, + { startIndex: 9, type: '' }, + { startIndex: 10, type: 'delimiter.ts' }, + { startIndex: 11, type: '' }, + { startIndex: 12, type: 'identifier.ts' }, + { startIndex: 13, type: 'delimiter.ts' } + ] + }], + + [{ + line: 'a /ads/ b;', + tokens: [ + { startIndex: 0, type: 'identifier.ts' }, + { startIndex: 1, type: '' }, + { startIndex: 2, type: 'delimiter.ts' }, + { startIndex: 3, type: 'identifier.ts' }, + { startIndex: 6, type: 'delimiter.ts' }, + { startIndex: 7, type: '' }, + { startIndex: 8, type: 'identifier.ts' }, + { startIndex: 9, type: 'delimiter.ts' } + ] + }], + + [{ + line: '1/(2/3)/2/3;', + tokens: [ + { startIndex: 0, type: 'number.ts' }, + { startIndex: 1, type: 'delimiter.ts' }, + { startIndex: 2, type: 'delimiter.parenthesis.ts' }, + { startIndex: 3, type: 'number.ts' }, + { startIndex: 4, type: 'delimiter.ts' }, + { startIndex: 5, type: 'number.ts' }, + { startIndex: 6, type: 'delimiter.parenthesis.ts' }, + { startIndex: 7, type: 'delimiter.ts' }, + { startIndex: 8, type: 'number.ts' }, + { startIndex: 9, type: 'delimiter.ts' }, + { startIndex: 10, type: 'number.ts' }, + { startIndex: 11, type: 'delimiter.ts' } + ] + }], + + [{ + line: '{ key: 123 }', + tokens: [ + { startIndex: 0, type: 'delimiter.bracket.ts' }, + { startIndex: 1, type: '' }, + { startIndex: 2, type: 'identifier.ts' }, + { startIndex: 5, type: 'delimiter.ts' }, + { startIndex: 6, type: '' }, + { startIndex: 7, type: 'number.ts' }, + { startIndex: 10, type: '' }, + { startIndex: 11, type: 'delimiter.bracket.ts' } + ] + }], + + [{ + line: '[1,2,3]', + tokens: [ + { startIndex: 0, type: 'delimiter.square.ts' }, + { startIndex: 1, type: 'number.ts' }, + { startIndex: 2, type: 'delimiter.ts' }, + { startIndex: 3, type: 'number.ts' }, + { startIndex: 4, type: 'delimiter.ts' }, + { startIndex: 5, type: 'number.ts' }, + { startIndex: 6, type: 'delimiter.square.ts' } + ] + }], + + [{ + line: 'foo(123);', + tokens: [ + { startIndex: 0, type: 'identifier.ts' }, + { startIndex: 3, type: 'delimiter.parenthesis.ts' }, + { startIndex: 4, type: 'number.ts' }, + { startIndex: 7, type: 'delimiter.parenthesis.ts' }, + { startIndex: 8, type: 'delimiter.ts' } + ] + }], + + [{ + line: '{a:{b:[]}}', + tokens: [ + { startIndex: 0, type: 'delimiter.bracket.ts' }, + { startIndex: 1, type: 'identifier.ts' }, + { startIndex: 2, type: 'delimiter.ts' }, + { startIndex: 3, type: 'delimiter.bracket.ts' }, + { startIndex: 4, type: 'identifier.ts' }, + { startIndex: 5, type: 'delimiter.ts' }, + { startIndex: 6, type: 'delimiter.square.ts' }, + { startIndex: 8, type: 'delimiter.bracket.ts' } + ] + }], + + [{ + line: 'x = "[{()}]"', + tokens: [ + { startIndex: 0, type: 'identifier.ts' }, + { startIndex: 1, type: '' }, + { startIndex: 2, type: 'delimiter.ts' }, + { startIndex: 3, type: '' }, + { startIndex: 4, type: 'string.ts' } + ] + }], + + + [{ + line: '`${5 + \'x\' + ()3}`', + tokens: [ + { startIndex: 0, type: 'string.ts' }, + { startIndex: 1, type: 'delimiter.bracket.ts' }, + { startIndex: 3, type: 'number.ts' }, + { startIndex: 4, type: '' }, + { startIndex: 5, type: 'delimiter.ts' }, + { startIndex: 6, type: '' }, + { startIndex: 7, type: 'string.ts' }, + { startIndex: 10, type: '' }, + { startIndex: 11, type: 'delimiter.ts' }, + { startIndex: 12, type: '' }, + { startIndex: 13, type: 'delimiter.parenthesis.ts' }, + { startIndex: 14, type: 'delimiter.angle.ts' }, + { startIndex: 15, type: 'keyword.ts' }, + { startIndex: 18, type: 'delimiter.angle.ts' }, + { startIndex: 19, type: 'delimiter.parenthesis.ts' }, + { startIndex: 20, type: 'number.ts' }, + { startIndex: 21, type: 'delimiter.bracket.ts' }, + { startIndex: 22, type: 'string.ts' }, + ] + }] + +]); diff --git a/src/typescript/typescript.ts b/src/typescript/typescript.ts new file mode 100644 index 00000000..81a6c334 --- /dev/null +++ b/src/typescript/typescript.ts @@ -0,0 +1,205 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +'use strict'; + +import IRichLanguageConfiguration = monaco.languages.LanguageConfiguration; +import ILanguage = monaco.languages.IMonarchLanguage; + +// Allow for running under nodejs/requirejs in tests +const _monaco: typeof monaco = (typeof monaco === 'undefined' ? (self).monaco : monaco); + +export const conf: IRichLanguageConfiguration = { + wordPattern: /(-?\d*\.\d\w*)|([^\`\~\!\@\#\%\^\&\*\(\)\-\=\+\[\{\]\}\\\|\;\:\'\"\,\.\<\>\/\?\s]+)/g, + + comments: { + lineComment: '//', + blockComment: ['/*', '*/'] + }, + + brackets: [ + ['{', '}'], + ['[', ']'], + ['(', ')'] + ], + + onEnterRules: [ + { + // e.g. /** | */ + beforeText: /^\s*\/\*\*(?!\/)([^\*]|\*(?!\/))*$/, + afterText: /^\s*\*\/$/, + action: { indentAction: _monaco.languages.IndentAction.IndentOutdent, appendText: ' * ' } + }, + { + // e.g. /** ...| + beforeText: /^\s*\/\*\*(?!\/)([^\*]|\*(?!\/))*$/, + action: { indentAction: _monaco.languages.IndentAction.None, appendText: ' * ' } + }, + { + // e.g. * ...| + beforeText: /^(\t|(\ \ ))*\ \*(\ ([^\*]|\*(?!\/))*)?$/, + action: { indentAction: _monaco.languages.IndentAction.None, appendText: '* ' } + }, + { + // e.g. */| + beforeText: /^(\t|(\ \ ))*\ \*\/\s*$/, + action: { indentAction: _monaco.languages.IndentAction.None, removeText: 1 } + } + ], + + autoClosingPairs: [ + { open: '{', close: '}' }, + { open: '[', close: ']' }, + { open: '(', close: ')' }, + { open: '"', close: '"', notIn: ['string'] }, + { open: '\'', close: '\'', notIn: ['string', 'comment'] }, + { open: '`', close: '`', notIn: ['string', 'comment'] }, + { open: "/**", close: " */", notIn: ["string"] } + ], + + folding: { + markers: { + start: new RegExp("^\\s*//\\s*#?region\\b"), + end: new RegExp("^\\s*//\\s*#?endregion\\b") + } + } +}; + +export const language = { + // Set defaultToken to invalid to see what you do not tokenize yet + defaultToken: 'invalid', + tokenPostfix: '.ts', + + keywords: [ + 'abstract', 'as', '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', 'infer', 'instanceof', 'interface', + 'is', 'keyof', 'let', 'module', 'namespace', 'never', 'new', 'null', 'package', + 'private', 'protected', 'public', 'readonly', 'require', 'global', 'return', + 'set', 'static', 'super', 'switch', 'symbol', 'this', 'throw', 'true', 'try', + 'type', 'typeof', 'unique', 'var', 'void', 'while', 'with', 'yield', 'async', + 'await', 'of' + ], + + typeKeywords: [ + 'any', 'boolean', 'number', 'object', 'string', 'undefined' + ], + + operators: [ + '<=', '>=', '==', '!=', '===', '!==', '=>', '+', '-', '**', + '*', '/', '%', '++', '--', '<<', '>', '>>>', '&', + '|', '^', '!', '~', '&&', '||', '?', ':', '=', '+=', '-=', + '*=', '**=', '/=', '%=', '<<=', '>>=', '>>>=', '&=', '|=', + '^=', '@', + ], + + // we include these common regular expressions + symbols: /[=>](?!@symbols)/, '@brackets'], + [/@symbols/, { + cases: { + '@operators': 'delimiter', + '@default': '' + } + }], + + // numbers + [/(@digits)[eE]([\-+]?(@digits))?/, 'number.float'], + [/(@digits)\.(@digits)([eE][\-+]?(@digits))?/, 'number.float'], + [/0[xX](@hexdigits)/, 'number.hex'], + [/0(@octaldigits)/, 'number.octal'], + [/0[bB](@binarydigits)/, 'number.binary'], + [/(@digits)/, 'number'], + + // delimiter: after number because of .\d floats + [/[;,.]/, 'delimiter'], + + // strings + [/"([^"\\]|\\.)*$/, 'string.invalid'], // non-teminated string + [/'([^'\\]|\\.)*$/, 'string.invalid'], // non-teminated string + [/"/, 'string', '@string_double'], + [/'/, 'string', '@string_single'], + [/`/, 'string', '@string_backtick'], + ], + + whitespace: [ + [/[ \t\r\n]+/, ''], + [/\/\*\*(?!\/)/, 'comment.doc', '@jsdoc'], + [/\/\*/, 'comment', '@comment'], + [/\/\/.*$/, 'comment'], + ], + + comment: [ + [/[^\/*]+/, 'comment'], + [/\*\//, 'comment', '@pop'], + [/[\/*]/, 'comment'] + ], + + jsdoc: [ + [/[^\/*]+/, 'comment.doc'], + [/\*\//, 'comment.doc', '@pop'], + [/[\/*]/, 'comment.doc'] + ], + + string_double: [ + [/[^\\"]+/, 'string'], + [/@escapes/, 'string.escape'], + [/\\./, 'string.escape.invalid'], + [/"/, 'string', '@pop'] + ], + + string_single: [ + [/[^\\']+/, 'string'], + [/@escapes/, 'string.escape'], + [/\\./, 'string.escape.invalid'], + [/'/, 'string', '@pop'] + ], + + string_backtick: [ + [/\$\{/, { token: 'delimiter.bracket', next: '@bracketCounting' }], + [/[^\\`]+/, 'string'], + [/@escapes/, 'string.escape'], + [/\\./, 'string.escape.invalid'], + [/`/, 'string', '@pop'] + ], + + bracketCounting: [ + [/\{/, 'delimiter.bracket', '@bracketCounting'], + [/\}/, 'delimiter.bracket', '@pop'], + { include: 'common' } + ], + }, +}; diff --git a/test/setup.js b/test/setup.js index 1cbff462..1583d9b5 100644 --- a/test/setup.js +++ b/test/setup.js @@ -66,6 +66,7 @@ define(['require'], function (require) { 'release/dev/csp/csp.test', 'release/dev/st/st.test', 'release/dev/scheme/scheme.test', + 'release/dev/typescript/typescript.test', 'release/dev/clojure/clojure.test', 'release/dev/shell/shell.test', 'release/dev/perl/perl.test' From 4b1d2982ff594779e07b0acdade4540016fa5d28 Mon Sep 17 00:00:00 2001 From: Alex Dima Date: Wed, 8 Aug 2018 10:43:41 +0200 Subject: [PATCH 044/133] Tweak launch.json --- .vscode/launch.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.vscode/launch.json b/.vscode/launch.json index 6aa227c6..df977905 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -8,8 +8,8 @@ "program": "${workspaceRoot}/node_modules/mocha/bin/_mocha", "stopOnEntry": false, "args": [ - "--grep", - "php" + // "--grep", + // "typescript" ], "cwd": "${workspaceRoot}", "preLaunchTask": null, @@ -25,4 +25,4 @@ "outDir": null } ] -} \ No newline at end of file +} From 3979a669f348e1fc084fa47d32e4b83c46eb21cc Mon Sep 17 00:00:00 2001 From: Alex Dima Date: Wed, 8 Aug 2018 11:19:05 +0200 Subject: [PATCH 045/133] Add JavaScript coloring --- README.md | 1 + scripts/bundle.js | 1 + src/html/html.test.ts | 47 +- src/javascript/javascript.contribution.ts | 20 + src/javascript/javascript.test.ts | 553 ++++++++++++++++++++++ src/javascript/javascript.ts | 41 ++ src/less/less.test.ts | 7 +- src/monaco.contribution.ts | 1 + src/php/php.test.ts | 50 +- src/typescript/typescript.test.ts | 6 +- src/typescript/typescript.ts | 4 +- test/setup.js | 1 + 12 files changed, 711 insertions(+), 21 deletions(-) create mode 100644 src/javascript/javascript.contribution.ts create mode 100644 src/javascript/javascript.test.ts create mode 100644 src/javascript/javascript.ts diff --git a/README.md b/README.md index a46dc3ea..c11a2048 100644 --- a/README.md +++ b/README.md @@ -17,6 +17,7 @@ Colorization and configuration supports for multiple languages for the Monaco Ed * html * ini * java +* javascript * lua * markdown * msdax diff --git a/scripts/bundle.js b/scripts/bundle.js index 4eb30949..8189116f 100644 --- a/scripts/bundle.js +++ b/scripts/bundle.js @@ -34,6 +34,7 @@ bundleOne('html/html'); bundleOne('ini/ini'); bundleOne('pug/pug'); bundleOne('java/java'); +bundleOne('javascript/javascript'); bundleOne('less/less'); bundleOne('lua/lua'); bundleOne('markdown/markdown'); diff --git a/src/html/html.test.ts b/src/html/html.test.ts index 07c7fe56..65c03567 100644 --- a/src/html/html.test.ts +++ b/src/html/html.test.ts @@ -7,7 +7,7 @@ import { testTokenization } from '../test/testRunner'; -testTokenization(['html', 'css'], [ +testTokenization(['html', 'css', 'javascript'], [ // Open Start Tag #1' [{ @@ -147,7 +147,13 @@ testTokenization(['html', 'css'], [ { startIndex: 12, type: 'delimiter.html' }, { startIndex: 13, type: 'attribute.value.html' }, { startIndex: 30, type: 'delimiter.html' }, - { startIndex: 31, type: '' }, + { startIndex: 31, type: 'keyword.js' }, + { startIndex: 34, type: '' }, + { startIndex: 35, type: 'identifier.js' }, + { startIndex: 36, type: 'delimiter.js' }, + { startIndex: 37, type: '' }, + { startIndex: 38, type: 'number.js' }, + { startIndex: 40, type: 'delimiter.js' }, { startIndex: 41, type: 'delimiter.html' }, { startIndex: 43, type: 'tag.html' }, { startIndex: 49, type: 'delimiter.html' } @@ -169,7 +175,13 @@ testTokenization(['html', 'css'], [ }, { line: 'var i= 10;', tokens: [ - { startIndex: 0, type: '' }, + { startIndex: 0, type: 'keyword.js' }, + { startIndex: 3, type: '' }, + { startIndex: 4, type: 'identifier.js' }, + { startIndex: 5, type: 'delimiter.js' }, + { startIndex: 6, type: '' }, + { startIndex: 7, type: 'number.js' }, + { startIndex: 9, type: 'delimiter.js' }, ] }, { line: '', @@ -191,7 +203,14 @@ testTokenization(['html', 'css'], [ { startIndex: 12, type: 'delimiter.html' }, { startIndex: 13, type: 'attribute.value.html' }, { startIndex: 30, type: 'delimiter.html' }, - { startIndex: 31, type: '' }, + { startIndex: 31, type: 'keyword.js' }, + { startIndex: 34, type: '' }, + { startIndex: 35, type: 'identifier.js' }, + { startIndex: 36, type: 'delimiter.js' }, + { startIndex: 37, type: '' }, + { startIndex: 38, type: 'number.js' }, + { startIndex: 40, type: 'delimiter.js' }, + ] }, { line: '', @@ -217,7 +236,13 @@ testTokenization(['html', 'css'], [ }, { line: 'var i= 10;', tokens: [ - { startIndex: 0, type: '' }, + { startIndex: 0, type: 'keyword.js' }, + { startIndex: 3, type: '' }, + { startIndex: 4, type: 'identifier.js' }, + { startIndex: 5, type: 'delimiter.js' }, + { startIndex: 6, type: '' }, + { startIndex: 7, type: 'number.js' }, + { startIndex: 9, type: 'delimiter.js' }, { startIndex: 10, type: 'delimiter.html' }, { startIndex: 12, type: 'tag.html' }, { startIndex: 18, type: 'delimiter.html' } @@ -254,14 +279,14 @@ testTokenization(['html', 'css'], [ { startIndex: 0, type: 'delimiter.html' }, { startIndex: 1, type: 'tag.html' }, { startIndex: 7, type: 'delimiter.html' }, - { startIndex: 8, type: '' }, + { startIndex: 8, type: 'identifier.js' }, { startIndex: 9, type: 'delimiter.html' }, { startIndex: 11, type: 'tag.html' }, { startIndex: 17, type: 'delimiter.html' }, // { startIndex:18, type: 'delimiter.html' }, { startIndex: 19, type: 'tag.html' }, { startIndex: 25, type: 'delimiter.html' }, - { startIndex: 26, type: '' }, + { startIndex: 26, type: 'identifier.js' }, { startIndex: 27, type: 'delimiter.html' }, { startIndex: 29, type: 'tag.html' }, { startIndex: 35, type: 'delimiter.html' } @@ -292,7 +317,13 @@ testTokenization(['html', 'css'], [ { startIndex: 0, type: 'delimiter.html' }, { startIndex: 1, type: 'tag.html' }, { startIndex: 7, type: 'delimiter.html' }, - { startIndex: 8, type: '' }, + { startIndex: 8, type: 'keyword.js' }, + { startIndex: 11, type: '' }, + { startIndex: 12, type: 'identifier.js' }, + { startIndex: 13, type: 'delimiter.js' }, + { startIndex: 14, type: '' }, + { startIndex: 15, type: 'number.js' }, + { startIndex: 17, type: 'delimiter.js' }, { startIndex: 18, type: 'delimiter.html' }, { startIndex: 20, type: 'tag.html' }, { startIndex: 26, type: 'delimiter.html' } diff --git a/src/javascript/javascript.contribution.ts b/src/javascript/javascript.contribution.ts new file mode 100644 index 00000000..32c75b71 --- /dev/null +++ b/src/javascript/javascript.contribution.ts @@ -0,0 +1,20 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +'use strict'; + +import { registerLanguage } from '../_.contribution'; + +// Allow for running under nodejs/requirejs in tests +const _monaco: typeof monaco = (typeof monaco === 'undefined' ? (self).monaco : monaco); + +registerLanguage({ + id: 'javascript', + extensions: ['.js', '.es6', '.jsx'], + firstLine: '^#!.*\\bnode', + filenames: ['jakefile'], + aliases: ['JavaScript', 'javascript', 'js'], + mimetypes: ['text/javascript'], + loader: () => _monaco.Promise.wrap(import('./javascript')) +}); diff --git a/src/javascript/javascript.test.ts b/src/javascript/javascript.test.ts new file mode 100644 index 00000000..e2033026 --- /dev/null +++ b/src/javascript/javascript.test.ts @@ -0,0 +1,553 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +'use strict'; + +import { testTokenization } from '../test/testRunner'; + +testTokenization('javascript', [ + // Keywords + [{ + line: 'var x = function() { };', + tokens: [ + { startIndex: 0, type: 'keyword.js' }, + { startIndex: 3, type: '' }, + { startIndex: 4, type: 'identifier.js' }, + { startIndex: 5, type: '' }, + { startIndex: 6, type: 'delimiter.js' }, + { startIndex: 7, type: '' }, + { startIndex: 8, type: 'keyword.js' }, + { startIndex: 16, type: 'delimiter.parenthesis.js' }, + { startIndex: 18, type: '' }, + { startIndex: 19, type: 'delimiter.bracket.js' }, + { startIndex: 20, type: '' }, + { startIndex: 21, type: 'delimiter.bracket.js' }, + { startIndex: 22, type: 'delimiter.js' } + ] + }], + + [{ + line: ' var ', + tokens: [ + { startIndex: 0, type: '' }, + { startIndex: 4, type: 'keyword.js' }, + { startIndex: 7, type: '' } + ] + }], + + // Comments - single line + [{ + line: '//', + tokens: [ + { startIndex: 0, type: 'comment.js' } + ] + }], + + [{ + line: ' // a comment', + tokens: [ + { startIndex: 0, type: '' }, + { startIndex: 4, type: 'comment.js' } + ] + }], + + [{ + line: '// a comment', + tokens: [ + { startIndex: 0, type: 'comment.js' } + ] + }], + + [{ + line: '// a comment /*', + tokens: [ + { startIndex: 0, type: 'comment.js' } + ] + }], + + [{ + line: '// a comment /**', + tokens: [ + { startIndex: 0, type: 'comment.js' } + ] + }], + + [{ + line: '//sticky comment', + tokens: [ + { startIndex: 0, type: 'comment.js' } + ] + }], + + [{ + line: 'var x = 1; // my comment // is a nice one', + tokens: [ + { startIndex: 0, type: 'keyword.js' }, + { startIndex: 3, type: '' }, + { startIndex: 4, type: 'identifier.js' }, + { startIndex: 5, type: '' }, + { startIndex: 6, type: 'delimiter.js' }, + { startIndex: 7, type: '' }, + { startIndex: 8, type: 'number.js' }, + { startIndex: 9, type: 'delimiter.js' }, + { startIndex: 10, type: '' }, + { startIndex: 11, type: 'comment.js' } + ] + }], + + // Comments - range comment, single line + [{ + line: '/* a simple comment */', + tokens: [ + { startIndex: 0, type: 'comment.js' } + ] + }], + + [{ + line: 'var x = /* a simple comment */ 1;', + tokens: [ + { startIndex: 0, type: 'keyword.js' }, + { startIndex: 3, type: '' }, + { startIndex: 4, type: 'identifier.js' }, + { startIndex: 5, type: '' }, + { startIndex: 6, type: 'delimiter.js' }, + { startIndex: 7, type: '' }, + { startIndex: 8, type: 'comment.js' }, + { startIndex: 30, type: '' }, + { startIndex: 31, type: 'number.js' }, + { startIndex: 32, type: 'delimiter.js' } + ] + }], + + [{ + line: 'x = /**/;', + tokens: [ + { startIndex: 0, type: 'identifier.js' }, + { startIndex: 1, type: '' }, + { startIndex: 2, type: 'delimiter.js' }, + { startIndex: 3, type: '' }, + { startIndex: 4, type: 'comment.js' }, + { startIndex: 8, type: 'delimiter.js' } + ] + }], + + [{ + line: 'x = /*/;', + tokens: [ + { startIndex: 0, type: 'identifier.js' }, + { startIndex: 1, type: '' }, + { startIndex: 2, type: 'delimiter.js' }, + { startIndex: 3, type: '' }, + { startIndex: 4, type: 'comment.js' } + ] + }], + + // Comments - range comment, multi lines + [{ + line: '/* a multiline comment', + tokens: [ + { startIndex: 0, type: 'comment.js' } + ] + }, { + line: 'can actually span', + tokens: [ + { startIndex: 0, type: 'comment.js' } + ] + }, { + line: 'multiple lines */', + tokens: [ + { startIndex: 0, type: 'comment.js' } + ] + }], + + [{ + line: 'var x = /* start a comment', + tokens: [ + { startIndex: 0, type: 'keyword.js' }, + { startIndex: 3, type: '' }, + { startIndex: 4, type: 'identifier.js' }, + { startIndex: 5, type: '' }, + { startIndex: 6, type: 'delimiter.js' }, + { startIndex: 7, type: '' }, + { startIndex: 8, type: 'comment.js' } + ] + }, { + line: ' a ', + tokens: [ + { startIndex: 0, type: 'comment.js' } + ] + }, { + line: 'and end it */ var a = 2;', + tokens: [ + { startIndex: 0, type: 'comment.js' }, + { startIndex: 13, type: '' }, + { startIndex: 14, type: 'keyword.js' }, + { startIndex: 17, type: '' }, + { startIndex: 18, type: 'identifier.js' }, + { startIndex: 19, type: '' }, + { startIndex: 20, type: 'delimiter.js' }, + { startIndex: 21, type: '' }, + { startIndex: 22, type: 'number.js' }, + { startIndex: 23, type: 'delimiter.js' } + ] + }], + + // Strings + [{ + line: 'var a = \'a\';', + tokens: [ + { startIndex: 0, type: 'keyword.js' }, + { startIndex: 3, type: '' }, + { startIndex: 4, type: 'identifier.js' }, + { startIndex: 5, type: '' }, + { startIndex: 6, type: 'delimiter.js' }, + { startIndex: 7, type: '' }, + { startIndex: 8, type: 'string.js' }, + { startIndex: 11, type: 'delimiter.js' } + ] + }], + + [{ + line: '"use strict";', + tokens: [ + { startIndex: 0, type: 'string.js' }, + { startIndex: 12, type: 'delimiter.js' } + ] + }], + + [{ + line: 'b = a + " \'cool\' "', + tokens: [ + { startIndex: 0, type: 'identifier.js' }, + { startIndex: 1, type: '' }, + { startIndex: 2, type: 'delimiter.js' }, + { startIndex: 3, type: '' }, + { startIndex: 4, type: 'identifier.js' }, + { startIndex: 5, type: '' }, + { startIndex: 6, type: 'delimiter.js' }, + { startIndex: 7, type: '' }, + { startIndex: 8, type: 'string.js' } + ] + }], + + [{ + line: '"escaping \\"quotes\\" is cool"', + tokens: [ + { startIndex: 0, type: 'string.js' }, + { startIndex: 10, type: 'string.escape.js' }, + { startIndex: 12, type: 'string.js' }, + { startIndex: 18, type: 'string.escape.js' }, + { startIndex: 20, type: 'string.js' }, + ] + }], + + [{ + line: '\'\'\'', + tokens: [ + { startIndex: 0, type: 'string.js' }, + { startIndex: 2, type: 'string.invalid.js' }, + ] + }], + + [{ + line: '\'\\\'\'', + tokens: [ + { startIndex: 0, type: 'string.js' }, + { startIndex: 1, type: 'string.escape.js' }, + { startIndex: 3, type: 'string.js' }, + ] + }], + + [{ + line: '\'be careful \\not to escape\'', + tokens: [ + { startIndex: 0, type: 'string.js' }, + { startIndex: 12, type: 'string.escape.js' }, + { startIndex: 14, type: 'string.js' }, + ] + }], + + // Numbers + [{ + line: '0', + tokens: [ + { startIndex: 0, type: 'number.js' } + ] + }], + + [{ + line: ' 0', + tokens: [ + { startIndex: 0, type: '' }, + { startIndex: 1, type: 'number.js' } + ] + }], + + [{ + line: ' 0 ', + tokens: [ + { startIndex: 0, type: '' }, + { startIndex: 1, type: 'number.js' }, + { startIndex: 2, type: '' } + ] + }], + + [{ + line: '0 ', + tokens: [ + { startIndex: 0, type: 'number.js' }, + { startIndex: 1, type: '' } + ] + }], + + [{ + line: '0+0', + tokens: [ + { startIndex: 0, type: 'number.js' }, + { startIndex: 1, type: 'delimiter.js' }, + { startIndex: 2, type: 'number.js' } + ] + }], + + [{ + line: '100+10', + tokens: [ + { startIndex: 0, type: 'number.js' }, + { startIndex: 3, type: 'delimiter.js' }, + { startIndex: 4, type: 'number.js' } + ] + }], + + [{ + line: '0 + 0', + tokens: [ + { startIndex: 0, type: 'number.js' }, + { startIndex: 1, type: '' }, + { startIndex: 2, type: 'delimiter.js' }, + { startIndex: 3, type: '' }, + { startIndex: 4, type: 'number.js' } + ] + }], + + [{ + line: '0123', + tokens: [ + { startIndex: 0, type: 'number.octal.js' } + ] + }], + + [{ + line: '01239', + tokens: [ + { startIndex: 0, type: 'number.octal.js' }, + { startIndex: 4, type: 'number.js' } + ] + }], + + [{ + line: '0x', + tokens: [ + { startIndex: 0, type: 'number.js' }, + { startIndex: 1, type: 'identifier.js' } + ] + }], + + [{ + line: '0x123', + tokens: [ + { startIndex: 0, type: 'number.hex.js' } + ] + }], + + // Regular Expressions + [{ + line: '//', + tokens: [ + { startIndex: 0, type: 'comment.js' } + ] + }], + + [{ + line: '/**/', + tokens: [ + { startIndex: 0, type: 'comment.js' } + ] + }], + + [{ + line: '/***/', + tokens: [ + { startIndex: 0, type: 'comment.doc.js' } + ] + }], + + [{ + line: '5 / 3;', + tokens: [ + { startIndex: 0, type: 'number.js' }, + { startIndex: 1, type: '' }, + { startIndex: 2, type: 'delimiter.js' }, + { startIndex: 3, type: '' }, + { startIndex: 4, type: 'number.js' }, + { startIndex: 5, type: 'delimiter.js' } + ] + }], + + // Advanced regular expressions + [{ + line: '1 / 2; /* comment', + tokens: [ + { startIndex: 0, type: 'number.js' }, + { startIndex: 1, type: '' }, + { startIndex: 2, type: 'delimiter.js' }, + { startIndex: 3, type: '' }, + { startIndex: 4, type: 'number.js' }, + { startIndex: 5, type: 'delimiter.js' }, + { startIndex: 6, type: '' }, + { startIndex: 7, type: 'comment.js' } + ] + }], + + [{ + line: '1 / 2 / x / b;', + tokens: [ + { startIndex: 0, type: 'number.js' }, + { startIndex: 1, type: '' }, + { startIndex: 2, type: 'delimiter.js' }, + { startIndex: 3, type: '' }, + { startIndex: 4, type: 'number.js' }, + { startIndex: 5, type: '' }, + { startIndex: 6, type: 'delimiter.js' }, + { startIndex: 7, type: '' }, + { startIndex: 8, type: 'identifier.js' }, + { startIndex: 9, type: '' }, + { startIndex: 10, type: 'delimiter.js' }, + { startIndex: 11, type: '' }, + { startIndex: 12, type: 'identifier.js' }, + { startIndex: 13, type: 'delimiter.js' } + ] + }], + + [{ + line: 'a /ads/ b;', + tokens: [ + { startIndex: 0, type: 'identifier.js' }, + { startIndex: 1, type: '' }, + { startIndex: 2, type: 'delimiter.js' }, + { startIndex: 3, type: 'identifier.js' }, + { startIndex: 6, type: 'delimiter.js' }, + { startIndex: 7, type: '' }, + { startIndex: 8, type: 'identifier.js' }, + { startIndex: 9, type: 'delimiter.js' } + ] + }], + + [{ + line: '1/(2/3)/2/3;', + tokens: [ + { startIndex: 0, type: 'number.js' }, + { startIndex: 1, type: 'delimiter.js' }, + { startIndex: 2, type: 'delimiter.parenthesis.js' }, + { startIndex: 3, type: 'number.js' }, + { startIndex: 4, type: 'delimiter.js' }, + { startIndex: 5, type: 'number.js' }, + { startIndex: 6, type: 'delimiter.parenthesis.js' }, + { startIndex: 7, type: 'delimiter.js' }, + { startIndex: 8, type: 'number.js' }, + { startIndex: 9, type: 'delimiter.js' }, + { startIndex: 10, type: 'number.js' }, + { startIndex: 11, type: 'delimiter.js' } + ] + }], + + [{ + line: '{ key: 123 }', + tokens: [ + { startIndex: 0, type: 'delimiter.bracket.js' }, + { startIndex: 1, type: '' }, + { startIndex: 2, type: 'identifier.js' }, + { startIndex: 5, type: 'delimiter.js' }, + { startIndex: 6, type: '' }, + { startIndex: 7, type: 'number.js' }, + { startIndex: 10, type: '' }, + { startIndex: 11, type: 'delimiter.bracket.js' } + ] + }], + + [{ + line: '[1,2,3]', + tokens: [ + { startIndex: 0, type: 'delimiter.square.js' }, + { startIndex: 1, type: 'number.js' }, + { startIndex: 2, type: 'delimiter.js' }, + { startIndex: 3, type: 'number.js' }, + { startIndex: 4, type: 'delimiter.js' }, + { startIndex: 5, type: 'number.js' }, + { startIndex: 6, type: 'delimiter.square.js' } + ] + }], + + [{ + line: 'foo(123);', + tokens: [ + { startIndex: 0, type: 'identifier.js' }, + { startIndex: 3, type: 'delimiter.parenthesis.js' }, + { startIndex: 4, type: 'number.js' }, + { startIndex: 7, type: 'delimiter.parenthesis.js' }, + { startIndex: 8, type: 'delimiter.js' } + ] + }], + + [{ + line: '{a:{b:[]}}', + tokens: [ + { startIndex: 0, type: 'delimiter.bracket.js' }, + { startIndex: 1, type: 'identifier.js' }, + { startIndex: 2, type: 'delimiter.js' }, + { startIndex: 3, type: 'delimiter.bracket.js' }, + { startIndex: 4, type: 'identifier.js' }, + { startIndex: 5, type: 'delimiter.js' }, + { startIndex: 6, type: 'delimiter.square.js' }, + { startIndex: 8, type: 'delimiter.bracket.js' } + ] + }], + + [{ + line: 'x = "[{()}]"', + tokens: [ + { startIndex: 0, type: 'identifier.js' }, + { startIndex: 1, type: '' }, + { startIndex: 2, type: 'delimiter.js' }, + { startIndex: 3, type: '' }, + { startIndex: 4, type: 'string.js' } + ] + }], + + + [{ + line: '`${5 + \'x\' + 3}a${4}`', + tokens: [ + { startIndex: 0, type: 'string.js' }, + { startIndex: 1, type: 'delimiter.bracket.js' }, + { startIndex: 3, type: 'number.js' }, + { startIndex: 4, type: '' }, + { startIndex: 5, type: 'delimiter.js' }, + { startIndex: 6, type: '' }, + { startIndex: 7, type: 'string.js' }, + { startIndex: 10, type: '' }, + { startIndex: 11, type: 'delimiter.js' }, + { startIndex: 12, type: '' }, + { startIndex: 13, type: 'number.js' }, + { startIndex: 14, type: 'delimiter.bracket.js' }, + { startIndex: 15, type: 'string.js' }, + { startIndex: 16, type: 'delimiter.bracket.js' }, + { startIndex: 18, type: 'number.js' }, + { startIndex: 19, type: 'delimiter.bracket.js' }, + { startIndex: 20, type: 'string.js' }, + + ] + }] + +]); diff --git a/src/javascript/javascript.ts b/src/javascript/javascript.ts new file mode 100644 index 00000000..9b57ca9d --- /dev/null +++ b/src/javascript/javascript.ts @@ -0,0 +1,41 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +'use strict'; + +import { conf as tsConf, language as tsLanguage } from '../typescript/typescript'; +import IRichLanguageConfiguration = monaco.languages.LanguageConfiguration; +import ILanguage = monaco.languages.IMonarchLanguage; + +// Allow for running under nodejs/requirejs in tests +const _monaco: typeof monaco = (typeof monaco === 'undefined' ? (self).monaco : monaco); + +export const conf: IRichLanguageConfiguration = tsConf; + +export const language = { + // Set defaultToken to invalid to see what you do not tokenize yet + defaultToken: 'invalid', + tokenPostfix: '.js', + + keywords: [ + 'break', 'case', 'catch', 'class', 'continue', 'const', + 'constructor', 'debugger', 'default', 'delete', 'do', 'else', + 'export', 'extends', 'false', 'finally', 'for', 'from', 'function', + 'get', 'if', 'import', 'in', 'instanceof', 'let', 'new', 'null', + 'return', 'set', 'super', 'switch', 'symbol', 'this', 'throw', 'true', + 'try', 'typeof', 'undefined', 'var', 'void', 'while', 'with', 'yield', + 'async', 'await', 'of' + ], + typeKeywords: [], + + operators: tsLanguage.operators, + symbols: tsLanguage.symbols, + escapes: tsLanguage.escapes, + digits: tsLanguage.digits, + octaldigits: tsLanguage.octaldigits, + binarydigits: tsLanguage.binarydigits, + hexdigits: tsLanguage.hexdigits, + tokenizer: tsLanguage.tokenizer, +}; diff --git a/src/less/less.test.ts b/src/less/less.test.ts index 3b9eff59..c3b3fd5e 100644 --- a/src/less/less.test.ts +++ b/src/less/less.test.ts @@ -7,7 +7,7 @@ import { testTokenization } from '../test/testRunner'; -testTokenization(['less'], [ +testTokenization(['less', 'javascript'], [ // Keywords [{ @@ -641,7 +641,10 @@ testTokenization(['less'], [ { startIndex: 5, type: 'delimiter.less' }, { startIndex: 6, type: '' }, { startIndex: 7, type: 'delimiter.backtick.less' }, - { startIndex: 8, type: '' }, + { startIndex: 8, type: 'keyword.js' }, + { startIndex: 16, type: '' }, + { startIndex: 17, type: 'identifier.js' }, + { startIndex: 24, type: 'delimiter.parenthesis.js' }, { startIndex: 26, type: 'delimiter.backtick.less' }, { startIndex: 27, type: '' }, { startIndex: 28, type: 'comment.less' } diff --git a/src/monaco.contribution.ts b/src/monaco.contribution.ts index 9148aa98..1baa3237 100644 --- a/src/monaco.contribution.ts +++ b/src/monaco.contribution.ts @@ -17,6 +17,7 @@ import './handlebars/handlebars.contribution'; import './html/html.contribution'; import './ini/ini.contribution'; import './java/java.contribution'; +import './javascript/javascript.contribution'; import './less/less.contribution'; import './lua/lua.contribution'; import './markdown/markdown.contribution'; diff --git a/src/php/php.test.ts b/src/php/php.test.ts index 1e3c29db..38f6cdd1 100644 --- a/src/php/php.test.ts +++ b/src/php/php.test.ts @@ -7,7 +7,7 @@ import { testTokenization } from '../test/testRunner'; -testTokenization(['php', 'css'], [ +testTokenization(['php', 'css', 'javascript'], [ // Bug 13596:[ErrorTelemetry] Stream did not advance while tokenizing. Mode id is php (stuck) // We're testing the fact that tokenize does not throw [ @@ -1863,7 +1863,13 @@ testTokenization(['php', 'css'], [ // { startIndex:5, type: 'delimiter.html' }, { startIndex: 6, type: 'tag.html' }, { startIndex: 12, type: 'delimiter.html' }, - { startIndex: 13, type: '' }, + { startIndex: 13, type: 'keyword.js' }, + { startIndex: 16, type: '' }, + { startIndex: 17, type: 'identifier.js' }, + { startIndex: 18, type: 'delimiter.js' }, + { startIndex: 19, type: '' }, + { startIndex: 20, type: 'number.js' }, + { startIndex: 22, type: 'delimiter.js' }, { startIndex: 23, type: 'delimiter.html' }, { startIndex: 25, type: 'tag.html' }, { startIndex: 31, type: 'delimiter.html' }, @@ -1888,7 +1894,13 @@ testTokenization(['php', 'css'], [ // { startIndex:5, type: 'delimiter.html' }, { startIndex: 6, type: 'tag.html' }, { startIndex: 12, type: 'delimiter.html' }, - { startIndex: 13, type: '' }, + { startIndex: 13, type: 'keyword.js' }, + { startIndex: 16, type: '' }, + { startIndex: 17, type: 'identifier.js' }, + { startIndex: 18, type: 'delimiter.js' }, + { startIndex: 19, type: '' }, + { startIndex: 20, type: 'number.js' }, + { startIndex: 22, type: 'delimiter.js' }, { startIndex: 23, type: 'delimiter.html' }, { startIndex: 25, type: 'tag.html' }, { startIndex: 31, type: 'delimiter.html' }, @@ -1900,7 +1912,13 @@ testTokenization(['php', 'css'], [ { startIndex: 42, type: 'delimiter.html' }, { startIndex: 43, type: 'tag.html' }, { startIndex: 49, type: 'delimiter.html' }, - { startIndex: 50, type: '' }, + { startIndex: 50, type: 'keyword.js' }, + { startIndex: 53, type: '' }, + { startIndex: 54, type: 'identifier.js' }, + { startIndex: 55, type: 'delimiter.js' }, + { startIndex: 56, type: '' }, + { startIndex: 57, type: 'number.js' }, + { startIndex: 59, type: 'delimiter.js' }, { startIndex: 60, type: 'delimiter.html' }, { startIndex: 62, type: 'tag.html' }, { startIndex: 68, type: 'delimiter.html' } @@ -1969,12 +1987,28 @@ testTokenization(['php', 'css'], [ { startIndex: 73, type: 'delimiter.html' }, { startIndex: 74, type: 'tag.html' }, { startIndex: 80, type: 'delimiter.html' }, - { startIndex: 81, type: '' }, + { startIndex: 81, type: 'keyword.js' }, + { startIndex: 84, type: '' }, + { startIndex: 85, type: 'identifier.js' }, + { startIndex: 86, type: '' }, + { startIndex: 87, type: 'delimiter.js' }, + { startIndex: 88, type: '' }, + { startIndex: 89, type: 'number.js' }, + { startIndex: 90, type: 'delimiter.js' }, + { startIndex: 91, type: 'comment.js' }, { startIndex: 94, type: 'metatag.php' }, { startIndex: 97, type: 'string.php' }, { startIndex: 109, type: 'comment.php' }, { startIndex: 122, type: 'metatag.php' }, { startIndex: 124, type: '' }, + { startIndex: 127, type: 'keyword.js' }, + { startIndex: 130, type: '' }, + { startIndex: 131, type: 'identifier.js' }, + { startIndex: 132, type: '' }, + { startIndex: 133, type: 'delimiter.js' }, + { startIndex: 134, type: '' }, + { startIndex: 135, type: 'number.js' }, + { startIndex: 136, type: 'delimiter.js' }, { startIndex: 137, type: 'delimiter.html' }, { startIndex: 139, type: 'tag.html' }, { startIndex: 145, type: 'delimiter.html' }, @@ -2010,7 +2044,7 @@ testTokenization(['php', 'css'], [ { startIndex: 0, type: 'delimiter.html' }, { startIndex: 1, type: 'tag.html' }, { startIndex: 7, type: 'delimiter.html' }, - { startIndex: 8, type: '' }, + { startIndex: 8, type: 'comment.js' }, { startIndex: 10, type: 'metatag.php' } ] }], @@ -2021,13 +2055,13 @@ testTokenization(['php', 'css'], [ { startIndex: 0, type: 'delimiter.html' }, { startIndex: 1, type: 'tag.html' }, { startIndex: 7, type: 'delimiter.html' }, - { startIndex: 8, type: '' }, + { startIndex: 8, type: 'string.invalid.js' }, { startIndex: 9, type: 'metatag.php' }, { startIndex: 14, type: 'number.php' }, { startIndex: 15, type: 'delimiter.php' }, { startIndex: 16, type: 'number.php' }, { startIndex: 17, type: 'metatag.php' }, - { startIndex: 19, type: '' } + { startIndex: 19, type: 'string.invalid.js' } ] }], diff --git a/src/typescript/typescript.test.ts b/src/typescript/typescript.test.ts index b783377c..221a64f2 100644 --- a/src/typescript/typescript.test.ts +++ b/src/typescript/typescript.test.ts @@ -527,7 +527,7 @@ testTokenization('typescript', [ [{ - line: '`${5 + \'x\' + ()3}`', + line: '`${5 + \'x\' + ()3}a${4}`', tokens: [ { startIndex: 0, type: 'string.ts' }, { startIndex: 1, type: 'delimiter.bracket.ts' }, @@ -547,6 +547,10 @@ testTokenization('typescript', [ { startIndex: 20, type: 'number.ts' }, { startIndex: 21, type: 'delimiter.bracket.ts' }, { startIndex: 22, type: 'string.ts' }, + { startIndex: 23, type: 'delimiter.bracket.ts' }, + { startIndex: 25, type: 'number.ts' }, + { startIndex: 26, type: 'delimiter.bracket.ts' }, + { startIndex: 27, type: 'string.ts' }, ] }] diff --git a/src/typescript/typescript.ts b/src/typescript/typescript.ts index 81a6c334..cba42190 100644 --- a/src/typescript/typescript.ts +++ b/src/typescript/typescript.ts @@ -67,7 +67,7 @@ export const conf: IRichLanguageConfiguration = { } }; -export const language = { +export const language = { // Set defaultToken to invalid to see what you do not tokenize yet defaultToken: 'invalid', tokenPostfix: '.ts', @@ -190,7 +190,7 @@ export const language = { string_backtick: [ [/\$\{/, { token: 'delimiter.bracket', next: '@bracketCounting' }], - [/[^\\`]+/, 'string'], + [/[^\\`$]+/, 'string'], [/@escapes/, 'string.escape'], [/\\./, 'string.escape.invalid'], [/`/, 'string', '@pop'] diff --git a/test/setup.js b/test/setup.js index 1583d9b5..ba04fcf6 100644 --- a/test/setup.js +++ b/test/setup.js @@ -38,6 +38,7 @@ define(['require'], function (require) { 'release/dev/html/html.test', 'release/dev/pug/pug.test', 'release/dev/java/java.test', + 'release/dev/javascript/javascript.test', 'release/dev/less/less.test', 'release/dev/lua/lua.test', 'release/dev/markdown/markdown.test', From 6fc362e75a0a6fcf2ec813883a336d0e03d8793f Mon Sep 17 00:00:00 2001 From: Alex Dima Date: Wed, 8 Aug 2018 11:21:18 +0200 Subject: [PATCH 046/133] Fix compilation error --- src/typescript/typescript.contribution.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/typescript/typescript.contribution.ts b/src/typescript/typescript.contribution.ts index a205093a..bc0483e2 100644 --- a/src/typescript/typescript.contribution.ts +++ b/src/typescript/typescript.contribution.ts @@ -14,5 +14,5 @@ registerLanguage({ extensions: ['.ts', '.tsx'], aliases: ['TypeScript', 'ts', 'typescript'], mimetypes: ['text/typescript'], - loader: () => _monaco.Promise.wrap(import('./typescript')) + loader: () => _monaco.Promise.wrap(>import('./typescript')) }); From 46d0fd640072a3be9ee71148804e1aeb5f23535d Mon Sep 17 00:00:00 2001 From: Alex Dima Date: Wed, 8 Aug 2018 15:58:52 +0200 Subject: [PATCH 047/133] 1.4.0 --- package-lock.json | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index db22bfa4..97edef61 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "monaco-languages", - "version": "1.3.0", + "version": "1.4.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 5b7b0d62..16a871de 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "monaco-languages", - "version": "1.3.0", + "version": "1.4.0", "description": "Bundle of many languages for the Monaco Editor.", "scripts": { "compile": "mrmdir ./release && tsc -p ./src/tsconfig.json && tsc -p ./src/tsconfig.esm.json", From 0821a3dd33ff7fece01a42fec45307781e705f76 Mon Sep 17 00:00:00 2001 From: olane Date: Fri, 10 Aug 2018 10:38:33 +0100 Subject: [PATCH 048/133] Add Apex highlighter based on Java highlighter --- src/apex/apex.contribution.ts | 18 + src/apex/apex.test.ts | 663 ++++++++++++++++++++++++++++++++++ src/apex/apex.ts | 151 ++++++++ 3 files changed, 832 insertions(+) create mode 100644 src/apex/apex.contribution.ts create mode 100644 src/apex/apex.test.ts create mode 100644 src/apex/apex.ts diff --git a/src/apex/apex.contribution.ts b/src/apex/apex.contribution.ts new file mode 100644 index 00000000..d7a38595 --- /dev/null +++ b/src/apex/apex.contribution.ts @@ -0,0 +1,18 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +'use strict'; + +import { registerLanguage } from '../_.contribution'; + +// Allow for running under nodejs/requirejs in tests +const _monaco: typeof monaco = (typeof monaco === 'undefined' ? (self).monaco : monaco); + +registerLanguage({ + id: 'apex', + extensions: ['.cls'], + aliases: ['Apex', 'apex'], + mimetypes: ['text/x-apex-source', 'text/x-apex'], + loader: () => _monaco.Promise.wrap(import('./apex')) +}); diff --git a/src/apex/apex.test.ts b/src/apex/apex.test.ts new file mode 100644 index 00000000..37ba8145 --- /dev/null +++ b/src/apex/apex.test.ts @@ -0,0 +1,663 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +'use strict'; + +import { testTokenization } from '../test/testRunner'; + +testTokenization('apex', [ + // Comments - single line + [{ + line: '//', + tokens: [ + { startIndex: 0, type: 'comment.apex' } + ] + }], + + [{ + line: ' // a comment', + tokens: [ + { startIndex: 0, type: '' }, + { startIndex: 4, type: 'comment.apex' } + ] + }], + + // Broken nested tokens due to invalid comment tokenization + [{ + line: '/* //*/ a', + tokens: [ + { startIndex: 0, type: 'comment.apex' }, + { startIndex: 7, type: '' }, + { startIndex: 8, type: 'identifier.apex' } + ] + }], + + [{ + line: '// a comment', + tokens: [ + { startIndex: 0, type: 'comment.apex' } + ] + }], + + [{ + line: '//sticky comment', + tokens: [ + { startIndex: 0, type: 'comment.apex' } + ] + }], + + [{ + line: '/almost a comment', + tokens: [ + { startIndex: 0, type: 'delimiter.apex' }, + { startIndex: 1, type: 'identifier.apex' }, + { startIndex: 7, type: '' }, + { startIndex: 8, type: 'identifier.apex' }, + { startIndex: 9, type: '' }, + { startIndex: 10, type: 'identifier.apex' } + ] + }], + + [{ + line: '1 / 2; /* comment', + tokens: [ + { startIndex: 0, type: 'number.apex' }, + { startIndex: 1, type: '' }, + { startIndex: 2, type: 'delimiter.apex' }, + { startIndex: 3, type: '' }, + { startIndex: 4, type: 'number.apex' }, + { startIndex: 5, type: 'delimiter.apex' }, + { startIndex: 6, type: '' }, + { startIndex: 7, type: 'comment.apex' } + ] + }], + + [{ + line: 'int x = 1; // my comment // is a nice one', + tokens: [ + { startIndex: 0, type: 'keyword.int.apex' }, + { startIndex: 3, type: '' }, + { startIndex: 4, type: 'identifier.apex' }, + { startIndex: 5, type: '' }, + { startIndex: 6, type: 'delimiter.apex' }, + { startIndex: 7, type: '' }, + { startIndex: 8, type: 'number.apex' }, + { startIndex: 9, type: 'delimiter.apex' }, + { startIndex: 10, type: '' }, + { startIndex: 11, type: 'comment.apex' } + ] + }], + + // Comments - range comment, single line + [{ + line: '/* a simple comment */', + tokens: [ + { startIndex: 0, type: 'comment.apex' } + ] + }], + + [{ + line: 'int x = /* a simple comment */ 1;', + tokens: [ + { startIndex: 0, type: 'keyword.int.apex' }, + { startIndex: 3, type: '' }, + { startIndex: 4, type: 'identifier.apex' }, + { startIndex: 5, type: '' }, + { startIndex: 6, type: 'delimiter.apex' }, + { startIndex: 7, type: '' }, + { startIndex: 8, type: 'comment.apex' }, + { startIndex: 30, type: '' }, + { startIndex: 31, type: 'number.apex' }, + { startIndex: 32, type: 'delimiter.apex' } + ] + }], + + [{ + line: 'int x = /* comment */ 1; */', + tokens: [ + { startIndex: 0, type: 'keyword.int.apex' }, + { startIndex: 3, type: '' }, + { startIndex: 4, type: 'identifier.apex' }, + { startIndex: 5, type: '' }, + { startIndex: 6, type: 'delimiter.apex' }, + { startIndex: 7, type: '' }, + { startIndex: 8, type: 'comment.apex' }, + { startIndex: 21, type: '' }, + { startIndex: 22, type: 'number.apex' }, + { startIndex: 23, type: 'delimiter.apex' }, + { startIndex: 24, type: '' } + ] + }], + + [{ + line: 'x = /**/;', + tokens: [ + { startIndex: 0, type: 'identifier.apex' }, + { startIndex: 1, type: '' }, + { startIndex: 2, type: 'delimiter.apex' }, + { startIndex: 3, type: '' }, + { startIndex: 4, type: 'comment.apex' }, + { startIndex: 8, type: 'delimiter.apex' } + ] + }], + + [{ + line: 'x = /*/;', + tokens: [ + { startIndex: 0, type: 'identifier.apex' }, + { startIndex: 1, type: '' }, + { startIndex: 2, type: 'delimiter.apex' }, + { startIndex: 3, type: '' }, + { startIndex: 4, type: 'comment.apex' } + ] + }], + + // Comments - range comment, multiple lines + [{ + line: '/* start of multiline comment', + tokens: [ + { startIndex: 0, type: 'comment.apex' } + ] + }, { + line: 'a comment between without a star', + tokens: [ + { startIndex: 0, type: 'comment.apex' } + ] + }, { + line: 'end of multiline comment*/', + tokens: [ + { startIndex: 0, type: 'comment.apex' } + ] + }], + + [{ + line: 'int x = /* start a comment', + tokens: [ + { startIndex: 0, type: 'keyword.int.apex' }, + { startIndex: 3, type: '' }, + { startIndex: 4, type: 'identifier.apex' }, + { startIndex: 5, type: '' }, + { startIndex: 6, type: 'delimiter.apex' }, + { startIndex: 7, type: '' }, + { startIndex: 8, type: 'comment.apex' } + ] + }, { + line: ' a ', + tokens: [ + { startIndex: 0, type: 'comment.apex' } + ] + }, { + line: 'and end it */ 2;', + tokens: [ + { startIndex: 0, type: 'comment.apex' }, + { startIndex: 13, type: '' }, + { startIndex: 14, type: 'number.apex' }, + { startIndex: 15, type: 'delimiter.apex' } + ] + }], + + // Keywords + [{ + line: 'package test; class Program { static void main(String[] args) {} } }', + tokens: [ + { startIndex: 0, type: 'keyword.package.apex' }, + { startIndex: 7, type: '' }, + { startIndex: 8, type: 'identifier.apex' }, + { startIndex: 12, type: 'delimiter.apex' }, + { startIndex: 13, type: '' }, + { startIndex: 14, type: 'keyword.class.apex' }, + { startIndex: 19, type: '' }, + { startIndex: 20, type: 'identifier.apex' }, + { startIndex: 27, type: '' }, + { startIndex: 28, type: 'delimiter.curly.apex' }, + { startIndex: 29, type: '' }, + { startIndex: 30, type: 'keyword.static.apex' }, + { startIndex: 36, type: '' }, + { startIndex: 37, type: 'keyword.void.apex' }, + { startIndex: 41, type: '' }, + { startIndex: 42, type: 'identifier.apex' }, + { startIndex: 46, type: 'delimiter.parenthesis.apex' }, + { startIndex: 47, type: 'identifier.apex' }, + { startIndex: 53, type: 'delimiter.square.apex' }, + { startIndex: 55, type: '' }, + { startIndex: 56, type: 'identifier.apex' }, + { startIndex: 60, type: 'delimiter.parenthesis.apex' }, + { startIndex: 61, type: '' }, + { startIndex: 62, type: 'delimiter.curly.apex' }, + { startIndex: 64, type: '' }, + { startIndex: 65, type: 'delimiter.curly.apex' }, + { startIndex: 66, type: '' }, + { startIndex: 67, type: 'delimiter.curly.apex' } + ] + }], + + // Numbers + [{ + line: '0', + tokens: [ + { startIndex: 0, type: 'number.apex' } + ] + }], + + [{ + line: '0.10', + tokens: [ + { startIndex: 0, type: 'number.float.apex' } + ] + }], + + [{ + line: '0x', + tokens: [ + { startIndex: 0, type: 'number.apex' }, + { startIndex: 1, type: 'identifier.apex' } + ] + }], + + [{ + line: '0x123', + tokens: [ + { startIndex: 0, type: 'number.hex.apex' } + ] + }], + + [{ + line: '0x5_2', + tokens: [ + { startIndex: 0, type: 'number.hex.apex' } + ] + }], + + [{ + line: '023L', + tokens: [ + { startIndex: 0, type: 'number.octal.apex' } + ] + }], + + [{ + line: '0123l', + tokens: [ + { startIndex: 0, type: 'number.octal.apex' } + ] + }], + + [{ + line: '05_2', + tokens: [ + { startIndex: 0, type: 'number.octal.apex' } + ] + }], + + [{ + line: '0b1010_0101', + tokens: [ + { startIndex: 0, type: 'number.binary.apex' } + ] + }], + + [{ + line: '0B001', + tokens: [ + { startIndex: 0, type: 'number.binary.apex' } + ] + }], + + [{ + line: '10e3', + tokens: [ + { startIndex: 0, type: 'number.float.apex' } + ] + }], + + [{ + line: '10f', + tokens: [ + { startIndex: 0, type: 'number.float.apex' } + ] + }], + + [{ + line: '23.5', + tokens: [ + { startIndex: 0, type: 'number.float.apex' } + ] + }], + + [{ + line: '23.5e3', + tokens: [ + { startIndex: 0, type: 'number.float.apex' } + ] + }], + + [{ + line: '23.5e-3', + tokens: [ + { startIndex: 0, type: 'number.float.apex' } + ] + }], + + [{ + line: '23.5E3', + tokens: [ + { startIndex: 0, type: 'number.float.apex' } + ] + }], + + [{ + line: '23.5E-3', + tokens: [ + { startIndex: 0, type: 'number.float.apex' } + ] + }], + + [{ + line: '23.5F', + tokens: [ + { startIndex: 0, type: 'number.float.apex' } + ] + }], + + [{ + line: '23.5f', + tokens: [ + { startIndex: 0, type: 'number.float.apex' } + ] + }], + + [{ + line: '23.5D', + tokens: [ + { startIndex: 0, type: 'number.float.apex' } + ] + }], + + [{ + line: '23.5d', + tokens: [ + { startIndex: 0, type: 'number.float.apex' } + ] + }], + + [{ + line: '1.72E3D', + tokens: [ + { startIndex: 0, type: 'number.float.apex' } + ] + }], + + [{ + line: '1.72E3d', + tokens: [ + { startIndex: 0, type: 'number.float.apex' } + ] + }], + + [{ + line: '1.72E-3d', + tokens: [ + { startIndex: 0, type: 'number.float.apex' } + ] + }], + + [{ + line: '1.72e3D', + tokens: [ + { startIndex: 0, type: 'number.float.apex' } + ] + }], + + [{ + line: '1.72e3d', + tokens: [ + { startIndex: 0, type: 'number.float.apex' } + ] + }], + + [{ + line: '1.72e-3d', + tokens: [ + { startIndex: 0, type: 'number.float.apex' } + ] + }], + + [{ + line: '23L', + tokens: [ + { startIndex: 0, type: 'number.apex' } + ] + }], + + [{ + line: '23l', + tokens: [ + { startIndex: 0, type: 'number.apex' } + ] + }], + + [{ + line: '0_52', + tokens: [ + { startIndex: 0, type: 'number.apex' } + ] + }], + + [{ + line: '5_2', + tokens: [ + { startIndex: 0, type: 'number.apex' } + ] + }], + + [{ + line: '5_______2', + tokens: [ + { startIndex: 0, type: 'number.apex' } + ] + }], + + [{ + line: '3_.1415F', + tokens: [ + { startIndex: 0, type: 'number.apex' }, + { startIndex: 1, type: 'identifier.apex' }, + { startIndex: 2, type: 'delimiter.apex' }, + { startIndex: 3, type: 'number.float.apex' } + ] + }], + + [{ + line: '3._1415F', + tokens: [ + { startIndex: 0, type: 'number.apex' }, + { startIndex: 1, type: 'delimiter.apex' }, + { startIndex: 2, type: 'identifier.apex' } + ] + }], + + [{ + line: '999_99_9999_L', + tokens: [ + { startIndex: 0, type: 'number.apex' }, + { startIndex: 11, type: 'identifier.apex' } + ] + }], + + [{ + line: '52_', + tokens: [ + { startIndex: 0, type: 'number.apex' }, + { startIndex: 2, type: 'identifier.apex' } + ] + }], + + [{ + line: '0_x52', + tokens: [ + { startIndex: 0, type: 'number.apex' }, + { startIndex: 1, type: 'identifier.apex' } + ] + }], + + [{ + line: '0x_52', + tokens: [ + { startIndex: 0, type: 'number.apex' }, + { startIndex: 1, type: 'identifier.apex' } + ] + }], + + [{ + line: '0x52_', + tokens: [ + { startIndex: 0, type: 'number.hex.apex' }, + { startIndex: 4, type: 'identifier.apex' } + ] + }], + + [{ + line: '052_', + tokens: [ + { startIndex: 0, type: 'number.octal.apex' }, + { startIndex: 3, type: 'identifier.apex' } + ] + }], + + [{ + line: '23.5L', + tokens: [ + { startIndex: 0, type: 'number.float.apex' }, + { startIndex: 4, type: 'identifier.apex' } + ] + }], + + [{ + line: '0+0', + tokens: [ + { startIndex: 0, type: 'number.apex' }, + { startIndex: 1, type: 'delimiter.apex' }, + { startIndex: 2, type: 'number.apex' } + ] + }], + + [{ + line: '100+10', + tokens: [ + { startIndex: 0, type: 'number.apex' }, + { startIndex: 3, type: 'delimiter.apex' }, + { startIndex: 4, type: 'number.apex' } + ] + }], + + [{ + line: '0 + 0', + tokens: [ + { startIndex: 0, type: 'number.apex' }, + { startIndex: 1, type: '' }, + { startIndex: 2, type: 'delimiter.apex' }, + { startIndex: 3, type: '' }, + { startIndex: 4, type: 'number.apex' } + ] + }], + + // single line Strings + [{ + line: 'String s = "I\'m an Apex String";', + tokens: [ + { startIndex: 0, type: 'identifier.apex' }, + { startIndex: 6, type: '' }, + { startIndex: 7, type: 'identifier.apex' }, + { startIndex: 8, type: '' }, + { startIndex: 9, type: 'delimiter.apex' }, + { startIndex: 10, type: '' }, + { startIndex: 11, type: 'string.apex' }, + { startIndex: 31, type: 'delimiter.apex' } + ] + }], + + [{ + line: 'String s = "concatenated" + " String" ;', + tokens: [ + { startIndex: 0, type: 'identifier.apex' }, + { startIndex: 6, type: '' }, + { startIndex: 7, type: 'identifier.apex' }, + { startIndex: 8, type: '' }, + { startIndex: 9, type: 'delimiter.apex' }, + { startIndex: 10, type: '' }, + { startIndex: 11, type: 'string.apex' }, + { startIndex: 25, type: '' }, + { startIndex: 26, type: 'delimiter.apex' }, + { startIndex: 27, type: '' }, + { startIndex: 28, type: 'string.apex' }, + { startIndex: 37, type: '' }, + { startIndex: 38, type: 'delimiter.apex' } + ] + }], + + [{ + line: '"quote in a string"', + tokens: [ + { startIndex: 0, type: 'string.apex' } + ] + }], + + [{ + line: '"escaping \\"quotes\\" is cool"', + tokens: [ + { startIndex: 0, type: 'string.apex' }, + { startIndex: 10, type: 'string.escape.apex' }, + { startIndex: 12, type: 'string.apex' }, + { startIndex: 18, type: 'string.escape.apex' }, + { startIndex: 20, type: 'string.apex' } + ] + }], + + [{ + line: '"\\"', + tokens: [ + { startIndex: 0, type: 'string.invalid.apex' } + ] + }], + + // Annotations + [{ + line: '@', + tokens: [ + { startIndex: 0, type: '' } + ] + }], + + [{ + line: '@Override', + tokens: [ + { startIndex: 0, type: 'annotation.apex' } + ] + }], + + [{ + line: '@SuppressWarnings(value = "aString")', + tokens: [ + { startIndex: 0, type: 'annotation.apex' }, + { startIndex: 17, type: 'delimiter.parenthesis.apex' }, + { startIndex: 18, type: 'identifier.apex' }, + { startIndex: 23, type: '' }, + { startIndex: 24, type: 'delimiter.apex' }, + { startIndex: 25, type: '' }, + { startIndex: 26, type: 'string.apex' }, + { startIndex: 35, type: 'delimiter.parenthesis.apex' } + ] + }], + + [{ + line: '@ AnnotationWithKeywordAfter private', + tokens: [ + { startIndex: 0, type: 'annotation.apex' }, + { startIndex: 28, type: '' }, + { startIndex: 29, type: 'keyword.private.apex' } + ] + }] +]); + diff --git a/src/apex/apex.ts b/src/apex/apex.ts new file mode 100644 index 00000000..d4b6dc37 --- /dev/null +++ b/src/apex/apex.ts @@ -0,0 +1,151 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +'use strict'; + +import IRichLanguageConfiguration = monaco.languages.LanguageConfiguration; +import ILanguage = monaco.languages.IMonarchLanguage; + +export const conf: IRichLanguageConfiguration = { + // the default separators except `@$` + wordPattern: /(-?\d*\.\d\w*)|([^\`\~\!\#\%\^\&\*\(\)\-\=\+\[\{\]\}\\\|\;\:\'\"\,\.\<\>\/\?\s]+)/g, + comments: { + lineComment: '//', + blockComment: ['/*', '*/'], + }, + brackets: [ + ['{', '}'], + ['[', ']'], + ['(', ')'], + ], + autoClosingPairs: [ + { open: '{', close: '}' }, + { open: '[', close: ']' }, + { open: '(', close: ')' }, + { open: '"', close: '"' }, + { open: '\'', close: '\'' }, + ], + surroundingPairs: [ + { open: '{', close: '}' }, + { open: '[', close: ']' }, + { open: '(', close: ')' }, + { open: '"', close: '"' }, + { open: '\'', close: '\'' }, + { open: '<', close: '>' }, + ], + folding: { + markers: { + start: new RegExp("^\\s*//\\s*(?:(?:#?region\\b)|(?:))") + } + } +}; + +export const language = { + defaultToken: '', + tokenPostfix: '.apex', + + keywords: [ + 'abstract', 'continue', 'for', 'new', 'switch', 'assert', 'default', + 'goto', 'package', 'synchronized', 'boolean', 'do', 'if', 'private', + 'this', 'break', 'double', 'implements', 'protected', 'throw', 'byte', + 'else', 'import', 'public', 'throws', 'case', 'enum', 'instanceof', 'return', + 'transient', 'catch', 'extends', 'int', 'short', 'try', 'char', 'final', + 'interface', 'static', 'void', 'class', 'finally', 'long', 'strictfp', + 'volatile', 'const', 'float', 'native', 'super', 'while', 'true', 'false', + 'virtual', 'insert' + ], + + operators: [ + '=', '>', '<', '!', '~', '?', ':', + '==', '<=', '>=', '!=', '&&', '||', '++', '--', + '+', '-', '*', '/', '&', '|', '^', '%', '<<', + '>>', '>>>', '+=', '-=', '*=', '/=', '&=', '|=', + '^=', '%=', '<<=', '>>=', '>>>=' + ], + + // we include these common regular expressions + symbols: /[=>](?!@symbols)/, '@brackets'], + [/@symbols/, { + cases: { + '@operators': 'delimiter', + '@default': '' + } + }], + + // @ annotations. + [/@\s*[a-zA-Z_\$][\w\$]*/, 'annotation'], + + // numbers + [/(@digits)[eE]([\-+]?(@digits))?[fFdD]?/, 'number.float'], + [/(@digits)\.(@digits)([eE][\-+]?(@digits))?[fFdD]?/, 'number.float'], + [/0[xX](@hexdigits)[Ll]?/, 'number.hex'], + [/0(@octaldigits)[Ll]?/, 'number.octal'], + [/0[bB](@binarydigits)[Ll]?/, 'number.binary'], + [/(@digits)[fFdD]/, 'number.float'], + [/(@digits)[lL]?/, 'number'], + + // delimiter: after number because of .\d floats + [/[;,.]/, 'delimiter'], + + // strings + [/"([^"\\]|\\.)*$/, 'string.invalid' ], // non-teminated string + [/'([^'\\]|\\.)*$/, 'string.invalid' ], // non-teminated string + [/"/, 'string', '@string."' ], + [/'/, 'string', '@string.\'' ], + + + // characters + [/'[^\\']'/, 'string'], + [/(')(@escapes)(')/, ['string', 'string.escape', 'string']], + [/'/, 'string.invalid'] + ], + + whitespace: [ + [/[ \t\r\n]+/, ''], + [/\/\*/, 'comment', '@comment'], + [/\/\/.*$/, 'comment'], + ], + + comment: [ + [/[^\/*]+/, 'comment'], + // [/\/\*/, 'comment', '@push' ], // nested comment not allowed :-( + // [/\/\*/, 'comment.invalid' ], // this breaks block comments in the shape of /* //*/ + [/\*\//, 'comment', '@pop'], + [/[\/*]/, 'comment'] + ], + + string: [ + [/[^\\"']+/, 'string'], + [/@escapes/, 'string.escape'], + [/\\./, 'string.escape.invalid'], + [/["']/, { cases: { '$#==$S2' : { token: 'string', next: '@pop' }, + '@default': 'string' }} ] + ], + }, +}; From 62d143821a1227cd919ac54f9d4335f145b2b7cf Mon Sep 17 00:00:00 2001 From: olane Date: Fri, 10 Aug 2018 10:39:13 +0100 Subject: [PATCH 049/133] Register apex language and load tests --- src/monaco.contribution.ts | 1 + test/setup.js | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/monaco.contribution.ts b/src/monaco.contribution.ts index 6f96d356..ae9aad59 100644 --- a/src/monaco.contribution.ts +++ b/src/monaco.contribution.ts @@ -52,3 +52,4 @@ import './clojure/clojure.contribution'; import './shell/shell.contribution'; import './perl/perl.contribution'; import './azcli/azcli.contribution'; +import './apex/apex.contribution'; diff --git a/test/setup.js b/test/setup.js index 03ca7803..dca4ff44 100644 --- a/test/setup.js +++ b/test/setup.js @@ -72,7 +72,8 @@ define(['require'], function (require) { 'release/dev/clojure/clojure.test', 'release/dev/shell/shell.test', 'release/dev/perl/perl.test', - 'release/dev/azcli/azcli.test' + 'release/dev/azcli/azcli.test', + 'release/dev/apex/apex.test' ], function () { run(); // We can launch the tests! }, function (err) { From cd8c782c0ef62736d98f34ae6c7b1d0f76afcf0a Mon Sep 17 00:00:00 2001 From: olane Date: Fri, 10 Aug 2018 10:41:36 +0100 Subject: [PATCH 050/133] Bundle apex --- scripts/bundle.js | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/bundle.js b/scripts/bundle.js index 9bce8b1a..614d5c83 100644 --- a/scripts/bundle.js +++ b/scripts/bundle.js @@ -69,6 +69,7 @@ bundleOne('shell/shell'); bundleOne('perl/perl'), bundleOne('powerquery/powerquery') bundleOne('azcli/azcli') +bundleOne('apex/apex'); function bundleOne(moduleId, exclude) { requirejs.optimize({ From ca8e66588af7aa6bf942fec89cbce3db60503cbf Mon Sep 17 00:00:00 2001 From: olane Date: Fri, 10 Aug 2018 10:54:25 +0100 Subject: [PATCH 051/133] Add apex to readme list --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index a296122a..461d62bd 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,7 @@ Colorization and configuration supports for multiple languages for the Monaco Ed ![monaco-languages](https://cloud.githubusercontent.com/assets/5047891/15938606/1fd4bac6-2e74-11e6-8839-d455da8bc8a7.gif) +* apex * azcli * bat * clojure From 5557352259d3b089d4c9d7ae2f93dcbb94133648 Mon Sep 17 00:00:00 2001 From: olane Date: Fri, 10 Aug 2018 11:28:44 +0100 Subject: [PATCH 052/133] Merge keyword list with keyword list from SFDC documentation --- src/apex/apex.ts | 149 ++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 141 insertions(+), 8 deletions(-) diff --git a/src/apex/apex.ts b/src/apex/apex.ts index d4b6dc37..7848895b 100644 --- a/src/apex/apex.ts +++ b/src/apex/apex.ts @@ -48,14 +48,147 @@ export const language = { tokenPostfix: '.apex', keywords: [ - 'abstract', 'continue', 'for', 'new', 'switch', 'assert', 'default', - 'goto', 'package', 'synchronized', 'boolean', 'do', 'if', 'private', - 'this', 'break', 'double', 'implements', 'protected', 'throw', 'byte', - 'else', 'import', 'public', 'throws', 'case', 'enum', 'instanceof', 'return', - 'transient', 'catch', 'extends', 'int', 'short', 'try', 'char', 'final', - 'interface', 'static', 'void', 'class', 'finally', 'long', 'strictfp', - 'volatile', 'const', 'float', 'native', 'super', 'while', 'true', 'false', - 'virtual', 'insert' + 'abstract', + 'activate', + 'and', + 'any', + 'array', + 'as', + 'asc', + 'assert', + 'autonomous', + 'begin', + 'bigdecimal', + 'blob', + 'boolean', + 'break', + 'bulk', + 'by', + 'byte', + 'case', + 'cast', + 'catch', + 'char', + 'class', + 'collect', + 'commit', + 'const', + 'continue', + 'convertcurrency', + 'decimal', + 'default', + 'delete', + 'desc', + 'do', + 'double', + 'else', + 'end', + 'enum', + 'exception', + 'exit', + 'export', + 'extends', + 'false', + 'final', + 'finally', + 'float', + 'for', + 'from', + 'future', + 'global', + 'goto', + 'group', + 'having', + 'hint', + 'if', + 'implements', + 'import', + 'in', + 'inner', + 'insert', + 'instanceof', + 'int', + 'interface', + 'into', + 'join', + 'last_90_days', + 'last_month', + 'last_n_days', + 'last_week', + 'like', + 'limit', + 'list', + 'long', + 'loop', + 'map', + 'merge', + 'native', + 'new', + 'next_90_days', + 'next_month', + 'next_n_days', + 'next_week', + 'not', + 'null', + 'nulls', + 'number', + 'object', + 'of', + 'on', + 'or', + 'outer', + 'override', + 'package', + 'parallel', + 'pragma', + 'private', + 'protected', + 'public', + 'retrieve', + 'return', + 'returning', + 'rollback', + 'savepoint', + 'search', + 'select', + 'set', + 'short', + 'sort', + 'stat', + 'static', + 'strictfp', + 'super', + 'switch', + 'synchronized', + 'system', + 'testmethod', + 'then', + 'this', + 'this_month', + 'this_week', + 'throw', + 'throws', + 'today', + 'tolabel', + 'tomorrow', + 'transaction', + 'transient', + 'trigger', + 'true', + 'try', + 'type', + 'undelete', + 'update', + 'upsert', + 'using', + 'virtual', + 'void', + 'volatile', + 'webservice', + 'when', + 'where', + 'while', + 'yesterday' ], operators: [ From 7140444de90d044a4dd9233353e82180a353b244 Mon Sep 17 00:00:00 2001 From: olane Date: Fri, 10 Aug 2018 11:57:03 +0100 Subject: [PATCH 053/133] Assume identifiers starting with an uppercase letter are types --- src/apex/apex.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/apex/apex.ts b/src/apex/apex.ts index 7848895b..258172f7 100644 --- a/src/apex/apex.ts +++ b/src/apex/apex.ts @@ -211,13 +211,21 @@ export const language = { tokenizer: { root: [ // identifiers and keywords - [/[a-zA-Z_$][\w$]*/, { + [/[a-z_$][\w$]*/, { cases: { '@keywords': { token: 'keyword.$0' }, '@default': 'identifier' } }], + // assume that identifiers starting with an uppercase letter are types + [/[A-Z][\w\$]*/, { + cases: { + '@keywords': { token: 'keyword.$0' }, + '@default': 'type.identifier' + } + }], + // whitespace { include: '@whitespace' }, From 9498adec54d4b0dc2e2d457351b72f375ba307e0 Mon Sep 17 00:00:00 2001 From: olane Date: Fri, 10 Aug 2018 11:57:12 +0100 Subject: [PATCH 054/133] Update tests to reflect new assumption --- src/apex/apex.test.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/apex/apex.test.ts b/src/apex/apex.test.ts index 37ba8145..8511a03f 100644 --- a/src/apex/apex.test.ts +++ b/src/apex/apex.test.ts @@ -209,7 +209,7 @@ testTokenization('apex', [ { startIndex: 13, type: '' }, { startIndex: 14, type: 'keyword.class.apex' }, { startIndex: 19, type: '' }, - { startIndex: 20, type: 'identifier.apex' }, + { startIndex: 20, type: 'type.identifier.apex' }, { startIndex: 27, type: '' }, { startIndex: 28, type: 'delimiter.curly.apex' }, { startIndex: 29, type: '' }, @@ -219,7 +219,7 @@ testTokenization('apex', [ { startIndex: 41, type: '' }, { startIndex: 42, type: 'identifier.apex' }, { startIndex: 46, type: 'delimiter.parenthesis.apex' }, - { startIndex: 47, type: 'identifier.apex' }, + { startIndex: 47, type: 'type.identifier.apex' }, { startIndex: 53, type: 'delimiter.square.apex' }, { startIndex: 55, type: '' }, { startIndex: 56, type: 'identifier.apex' }, @@ -530,7 +530,7 @@ testTokenization('apex', [ line: '23.5L', tokens: [ { startIndex: 0, type: 'number.float.apex' }, - { startIndex: 4, type: 'identifier.apex' } + { startIndex: 4, type: 'type.identifier.apex' } ] }], @@ -567,7 +567,7 @@ testTokenization('apex', [ [{ line: 'String s = "I\'m an Apex String";', tokens: [ - { startIndex: 0, type: 'identifier.apex' }, + { startIndex: 0, type: 'type.identifier.apex' }, { startIndex: 6, type: '' }, { startIndex: 7, type: 'identifier.apex' }, { startIndex: 8, type: '' }, @@ -581,7 +581,7 @@ testTokenization('apex', [ [{ line: 'String s = "concatenated" + " String" ;', tokens: [ - { startIndex: 0, type: 'identifier.apex' }, + { startIndex: 0, type: 'type.identifier.apex' }, { startIndex: 6, type: '' }, { startIndex: 7, type: 'identifier.apex' }, { startIndex: 8, type: '' }, From e656c6a44918e303a88247ee7851ab3b013bd58e Mon Sep 17 00:00:00 2001 From: Alex Dima Date: Fri, 10 Aug 2018 13:02:53 +0200 Subject: [PATCH 055/133] Update dependencies --- package-lock.json | 44 +++++++++++++++++++++++++------------------- package.json | 6 +++--- 2 files changed, 28 insertions(+), 22 deletions(-) diff --git a/package-lock.json b/package-lock.json index 97edef61..d622e971 100644 --- a/package-lock.json +++ b/package-lock.json @@ -108,6 +108,12 @@ "delayed-stream": "1.0.0" } }, + "commander": { + "version": "2.16.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.16.0.tgz", + "integrity": "sha512-sVXqklSaotK9at437sFlFpyOcJonxe0yST/AG9DkQKUdIE6IqGIMv4SfAQSKaJbSdVEJYItASCrBiVQHq1HQew==", + "dev": true + }, "concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", @@ -567,9 +573,9 @@ } }, "monaco-editor-core": { - "version": "0.13.0", - "resolved": "https://registry.npmjs.org/monaco-editor-core/-/monaco-editor-core-0.13.0.tgz", - "integrity": "sha512-xIs6yzj9juIfaN8nFn/odwEa0Ux/R6nm4BupXsgcU/3LU0ZRhd5j56ep0Ta5G6YLF9orGf5t5vXAh5ailjbGmw==", + "version": "0.14.1", + "resolved": "https://registry.npmjs.org/monaco-editor-core/-/monaco-editor-core-0.14.1.tgz", + "integrity": "sha512-bWJuPbDEftxaN2bG+JZ29+aJhg0rmq+y6VmCUqPZpmw8bSevoYjuTcdLkt9BbNaGnwosAVy+vSktXgs/JW7OvQ==", "dev": true }, "monaco-plugin-helpers": { @@ -578,7 +584,15 @@ "integrity": "sha512-7kUx8dtd5qVNVgUARBRhnM8oftPglYwlINfigC4yGUiuzqtIN22u1tly8umiOCIPR0eFiBLjt6aN23oZh2QJgg==", "dev": true, "requires": { - "typescript": "2.7.2" + "typescript": "2.9.2" + }, + "dependencies": { + "typescript": { + "version": "2.9.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-2.9.2.tgz", + "integrity": "sha512-Gr4p6nFNaoufRIY4NMdpQRNmgxVIGMs4Fcu/ujdYk3nAZqk7supzBE9idmvfZIlH/Cuj//dvi+019qEue9lV0w==", + "dev": true + } } }, "ms": { @@ -773,27 +787,19 @@ "optional": true }, "typescript": { - "version": "2.7.2", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-2.7.2.tgz", - "integrity": "sha512-p5TCYZDAO0m4G344hD+wx/LATebLWZNkkh2asWUFqSsD2OrDNhbAHuSjobrmsUmdzjJjEeZVU9g1h3O6vpstnw==", + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.0.1.tgz", + "integrity": "sha512-zQIMOmC+372pC/CCVLqnQ0zSBiY7HHodU7mpQdjiZddek4GMj31I3dUJ7gAs9o65X7mnRma6OokOkc6f9jjfBg==", "dev": true }, "uglify-js": { - "version": "3.3.14", - "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.3.14.tgz", - "integrity": "sha512-OY8VPQU25q09gQRbC+Ekk3xgEVBmYFEfVcgS47ksjTiNht2LmLlUkWutyi38ZsDSToJHwbe76kDGwmD226Z2Fg==", + "version": "3.4.7", + "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.4.7.tgz", + "integrity": "sha512-J0M2i1mQA+ze3EdN9SBi751DNdAXmeFLfJrd/MDIkRc3G3Gbb9OPVSx7GIQvVwfWxQARcYV2DTxIkMyDAk3o9Q==", "dev": true, "requires": { - "commander": "2.14.1", + "commander": "2.16.0", "source-map": "0.6.1" - }, - "dependencies": { - "commander": { - "version": "2.14.1", - "resolved": "https://registry.npmjs.org/commander/-/commander-2.14.1.tgz", - "integrity": "sha512-+YR16o3rK53SmWHU3rEM3tPAh2rwb1yPcQX5irVn7mb0gXbwuCCrnkbV5+PBfETdfg1vui07nM6PCG1zndcjQw==", - "dev": true - } } }, "util-deprecate": { diff --git a/package.json b/package.json index 16a871de..6342d88d 100644 --- a/package.json +++ b/package.json @@ -20,10 +20,10 @@ "devDependencies": { "jsdom-no-contextify": "^3.1.0", "mocha": "^5.2.0", - "monaco-editor-core": "0.13.0", + "monaco-editor-core": "0.14.1", "monaco-plugin-helpers": "^1.0.2", "requirejs": "^2.3.5", - "typescript": "2.7.2", - "uglify-js": "^3.3.14" + "typescript": "3.0.1", + "uglify-js": "^3.4.7" } } From 178be30d4692ce2b3441c9bbdfbe22a95ff50dca Mon Sep 17 00:00:00 2001 From: Alex Dima Date: Fri, 10 Aug 2018 13:03:15 +0200 Subject: [PATCH 056/133] 1.4.1 --- package-lock.json | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index d622e971..31cf53f1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "monaco-languages", - "version": "1.4.0", + "version": "1.4.1", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 6342d88d..4afdb66d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "monaco-languages", - "version": "1.4.0", + "version": "1.4.1", "description": "Bundle of many languages for the Monaco Editor.", "scripts": { "compile": "mrmdir ./release && tsc -p ./src/tsconfig.json && tsc -p ./src/tsconfig.esm.json", From 40dfb97e568926bc35bdf7bb7692ba8173bbd1ce Mon Sep 17 00:00:00 2001 From: olane Date: Fri, 10 Aug 2018 12:37:20 +0100 Subject: [PATCH 057/133] Add support for apexdoc (based on java javadoc support) --- src/apex/apex.test.ts | 18 ++++++++++++++++++ src/apex/apex.ts | 8 ++++++++ 2 files changed, 26 insertions(+) diff --git a/src/apex/apex.test.ts b/src/apex/apex.test.ts index 8511a03f..1b25de2a 100644 --- a/src/apex/apex.test.ts +++ b/src/apex/apex.test.ts @@ -198,6 +198,24 @@ testTokenization('apex', [ ] }], + // Comments - apex doc, multiple lines + [{ + line: '/** start of Apex Doc', + tokens: [ + { startIndex: 0, type: 'comment.doc.apex' } + ] + }, { + line: 'a comment between without a star', + tokens: [ + { startIndex: 0, type: 'comment.doc.apex' } + ] + }, { + line: 'end of multiline comment*/', + tokens: [ + { startIndex: 0, type: 'comment.doc.apex' } + ] + }], + // Keywords [{ line: 'package test; class Program { static void main(String[] args) {} } }', diff --git a/src/apex/apex.ts b/src/apex/apex.ts index 258172f7..6773dea0 100644 --- a/src/apex/apex.ts +++ b/src/apex/apex.ts @@ -269,6 +269,7 @@ export const language = { whitespace: [ [/[ \t\r\n]+/, ''], + [/\/\*\*(?!\/)/, 'comment.doc', '@apexdoc'], [/\/\*/, 'comment', '@comment'], [/\/\/.*$/, 'comment'], ], @@ -281,6 +282,13 @@ export const language = { [/[\/*]/, 'comment'] ], + //Identical copy of comment above, except for the addition of .doc + apexdoc: [ + [/[^\/*]+/, 'comment.doc'], + [/\*\//, 'comment.doc', '@pop'], + [/[\/*]/, 'comment.doc'] + ], + string: [ [/[^\\"']+/, 'string'], [/@escapes/, 'string.escape'], From 1d66cf8412a6d4221d04090f3ba1787b220fb7fa Mon Sep 17 00:00:00 2001 From: olane Date: Fri, 10 Aug 2018 12:45:25 +0100 Subject: [PATCH 058/133] Remove hex, octal and binary numbers - apex doesn't support them --- src/apex/apex.test.ts | 65 ------------------------------------------- src/apex/apex.ts | 3 -- 2 files changed, 68 deletions(-) diff --git a/src/apex/apex.test.ts b/src/apex/apex.test.ts index 1b25de2a..9c6c9b8f 100644 --- a/src/apex/apex.test.ts +++ b/src/apex/apex.test.ts @@ -274,55 +274,6 @@ testTokenization('apex', [ ] }], - [{ - line: '0x123', - tokens: [ - { startIndex: 0, type: 'number.hex.apex' } - ] - }], - - [{ - line: '0x5_2', - tokens: [ - { startIndex: 0, type: 'number.hex.apex' } - ] - }], - - [{ - line: '023L', - tokens: [ - { startIndex: 0, type: 'number.octal.apex' } - ] - }], - - [{ - line: '0123l', - tokens: [ - { startIndex: 0, type: 'number.octal.apex' } - ] - }], - - [{ - line: '05_2', - tokens: [ - { startIndex: 0, type: 'number.octal.apex' } - ] - }], - - [{ - line: '0b1010_0101', - tokens: [ - { startIndex: 0, type: 'number.binary.apex' } - ] - }], - - [{ - line: '0B001', - tokens: [ - { startIndex: 0, type: 'number.binary.apex' } - ] - }], - [{ line: '10e3', tokens: [ @@ -528,22 +479,6 @@ testTokenization('apex', [ ] }], - [{ - line: '0x52_', - tokens: [ - { startIndex: 0, type: 'number.hex.apex' }, - { startIndex: 4, type: 'identifier.apex' } - ] - }], - - [{ - line: '052_', - tokens: [ - { startIndex: 0, type: 'number.octal.apex' }, - { startIndex: 3, type: 'identifier.apex' } - ] - }], - [{ line: '23.5L', tokens: [ diff --git a/src/apex/apex.ts b/src/apex/apex.ts index 6773dea0..dd96db1f 100644 --- a/src/apex/apex.ts +++ b/src/apex/apex.ts @@ -245,9 +245,6 @@ export const language = { // numbers [/(@digits)[eE]([\-+]?(@digits))?[fFdD]?/, 'number.float'], [/(@digits)\.(@digits)([eE][\-+]?(@digits))?[fFdD]?/, 'number.float'], - [/0[xX](@hexdigits)[Ll]?/, 'number.hex'], - [/0(@octaldigits)[Ll]?/, 'number.octal'], - [/0[bB](@binarydigits)[Ll]?/, 'number.binary'], [/(@digits)[fFdD]/, 'number.float'], [/(@digits)[lL]?/, 'number'], From c421273fca18b8c447c3ee18c37982e8a4d92ce4 Mon Sep 17 00:00:00 2001 From: olane Date: Fri, 10 Aug 2018 12:46:12 +0100 Subject: [PATCH 059/133] Apex also doesn't have a byte type --- src/apex/apex.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/apex/apex.ts b/src/apex/apex.ts index dd96db1f..c98515ea 100644 --- a/src/apex/apex.ts +++ b/src/apex/apex.ts @@ -64,7 +64,6 @@ export const language = { 'break', 'bulk', 'by', - 'byte', 'case', 'cast', 'catch', From acea7fd4a187b4101404f6626dadb42de36a1a1c Mon Sep 17 00:00:00 2001 From: olane Date: Fri, 10 Aug 2018 12:50:42 +0100 Subject: [PATCH 060/133] Add missing `get` keyword --- src/apex/apex.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/apex/apex.ts b/src/apex/apex.ts index c98515ea..b22fd9b4 100644 --- a/src/apex/apex.ts +++ b/src/apex/apex.ts @@ -94,6 +94,7 @@ export const language = { 'for', 'from', 'future', + 'get', 'global', 'goto', 'group', From a3d82924a904c2b09c0fcee486c452acca5dc5fb Mon Sep 17 00:00:00 2001 From: olane Date: Fri, 10 Aug 2018 13:17:45 +0100 Subject: [PATCH 061/133] Create case variations of the keywords Apex is case insensitive, but we can't make the highlighter case insensitive without breaking the heuristic which assumes that identifiers starting with an upper case letter are types. As a compromise, create the common case variations of the keywords and match on all of them. --- src/apex/apex.test.ts | 35 +++++ src/apex/apex.ts | 299 ++++++++++++++++++++++-------------------- 2 files changed, 191 insertions(+), 143 deletions(-) diff --git a/src/apex/apex.test.ts b/src/apex/apex.test.ts index 9c6c9b8f..5f9f6c8f 100644 --- a/src/apex/apex.test.ts +++ b/src/apex/apex.test.ts @@ -251,6 +251,41 @@ testTokenization('apex', [ ] }], + // Keywords with case variations + [{ + line: 'Package test; CLASS Program { Static void main(String[] args) {} } }', + tokens: [ + { startIndex: 0, type: 'keyword.Package.apex' }, + { startIndex: 7, type: '' }, + { startIndex: 8, type: 'identifier.apex' }, + { startIndex: 12, type: 'delimiter.apex' }, + { startIndex: 13, type: '' }, + { startIndex: 14, type: 'keyword.CLASS.apex' }, + { startIndex: 19, type: '' }, + { startIndex: 20, type: 'type.identifier.apex' }, + { startIndex: 27, type: '' }, + { startIndex: 28, type: 'delimiter.curly.apex' }, + { startIndex: 29, type: '' }, + { startIndex: 30, type: 'keyword.Static.apex' }, + { startIndex: 36, type: '' }, + { startIndex: 37, type: 'keyword.void.apex' }, + { startIndex: 41, type: '' }, + { startIndex: 42, type: 'identifier.apex' }, + { startIndex: 46, type: 'delimiter.parenthesis.apex' }, + { startIndex: 47, type: 'type.identifier.apex' }, + { startIndex: 53, type: 'delimiter.square.apex' }, + { startIndex: 55, type: '' }, + { startIndex: 56, type: 'identifier.apex' }, + { startIndex: 60, type: 'delimiter.parenthesis.apex' }, + { startIndex: 61, type: '' }, + { startIndex: 62, type: 'delimiter.curly.apex' }, + { startIndex: 64, type: '' }, + { startIndex: 65, type: 'delimiter.curly.apex' }, + { startIndex: 66, type: '' }, + { startIndex: 67, type: 'delimiter.curly.apex' } + ] + }], + // Numbers [{ line: '0', diff --git a/src/apex/apex.ts b/src/apex/apex.ts index b22fd9b4..c02eddd9 100644 --- a/src/apex/apex.ts +++ b/src/apex/apex.ts @@ -43,153 +43,166 @@ export const conf: IRichLanguageConfiguration = { } }; +const keywords = [ + 'abstract', + 'activate', + 'and', + 'any', + 'array', + 'as', + 'asc', + 'assert', + 'autonomous', + 'begin', + 'bigdecimal', + 'blob', + 'boolean', + 'break', + 'bulk', + 'by', + 'case', + 'cast', + 'catch', + 'char', + 'class', + 'collect', + 'commit', + 'const', + 'continue', + 'convertcurrency', + 'decimal', + 'default', + 'delete', + 'desc', + 'do', + 'double', + 'else', + 'end', + 'enum', + 'exception', + 'exit', + 'export', + 'extends', + 'false', + 'final', + 'finally', + 'float', + 'for', + 'from', + 'future', + 'get', + 'global', + 'goto', + 'group', + 'having', + 'hint', + 'if', + 'implements', + 'import', + 'in', + 'inner', + 'insert', + 'instanceof', + 'int', + 'interface', + 'into', + 'join', + 'last_90_days', + 'last_month', + 'last_n_days', + 'last_week', + 'like', + 'limit', + 'list', + 'long', + 'loop', + 'map', + 'merge', + 'native', + 'new', + 'next_90_days', + 'next_month', + 'next_n_days', + 'next_week', + 'not', + 'null', + 'nulls', + 'number', + 'object', + 'of', + 'on', + 'or', + 'outer', + 'override', + 'package', + 'parallel', + 'pragma', + 'private', + 'protected', + 'public', + 'retrieve', + 'return', + 'returning', + 'rollback', + 'savepoint', + 'search', + 'select', + 'set', + 'short', + 'sort', + 'stat', + 'static', + 'strictfp', + 'super', + 'switch', + 'synchronized', + 'system', + 'testmethod', + 'then', + 'this', + 'this_month', + 'this_week', + 'throw', + 'throws', + 'today', + 'tolabel', + 'tomorrow', + 'transaction', + 'transient', + 'trigger', + 'true', + 'try', + 'type', + 'undelete', + 'update', + 'upsert', + 'using', + 'virtual', + 'void', + 'volatile', + 'webservice', + 'when', + 'where', + 'while', + 'yesterday' +]; + +// create case variations of the keywords - apex is case insensitive, but we can't make the highlighter case insensitive +// because we use a heuristic to assume that identifiers starting with an upper case letter are types. +const uppercaseFirstLetter = (lowercase) => lowercase.charAt(0).toUpperCase() + lowercase.substr(1); + +let keywordsWithCaseVariations = []; +keywords.forEach(lowercase => { + keywordsWithCaseVariations.push(lowercase); + keywordsWithCaseVariations.push(lowercase.toUpperCase()); + keywordsWithCaseVariations.push(uppercaseFirstLetter(lowercase)); +}) + export const language = { defaultToken: '', tokenPostfix: '.apex', - keywords: [ - 'abstract', - 'activate', - 'and', - 'any', - 'array', - 'as', - 'asc', - 'assert', - 'autonomous', - 'begin', - 'bigdecimal', - 'blob', - 'boolean', - 'break', - 'bulk', - 'by', - 'case', - 'cast', - 'catch', - 'char', - 'class', - 'collect', - 'commit', - 'const', - 'continue', - 'convertcurrency', - 'decimal', - 'default', - 'delete', - 'desc', - 'do', - 'double', - 'else', - 'end', - 'enum', - 'exception', - 'exit', - 'export', - 'extends', - 'false', - 'final', - 'finally', - 'float', - 'for', - 'from', - 'future', - 'get', - 'global', - 'goto', - 'group', - 'having', - 'hint', - 'if', - 'implements', - 'import', - 'in', - 'inner', - 'insert', - 'instanceof', - 'int', - 'interface', - 'into', - 'join', - 'last_90_days', - 'last_month', - 'last_n_days', - 'last_week', - 'like', - 'limit', - 'list', - 'long', - 'loop', - 'map', - 'merge', - 'native', - 'new', - 'next_90_days', - 'next_month', - 'next_n_days', - 'next_week', - 'not', - 'null', - 'nulls', - 'number', - 'object', - 'of', - 'on', - 'or', - 'outer', - 'override', - 'package', - 'parallel', - 'pragma', - 'private', - 'protected', - 'public', - 'retrieve', - 'return', - 'returning', - 'rollback', - 'savepoint', - 'search', - 'select', - 'set', - 'short', - 'sort', - 'stat', - 'static', - 'strictfp', - 'super', - 'switch', - 'synchronized', - 'system', - 'testmethod', - 'then', - 'this', - 'this_month', - 'this_week', - 'throw', - 'throws', - 'today', - 'tolabel', - 'tomorrow', - 'transaction', - 'transient', - 'trigger', - 'true', - 'try', - 'type', - 'undelete', - 'update', - 'upsert', - 'using', - 'virtual', - 'void', - 'volatile', - 'webservice', - 'when', - 'where', - 'while', - 'yesterday' - ], + keywords: keywordsWithCaseVariations, operators: [ '=', '>', '<', '!', '~', '?', ':', From 159af65cc50b613e6020f42d19ed3849bed6d32b Mon Sep 17 00:00:00 2001 From: Alex Dima Date: Fri, 10 Aug 2018 15:43:12 +0200 Subject: [PATCH 062/133] Assume identifiers starting with upper case are type names --- src/typescript/typescript.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/typescript/typescript.ts b/src/typescript/typescript.ts index cba42190..2e1b9f7a 100644 --- a/src/typescript/typescript.ts +++ b/src/typescript/typescript.ts @@ -120,8 +120,8 @@ export const language = { '@default': 'identifier' } }], - // [/[A-Z][\w\$]*/, 'type.identifier' ], // to show class names nicely - [/[A-Z][\w\$]*/, 'identifier'], + [/[A-Z][\w\$]*/, 'type.identifier' ], // to show class names nicely + // [/[A-Z][\w\$]*/, 'identifier'], // whitespace { include: '@whitespace' }, From 701a5b458444c31d16953159550a98855062d26b Mon Sep 17 00:00:00 2001 From: Alex Dima Date: Fri, 10 Aug 2018 15:44:29 +0200 Subject: [PATCH 063/133] 1.5.0 --- package-lock.json | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index 31cf53f1..ebdf79b3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "monaco-languages", - "version": "1.4.1", + "version": "1.5.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 4afdb66d..91a4a2d8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "monaco-languages", - "version": "1.4.1", + "version": "1.5.0", "description": "Bundle of many languages for the Monaco Editor.", "scripts": { "compile": "mrmdir ./release && tsc -p ./src/tsconfig.json && tsc -p ./src/tsconfig.esm.json", From 711d51d9fcf9c8ac746f075f40cb54d23f0e96f6 Mon Sep 17 00:00:00 2001 From: Alex Dima Date: Fri, 17 Aug 2018 10:29:51 +0200 Subject: [PATCH 064/133] Fixes Microsoft/monaco-editor#1009 --- src/javascript/javascript.test.ts | 41 +++++++++++++++++++++++++++++++ src/javascript/javascript.ts | 2 ++ src/typescript/typescript.test.ts | 41 +++++++++++++++++++++++++++++++ src/typescript/typescript.ts | 29 +++++++++++++++++++++- 4 files changed, 112 insertions(+), 1 deletion(-) diff --git a/src/javascript/javascript.test.ts b/src/javascript/javascript.test.ts index e2033026..54b7effc 100644 --- a/src/javascript/javascript.test.ts +++ b/src/javascript/javascript.test.ts @@ -430,6 +430,47 @@ testTokenization('javascript', [ ] }], +[{ + line: 'x = /foo/.test(\'\')', + tokens: [ + { startIndex: 0, type: 'identifier.js' }, + { startIndex: 1, type: '' }, + { startIndex: 2, type: 'delimiter.js' }, + { startIndex: 3, type: '' }, + { startIndex: 4, type: 'regexp.js' }, + { startIndex: 9, type: 'delimiter.js' }, + { startIndex: 10, type: 'identifier.js' }, + { startIndex: 14, type: 'delimiter.parenthesis.js' }, + { startIndex: 15, type: 'string.js' }, + { startIndex: 17, type: 'delimiter.parenthesis.js' } + ] + }], + + [{ + line: 'x = 1 + f(2 / 3, /foo/)', + tokens: [ + { startIndex: 0, type: 'identifier.js' }, + { startIndex: 1, type: '' }, + { startIndex: 2, type: 'delimiter.js' }, + { startIndex: 3, type: '' }, + { startIndex: 4, type: 'number.js' }, + { startIndex: 5, type: '' }, + { startIndex: 6, type: 'delimiter.js' }, + { startIndex: 7, type: '' }, + { startIndex: 8, type: 'identifier.js' }, + { startIndex: 9, type: 'delimiter.parenthesis.js' }, + { startIndex: 10, type: 'number.js' }, + { startIndex: 11, type: '' }, + { startIndex: 12, type: 'delimiter.js' }, + { startIndex: 13, type: '' }, + { startIndex: 14, type: 'number.js' }, + { startIndex: 15, type: 'delimiter.js' }, + { startIndex: 16, type: '' }, + { startIndex: 17, type: 'regexp.js' }, + { startIndex: 22, type: 'delimiter.parenthesis.js' } + ] + }], + [{ line: 'a /ads/ b;', tokens: [ diff --git a/src/javascript/javascript.ts b/src/javascript/javascript.ts index 9b57ca9d..e635750c 100644 --- a/src/javascript/javascript.ts +++ b/src/javascript/javascript.ts @@ -37,5 +37,7 @@ export const language = { octaldigits: tsLanguage.octaldigits, binarydigits: tsLanguage.binarydigits, hexdigits: tsLanguage.hexdigits, + regexpctl: tsLanguage.regexpctl, + regexpesc: tsLanguage.regexpesc, tokenizer: tsLanguage.tokenizer, }; diff --git a/src/typescript/typescript.test.ts b/src/typescript/typescript.test.ts index 221a64f2..bc2f4a1a 100644 --- a/src/typescript/typescript.test.ts +++ b/src/typescript/typescript.test.ts @@ -430,6 +430,47 @@ testTokenization('typescript', [ ] }], + [{ + line: 'x = /foo/.test(\'\')', + tokens: [ + { startIndex: 0, type: 'identifier.ts' }, + { startIndex: 1, type: '' }, + { startIndex: 2, type: 'delimiter.ts' }, + { startIndex: 3, type: '' }, + { startIndex: 4, type: 'regexp.ts' }, + { startIndex: 9, type: 'delimiter.ts' }, + { startIndex: 10, type: 'identifier.ts' }, + { startIndex: 14, type: 'delimiter.parenthesis.ts' }, + { startIndex: 15, type: 'string.ts' }, + { startIndex: 17, type: 'delimiter.parenthesis.ts' } + ] + }], + + [{ + line: 'x = 1 + f(2 / 3, /foo/)', + tokens: [ + { startIndex: 0, type: 'identifier.ts' }, + { startIndex: 1, type: '' }, + { startIndex: 2, type: 'delimiter.ts' }, + { startIndex: 3, type: '' }, + { startIndex: 4, type: 'number.ts' }, + { startIndex: 5, type: '' }, + { startIndex: 6, type: 'delimiter.ts' }, + { startIndex: 7, type: '' }, + { startIndex: 8, type: 'identifier.ts' }, + { startIndex: 9, type: 'delimiter.parenthesis.ts' }, + { startIndex: 10, type: 'number.ts' }, + { startIndex: 11, type: '' }, + { startIndex: 12, type: 'delimiter.ts' }, + { startIndex: 13, type: '' }, + { startIndex: 14, type: 'number.ts' }, + { startIndex: 15, type: 'delimiter.ts' }, + { startIndex: 16, type: '' }, + { startIndex: 17, type: 'regexp.ts' }, + { startIndex: 22, type: 'delimiter.parenthesis.ts' } + ] + }], + [{ line: 'a /ads/ b;', tokens: [ diff --git a/src/typescript/typescript.ts b/src/typescript/typescript.ts index 2e1b9f7a..d22920e4 100644 --- a/src/typescript/typescript.ts +++ b/src/typescript/typescript.ts @@ -104,6 +104,9 @@ export const language = { binarydigits: /[0-1]+(_+[0-1]+)*/, hexdigits: /[[0-9a-fA-F]+(_+[0-9a-fA-F]+)*/, + regexpctl: /[(){}\[\]\$\^|\-*+?\.]/, + regexpesc: /\\(?:[bBdDfnrstvwWn0\\\/]|@regexpctl|c[A-Z]|x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4})/, + // The main tokenizer for our languages tokenizer: { root: [ @@ -120,12 +123,15 @@ export const language = { '@default': 'identifier' } }], - [/[A-Z][\w\$]*/, 'type.identifier' ], // to show class names nicely + [/[A-Z][\w\$]*/, 'type.identifier'], // to show class names nicely // [/[A-Z][\w\$]*/, 'identifier'], // whitespace { include: '@whitespace' }, + // regular expression: ensure it is terminated before beginning (otherwise it is an opeator) + [/\/(?=([^\\\/]|\\.)+\/([gimuy]*)(\s*)(\.|;|\/|,|\)|\]|\}|$))/, { token: 'regexp', bracket: '@open', next: '@regexp' }], + // delimiters and operators [/[()\[\]]/, '@brackets'], [/[<>](?!@symbols)/, '@brackets'], @@ -174,6 +180,27 @@ export const language = { [/[\/*]/, 'comment.doc'] ], + // We match regular expression quite precisely + regexp: [ + [/(\{)(\d+(?:,\d*)?)(\})/, ['regexp.escape.control', 'regexp.escape.control', 'regexp.escape.control']], + [/(\[)(\^?)(?=(?:[^\]\\\/]|\\.)+)/, ['regexp.escape.control', { token: 'regexp.escape.control', next: '@regexrange' }]], + [/(\()(\?:|\?=|\?!)/, ['regexp.escape.control', 'regexp.escape.control']], + [/[()]/, 'regexp.escape.control'], + [/@regexpctl/, 'regexp.escape.control'], + [/[^\\\/]/, 'regexp'], + [/@regexpesc/, 'regexp.escape'], + [/\\\./, 'regexp.invalid'], + ['/', { token: 'regexp', bracket: '@close' }, '@pop'], + ], + + regexrange: [ + [/-/, 'regexp.escape.control'], + [/\^/, 'regexp.invalid'], + [/@regexpesc/, 'regexp.escape'], + [/[^\]]/, 'regexp'], + [/\]/, '@brackets.regexp.escape.control', '@pop'], + ], + string_double: [ [/[^\\"]+/, 'string'], [/@escapes/, 'string.escape'], From d085b3bad82f8b59df390ce976adef0c83a9289e Mon Sep 17 00:00:00 2001 From: Alex Dima Date: Fri, 17 Aug 2018 10:30:02 +0200 Subject: [PATCH 065/133] 1.5.1 --- package-lock.json | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index ebdf79b3..4fb2a4da 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "monaco-languages", - "version": "1.5.0", + "version": "1.5.1", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 91a4a2d8..fc199b7e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "monaco-languages", - "version": "1.5.0", + "version": "1.5.1", "description": "Bundle of many languages for the Monaco Editor.", "scripts": { "compile": "mrmdir ./release && tsc -p ./src/tsconfig.json && tsc -p ./src/tsconfig.esm.json", From a3d4b50888f8ad49d5fc87d6add002b99809f4c9 Mon Sep 17 00:00:00 2001 From: Alex Dima Date: Mon, 20 Aug 2018 17:55:37 +0200 Subject: [PATCH 066/133] Remove usage of jsdom-no-contextify --- package-lock.json | 734 +++++++++++++++++++++++++--------------------- package.json | 2 +- test/all.js | 15 +- 3 files changed, 407 insertions(+), 344 deletions(-) diff --git a/package-lock.json b/package-lock.json index 4fb2a4da..428ff67e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4,11 +4,28 @@ "lockfileVersion": 1, "requires": true, "dependencies": { + "abab": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/abab/-/abab-2.0.0.tgz", + "integrity": "sha512-sY5AXXVZv4Y1VACTtR11UJCPHHudgY5i26Qj5TypE6DKlIApbwb5uqhXcJ5UUGbvZNRh7EeIoW+LrJumBsKp7w==" + }, + "acorn": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-5.7.1.tgz", + "integrity": "sha512-d+nbxBUGKg7Arpsvbnlq61mc12ek3EY8EQldM3GPAhWJ1UVxC6TDGbIvUMNU6obBX3i1+ptCIzV4vq0gFPEGVQ==" + }, + "acorn-globals": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/acorn-globals/-/acorn-globals-4.1.0.tgz", + "integrity": "sha512-KjZwU26uG3u6eZcfGbTULzFcsoz6pegNKtHPksZPOUsiKo5bUmiBPa38FuHZ/Eun+XYh/JCCkS9AS3Lu4McQOQ==", + "requires": { + "acorn": "5.7.1" + } + }, "ajv": { "version": "5.5.2", "resolved": "https://registry.npmjs.org/ajv/-/ajv-5.5.2.tgz", "integrity": "sha1-c7Xuyj+rZT49P5Qis0GtQiBdyWU=", - "dev": true, "requires": { "co": "4.6.0", "fast-deep-equal": "1.1.0", @@ -16,35 +33,43 @@ "json-schema-traverse": "0.3.1" } }, + "array-equal": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/array-equal/-/array-equal-1.0.0.tgz", + "integrity": "sha1-jCpe8kcv2ep0KwTHenUJO6J1fJM=" + }, "asn1": { - "version": "0.2.3", - "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.3.tgz", - "integrity": "sha1-2sh4dxPJlmhJ/IGAd36+nB3fO4Y=", - "dev": true + "version": "0.2.4", + "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.4.tgz", + "integrity": "sha512-jxwzQpLQjSmWXgwaCZE9Nz+glAG01yF1QnWgbhGwHI5A6FRIEY6IVqtHhIepHqI7/kyEyQEagBC5mBEFlIYvdg==", + "requires": { + "safer-buffer": "2.1.2" + } }, "assert-plus": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", - "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=", - "dev": true + "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=" + }, + "async-limiter": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/async-limiter/-/async-limiter-1.0.0.tgz", + "integrity": "sha512-jp/uFnooOiO+L211eZOoSyzpOITMXx1rBITauYykG3BRYPu8h0UcxsPNB04RR5vo4Tyz3+ay17tR6JVf9qzYWg==" }, "asynckit": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", - "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=", - "dev": true + "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=" }, "aws-sign2": { "version": "0.7.0", "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz", - "integrity": "sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg=", - "dev": true + "integrity": "sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg=" }, "aws4": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.6.0.tgz", - "integrity": "sha1-g+9cqGCysy5KDe7e6MdxudtXRx4=", - "dev": true + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.8.0.tgz", + "integrity": "sha512-ReZxvNHIOv88FlT7rxcXIIC0fPt4KZqZbOlivyWtXLt8ESx84zd3kMC6iK5jVeS2qt+g7ftS7ye4fi06X5rtRQ==" }, "balanced-match": { "version": "1.0.0", @@ -53,24 +78,14 @@ "dev": true }, "bcrypt-pbkdf": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.1.tgz", - "integrity": "sha1-Y7xdy2EzG5K8Bf1SiVPDNGKgb40=", - "dev": true, + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz", + "integrity": "sha1-pDAdOJtqQ/m2f/PKEaP2Y342Dp4=", "optional": true, "requires": { "tweetnacl": "0.14.5" } }, - "boom": { - "version": "4.3.1", - "resolved": "https://registry.npmjs.org/boom/-/boom-4.3.1.tgz", - "integrity": "sha1-T4owBctKfjiJ90kDD9JbluAdLjE=", - "dev": true, - "requires": { - "hoek": "4.2.1" - } - }, "brace-expansion": { "version": "1.1.11", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", @@ -81,29 +96,25 @@ "concat-map": "0.0.1" } }, - "browser-request": { - "version": "0.3.3", - "resolved": "https://registry.npmjs.org/browser-request/-/browser-request-0.3.3.tgz", - "integrity": "sha1-ns5bWsqJopkyJC4Yv5M975h2zBc=", - "dev": true + "browser-process-hrtime": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/browser-process-hrtime/-/browser-process-hrtime-0.1.2.tgz", + "integrity": "sha1-Ql1opY00R/AqBKqJQYf86K+Le44=" }, "caseless": { "version": "0.12.0", "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", - "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=", - "dev": true + "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=" }, "co": { "version": "4.6.0", "resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz", - "integrity": "sha1-bqa989hTrlTMuOR7+gvz+QMfsYQ=", - "dev": true + "integrity": "sha1-bqa989hTrlTMuOR7+gvz+QMfsYQ=" }, "combined-stream": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.6.tgz", "integrity": "sha1-cj599ugBrFYTETp+RFqbactjKBg=", - "dev": true, "requires": { "delayed-stream": "1.0.0" } @@ -123,163 +134,150 @@ "core-util-is": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", - "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=", - "dev": true - }, - "cryptiles": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/cryptiles/-/cryptiles-3.1.2.tgz", - "integrity": "sha1-qJ+7Ig9c4l7FboxKqKT9e1sNKf4=", - "dev": true, - "requires": { - "boom": "5.2.0" - }, - "dependencies": { - "boom": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/boom/-/boom-5.2.0.tgz", - "integrity": "sha512-Z5BTk6ZRe4tXXQlkqftmsAUANpXmuwlsF5Oov8ThoMbQRzdGTA1ngYRW160GexgOgjsFOKJz0LYhoNi+2AMBUw==", - "dev": true, - "requires": { - "hoek": "4.2.1" - } - } - } + "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=" }, "cssom": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/cssom/-/cssom-0.3.2.tgz", - "integrity": "sha1-uANhcMefB6kP8vFuIihAJ6JDhIs=", - "dev": true + "version": "0.3.4", + "resolved": "https://registry.npmjs.org/cssom/-/cssom-0.3.4.tgz", + "integrity": "sha512-+7prCSORpXNeR4/fUP3rL+TzqtiFfhMvTd7uEqMdgPvLPt4+uzFUeufx5RHjGTACCargg/DiEt/moMQmvnfkog==" }, "cssstyle": { - "version": "0.2.37", - "resolved": "https://registry.npmjs.org/cssstyle/-/cssstyle-0.2.37.tgz", - "integrity": "sha1-VBCXI0yyUTyDzu06zdwn/yeYfVQ=", - "dev": true, + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/cssstyle/-/cssstyle-1.1.1.tgz", + "integrity": "sha512-364AI1l/M5TYcFH83JnOH/pSqgaNnKmYgKrm0didZMGKWjQB60dymwWy1rKUgL3J1ffdq9xVi2yGLHdSjjSNog==", "requires": { - "cssom": "0.3.2" + "cssom": "0.3.4" } }, "dashdash": { "version": "1.14.1", "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", "integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA=", - "dev": true, "requires": { "assert-plus": "1.0.0" } }, - "delayed-stream": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", - "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=", - "dev": true - }, - "dom-serializer": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-0.1.0.tgz", - "integrity": "sha1-BzxpdUbOB4DOI75KKOKT5AvDDII=", - "dev": true, + "data-urls": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/data-urls/-/data-urls-1.0.1.tgz", + "integrity": "sha512-0HdcMZzK6ubMUnsMmQmG0AcLQPvbvb47R0+7CCZQCYgcd8OUWG91CG7sM6GoXgjz+WLl4ArFzHtBMy/QqSF4eg==", "requires": { - "domelementtype": "1.1.3", - "entities": "1.1.1" + "abab": "2.0.0", + "whatwg-mimetype": "2.1.0", + "whatwg-url": "7.0.0" }, "dependencies": { - "domelementtype": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-1.1.3.tgz", - "integrity": "sha1-vSh3PiZCiBrsUVRJJCmcXNgiGFs=", - "dev": true + "whatwg-url": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-7.0.0.tgz", + "integrity": "sha512-37GeVSIJ3kn1JgKyjiYNmSLP1yzbpb29jdmwBSgkD9h40/hyrR/OifpVUndji3tmwGgD8qpw7iQu3RSbCrBpsQ==", + "requires": { + "lodash.sortby": "4.7.0", + "tr46": "1.0.1", + "webidl-conversions": "4.0.2" + } } } }, - "domelementtype": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-1.3.0.tgz", - "integrity": "sha1-sXrtguirWeUt2cGbF1bg/BhyBMI=", - "dev": true + "deep-is": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.3.tgz", + "integrity": "sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ=" }, - "domhandler": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/domhandler/-/domhandler-2.4.1.tgz", - "integrity": "sha1-iS5HAAqZvlW783dP/qBWHYh5wlk=", - "dev": true, - "requires": { - "domelementtype": "1.3.0" - } + "delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=" }, - "domutils": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/domutils/-/domutils-1.7.0.tgz", - "integrity": "sha512-Lgd2XcJ/NjEw+7tFvfKxOzCYKZsdct5lczQ2ZaQY8Djz7pfAD3Gbp8ySJWtreII/vDlMVmxwa6pHmdxIYgttDg==", - "dev": true, + "domexception": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/domexception/-/domexception-1.0.1.tgz", + "integrity": "sha512-raigMkn7CJNNo6Ihro1fzG7wr3fHuYVytzquZKX5n0yizGsTcYgzdIUwj1X9pK0VvjeihV+XiclP+DjwbsSKug==", "requires": { - "dom-serializer": "0.1.0", - "domelementtype": "1.3.0" + "webidl-conversions": "4.0.2" } }, "ecc-jsbn": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.1.tgz", - "integrity": "sha1-D8c6ntXw1Tw4GTOYUj735UN3dQU=", - "dev": true, + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz", + "integrity": "sha1-OoOpBOVDUyh4dMVkt1SThoSamMk=", "optional": true, "requires": { - "jsbn": "0.1.1" + "jsbn": "0.1.1", + "safer-buffer": "2.1.2" } }, - "entities": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/entities/-/entities-1.1.1.tgz", - "integrity": "sha1-blwtClYhtdra7O+AuQ7ftc13cvA=", - "dev": true - }, "escape-string-regexp": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", "dev": true }, + "escodegen": { + "version": "1.11.0", + "resolved": "https://registry.npmjs.org/escodegen/-/escodegen-1.11.0.tgz", + "integrity": "sha512-IeMV45ReixHS53K/OmfKAIztN/igDHzTJUhZM3k1jMhIZWjk45SMwAtBsEXiJp3vSPmTcu6CXn7mDvFHRN66fw==", + "requires": { + "esprima": "3.1.3", + "estraverse": "4.2.0", + "esutils": "2.0.2", + "optionator": "0.8.2", + "source-map": "0.6.1" + } + }, + "esprima": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-3.1.3.tgz", + "integrity": "sha1-/cpRzuYTOJXjyI1TXOSdv/YqRjM=" + }, + "estraverse": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.2.0.tgz", + "integrity": "sha1-De4/7TH81GlhjOc0IJn8GvoL2xM=" + }, + "esutils": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.2.tgz", + "integrity": "sha1-Cr9PHKpbyx96nYrMbepPqqBLrJs=" + }, "extend": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.1.tgz", - "integrity": "sha1-p1Xqe8Gt/MWjHOfnYtuq3F5jZEQ=", - "dev": true + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", + "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==" }, "extsprintf": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz", - "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=", - "dev": true + "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=" }, "fast-deep-equal": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-1.1.0.tgz", - "integrity": "sha1-wFNHeBfIa1HaqFPIHgWbcz0CNhQ=", - "dev": true + "integrity": "sha1-wFNHeBfIa1HaqFPIHgWbcz0CNhQ=" }, "fast-json-stable-stringify": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz", - "integrity": "sha1-1RQsDK7msRifh9OnYREGT4bIu/I=", - "dev": true + "integrity": "sha1-1RQsDK7msRifh9OnYREGT4bIu/I=" + }, + "fast-levenshtein": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", + "integrity": "sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=" }, "forever-agent": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", - "integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=", - "dev": true + "integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=" }, "form-data": { "version": "2.3.2", "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.2.tgz", "integrity": "sha1-SXBJi+YEwgwAXU9cI67NIda0kJk=", - "dev": true, "requires": { "asynckit": "0.4.0", "combined-stream": "1.0.6", - "mime-types": "2.1.18" + "mime-types": "2.1.19" } }, "fs.realpath": { @@ -292,7 +290,6 @@ "version": "0.1.7", "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", "integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=", - "dev": true, "requires": { "assert-plus": "1.0.0" } @@ -300,66 +297,47 @@ "har-schema": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz", - "integrity": "sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI=", - "dev": true + "integrity": "sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI=" }, "har-validator": { - "version": "5.0.3", - "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.0.3.tgz", - "integrity": "sha1-ukAsJmGU8VlW7xXg/PJCmT9qff0=", - "dev": true, + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.1.0.tgz", + "integrity": "sha512-+qnmNjI4OfH2ipQ9VQOw23bBd/ibtfbVdK2fYbY4acTDqKTW/YDp9McimZdDbG8iV9fZizUqQMD5xvriB146TA==", "requires": { "ajv": "5.5.2", "har-schema": "2.0.0" } }, - "hawk": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/hawk/-/hawk-6.0.2.tgz", - "integrity": "sha512-miowhl2+U7Qle4vdLqDdPt9m09K6yZhkLDTWGoUiUzrQCn+mHHSmfJgAyGaLRZbPmTqfFFjRV1QWCW0VWUJBbQ==", - "dev": true, - "requires": { - "boom": "4.3.1", - "cryptiles": "3.1.2", - "hoek": "4.2.1", - "sntp": "2.1.0" - } - }, "he": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/he/-/he-1.1.1.tgz", "integrity": "sha1-k0EP0hsAlzUVH4howvJx80J+I/0=", "dev": true }, - "hoek": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/hoek/-/hoek-4.2.1.tgz", - "integrity": "sha512-QLg82fGkfnJ/4iy1xZ81/9SIJiq1NGFUMGs6ParyjBZr6jW2Ufj/snDqTHixNlHdPNwN2RLVD0Pi3igeK9+JfA==", - "dev": true - }, - "htmlparser2": { - "version": "3.9.2", - "resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-3.9.2.tgz", - "integrity": "sha1-G9+HrMoPP55T+k/M6w9LTLsAszg=", - "dev": true, + "html-encoding-sniffer": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/html-encoding-sniffer/-/html-encoding-sniffer-1.0.2.tgz", + "integrity": "sha512-71lZziiDnsuabfdYiUeWdCVyKuqwWi23L8YeIgV9jSSZHCtb6wB1BKWooH7L3tn4/FuZJMVWyNaIDr4RGmaSYw==", "requires": { - "domelementtype": "1.3.0", - "domhandler": "2.4.1", - "domutils": "1.7.0", - "entities": "1.1.1", - "inherits": "2.0.3", - "readable-stream": "2.3.5" + "whatwg-encoding": "1.0.4" } }, "http-signature": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz", "integrity": "sha1-muzZJRFHcvPZW2WmCruPfBj7rOE=", - "dev": true, "requires": { "assert-plus": "1.0.0", "jsprim": "1.4.1", - "sshpk": "1.13.1" + "sshpk": "1.14.2" + } + }, + "iconv-lite": { + "version": "0.4.23", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.23.tgz", + "integrity": "sha512-neyTUVFtahjf0mB3dZT77u+8O0QB89jFdnBkd5P1JgYPbPaia3gXXOVL2fq8VyU2gMMD7SaN7QukTB/pmXYvDA==", + "requires": { + "safer-buffer": "2.1.2" } }, "inflight": { @@ -381,68 +359,71 @@ "is-typedarray": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", - "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=", - "dev": true - }, - "isarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", - "dev": true + "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=" }, "isstream": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", - "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=", - "dev": true + "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=" }, "jsbn": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=", - "dev": true, "optional": true }, - "jsdom-no-contextify": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/jsdom-no-contextify/-/jsdom-no-contextify-3.1.0.tgz", - "integrity": "sha1-DYvq9hDC/yOJT1Tfp/id0i/Q96s=", - "dev": true, - "requires": { - "browser-request": "0.3.3", - "cssom": "0.3.2", - "cssstyle": "0.2.37", - "htmlparser2": "3.9.2", - "nwmatcher": "1.4.3", - "parse5": "1.5.1", - "request": "2.85.0", - "xml-name-validator": "1.0.0", - "xmlhttprequest": "1.8.0" + "jsdom": { + "version": "11.12.0", + "resolved": "https://registry.npmjs.org/jsdom/-/jsdom-11.12.0.tgz", + "integrity": "sha512-y8Px43oyiBM13Zc1z780FrfNLJCXTL40EWlty/LXUtcjykRBNgLlCjWXpfSPBl2iv+N7koQN+dvqszHZgT/Fjw==", + "requires": { + "abab": "2.0.0", + "acorn": "5.7.1", + "acorn-globals": "4.1.0", + "array-equal": "1.0.0", + "cssom": "0.3.4", + "cssstyle": "1.1.1", + "data-urls": "1.0.1", + "domexception": "1.0.1", + "escodegen": "1.11.0", + "html-encoding-sniffer": "1.0.2", + "left-pad": "1.3.0", + "nwsapi": "2.0.8", + "parse5": "4.0.0", + "pn": "1.1.0", + "request": "2.88.0", + "request-promise-native": "1.0.5", + "sax": "1.2.4", + "symbol-tree": "3.2.2", + "tough-cookie": "2.4.3", + "w3c-hr-time": "1.0.1", + "webidl-conversions": "4.0.2", + "whatwg-encoding": "1.0.4", + "whatwg-mimetype": "2.1.0", + "whatwg-url": "6.5.0", + "ws": "5.2.2", + "xml-name-validator": "3.0.0" } }, "json-schema": { "version": "0.2.3", "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz", - "integrity": "sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM=", - "dev": true + "integrity": "sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM=" }, "json-schema-traverse": { "version": "0.3.1", "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.3.1.tgz", - "integrity": "sha1-NJptRMU6Ud6JtAgFxdXlm0F9M0A=", - "dev": true + "integrity": "sha1-NJptRMU6Ud6JtAgFxdXlm0F9M0A=" }, "json-stringify-safe": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", - "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=", - "dev": true + "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=" }, "jsprim": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz", "integrity": "sha1-MT5mvB5cwG5Di8G3SZwuXFastqI=", - "dev": true, "requires": { "assert-plus": "1.0.0", "extsprintf": "1.3.0", @@ -450,19 +431,41 @@ "verror": "1.10.0" } }, + "left-pad": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/left-pad/-/left-pad-1.3.0.tgz", + "integrity": "sha512-XI5MPzVNApjAyhQzphX8BkmKsKUxD4LdyK24iZeQGinBN9yTQT3bFlCBy/aVx2HrNcqQGsdot8ghrjyrvMCoEA==" + }, + "levn": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/levn/-/levn-0.3.0.tgz", + "integrity": "sha1-OwmSTt+fCDwEkP3UwLxEIeBHZO4=", + "requires": { + "prelude-ls": "1.1.2", + "type-check": "0.3.2" + } + }, + "lodash": { + "version": "4.17.10", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.10.tgz", + "integrity": "sha512-UejweD1pDoXu+AD825lWwp4ZGtSwgnpZxb3JDViD7StjQz+Nb/6l093lx4OQ0foGWNRoc19mWy7BzL+UAK2iVg==" + }, + "lodash.sortby": { + "version": "4.7.0", + "resolved": "https://registry.npmjs.org/lodash.sortby/-/lodash.sortby-4.7.0.tgz", + "integrity": "sha1-7dFMgk4sycHgsKG0K7UhBRakJDg=" + }, "mime-db": { - "version": "1.33.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.33.0.tgz", - "integrity": "sha512-BHJ/EKruNIqJf/QahvxwQZXKygOQ256myeN/Ew+THcAa5q+PjyTTMMeNQC4DZw5AwfvelsUrA6B67NKMqXDbzQ==", - "dev": true + "version": "1.35.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.35.0.tgz", + "integrity": "sha512-JWT/IcCTsB0Io3AhWUMjRqucrHSPsSf2xKLaRldJVULioggvkJvggZ3VXNNSRkCddE6D+BUI4HEIZIA2OjwIvg==" }, "mime-types": { - "version": "2.1.18", - "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.18.tgz", - "integrity": "sha512-lc/aahn+t4/SWV/qcmumYjymLsWfN3ELhpmVuUFjgsORruuZPVSwAQryq+HHGvO/SI2KVX26bx+En+zhM8g8hQ==", - "dev": true, + "version": "2.1.19", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.19.tgz", + "integrity": "sha512-P1tKYHVSZ6uFo26mtnve4HQFE3koh1UWVkp8YUC+ESBHe945xWSoXuHHiGarDqcEZ+whpCDnlNw5LON0kLo+sw==", "requires": { - "mime-db": "1.33.0" + "mime-db": "1.35.0" } }, "minimatch": { @@ -601,17 +604,15 @@ "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", "dev": true }, - "nwmatcher": { - "version": "1.4.3", - "resolved": "https://registry.npmjs.org/nwmatcher/-/nwmatcher-1.4.3.tgz", - "integrity": "sha512-IKdSTiDWCarf2JTS5e9e2+5tPZGdkRJ79XjYV0pzK8Q9BpsFyBq1RGKxzs7Q8UBushGw7m6TzVKz6fcY99iSWw==", - "dev": true + "nwsapi": { + "version": "2.0.8", + "resolved": "https://registry.npmjs.org/nwsapi/-/nwsapi-2.0.8.tgz", + "integrity": "sha512-7RZ+qbFGiVc6v14Y8DSZjPN1wZPOaMbiiP4tzf5eNuyOITAeOIA3cMhjuKUypVIqBgCSg1KaSyAv8Ocq/0ZJ1A==" }, "oauth-sign": { - "version": "0.8.2", - "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.8.2.tgz", - "integrity": "sha1-Rqarfwrq2N6unsBWV4C31O/rnUM=", - "dev": true + "version": "0.9.0", + "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz", + "integrity": "sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ==" }, "once": { "version": "1.4.0", @@ -622,11 +623,23 @@ "wrappy": "1.0.2" } }, + "optionator": { + "version": "0.8.2", + "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.8.2.tgz", + "integrity": "sha1-NkxeQJ0/TWMB1sC0wFu6UBgK62Q=", + "requires": { + "deep-is": "0.1.3", + "fast-levenshtein": "2.0.6", + "levn": "0.3.0", + "prelude-ls": "1.1.2", + "type-check": "0.3.2", + "wordwrap": "1.0.0" + } + }, "parse5": { - "version": "1.5.1", - "resolved": "https://registry.npmjs.org/parse5/-/parse5-1.5.1.tgz", - "integrity": "sha1-m387DeMr543CQBsXVzzK8Pb1nZQ=", - "dev": true + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/parse5/-/parse5-4.0.0.tgz", + "integrity": "sha512-VrZ7eOd3T1Fk4XWNXMgiGBK/z0MG48BWG2uQNU4I72fkQuKUTZpl+u9k+CxEG0twMVzSmXEEz12z5Fnw1jIQFA==" }, "path-is-absolute": { "version": "1.0.1", @@ -637,70 +650,76 @@ "performance-now": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", - "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=", - "dev": true + "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=" }, - "process-nextick-args": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.0.tgz", - "integrity": "sha512-MtEC1TqN0EU5nephaJ4rAtThHtC86dNN9qCuEhtshvpVBkAW5ZO7BASN9REnF9eoXGcRub+pFuKEpOHE+HbEMw==", - "dev": true + "pn": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/pn/-/pn-1.1.0.tgz", + "integrity": "sha512-2qHaIQr2VLRFoxe2nASzsV6ef4yOOH+Fi9FBOVH6cqeSgUnoyySPZkxzLuzd+RYOQTRpROA0ztTMqxROKSb/nA==" + }, + "prelude-ls": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.2.tgz", + "integrity": "sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ=" + }, + "psl": { + "version": "1.1.29", + "resolved": "https://registry.npmjs.org/psl/-/psl-1.1.29.tgz", + "integrity": "sha512-AeUmQ0oLN02flVHXWh9sSJF7mcdFq0ppid/JkErufc3hGIV/AMa8Fo9VgDo/cT2jFdOWoFvHp90qqBH54W+gjQ==" }, "punycode": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz", - "integrity": "sha1-wNWmOycYgArY4esPpSachN1BhF4=", - "dev": true + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", + "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==" }, "qs": { - "version": "6.5.1", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.1.tgz", - "integrity": "sha512-eRzhrN1WSINYCDCbrz796z37LOe3m5tmW7RQf6oBntukAG1nmovJvhnwHHRMAfeoItc1m2Hk02WER2aQ/iqs+A==", - "dev": true - }, - "readable-stream": { - "version": "2.3.5", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.5.tgz", - "integrity": "sha512-tK0yDhrkygt/knjowCUiWP9YdV7c5R+8cR0r/kt9ZhBU906Fs6RpQJCEilamRJj1Nx2rWI6LkW9gKqjTkshhEw==", - "dev": true, - "requires": { - "core-util-is": "1.0.2", - "inherits": "2.0.3", - "isarray": "1.0.0", - "process-nextick-args": "2.0.0", - "safe-buffer": "5.1.1", - "string_decoder": "1.0.3", - "util-deprecate": "1.0.2" - } + "version": "6.5.2", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz", + "integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==" }, "request": { - "version": "2.85.0", - "resolved": "https://registry.npmjs.org/request/-/request-2.85.0.tgz", - "integrity": "sha512-8H7Ehijd4js+s6wuVPLjwORxD4zeuyjYugprdOXlPSqaApmL/QOy+EB/beICHVCHkGMKNh5rvihb5ov+IDw4mg==", - "dev": true, + "version": "2.88.0", + "resolved": "https://registry.npmjs.org/request/-/request-2.88.0.tgz", + "integrity": "sha512-NAqBSrijGLZdM0WZNsInLJpkJokL72XYjUpnB0iwsRgxh7dB6COrHnTBNwN0E+lHDAJzu7kLAkDeY08z2/A0hg==", "requires": { "aws-sign2": "0.7.0", - "aws4": "1.6.0", + "aws4": "1.8.0", "caseless": "0.12.0", "combined-stream": "1.0.6", - "extend": "3.0.1", + "extend": "3.0.2", "forever-agent": "0.6.1", "form-data": "2.3.2", - "har-validator": "5.0.3", - "hawk": "6.0.2", + "har-validator": "5.1.0", "http-signature": "1.2.0", "is-typedarray": "1.0.0", "isstream": "0.1.2", "json-stringify-safe": "5.0.1", - "mime-types": "2.1.18", - "oauth-sign": "0.8.2", + "mime-types": "2.1.19", + "oauth-sign": "0.9.0", "performance-now": "2.1.0", - "qs": "6.5.1", - "safe-buffer": "5.1.1", - "stringstream": "0.0.5", - "tough-cookie": "2.3.4", + "qs": "6.5.2", + "safe-buffer": "5.1.2", + "tough-cookie": "2.4.3", "tunnel-agent": "0.6.0", - "uuid": "3.2.1" + "uuid": "3.3.2" + } + }, + "request-promise-core": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/request-promise-core/-/request-promise-core-1.1.1.tgz", + "integrity": "sha1-Pu4AssWqgyOc+wTFcA2jb4HNCLY=", + "requires": { + "lodash": "4.17.10" + } + }, + "request-promise-native": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/request-promise-native/-/request-promise-native-1.0.5.tgz", + "integrity": "sha1-UoF3D2jgyXGeUWP9P6tIIhX0/aU=", + "requires": { + "request-promise-core": "1.1.1", + "stealthy-require": "1.1.1", + "tough-cookie": "2.4.3" } }, "requirejs": { @@ -710,82 +729,97 @@ "dev": true }, "safe-buffer": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.1.tgz", - "integrity": "sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg==", - "dev": true + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" }, - "sntp": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/sntp/-/sntp-2.1.0.tgz", - "integrity": "sha512-FL1b58BDrqS3A11lJ0zEdnJ3UOKqVxawAkF3k7F0CVN7VQ34aZrV+G8BZ1WC9ZL7NyrwsW0oviwsWDgRuVYtJg==", - "dev": true, - "requires": { - "hoek": "4.2.1" - } + "safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" + }, + "sax": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz", + "integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==" }, "source-map": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", - "dev": true + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==" }, "sshpk": { - "version": "1.13.1", - "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.13.1.tgz", - "integrity": "sha1-US322mKHFEMW3EwY/hzx2UBzm+M=", - "dev": true, + "version": "1.14.2", + "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.14.2.tgz", + "integrity": "sha1-xvxhZIo9nE52T9P8306hBeSSupg=", "requires": { - "asn1": "0.2.3", + "asn1": "0.2.4", "assert-plus": "1.0.0", - "bcrypt-pbkdf": "1.0.1", + "bcrypt-pbkdf": "1.0.2", "dashdash": "1.14.1", - "ecc-jsbn": "0.1.1", + "ecc-jsbn": "0.1.2", "getpass": "0.1.7", "jsbn": "0.1.1", + "safer-buffer": "2.1.2", "tweetnacl": "0.14.5" } }, - "string_decoder": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.0.3.tgz", - "integrity": "sha512-4AH6Z5fzNNBcH+6XDMfA/BTt87skxqJlO0lAh3Dker5zThcAxG6mKz+iGu308UKoPPQ8Dcqx/4JhujzltRa+hQ==", - "dev": true, - "requires": { - "safe-buffer": "5.1.1" - } + "stealthy-require": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/stealthy-require/-/stealthy-require-1.1.1.tgz", + "integrity": "sha1-NbCYdbT/SfJqd35QmzCQoyJr8ks=" }, - "stringstream": { - "version": "0.0.5", - "resolved": "https://registry.npmjs.org/stringstream/-/stringstream-0.0.5.tgz", - "integrity": "sha1-TkhM1N5aC7vuGORjB3EKioFiGHg=", - "dev": true + "symbol-tree": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/symbol-tree/-/symbol-tree-3.2.2.tgz", + "integrity": "sha1-rifbOPZgp64uHDt9G8KQgZuFGeY=" }, "tough-cookie": { - "version": "2.3.4", - "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.3.4.tgz", - "integrity": "sha512-TZ6TTfI5NtZnuyy/Kecv+CnoROnyXn2DN97LontgQpCwsX2XyLYCC0ENhYkehSOwAp8rTQKc/NUIF7BkQ5rKLA==", - "dev": true, + "version": "2.4.3", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.4.3.tgz", + "integrity": "sha512-Q5srk/4vDM54WJsJio3XNn6K2sCG+CQ8G5Wz6bZhRZoAe/+TxjWB/GlFAnYEbkYVlON9FMk/fE3h2RLpPXo4lQ==", "requires": { + "psl": "1.1.29", "punycode": "1.4.1" + }, + "dependencies": { + "punycode": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz", + "integrity": "sha1-wNWmOycYgArY4esPpSachN1BhF4=" + } + } + }, + "tr46": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-1.0.1.tgz", + "integrity": "sha1-qLE/1r/SSJUZZ0zN5VujaTtwbQk=", + "requires": { + "punycode": "2.1.1" } }, "tunnel-agent": { "version": "0.6.0", "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", "integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=", - "dev": true, "requires": { - "safe-buffer": "5.1.1" + "safe-buffer": "5.1.2" } }, "tweetnacl": { "version": "0.14.5", "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=", - "dev": true, "optional": true }, + "type-check": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.3.2.tgz", + "integrity": "sha1-WITKtRLPHTVeP7eE8wgEsrUg23I=", + "requires": { + "prelude-ls": "1.1.2" + } + }, "typescript": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.0.1.tgz", @@ -802,46 +836,80 @@ "source-map": "0.6.1" } }, - "util-deprecate": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", - "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", - "dev": true - }, "uuid": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.2.1.tgz", - "integrity": "sha512-jZnMwlb9Iku/O3smGWvZhauCf6cvvpKi4BKRiliS3cxnI+Gz9j5MEpTz2UFuXiKPJocb7gnsLHwiS05ige5BEA==", - "dev": true + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.2.tgz", + "integrity": "sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA==" }, "verror": { "version": "1.10.0", "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", "integrity": "sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=", - "dev": true, "requires": { "assert-plus": "1.0.0", "core-util-is": "1.0.2", "extsprintf": "1.3.0" } }, + "w3c-hr-time": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/w3c-hr-time/-/w3c-hr-time-1.0.1.tgz", + "integrity": "sha1-gqwr/2PZUOqeMYmlimViX+3xkEU=", + "requires": { + "browser-process-hrtime": "0.1.2" + } + }, + "webidl-conversions": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-4.0.2.tgz", + "integrity": "sha512-YQ+BmxuTgd6UXZW3+ICGfyqRyHXVlD5GtQr5+qjiNW7bF0cqrzX500HVXPBOvgXb5YnzDd+h0zqyv61KUD7+Sg==" + }, + "whatwg-encoding": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/whatwg-encoding/-/whatwg-encoding-1.0.4.tgz", + "integrity": "sha512-vM9KWN6MP2mIHZ86ytcyIv7e8Cj3KTfO2nd2c8PFDqcI4bxFmQp83ibq4wadq7rL9l9sZV6o9B0LTt8ygGAAXg==", + "requires": { + "iconv-lite": "0.4.23" + } + }, + "whatwg-mimetype": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/whatwg-mimetype/-/whatwg-mimetype-2.1.0.tgz", + "integrity": "sha512-FKxhYLytBQiUKjkYteN71fAUA3g6KpNXoho1isLiLSB3N1G4F35Q5vUxWfKFhBwi5IWF27VE6WxhrnnC+m0Mew==" + }, + "whatwg-url": { + "version": "6.5.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-6.5.0.tgz", + "integrity": "sha512-rhRZRqx/TLJQWUpQ6bmrt2UV4f0HCQ463yQuONJqC6fO2VoEb1pTYddbe59SkYq87aoM5A3bdhMZiUiVws+fzQ==", + "requires": { + "lodash.sortby": "4.7.0", + "tr46": "1.0.1", + "webidl-conversions": "4.0.2" + } + }, + "wordwrap": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz", + "integrity": "sha1-J1hIEIkUVqQXHI0CJkQa3pDLyus=" + }, "wrappy": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", "dev": true }, - "xml-name-validator": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/xml-name-validator/-/xml-name-validator-1.0.0.tgz", - "integrity": "sha1-3Pgu4JIyKVHvjMG6WWycv9FKg/E=", - "dev": true + "ws": { + "version": "5.2.2", + "resolved": "https://registry.npmjs.org/ws/-/ws-5.2.2.tgz", + "integrity": "sha512-jaHFD6PFv6UgoIVda6qZllptQsMlDEJkTQcybzzXDYM1XO9Y8em691FGMPmM46WGyLU4z9KMgQN+qrux/nhlHA==", + "requires": { + "async-limiter": "1.0.0" + } }, - "xmlhttprequest": { - "version": "1.8.0", - "resolved": "https://registry.npmjs.org/xmlhttprequest/-/xmlhttprequest-1.8.0.tgz", - "integrity": "sha1-Z/4HXFwk/vOfnWX197f+dRcZaPw=", - "dev": true + "xml-name-validator": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/xml-name-validator/-/xml-name-validator-3.0.0.tgz", + "integrity": "sha512-A5CUptxDsvxKJEU3yO6DuWBSJz/qizqzJKOMIfUJHETbBw/sFaDxgd6fxm1ewUaM0jZ444Fc5vC5ROYurg/4Pw==" } } } diff --git a/package.json b/package.json index fc199b7e..6ad302ec 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,7 @@ "url": "https://github.com/Microsoft/monaco-languages/issues" }, "devDependencies": { - "jsdom-no-contextify": "^3.1.0", + "jsdom": "^11.12.0", "mocha": "^5.2.0", "monaco-editor-core": "0.14.1", "monaco-plugin-helpers": "^1.0.2", diff --git a/test/all.js b/test/all.js index ac92ab6d..1c2428b6 100644 --- a/test/all.js +++ b/test/all.js @@ -1,5 +1,5 @@ var requirejs = require("requirejs"); -var jsdom = require('jsdom-no-contextify'); +var jsdom = require('jsdom'); requirejs.config({ baseUrl: '', @@ -12,15 +12,10 @@ requirejs.config({ nodeRequire: require }); -global.document = jsdom.jsdom(''); -global.document.queryCommandSupported = function() {}; -global.self = global.window = global.document.parentWindow; -global.navigator = global.window.navigator; -global.window.require = requirejs; - -function MyWorker() {} -MyWorker.prototype.postMessage = function() {}; -global.Worker = MyWorker; +let tmp = new jsdom.JSDOM(''); +global.document = tmp.window.document; +global.navigator = tmp.window.navigator; +global.self = global; requirejs(['./test/setup'], function() { }, function(err) { From 383f172aeed273c8e62810a6bfcc78f2c3410850 Mon Sep 17 00:00:00 2001 From: Abdussalam Abdurrahman Date: Tue, 11 Sep 2018 11:37:56 -0700 Subject: [PATCH 067/133] [clojure] Add IntelliJ IDEA project directory/file to .gitignore. --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index 79b9535b..64fd3c52 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,4 @@ +/.idea/ +/*.iml /node_modules/ /release/ From b276d3ea837a06d2e3ba67a4637710be58a8fbb7 Mon Sep 17 00:00:00 2001 From: Abdussalam Abdurrahman Date: Tue, 11 Sep 2018 15:53:17 -0700 Subject: [PATCH 068/133] [clojure] Sort the test suites by file name. --- test/setup.js | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/test/setup.js b/test/setup.js index dca4ff44..fe8c8534 100644 --- a/test/setup.js +++ b/test/setup.js @@ -21,59 +21,59 @@ define('vs/nls', [], { } }); -define(['require'], function (require) { +define(['require'], function () { requirejs([ 'vs/editor/editor.main' ], function () { requirejs([ + 'release/dev/apex/apex.test', + 'release/dev/azcli/azcli.test', 'release/dev/bat/bat.test', - 'release/dev/css/css.test', + 'release/dev/clojure/clojure.test', 'release/dev/coffee/coffee.test', 'release/dev/cpp/cpp.test', 'release/dev/csharp/csharp.test', + 'release/dev/csp/csp.test', + 'release/dev/css/css.test', 'release/dev/dockerfile/dockerfile.test', 'release/dev/fsharp/fsharp.test', 'release/dev/go/go.test', 'release/dev/handlebars/handlebars.test', 'release/dev/html/html.test', - 'release/dev/pug/pug.test', 'release/dev/java/java.test', 'release/dev/javascript/javascript.test', 'release/dev/less/less.test', 'release/dev/lua/lua.test', 'release/dev/markdown/markdown.test', 'release/dev/msdax/msdax.test', + 'release/dev/mysql/mysql.test', 'release/dev/objective-c/objective-c.test', + 'release/dev/perl/perl.test', + 'release/dev/pgsql/pgsql.test', 'release/dev/php/php.test', 'release/dev/postiats/postiats.test', 'release/dev/powerquery/powerquery.test', 'release/dev/powershell/powershell.test', + 'release/dev/pug/pug.test', 'release/dev/python/python.test', 'release/dev/r/r.test', 'release/dev/razor/razor.test', + 'release/dev/redis/redis.test', + 'release/dev/redshift/redshift.test', 'release/dev/ruby/ruby.test', 'release/dev/rust/rust.test', + 'release/dev/sb/sb.test', + 'release/dev/scheme/scheme.test', 'release/dev/scss/scss.test', - 'release/dev/swift/swift.test', - 'release/dev/sql/sql.test', - 'release/dev/vb/vb.test', - 'release/dev/xml/xml.test', - 'release/dev/yaml/yaml.test', + 'release/dev/shell/shell.test', 'release/dev/solidity/solidity.test', - 'release/dev/sb/sb.test', - 'release/dev/mysql/mysql.test', - 'release/dev/pgsql/pgsql.test', - 'release/dev/redshift/redshift.test', - 'release/dev/redis/redis.test', - 'release/dev/csp/csp.test', + 'release/dev/sql/sql.test', 'release/dev/st/st.test', - 'release/dev/scheme/scheme.test', + 'release/dev/swift/swift.test', 'release/dev/typescript/typescript.test', - 'release/dev/clojure/clojure.test', - 'release/dev/shell/shell.test', - 'release/dev/perl/perl.test', - 'release/dev/azcli/azcli.test', - 'release/dev/apex/apex.test' + 'release/dev/vb/vb.test', + 'release/dev/xml/xml.test', + 'release/dev/yaml/yaml.test' ], function () { run(); // We can launch the tests! }, function (err) { From 073f212f632b7b3f9117e983c2b6cfdc99ceaba9 Mon Sep 17 00:00:00 2001 From: Abdussalam Abdurrahman Date: Tue, 11 Sep 2018 18:56:01 -0700 Subject: [PATCH 069/133] [clojure] Improve Clojure syntax highlighting. This commit: - Updates the keyword list with public symbols from `clojure.core` for Clojure 1.9. - Improves syntax highlighting of symbols, strings, character literals, and number literals. - Adds rules for syntax highlighting Clojure keywords and reader macro characters. - Fixes an issue where forms following a single semicolon (`;`) are not marked as comments. - Fixes an issue where parts of multi-line strings were not correctly syntax highlighted. - Adds additional test coverage for tokenization code. --- src/clojure/clojure.test.ts | 837 +++++++++++++++++++++++++++++++--- src/clojure/clojure.ts | 864 +++++++++++++++++++++++++++++------- 2 files changed, 1469 insertions(+), 232 deletions(-) diff --git a/src/clojure/clojure.test.ts b/src/clojure/clojure.test.ts index e039e5ab..685c5540 100644 --- a/src/clojure/clojure.test.ts +++ b/src/clojure/clojure.test.ts @@ -5,86 +5,775 @@ 'use strict'; -import { testTokenization } from '../test/testRunner'; +import {ITestItem, testTokenization} from '../test/testRunner'; -testTokenization('clojure', [ - // Keywords - [ - { - line: 'defmacro some', - tokens: [ - { startIndex: 0, type: 'keyword.clj' }, - { startIndex: 8, type: 'white.clj' }, - { startIndex: 9, type: 'variable.clj' }, - ], - }, +const specialForms = [ + '.', + 'catch', + 'def', + 'do', + 'if', + 'monitor-enter', + 'monitor-exit', + 'new', + 'quote', + 'recur', + 'set!', + 'throw', + 'try', + 'var', +]; - { - line: 'comment "text comment"', - tokens: [ - { startIndex: 0, type: 'keyword.clj' }, - { startIndex: 7, type: 'white.clj' }, - { startIndex: 8, type: 'string.clj' }, - ], - }, - { - line: 'in-ns "user', - tokens: [ - { startIndex: 0, type: 'keyword.clj' }, - { startIndex: 5, type: 'white.clj' }, - { startIndex: 6, type: 'string.clj' }, - ], - }, - ], +const coreSymbols = [ + '*', + '*\'', + '*1', + '*2', + '*3', + '*agent*', + '*allow-unresolved-vars*', + '*assert*', + '*clojure-version*', + '*command-line-args*', + '*compile-files*', + '*compile-path*', + '*compiler-options*', + '*data-readers*', + '*default-data-reader-fn*', + '*e', + '*err*', + '*file*', + '*flush-on-newline*', + '*fn-loader*', + '*in*', + '*math-context*', + '*ns*', + '*out*', + '*print-dup*', + '*print-length*', + '*print-level*', + '*print-meta*', + '*print-namespace-maps*', + '*print-readably*', + '*read-eval*', + '*reader-resolver*', + '*source-path*', + '*suppress-read*', + '*unchecked-math*', + '*use-context-classloader*', + '*verbose-defrecords*', + '*warn-on-reflection*', + '+', + '+\'', + '-', + '-\'', + '->', + '->>', + '->ArrayChunk', + '->Eduction', + '->Vec', + '->VecNode', + '->VecSeq', + '-cache-protocol-fn', + '-reset-methods', + '..', + '/', + '<', + '<=', + '=', + '==', + '>', + '>=', + 'EMPTY-NODE', + 'Inst', + 'StackTraceElement->vec', + 'Throwable->map', + 'accessor', + 'aclone', + 'add-classpath', + 'add-watch', + 'agent', + 'agent-error', + 'agent-errors', + 'aget', + 'alength', + 'alias', + 'all-ns', + 'alter', + 'alter-meta!', + 'alter-var-root', + 'amap', + 'ancestors', + 'and', + 'any?', + 'apply', + 'areduce', + 'array-map', + 'as->', + 'aset', + 'aset-boolean', + 'aset-byte', + 'aset-char', + 'aset-double', + 'aset-float', + 'aset-int', + 'aset-long', + 'aset-short', + 'assert', + 'assoc', + 'assoc!', + 'assoc-in', + 'associative?', + 'atom', + 'await', + 'await-for', + 'await1', + 'bases', + 'bean', + 'bigdec', + 'bigint', + 'biginteger', + 'binding', + 'bit-and', + 'bit-and-not', + 'bit-clear', + 'bit-flip', + 'bit-not', + 'bit-or', + 'bit-set', + 'bit-shift-left', + 'bit-shift-right', + 'bit-test', + 'bit-xor', + 'boolean', + 'boolean-array', + 'boolean?', + 'booleans', + 'bound-fn', + 'bound-fn*', + 'bound?', + 'bounded-count', + 'butlast', + 'byte', + 'byte-array', + 'bytes', + 'bytes?', + 'case', + 'cast', + 'cat', + 'char', + 'char-array', + 'char-escape-string', + 'char-name-string', + 'char?', + 'chars', + 'chunk', + 'chunk-append', + 'chunk-buffer', + 'chunk-cons', + 'chunk-first', + 'chunk-next', + 'chunk-rest', + 'chunked-seq?', + 'class', + 'class?', + 'clear-agent-errors', + 'clojure-version', + 'coll?', + 'comment', + 'commute', + 'comp', + 'comparator', + 'compare', + 'compare-and-set!', + 'compile', + 'complement', + 'completing', + 'concat', + 'cond', + 'cond->', + 'cond->>', + 'condp', + 'conj', + 'conj!', + 'cons', + 'constantly', + 'construct-proxy', + 'contains?', + 'count', + 'counted?', + 'create-ns', + 'create-struct', + 'cycle', + 'dec', + 'dec\'', + 'decimal?', + 'declare', + 'dedupe', + 'default-data-readers', + 'definline', + 'definterface', + 'defmacro', + 'defmethod', + 'defmulti', + 'defn', + 'defn-', + 'defonce', + 'defprotocol', + 'defrecord', + 'defstruct', + 'deftype', + 'delay', + 'delay?', + 'deliver', + 'denominator', + 'deref', + 'derive', + 'descendants', + 'destructure', + 'disj', + 'disj!', + 'dissoc', + 'dissoc!', + 'distinct', + 'distinct?', + 'doall', + 'dorun', + 'doseq', + 'dosync', + 'dotimes', + 'doto', + 'double', + 'double-array', + 'double?', + 'doubles', + 'drop', + 'drop-last', + 'drop-while', + 'eduction', + 'empty', + 'empty?', + 'ensure', + 'ensure-reduced', + 'enumeration-seq', + 'error-handler', + 'error-mode', + 'eval', + 'even?', + 'every-pred', + 'every?', + 'ex-data', + 'ex-info', + 'extend', + 'extend-protocol', + 'extend-type', + 'extenders', + 'extends?', + 'false?', + 'ffirst', + 'file-seq', + 'filter', + 'filterv', + 'find', + 'find-keyword', + 'find-ns', + 'find-protocol-impl', + 'find-protocol-method', + 'find-var', + 'first', + 'flatten', + 'float', + 'float-array', + 'float?', + 'floats', + 'flush', + 'fn', + 'fn?', + 'fnext', + 'fnil', + 'for', + 'force', + 'format', + 'frequencies', + 'future', + 'future-call', + 'future-cancel', + 'future-cancelled?', + 'future-done?', + 'future?', + 'gen-class', + 'gen-interface', + 'gensym', + 'get', + 'get-in', + 'get-method', + 'get-proxy-class', + 'get-thread-bindings', + 'get-validator', + 'group-by', + 'halt-when', + 'hash', + 'hash-combine', + 'hash-map', + 'hash-ordered-coll', + 'hash-set', + 'hash-unordered-coll', + 'ident?', + 'identical?', + 'identity', + 'if-let', + 'if-not', + 'if-some', + 'ifn?', + 'import', + 'in-ns', + 'inc', + 'inc\'', + 'indexed?', + 'init-proxy', + 'inst-ms', + 'inst-ms*', + 'inst?', + 'instance?', + 'int', + 'int-array', + 'int?', + 'integer?', + 'interleave', + 'intern', + 'interpose', + 'into', + 'into-array', + 'ints', + 'io!', + 'isa?', + 'iterate', + 'iterator-seq', + 'juxt', + 'keep', + 'keep-indexed', + 'key', + 'keys', + 'keyword', + 'keyword?', + 'last', + 'lazy-cat', + 'lazy-seq', + 'let', + 'letfn', + 'line-seq', + 'list', + 'list*', + 'list?', + 'load', + 'load-file', + 'load-reader', + 'load-string', + 'loaded-libs', + 'locking', + 'long', + 'long-array', + 'longs', + 'loop', + 'macroexpand', + 'macroexpand-1', + 'make-array', + 'make-hierarchy', + 'map', + 'map-entry?', + 'map-indexed', + 'map?', + 'mapcat', + 'mapv', + 'max', + 'max-key', + 'memfn', + 'memoize', + 'merge', + 'merge-with', + 'meta', + 'method-sig', + 'methods', + 'min', + 'min-key', + 'mix-collection-hash', + 'mod', + 'munge', + 'name', + 'namespace', + 'namespace-munge', + 'nat-int?', + 'neg-int?', + 'neg?', + 'newline', + 'next', + 'nfirst', + 'nil?', + 'nnext', + 'not', + 'not-any?', + 'not-empty', + 'not-every?', + 'not=', + 'ns', + 'ns-aliases', + 'ns-imports', + 'ns-interns', + 'ns-map', + 'ns-name', + 'ns-publics', + 'ns-refers', + 'ns-resolve', + 'ns-unalias', + 'ns-unmap', + 'nth', + 'nthnext', + 'nthrest', + 'num', + 'number?', + 'numerator', + 'object-array', + 'odd?', + 'or', + 'parents', + 'partial', + 'partition', + 'partition-all', + 'partition-by', + 'pcalls', + 'peek', + 'persistent!', + 'pmap', + 'pop', + 'pop!', + 'pop-thread-bindings', + 'pos-int?', + 'pos?', + 'pr', + 'pr-str', + 'prefer-method', + 'prefers', + 'primitives-classnames', + 'print', + 'print-ctor', + 'print-dup', + 'print-method', + 'print-simple', + 'print-str', + 'printf', + 'println', + 'println-str', + 'prn', + 'prn-str', + 'promise', + 'proxy', + 'proxy-call-with-super', + 'proxy-mappings', + 'proxy-name', + 'proxy-super', + 'push-thread-bindings', + 'pvalues', + 'qualified-ident?', + 'qualified-keyword?', + 'qualified-symbol?', + 'quot', + 'rand', + 'rand-int', + 'rand-nth', + 'random-sample', + 'range', + 'ratio?', + 'rational?', + 'rationalize', + 're-find', + 're-groups', + 're-matcher', + 're-matches', + 're-pattern', + 're-seq', + 'read', + 'read-line', + 'read-string', + 'reader-conditional', + 'reader-conditional?', + 'realized?', + 'record?', + 'reduce', + 'reduce-kv', + 'reduced', + 'reduced?', + 'reductions', + 'ref', + 'ref-history-count', + 'ref-max-history', + 'ref-min-history', + 'ref-set', + 'refer', + 'refer-clojure', + 'reify', + 'release-pending-sends', + 'rem', + 'remove', + 'remove-all-methods', + 'remove-method', + 'remove-ns', + 'remove-watch', + 'repeat', + 'repeatedly', + 'replace', + 'replicate', + 'require', + 'reset!', + 'reset-meta!', + 'reset-vals!', + 'resolve', + 'rest', + 'restart-agent', + 'resultset-seq', + 'reverse', + 'reversible?', + 'rseq', + 'rsubseq', + 'run!', + 'satisfies?', + 'second', + 'select-keys', + 'send', + 'send-off', + 'send-via', + 'seq', + 'seq?', + 'seqable?', + 'seque', + 'sequence', + 'sequential?', + 'set', + 'set-agent-send-executor!', + 'set-agent-send-off-executor!', + 'set-error-handler!', + 'set-error-mode!', + 'set-validator!', + 'set?', + 'short', + 'short-array', + 'shorts', + 'shuffle', + 'shutdown-agents', + 'simple-ident?', + 'simple-keyword?', + 'simple-symbol?', + 'slurp', + 'some', + 'some->', + 'some->>', + 'some-fn', + 'some?', + 'sort', + 'sort-by', + 'sorted-map', + 'sorted-map-by', + 'sorted-set', + 'sorted-set-by', + 'sorted?', + 'special-symbol?', + 'spit', + 'split-at', + 'split-with', + 'str', + 'string?', + 'struct', + 'struct-map', + 'subs', + 'subseq', + 'subvec', + 'supers', + 'swap!', + 'swap-vals!', + 'symbol', + 'symbol?', + 'sync', + 'tagged-literal', + 'tagged-literal?', + 'take', + 'take-last', + 'take-nth', + 'take-while', + 'test', + 'the-ns', + 'thread-bound?', + 'time', + 'to-array', + 'to-array-2d', + 'trampoline', + 'transduce', + 'transient', + 'tree-seq', + 'true?', + 'type', + 'unchecked-add', + 'unchecked-add-int', + 'unchecked-byte', + 'unchecked-char', + 'unchecked-dec', + 'unchecked-dec-int', + 'unchecked-divide-int', + 'unchecked-double', + 'unchecked-float', + 'unchecked-inc', + 'unchecked-inc-int', + 'unchecked-int', + 'unchecked-long', + 'unchecked-multiply', + 'unchecked-multiply-int', + 'unchecked-negate', + 'unchecked-negate-int', + 'unchecked-remainder-int', + 'unchecked-short', + 'unchecked-subtract', + 'unchecked-subtract-int', + 'underive', + 'unquote', + 'unquote-splicing', + 'unreduced', + 'unsigned-bit-shift-right', + 'update', + 'update-in', + 'update-proxy', + 'uri?', + 'use', + 'uuid?', + 'val', + 'vals', + 'var-get', + 'var-set', + 'var?', + 'vary-meta', + 'vec', + 'vector', + 'vector-of', + 'vector?', + 'volatile!', + 'volatile?', + 'vreset!', + 'vswap!', + 'when', + 'when-first', + 'when-let', + 'when-not', + 'when-some', + 'while', + 'with-bindings', + 'with-bindings*', + 'with-in-str', + 'with-loading-context', + 'with-local-vars', + 'with-meta', + 'with-open', + 'with-out-str', + 'with-precision', + 'with-redefs', + 'with-redefs-fn', + 'xml-seq', + 'zero?', + 'zipmap', +]; - // comments - [ - { - line: ';; comment', - tokens: [{ startIndex: 0, type: 'comment.clj' }], - }, - ], +function createTestCases(specialForms: string[], type: string): ITestItem[] { + const testCases = []; - // strings - [ - { - line: '"\\n string "', + for (const specialForm of specialForms) { + testCases.push({ + line: `${specialForm}`, tokens: [ - { startIndex: 0, type: 'string.clj' }, - { startIndex: 1, type: 'string.escape.clj' }, - { startIndex: 3, type: 'string.clj' }, + {startIndex: 0, type: `${type}.clj`}, ], - }, - ], - [ - { - line: '" string \\', - tokens: [{ startIndex: 0, type: 'string.clj' }], - }, - { - line: 'multiline', - tokens: [{ startIndex: 0, type: 'string.clj' }], - }, - { - line: ' ', - tokens: [ - // previous line needs to be terminated with \ - { startIndex: 0, type: 'white.clj' }, - ], - }, - ], + }); + } + + return testCases; +} + +testTokenization('clojure', [ + // special forms + createTestCases(specialForms, 'keyword'), + + // core symbols + createTestCases(coreSymbols, 'keyword'), + + // atoms + createTestCases(['false', 'nil', 'true'], 'constant'), + + // keywords + createTestCases([':foo', '::bar', ':foo/bar', ':foo.bar/baz'], 'constant'), // numbers - [ - { - line: '1e2', - tokens: [{ startIndex: 0, type: 'number.float.clj' }], - }, - ], - [ - { - line: '0xff', - tokens: [{ startIndex: 0, type: 'number.hex.clj' }], - }, - ], + createTestCases([ + '42', '+42', '-421', + '42N', '+42N', '-42N', + '0.42', '+0.42', '-0.42', + '42M', '+42M', '-42M', + '42.42M', '+42.42M', '-42.42M', + '1/42', '+1/42', '-1/42', + '0x42af', '+0x42af', '-0x42af', + '0x42AF', '+0x42AF', '-0x42AF', + '1e2', '1e+2', '1e-2', + '+1e2', '+1e+2', '+1e-2', + '-1e2', '-1e+2', '-1e-2', + '-1.0e2', '-0.1e+2', '-1.01e-2', + '1E2', '1E+2', '1E-2', + '+1E2', '+1E+2', '+1E-2', + '-1E2', '-1E+2', '-1E-2', + '-1.0E2', '-0.1E+2', '-1.01E-2', + '2r101010', '+2r101010', '-2r101010', + '2r101010', '+2r101010', '-2r101010', + '8r52', '+8r52', '-8r52', + '36rhello', '+36rhello', '-36rhello', + '36rz', '+36rz', '-36rz', + '36rZ', '+36rZ', '-36rZ', + ], 'number'), + + // characters + createTestCases([ + '\\1', + '\\a', + '\\#', + '\\\\', + '\\\"', + '\\(', + '\\A', + '\\backspace', + '\\formfeed', + '\\newline', + '\\space', + '\\return', + '\\tab', + '\\u1000', + '\\uAaAa', + '\\u9F9F' + ], 'string'), + + // strings + createTestCases([ + '\"I\'m a little teapot.\"', + '\"I\'m a \\\"little\\\" teapot.\"', + '\"I\'m', // this is + 'a little', // a multi-line + 'teapot.\"' // string + ], 'string'), + + // comments + createTestCases([ + '; this is an in-line comment.', + ';; this is a line comment.', + ], 'comment'), + + // reader macro characters + createTestCases([ + '#', + '@', + '^', + '`', + '~', + "'", + ], 'meta') ]); diff --git a/src/clojure/clojure.ts b/src/clojure/clojure.ts index 3e099e98..40a52298 100644 --- a/src/clojure/clojure.ts +++ b/src/clojure/clojure.ts @@ -13,20 +13,20 @@ export const conf: IRichLanguageConfiguration = { lineComment: ';;', }, - brackets: [['(', ')'], ['{', '}'], ['[', ']']], + brackets: [['(', ')'], ['[', ']'], ['{', '}']], autoClosingPairs: [ - { open: '{', close: '}' }, - { open: '[', close: ']' }, - { open: '(', close: ')' }, - { open: '"', close: '"' }, + {open: '(', close: ')'}, + {open: '[', close: ']'}, + {open: '{', close: '}'}, + {open: '"', close: '"'}, ], surroundingPairs: [ - { open: '{', close: '}' }, - { open: '[', close: ']' }, - { open: '(', close: ')' }, - { open: '"', close: '"' }, + {open: '(', close: ')'}, + {open: '[', close: ']'}, + {open: '{', close: '}'}, + {open: '"', close: '"'}, ], }; @@ -36,192 +36,740 @@ export const language = { tokenPostfix: '.clj', brackets: [ - { open: '(', close: ')', token: 'delimiter.parenthesis' }, - { open: '{', close: '}', token: 'delimiter.curly' }, - { open: '[', close: ']', token: 'delimiter.square' }, + {open: '(', close: ')', token: 'delimiter.parenthesis'}, + {open: '{', close: '}', token: 'delimiter.curly'}, + {open: '[', close: ']', token: 'delimiter.square'}, ], - keywords: [ - 'ns', - 'ns-unmap', - 'create-ns', - 'in-ns', - 'fn', + specialForms: [ + '.', + 'catch', 'def', - 'defn', + 'do', + 'if', + 'monitor-enter', + 'monitor-exit', + 'new', + 'quote', + 'recur', + 'set!', + 'throw', + 'try', + 'var', + ], + + coreSymbols: [ + '*', + '*\'', + '*1', + '*2', + '*3', + '*agent*', + '*allow-unresolved-vars*', + '*assert*', + '*clojure-version*', + '*command-line-args*', + '*compile-files*', + '*compile-path*', + '*compiler-options*', + '*data-readers*', + '*default-data-reader-fn*', + '*e', + '*err*', + '*file*', + '*flush-on-newline*', + '*fn-loader*', + '*in*', + '*math-context*', + '*ns*', + '*out*', + '*print-dup*', + '*print-length*', + '*print-level*', + '*print-meta*', + '*print-namespace-maps*', + '*print-readably*', + '*read-eval*', + '*reader-resolver*', + '*source-path*', + '*suppress-read*', + '*unchecked-math*', + '*use-context-classloader*', + '*verbose-defrecords*', + '*warn-on-reflection*', + '+', + '+\'', + '-', + '-\'', + '->', + '->>', + '->ArrayChunk', + '->Eduction', + '->Vec', + '->VecNode', + '->VecSeq', + '-cache-protocol-fn', + '-reset-methods', + '..', + '/', + '<', + '<=', + '=', + '==', + '>', + '>=', + 'EMPTY-NODE', + 'Inst', + 'StackTraceElement->vec', + 'Throwable->map', + 'accessor', + 'aclone', + 'add-classpath', + 'add-watch', + 'agent', + 'agent-error', + 'agent-errors', + 'aget', + 'alength', + 'alias', + 'all-ns', + 'alter', + 'alter-meta!', + 'alter-var-root', + 'amap', + 'ancestors', + 'and', + 'any?', + 'apply', + 'areduce', + 'array-map', + 'as->', + 'aset', + 'aset-boolean', + 'aset-byte', + 'aset-char', + 'aset-double', + 'aset-float', + 'aset-int', + 'aset-long', + 'aset-short', + 'assert', + 'assoc', + 'assoc!', + 'assoc-in', + 'associative?', + 'atom', + 'await', + 'await-for', + 'await1', + 'bases', + 'bean', + 'bigdec', + 'bigint', + 'biginteger', + 'binding', + 'bit-and', + 'bit-and-not', + 'bit-clear', + 'bit-flip', + 'bit-not', + 'bit-or', + 'bit-set', + 'bit-shift-left', + 'bit-shift-right', + 'bit-test', + 'bit-xor', + 'boolean', + 'boolean-array', + 'boolean?', + 'booleans', + 'bound-fn', + 'bound-fn*', + 'bound?', + 'bounded-count', + 'butlast', + 'byte', + 'byte-array', + 'bytes', + 'bytes?', + 'case', + 'cast', + 'cat', + 'char', + 'char-array', + 'char-escape-string', + 'char-name-string', + 'char?', + 'chars', + 'chunk', + 'chunk-append', + 'chunk-buffer', + 'chunk-cons', + 'chunk-first', + 'chunk-next', + 'chunk-rest', + 'chunked-seq?', + 'class', + 'class?', + 'clear-agent-errors', + 'clojure-version', + 'coll?', + 'comment', + 'commute', + 'comp', + 'comparator', + 'compare', + 'compare-and-set!', + 'compile', + 'complement', + 'completing', + 'concat', + 'cond', + 'cond->', + 'cond->>', + 'condp', + 'conj', + 'conj!', + 'cons', + 'constantly', + 'construct-proxy', + 'contains?', + 'count', + 'counted?', + 'create-ns', + 'create-struct', + 'cycle', + 'dec', + 'dec\'', + 'decimal?', + 'declare', + 'dedupe', + 'default-data-readers', + 'definline', + 'definterface', 'defmacro', + 'defmethod', 'defmulti', + 'defn', + 'defn-', 'defonce', - 'require', - 'import', - 'new', - 'refer', - 'pos', - 'pos?', + 'defprotocol', + 'defrecord', + 'defstruct', + 'deftype', + 'delay', + 'delay?', + 'deliver', + 'denominator', + 'deref', + 'derive', + 'descendants', + 'destructure', + 'disj', + 'disj!', + 'dissoc', + 'dissoc!', + 'distinct', + 'distinct?', + 'doall', + 'dorun', + 'doseq', + 'dosync', + 'dotimes', + 'doto', + 'double', + 'double-array', + 'double?', + 'doubles', + 'drop', + 'drop-last', + 'drop-while', + 'eduction', + 'empty', + 'empty?', + 'ensure', + 'ensure-reduced', + 'enumeration-seq', + 'error-handler', + 'error-mode', + 'eval', + 'even?', + 'every-pred', + 'every?', + 'ex-data', + 'ex-info', + 'extend', + 'extend-protocol', + 'extend-type', + 'extenders', + 'extends?', + 'false?', + 'ffirst', + 'file-seq', 'filter', + 'filterv', + 'find', + 'find-keyword', + 'find-ns', + 'find-protocol-impl', + 'find-protocol-method', + 'find-var', + 'first', + 'flatten', + 'float', + 'float-array', + 'float?', + 'floats', + 'flush', + 'fn', + 'fn?', + 'fnext', + 'fnil', + 'for', + 'force', + 'format', + 'frequencies', + 'future', + 'future-call', + 'future-cancel', + 'future-cancelled?', + 'future-done?', + 'future?', + 'gen-class', + 'gen-interface', + 'gensym', + 'get', + 'get-in', + 'get-method', + 'get-proxy-class', + 'get-thread-bindings', + 'get-validator', + 'group-by', + 'halt-when', + 'hash', + 'hash-combine', + 'hash-map', + 'hash-ordered-coll', + 'hash-set', + 'hash-unordered-coll', + 'ident?', + 'identical?', + 'identity', + 'if-let', + 'if-not', + 'if-some', + 'ifn?', + 'import', + 'in-ns', + 'inc', + 'inc\'', + 'indexed?', + 'init-proxy', + 'inst-ms', + 'inst-ms*', + 'inst?', + 'instance?', + 'int', + 'int-array', + 'int?', + 'integer?', + 'interleave', + 'intern', + 'interpose', + 'into', + 'into-array', + 'ints', + 'io!', + 'isa?', + 'iterate', + 'iterator-seq', + 'juxt', + 'keep', + 'keep-indexed', + 'key', + 'keys', + 'keyword', + 'keyword?', + 'last', + 'lazy-cat', + 'lazy-seq', + 'let', + 'letfn', + 'line-seq', + 'list', + 'list*', + 'list?', + 'load', + 'load-file', + 'load-reader', + 'load-string', + 'loaded-libs', + 'locking', + 'long', + 'long-array', + 'longs', + 'loop', + 'macroexpand', + 'macroexpand-1', + 'make-array', + 'make-hierarchy', 'map', + 'map-entry?', + 'map-indexed', + 'map?', + 'mapcat', + 'mapv', + 'max', + 'max-key', + 'memfn', + 'memoize', + 'merge', + 'merge-with', + 'meta', + 'method-sig', + 'methods', + 'min', + 'min-key', + 'mix-collection-hash', + 'mod', + 'munge', + 'name', + 'namespace', + 'namespace-munge', + 'nat-int?', + 'neg-int?', + 'neg?', + 'newline', + 'next', + 'nfirst', + 'nil?', + 'nnext', + 'not', + 'not-any?', + 'not-empty', + 'not-every?', + 'not=', + 'ns', + 'ns-aliases', + 'ns-imports', + 'ns-interns', + 'ns-map', + 'ns-name', + 'ns-publics', + 'ns-refers', + 'ns-resolve', + 'ns-unalias', + 'ns-unmap', + 'nth', + 'nthnext', + 'nthrest', + 'num', + 'number?', + 'numerator', + 'object-array', + 'odd?', + 'or', + 'parents', + 'partial', + 'partition', + 'partition-all', + 'partition-by', + 'pcalls', + 'peek', + 'persistent!', + 'pmap', + 'pop', + 'pop!', + 'pop-thread-bindings', + 'pos-int?', + 'pos?', + 'pr', + 'pr-str', + 'prefer-method', + 'prefers', + 'primitives-classnames', + 'print', + 'print-ctor', + 'print-dup', + 'print-method', + 'print-simple', + 'print-str', + 'printf', + 'println', + 'println-str', + 'prn', + 'prn-str', + 'promise', + 'proxy', + 'proxy-call-with-super', + 'proxy-mappings', + 'proxy-name', + 'proxy-super', + 'push-thread-bindings', + 'pvalues', + 'qualified-ident?', + 'qualified-keyword?', + 'qualified-symbol?', + 'quot', + 'rand', + 'rand-int', + 'rand-nth', + 'random-sample', + 'range', + 'ratio?', + 'rational?', + 'rationalize', + 're-find', + 're-groups', + 're-matcher', + 're-matches', + 're-pattern', + 're-seq', + 'read', + 'read-line', + 'read-string', + 'reader-conditional', + 'reader-conditional?', + 'realized?', + 'record?', 'reduce', + 'reduce-kv', + 'reduced', + 'reduced?', + 'reductions', + 'ref', + 'ref-history-count', + 'ref-max-history', + 'ref-min-history', + 'ref-set', + 'refer', + 'refer-clojure', + 'reify', + 'release-pending-sends', + 'rem', + 'remove', + 'remove-all-methods', + 'remove-method', + 'remove-ns', + 'remove-watch', 'repeat', - 'key', + 'repeatedly', + 'replace', + 'replicate', + 'require', + 'reset!', + 'reset-meta!', + 'reset-vals!', + 'resolve', 'rest', - 'concat', - 'into', + 'restart-agent', + 'resultset-seq', 'reverse', - 'iterate', - 'range', - 'drop', - 'drop-while', + 'reversible?', + 'rseq', + 'rsubseq', + 'run!', + 'satisfies?', + 'second', + 'select-keys', + 'send', + 'send-off', + 'send-via', + 'seq', + 'seq?', + 'seqable?', + 'seque', + 'sequence', + 'sequential?', + 'set', + 'set-agent-send-executor!', + 'set-agent-send-off-executor!', + 'set-error-handler!', + 'set-error-mode!', + 'set-validator!', + 'set?', + 'short', + 'short-array', + 'shorts', + 'shuffle', + 'shutdown-agents', + 'simple-ident?', + 'simple-keyword?', + 'simple-symbol?', + 'slurp', + 'some', + 'some->', + 'some->>', + 'some-fn', + 'some?', + 'sort', + 'sort-by', + 'sorted-map', + 'sorted-map-by', + 'sorted-set', + 'sorted-set-by', + 'sorted?', + 'special-symbol?', + 'spit', + 'split-at', + 'split-with', + 'str', + 'string?', + 'struct', + 'struct-map', + 'subs', + 'subseq', + 'subvec', + 'supers', + 'swap!', + 'swap-vals!', + 'symbol', + 'symbol?', + 'sync', + 'tagged-literal', + 'tagged-literal?', 'take', + 'take-last', + 'take-nth', 'take-while', - 'neg', - 'neg?', - 'bound-fn', - 'if', - 'if-not', - 'if-let', - 'case,', - 'contains', - 'conj', - 'disj', - 'sort', - 'get', - 'assoc', - 'merge', - 'keys', + 'test', + 'the-ns', + 'thread-bound?', + 'time', + 'to-array', + 'to-array-2d', + 'trampoline', + 'transduce', + 'transient', + 'tree-seq', + 'true?', + 'type', + 'unchecked-add', + 'unchecked-add-int', + 'unchecked-byte', + 'unchecked-char', + 'unchecked-dec', + 'unchecked-dec-int', + 'unchecked-divide-int', + 'unchecked-double', + 'unchecked-float', + 'unchecked-inc', + 'unchecked-inc-int', + 'unchecked-int', + 'unchecked-long', + 'unchecked-multiply', + 'unchecked-multiply-int', + 'unchecked-negate', + 'unchecked-negate-int', + 'unchecked-remainder-int', + 'unchecked-short', + 'unchecked-subtract', + 'unchecked-subtract-int', + 'underive', + 'unquote', + 'unquote-splicing', + 'unreduced', + 'unsigned-bit-shift-right', + 'update', + 'update-in', + 'update-proxy', + 'uri?', + 'use', + 'uuid?', + 'val', 'vals', - 'nth', - 'first', - 'last', - 'count', - 'contains?', - 'cond', - 'condp', - 'cond->', - 'cond->>', + 'var-get', + 'var-set', + 'var?', + 'vary-meta', + 'vec', + 'vector', + 'vector-of', + 'vector?', + 'volatile!', + 'volatile?', + 'vreset!', + 'vswap!', 'when', - 'while', - 'when-not', - 'when-let', 'when-first', - 'do', - 'future', - 'comment', - 'doto', - 'locking', - 'proxy', - 'println', - 'type', - 'meta', - 'var', - 'as->', - 'reify', - 'deftype', - 'defrecord', - 'defprotocol', - 'extend', - 'extend-protocol', - 'extend-type', - 'specify', - 'specify!', - 'try', - 'catch', - 'finally', - 'let', - 'letfn', - 'binding', - 'loop', - 'for', - 'seq', - 'doseq', - 'dotimes', 'when-let', - 'if-let', + 'when-not', 'when-some', - 'if-some', - 'this-as', - 'defmethod', - 'testing', - 'deftest', - 'are', - 'use-fixtures', - 'use', - 'remove', - 'run', - 'run*', - 'fresh', - 'alt!', - 'alt!!', - 'go', - 'go-loop', - 'thread', - 'boolean', - 'str', + 'while', + 'with-bindings', + 'with-bindings*', + 'with-in-str', + 'with-loading-context', + 'with-local-vars', + 'with-meta', + 'with-open', + 'with-out-str', + 'with-precision', + 'with-redefs', + 'with-redefs-fn', + 'xml-seq', + 'zero?', + 'zipmap', ], constants: ['true', 'false', 'nil'], - operators: [ - '=', - 'not=', - '<', - '<=', - '>', - '>=', - 'and', - 'or', - 'not', - 'inc', - 'dec', - 'max', - 'min', - 'rem', - 'bit-and', - 'bit-or', - 'bit-xor', - 'bit-not', - ], + symbolCharacter: /[!#'*+\-.\/:<=>?_\w\xa1-\uffff]/, + + numbers: /^[+\-]?\d+(?:(?:N|(?:[eE][+\-]?\d+))|(?:\.?\d*(?:M|(?:[eE][+\-]?\d+))?)|\/\d+|[xX][0-9a-fA-F]+|r[0-9a-zA-Z]+)?/, + + characters: /\\(?:@symbolCharacter+|[\\"()\[\]{}]|x[0-9A-Fa-f]{4}|u[0-9A-Fa-f]{4}|o[0-7]{3})/, tokenizer: { root: [ - [/0[xX][0-9a-fA-F]+/, 'number.hex'], - [/[+-]?\d+(?:(?:\.\d*)?(?:[eE][+-]?\d+)?)?/, 'number.float'], + // numbers + [/@numbers/, 'number'], - [ - /(?:\b(?:(ns|def|defn|defn-|defmacro|defmulti|defonce|ns|ns-unmap|fn))(?![\w-]))(\s+)((?:\w|\-|\!|\?)*)/, - ['keyword', 'white', 'variable'], - ], + // characters + [/@characters/, 'string'], - [ - /[a-zA-Z_#][a-zA-Z0-9_\-\?\!\*]*/, - { - cases: { - '@keywords': 'keyword', - '@constants': 'constant', - '@operators': 'operators', - '@default': 'identifier', - }, + // brackets + [/[()\[\]{}]/, '@brackets'], + + // regular expressions + [/\/#"(?:\.|(?:")|[^"\n])*"\/g/, 'regexp'], + + // inline comments + [/;.*$/, 'comment'], + + // reader macro characters + [/[#'@^`~]/, 'meta'], + + // keywords + [/:@symbolCharacter+/, 'constant'], + + // symbols + [/@symbolCharacter+/, { + cases: { + '@specialForms': 'keyword', + '@coreSymbols': 'keyword', + '@constants': 'constant', + '@default': 'identifier', }, + }, ], - [/\/#"(?:\.|(?:\")|[^""\n])*"\/g/, 'regexp'], - - { include: '@whitespace' }, - { include: '@strings' }, + {include: '@whitespace'}, + {include: '@string'}, ], - whitespace: [[/[ \t\r\n]+/, 'white'], [/;;.*$/, 'comment']], + whitespace: [ + [/[ \t\r\n]+/, 'white'], + [/;;.*$/, 'comment']], - strings: [ - [/"$/, 'string', '@popall'], - [/"(?=.)/, 'string', '@multiLineString'], + string: [ + [/"/, 'string', '@multiLineString'], ], multiLineString: [ - [/\\./, 'string.escape'], - [/"/, 'string', '@popall'], - [/.(?=.*")/, 'string'], - [/.*\\$/, 'string'], - [/.*$/, 'string', '@popall'], + [/[^\\"$]+/, 'string'], + [/@characters/, 'string'], + [/"/, 'string', '@pop'] ], }, }; From 1188cfa1bbee541d1cffdc83ae30d61b90d79ec2 Mon Sep 17 00:00:00 2001 From: Abdussalam Abdurrahman Date: Tue, 11 Sep 2018 21:41:03 -0700 Subject: [PATCH 070/133] [clojure] Fix regular expression for character literals. Consolidate regular expressions for line and in-line comments. --- src/clojure/clojure.test.ts | 1 + src/clojure/clojure.ts | 7 ++----- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/clojure/clojure.test.ts b/src/clojure/clojure.test.ts index 685c5540..0113d56e 100644 --- a/src/clojure/clojure.test.ts +++ b/src/clojure/clojure.test.ts @@ -747,6 +747,7 @@ testTokenization('clojure', [ '\\space', '\\return', '\\tab', + '\\o123', '\\u1000', '\\uAaAa', '\\u9F9F' diff --git a/src/clojure/clojure.ts b/src/clojure/clojure.ts index 40a52298..4b6825df 100644 --- a/src/clojure/clojure.ts +++ b/src/clojure/clojure.ts @@ -718,7 +718,7 @@ export const language = { numbers: /^[+\-]?\d+(?:(?:N|(?:[eE][+\-]?\d+))|(?:\.?\d*(?:M|(?:[eE][+\-]?\d+))?)|\/\d+|[xX][0-9a-fA-F]+|r[0-9a-zA-Z]+)?/, - characters: /\\(?:@symbolCharacter+|[\\"()\[\]{}]|x[0-9A-Fa-f]{4}|u[0-9A-Fa-f]{4}|o[0-7]{3})/, + characters: /\\(?:backspace|formfeed|newline|return|space|tab|x[0-9A-Fa-f]{4}|u[0-9A-Fa-f]{4}|o[0-7]{3}|@symbolCharacter|[\\"()\[\]{}])/, tokenizer: { root: [ @@ -734,9 +734,6 @@ export const language = { // regular expressions [/\/#"(?:\.|(?:")|[^"\n])*"\/g/, 'regexp'], - // inline comments - [/;.*$/, 'comment'], - // reader macro characters [/[#'@^`~]/, 'meta'], @@ -760,7 +757,7 @@ export const language = { whitespace: [ [/[ \t\r\n]+/, 'white'], - [/;;.*$/, 'comment']], + [/;.*$/, 'comment']], string: [ [/"/, 'string', '@multiLineString'], From c65a13afa1507b7afbf84317aa17d9dc8573f9a6 Mon Sep 17 00:00:00 2001 From: Abdussalam Abdurrahman Date: Tue, 11 Sep 2018 23:06:18 -0700 Subject: [PATCH 071/133] [clojure] Add support for `(comment ...)`. --- src/clojure/clojure.test.ts | 38 +++++++++++++++++++++++++++++++++++++ src/clojure/clojure.ts | 24 +++++++++++++++++------ 2 files changed, 56 insertions(+), 6 deletions(-) diff --git a/src/clojure/clojure.test.ts b/src/clojure/clojure.test.ts index 0113d56e..e4098fa1 100644 --- a/src/clojure/clojure.test.ts +++ b/src/clojure/clojure.test.ts @@ -768,6 +768,44 @@ testTokenization('clojure', [ ';; this is a line comment.', ], 'comment'), + // `comment` + [ + { + line: '(comment)', + tokens: [ + {startIndex: 0, type: 'comment.clj'}, + ], + }, + { + line: 'foo :bar 42', + tokens: [ + {startIndex: 0, type: 'identifier.clj'}, + {startIndex: 3, type: 'white.clj'}, + {startIndex: 4, type: 'constant.clj'}, + {startIndex: 8, type: 'white.clj'}, + {startIndex: 9, type: 'number.clj'}, + ], + }, + { + line: '(comment (foo [bar :baz 1 "qux"]))', + tokens: [ + {startIndex: 0, type: 'comment.clj'}, + ], + }, + { + line: '(comment foo', + tokens: [ + {startIndex: 0, type: 'comment.clj'}, + ], + }, + { + line: 'foo', + tokens: [ + {startIndex: 0, type: 'comment.clj'}, + ], + }, + ], + // reader macro characters createTestCases([ '#', diff --git a/src/clojure/clojure.ts b/src/clojure/clojure.ts index 4b6825df..df779450 100644 --- a/src/clojure/clojure.ts +++ b/src/clojure/clojure.ts @@ -716,18 +716,24 @@ export const language = { symbolCharacter: /[!#'*+\-.\/:<=>?_\w\xa1-\uffff]/, - numbers: /^[+\-]?\d+(?:(?:N|(?:[eE][+\-]?\d+))|(?:\.?\d*(?:M|(?:[eE][+\-]?\d+))?)|\/\d+|[xX][0-9a-fA-F]+|r[0-9a-zA-Z]+)?/, + numbers: /[+\-]?\d+(?:(?:N|(?:[eE][+\-]?\d+))|(?:\.?\d*(?:M|(?:[eE][+\-]?\d+))?)|\/\d+|[xX][0-9a-fA-F]+|r[0-9a-zA-Z]+)?/, characters: /\\(?:backspace|formfeed|newline|return|space|tab|x[0-9A-Fa-f]{4}|u[0-9A-Fa-f]{4}|o[0-7]{3}|@symbolCharacter|[\\"()\[\]{}])/, tokenizer: { root: [ + // whitespaces and comments + {include: '@whitespace'}, + // numbers [/@numbers/, 'number'], // characters [/@characters/, 'string'], + // strings + {include: '@string'}, + // brackets [/[()\[\]{}]/, '@brackets'], @@ -751,20 +757,26 @@ export const language = { }, ], - {include: '@whitespace'}, - {include: '@string'}, ], whitespace: [ - [/[ \t\r\n]+/, 'white'], - [/;.*$/, 'comment']], + [/\s+/, 'white'], + [/;.*$/, 'comment'], + [/\(comment/, 'comment', '@comment'], + ], + + comment: [ + [/\(/, 'comment', '@push'], + [/\)/, 'comment', '@pop'], + [/[^)]/, 'comment'], + ], string: [ [/"/, 'string', '@multiLineString'], ], multiLineString: [ - [/[^\\"$]+/, 'string'], + [/[^\\"]+/, 'string'], [/@characters/, 'string'], [/"/, 'string', '@pop'] ], From 3e6c3ee653bbd8b0f9627c3db2033c39dc0a2d30 Mon Sep 17 00:00:00 2001 From: Sebastian Pahnke Date: Mon, 1 Oct 2018 08:29:37 +0200 Subject: [PATCH 072/133] Allow the 's' flag in regular expressions --- src/typescript/typescript.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/typescript/typescript.ts b/src/typescript/typescript.ts index d22920e4..09441e69 100644 --- a/src/typescript/typescript.ts +++ b/src/typescript/typescript.ts @@ -130,7 +130,7 @@ export const language = { { include: '@whitespace' }, // regular expression: ensure it is terminated before beginning (otherwise it is an opeator) - [/\/(?=([^\\\/]|\\.)+\/([gimuy]*)(\s*)(\.|;|\/|,|\)|\]|\}|$))/, { token: 'regexp', bracket: '@open', next: '@regexp' }], + [/\/(?=([^\\\/]|\\.)+\/([gimsuy]*)(\s*)(\.|;|\/|,|\)|\]|\}|$))/, { token: 'regexp', bracket: '@open', next: '@regexp' }], // delimiters and operators [/[()\[\]]/, '@brackets'], From ce3a0652b306c6fd227441e735ae8965f77d98c6 Mon Sep 17 00:00:00 2001 From: Sebastian Pahnke Date: Mon, 1 Oct 2018 08:30:48 +0200 Subject: [PATCH 073/133] Tokenize regex flags as 'keyword.other' like VS Code does --- src/javascript/javascript.test.ts | 35 ++++++++++++++++++++++++++++++- src/typescript/typescript.test.ts | 33 +++++++++++++++++++++++++++++ src/typescript/typescript.ts | 2 +- 3 files changed, 68 insertions(+), 2 deletions(-) diff --git a/src/javascript/javascript.test.ts b/src/javascript/javascript.test.ts index 54b7effc..f140df15 100644 --- a/src/javascript/javascript.test.ts +++ b/src/javascript/javascript.test.ts @@ -430,7 +430,7 @@ testTokenization('javascript', [ ] }], -[{ + [{ line: 'x = /foo/.test(\'\')', tokens: [ { startIndex: 0, type: 'identifier.js' }, @@ -446,6 +446,39 @@ testTokenization('javascript', [ ] }], + [{ + line: '/foo/', + tokens: [ + { startIndex: 0, type: 'regexp.js' } + ] + }], + + [{ + line: '/foo/g', + tokens: [ + { startIndex: 0, type: 'regexp.js' }, + { startIndex: 5, type: 'keyword.other.js' } + ] + }], + + [{ + line: '/foo/gimsuy', + tokens: [ + { startIndex: 0, type: 'regexp.js' }, + { startIndex: 5, type: 'keyword.other.js' } + ] + }], + + [{ + line: '/foo/q', // invalid flag + tokens: [ + { startIndex: 0, type: 'delimiter.js' }, + { startIndex: 1, type: 'identifier.js' }, + { startIndex: 4, type: 'delimiter.js' }, + { startIndex: 5, type: 'identifier.js' } + ] + }], + [{ line: 'x = 1 + f(2 / 3, /foo/)', tokens: [ diff --git a/src/typescript/typescript.test.ts b/src/typescript/typescript.test.ts index bc2f4a1a..6b156a9e 100644 --- a/src/typescript/typescript.test.ts +++ b/src/typescript/typescript.test.ts @@ -446,6 +446,39 @@ testTokenization('typescript', [ ] }], + [{ + line: '/foo/', + tokens: [ + { startIndex: 0, type: 'regexp.ts' } + ] + }], + + [{ + line: '/foo/g', + tokens: [ + { startIndex: 0, type: 'regexp.ts' }, + { startIndex: 5, type: 'keyword.other.ts' } + ] + }], + + [{ + line: '/foo/gimsuy', + tokens: [ + { startIndex: 0, type: 'regexp.ts' }, + { startIndex: 5, type: 'keyword.other.ts' } + ] + }], + + [{ + line: '/foo/q', // invalid flag + tokens: [ + { startIndex: 0, type: 'delimiter.ts' }, + { startIndex: 1, type: 'identifier.ts' }, + { startIndex: 4, type: 'delimiter.ts' }, + { startIndex: 5, type: 'identifier.ts' } + ] + }], + [{ line: 'x = 1 + f(2 / 3, /foo/)', tokens: [ diff --git a/src/typescript/typescript.ts b/src/typescript/typescript.ts index 09441e69..01cd0150 100644 --- a/src/typescript/typescript.ts +++ b/src/typescript/typescript.ts @@ -190,7 +190,7 @@ export const language = { [/[^\\\/]/, 'regexp'], [/@regexpesc/, 'regexp.escape'], [/\\\./, 'regexp.invalid'], - ['/', { token: 'regexp', bracket: '@close' }, '@pop'], + [/(\/)([gimsuy]*)/, [{ token: 'regexp', bracket: '@close', next: '@pop' }, 'keyword.other']], ], regexrange: [ From 4b0d5c54d25aa131862dfd859f9a0e16715adb34 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Grzegorz=20Wcis=C5=82o?= Date: Wed, 3 Oct 2018 17:59:21 +0200 Subject: [PATCH 074/133] Fix yaml string tokenization --- src/yaml/yaml.test.ts | 29 +++++++++++++++++++++++++++++ src/yaml/yaml.ts | 24 +++++++++--------------- 2 files changed, 38 insertions(+), 15 deletions(-) diff --git a/src/yaml/yaml.test.ts b/src/yaml/yaml.test.ts index 553d4fff..0d644026 100644 --- a/src/yaml/yaml.test.ts +++ b/src/yaml/yaml.test.ts @@ -241,6 +241,35 @@ testTokenization('yaml', [ },] }], + // Flow Scalars + [{ + line: '\'this is a single quote string\'', + tokens: [{ + startIndex: 0, + type: 'string.yaml' + }] + }], + + [{ + line: "\"this is a double \\quote string\\n\"", + tokens: [{ + startIndex: 0, + type: 'string.yaml' + }, { + startIndex: 18, + type: 'string.escape.invalid.yaml' + }, { + startIndex: 20, + type: 'string.yaml' + }, { + startIndex: 31, + type: 'string.escape.yaml' + }, { + startIndex: 33, + type: 'string.yaml' + }] + }], + // Flow Sequence - Data types [{ line: '[string,"double",\'single\',1,1.1,2002-04-28]', diff --git a/src/yaml/yaml.ts b/src/yaml/yaml.ts index ee6f8fe5..779acb0f 100644 --- a/src/yaml/yaml.ts +++ b/src/yaml/yaml.ts @@ -156,19 +156,6 @@ export const language = { }] ], - // Flow Scalars (quoted strings) - string: [ - [/[^\\"']+/, 'string'], - [/@escapes/, 'string.escape'], - [/\\./, 'string.escape.invalid'], - [/["']/, { - cases: { - '$#==$S2': { token: 'string', next: '@pop' }, - '@default': 'string' - } - }] - ], - // First line of a Block Style multiString: [ [/^( +).+$/, 'string', '@multiStringContinued.$1'] @@ -202,8 +189,15 @@ export const language = { // Start Flow Scalars (quoted strings) flowScalars: [ - [/"/, 'string', '@string."'], - [/'/, 'string', '@string.\''] + [/'[^']*'/, 'string'], + [/"/, 'string', '@doubleQuotedString'] + ], + + doubleQuotedString: [ + [/[^\\"]+/, 'string'], + [/@escapes/, 'string.escape'], + [/\\./, 'string.escape.invalid'], + [/"/, 'string', '@pop'] ], // Start Block Scalar From c59dd6a01e1083979dedd8c84d355706d336f3a7 Mon Sep 17 00:00:00 2001 From: TiagoDanin Date: Wed, 3 Oct 2018 14:11:22 -0300 Subject: [PATCH 075/133] New rule for non-teminated string in yaml --- src/yaml/yaml.test.ts | 9 +++++++++ src/yaml/yaml.ts | 2 ++ 2 files changed, 11 insertions(+) diff --git a/src/yaml/yaml.test.ts b/src/yaml/yaml.test.ts index 553d4fff..caca678b 100644 --- a/src/yaml/yaml.test.ts +++ b/src/yaml/yaml.test.ts @@ -145,6 +145,15 @@ testTokenization('yaml', [ }] }], + //String + [{ + line: '\'\'\'', + tokens: [ + { startIndex: 0, type: 'string.yaml' }, + { startIndex: 2, type: 'string.invalid.yaml' }, + ] + }], + // Block Scalar [{ line: '>', diff --git a/src/yaml/yaml.ts b/src/yaml/yaml.ts index ee6f8fe5..a4330c60 100644 --- a/src/yaml/yaml.ts +++ b/src/yaml/yaml.ts @@ -202,6 +202,8 @@ export const language = { // Start Flow Scalars (quoted strings) flowScalars: [ + [/"([^"\\]|\\.)*$/, 'string.invalid'], + [/'([^'\\]|\\.)*$/, 'string.invalid'], [/"/, 'string', '@string."'], [/'/, 'string', '@string.\''] ], From 79ad5abdb3bf0b59aa8b48a8fd1c5d7a8bb3f7ce Mon Sep 17 00:00:00 2001 From: Sebastian Pahnke Date: Fri, 5 Oct 2018 17:28:43 +0200 Subject: [PATCH 076/133] Add support for alternate octal integer syntax --- src/javascript/javascript.test.ts | 14 ++++++++++++++ src/typescript/typescript.test.ts | 14 ++++++++++++++ src/typescript/typescript.ts | 2 +- 3 files changed, 29 insertions(+), 1 deletion(-) diff --git a/src/javascript/javascript.test.ts b/src/javascript/javascript.test.ts index f140df15..889286aa 100644 --- a/src/javascript/javascript.test.ts +++ b/src/javascript/javascript.test.ts @@ -346,6 +346,20 @@ testTokenization('javascript', [ ] }], + [{ + line: '0o123', + tokens: [ + { startIndex: 0, type: 'number.octal.js' } + ] + }], + + [{ + line: '0O123', + tokens: [ + { startIndex: 0, type: 'number.octal.js' } + ] + }], + [{ line: '0x', tokens: [ diff --git a/src/typescript/typescript.test.ts b/src/typescript/typescript.test.ts index 6b156a9e..795a4025 100644 --- a/src/typescript/typescript.test.ts +++ b/src/typescript/typescript.test.ts @@ -346,6 +346,20 @@ testTokenization('typescript', [ ] }], + [{ + line: '0o123', + tokens: [ + { startIndex: 0, type: 'number.octal.ts' } + ] + }], + + [{ + line: '0O123', + tokens: [ + { startIndex: 0, type: 'number.octal.ts' } + ] + }], + [{ line: '0x', tokens: [ diff --git a/src/typescript/typescript.ts b/src/typescript/typescript.ts index 01cd0150..1c3e38d5 100644 --- a/src/typescript/typescript.ts +++ b/src/typescript/typescript.ts @@ -146,7 +146,7 @@ export const language = { [/(@digits)[eE]([\-+]?(@digits))?/, 'number.float'], [/(@digits)\.(@digits)([eE][\-+]?(@digits))?/, 'number.float'], [/0[xX](@hexdigits)/, 'number.hex'], - [/0(@octaldigits)/, 'number.octal'], + [/0[oO]?(@octaldigits)/, 'number.octal'], [/0[bB](@binarydigits)/, 'number.binary'], [/(@digits)/, 'number'], From 623dbc1acc3f214e2bb0cfdd2b82e6cd7c209645 Mon Sep 17 00:00:00 2001 From: Sebastian Pahnke Date: Fri, 5 Oct 2018 17:29:11 +0200 Subject: [PATCH 077/133] Add more tests for hex and binary integer literals --- src/javascript/javascript.test.ts | 21 +++++++++++++++++++++ src/typescript/typescript.test.ts | 21 +++++++++++++++++++++ 2 files changed, 42 insertions(+) diff --git a/src/javascript/javascript.test.ts b/src/javascript/javascript.test.ts index 889286aa..fd5236c4 100644 --- a/src/javascript/javascript.test.ts +++ b/src/javascript/javascript.test.ts @@ -375,6 +375,27 @@ testTokenization('javascript', [ ] }], + [{ + line: '0X123', + tokens: [ + { startIndex: 0, type: 'number.hex.js' } + ] + }], + + [{ + line: '0b101', + tokens: [ + { startIndex: 0, type: 'number.binary.js' } + ] + }], + + [{ + line: '0B101', + tokens: [ + { startIndex: 0, type: 'number.binary.js' } + ] + }], + // Regular Expressions [{ line: '//', diff --git a/src/typescript/typescript.test.ts b/src/typescript/typescript.test.ts index 795a4025..0154ae57 100644 --- a/src/typescript/typescript.test.ts +++ b/src/typescript/typescript.test.ts @@ -375,6 +375,27 @@ testTokenization('typescript', [ ] }], + [{ + line: '0X123', + tokens: [ + { startIndex: 0, type: 'number.hex.ts' } + ] + }], + + [{ + line: '0b101', + tokens: [ + { startIndex: 0, type: 'number.binary.ts' } + ] + }], + + [{ + line: '0B101', + tokens: [ + { startIndex: 0, type: 'number.binary.ts' } + ] + }], + // Regular Expressions [{ line: '//', From 6feaf43d1d54c7edcc95aa875ab9d822f9151942 Mon Sep 17 00:00:00 2001 From: "Matthew D. Miller" Date: Wed, 10 Oct 2018 10:33:49 -0500 Subject: [PATCH 078/133] Added tests for quoted strings and regexes using alternative delimiters --- src/perl/perl.test.ts | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/src/perl/perl.test.ts b/src/perl/perl.test.ts index 879c2b3c..913c1688 100644 --- a/src/perl/perl.test.ts +++ b/src/perl/perl.test.ts @@ -429,4 +429,39 @@ testTokenization('perl', [ ], }, ], + + // Quoted constructs + [ + { + line: "m!can't!", + tokens: [ + { startIndex: 0, type: 'regexp.delim.perl' }, + { startIndex: 2, type: 'regexp.perl' }, + { startIndex: 7, type: 'regexp.delim.perl' }, + ], + }, + ], + + [ + { + line: 'q XfooX', + tokens: [ + { startIndex: 0, type: 'string.delim.perl' }, + { startIndex: 3, type: 'string.perl' }, + { startIndex: 6, type: 'string.delim.perl' }, + ], + }, + ], + + [ + { + line: 'qq(test $foo)', + tokens: [ + { startIndex: 0, type: 'string.delim.perl' }, + { startIndex: 3, type: 'string.perl' }, + { startIndex: 8, type: 'variable.perl' }, + { startIndex: 12, type: 'string.delim.perl' }, + ], + }, + ], ]); From 80e9270d804e11bfae042c41d81231592fa87297 Mon Sep 17 00:00:00 2001 From: "Matthew D. Miller" Date: Wed, 10 Oct 2018 10:37:28 -0500 Subject: [PATCH 079/133] Separated quote-like operators from other keywords --- src/perl/perl.ts | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/src/perl/perl.ts b/src/perl/perl.ts index edacb28a..b959ad66 100644 --- a/src/perl/perl.ts +++ b/src/perl/perl.ts @@ -48,15 +48,11 @@ export const language = { '__DATA__', 'else', 'lock', - 'qw', '__END__', 'elsif', 'lt', - 'qx', '__FILE__', 'eq', - 'm', - 's', '__LINE__', 'exp', 'ne', @@ -64,7 +60,6 @@ export const language = { '__PACKAGE__', 'for', 'no', - 'tr', 'and', 'foreach', 'or', @@ -75,16 +70,12 @@ export const language = { 'until', 'continue', 'gt', - 'q', 'while', 'CORE', 'if', - 'qq', 'xor', 'do', 'le', - 'qr', - 'y', '__DIE__', '__WARN__', @@ -468,6 +459,7 @@ export const language = { // operators symbols: /[:+\-\^*$&%@=<>!?|\/~\.]/, + quoteLikeOps: ['qr', 'm', 's', 'q', 'qq', 'qx', 'qw', 'tr', 'y'], escapes: /\\(?:[abfnrtv\\"']|x[0-9A-Fa-f]{1,4}|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8})/, From 40fdb5d594e2b962c1a693503270394bba4afa6a Mon Sep 17 00:00:00 2001 From: "Matthew D. Miller" Date: Wed, 10 Oct 2018 11:06:04 -0500 Subject: [PATCH 080/133] Added support for Perl quote-like operators to fix #1101 --- src/perl/perl.ts | 72 +++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 71 insertions(+), 1 deletion(-) diff --git a/src/perl/perl.ts b/src/perl/perl.ts index b959ad66..b385bd1c 100644 --- a/src/perl/perl.ts +++ b/src/perl/perl.ts @@ -469,12 +469,13 @@ export const language = { { include: '@whitespace' }, [ - /[a-zA-Z\-_][\w\-_]+/, + /[a-zA-Z\-_][\w\-_]*/, { cases: { '@keywords': 'keyword', '@builtinFunctions': 'type.identifier', '@builtinFileHandlers': 'variable.predefined', + '@quoteLikeOps': { token: '@rematch', next: 'quotedConstructs' }, '@default': '', }, }, @@ -547,6 +548,75 @@ export const language = { [/./, 'string'], ], + // Quoted constructs + // Percent strings in Ruby are similar to quote-like operators in Perl. + // This is adapted from pstrings in ../ruby/ruby.ts. + quotedConstructs: [ + [/(q|qw|tr|y)\s*\(/, { token: 'string.delim', switchTo: '@qstring.(.)' }], + [/(q|qw|tr|y)\s*\[/, { token: 'string.delim', switchTo: '@qstring.[.]' }], + [/(q|qw|tr|y)\s*\{/, { token: 'string.delim', switchTo: '@qstring.{.}' }], + [/(q|qw|tr|y)\s*' }], + [/(q|qw|tr|y)#/, { token: 'string.delim', switchTo: '@qstring.#.#' }], + [/(q|qw|tr|y)\s*([^A-Za-z0-9#\s])/, { token: 'string.delim', switchTo: '@qstring.$2.$2' }], + [/(q|qw|tr|y)\s+(\w)/, { token: 'string.delim', switchTo: '@qstring.$2.$2' }], + + [/(qr|m|s)\s*\(/, { token: 'regexp.delim', switchTo: '@qregexp.(.)' }], + [/(qr|m|s)\s*\[/, { token: 'regexp.delim', switchTo: '@qregexp.[.]' }], + [/(qr|m|s)\s*\{/, { token: 'regexp.delim', switchTo: '@qregexp.{.}' }], + [/(qr|m|s)\s*' }], + [/(qr|m|s)#/, { token: 'regexp.delim', switchTo: '@qregexp.#.#' }], + [/(qr|m|s)\s*([^A-Za-z0-9_#\s])/, { token: 'regexp.delim', switchTo: '@qregexp.$2.$2' }], + [/(qr|m|s)\s+(\w)/, { token: 'regexp.delim', switchTo: '@qregexp.$2.$2' }], + + [/(qq|qx)\s*\(/, { token: 'string.delim', switchTo: '@qqstring.(.)' }], + [/(qq|qx)\s*\[/, { token: 'string.delim', switchTo: '@qqstring.[.]' }], + [/(qq|qx)\s*\{/, { token: 'string.delim', switchTo: '@qqstring.{.}' }], + [/(qq|qx)\s*' }], + [/(qq|qx)#/, { token: 'string.delim', switchTo: '@qqstring.#.#' }], + [/(qq|qx)\s*([^A-Za-z0-9#\s])/, { token: 'string.delim', switchTo: '@qqstring.$2.$2' }], + [/(qq|qx)\s+(\w)/, { token: 'string.delim', switchTo: '@qqstring.$2.$2' }], + ], + + // Non-expanded quoted string + // qstring. + // open = open delimiter + // close = close delimiter + qstring: [ + [/\\./, 'string.escape'], + [/./, { + cases: { + '$#==$S3': { token: 'string.delim', next: '@pop' }, + '$#==$S2': { token: 'string.delim', next: '@push' }, // nested delimiters + '@default': 'string' + } + }], + ], + + // Quoted regexp + // qregexp.. + // open = open delimiter + // close = close delimiter + qregexp: [ + { include: '@variables' }, + [/\\./, 'regexp.escape'], + [/./, { + cases: { + '$#==$S3': { token: 'regexp.delim', next: '@pop' }, + '$#==$S2': { token: 'regexp.delim', next: '@push' }, // nested delimiters + '@default': 'regexp' + } + }], + ], + + // Expanded quoted string + // qqstring.. + // open = open delimiter + // close = close delimiter + qqstring: [ + { include: '@variables' }, + { include: '@qstring' }, + ], + heredoc: [ [ /<<\s*['"`]?([\w\-]+)['"`]?/, From 3928208ab45239986739256773b523e84972ed80 Mon Sep 17 00:00:00 2001 From: "Matthew D. Miller" Date: Wed, 10 Oct 2018 14:16:45 -0500 Subject: [PATCH 081/133] Fixed failing tests due to regexp modifiers being handled differently --- src/perl/perl.test.ts | 13 +++++++++++-- src/perl/perl.ts | 8 ++++++-- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/src/perl/perl.test.ts b/src/perl/perl.test.ts index 913c1688..fbca6845 100644 --- a/src/perl/perl.test.ts +++ b/src/perl/perl.test.ts @@ -310,14 +310,23 @@ testTokenization('perl', [ [ { line: 'm/abc/', - tokens: [{ startIndex: 0, type: 'regexp.perl' }], + tokens: [ + { startIndex: 0, type: 'regexp.delim.perl' }, + { startIndex: 2, type: 'regexp.perl' }, + { startIndex: 5, type: 'regexp.delim.perl' }, + ], }, ], [ { line: 'm/[abc]+/e', - tokens: [{ startIndex: 0, type: 'regexp.perl' }], + tokens: [ + { startIndex: 0, type: 'regexp.delim.perl' }, + { startIndex: 2, type: 'regexp.perl' }, + { startIndex: 8, type: 'regexp.delim.perl' }, + { startIndex: 9, type: 'regexp.modifier.perl' }, + ], }, ], diff --git a/src/perl/perl.ts b/src/perl/perl.ts index b385bd1c..6bfb1a95 100644 --- a/src/perl/perl.ts +++ b/src/perl/perl.ts @@ -601,13 +601,17 @@ export const language = { [/\\./, 'regexp.escape'], [/./, { cases: { - '$#==$S3': { token: 'regexp.delim', next: '@pop' }, + '$#==$S3': { token: 'regexp.delim', next: '@regexpModifiers' }, '$#==$S2': { token: 'regexp.delim', next: '@push' }, // nested delimiters '@default': 'regexp' } }], ], - + + regexpModifiers: [ + [/[msixpodualngcer]+/, { token: 'regexp.modifier', next: '@popall' }], + ], + // Expanded quoted string // qqstring.. // open = open delimiter From 8694e28edbf728dbe33df1074f6a59f1bfacb0ec Mon Sep 17 00:00:00 2001 From: "Matthew D. Miller" Date: Wed, 10 Oct 2018 14:27:36 -0500 Subject: [PATCH 082/133] Modified original regex rule to only catch instances of bare /regex/ --- src/perl/perl.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/perl/perl.ts b/src/perl/perl.ts index 6bfb1a95..e1e32da9 100644 --- a/src/perl/perl.ts +++ b/src/perl/perl.ts @@ -505,7 +505,7 @@ export const language = { // RegExp [ - /[goseximacplud]*[\/](?:(?:\[(?:\\]|[^\]])+\])|(?:\\\/|[^\]\/]))*[\/]\w*\s*(?=[).,;]|$)/, + /[\/](?:(?:\[(?:\\]|[^\]])+\])|(?:\\\/|[^\]\/]))*[\/]\w*\s*(?=[).,;]|$)/, 'regexp', ], From 8ddd2b62ebb1a1417eb0b00d569e79ac4d419d62 Mon Sep 17 00:00:00 2001 From: Abhishek Date: Mon, 15 Oct 2018 10:52:51 +0530 Subject: [PATCH 083/133] Markdown bug fix. Coloring was failing in a specific condition. --- src/markdown/markdown.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/markdown/markdown.ts b/src/markdown/markdown.ts index 9edf2d66..c2b852fd 100644 --- a/src/markdown/markdown.ts +++ b/src/markdown/markdown.ts @@ -131,7 +131,7 @@ export const language = { [/`([^\\`]|@escapes)+`/, 'variable'], // links - [/\{[^}]+\}/, 'string.target'], + [/\{+[^}]+\}+/, 'string.target'], [/(!?\[)((?:[^\]\\]|@escapes)*)(\]\([^\)]+\))/, ['string.link', '', 'string.link']], [/(!?\[)((?:[^\]\\]|@escapes)*)(\])/, 'string.link'], From 6182bc8a42f31063b95e7861ed4f239469bc2b2a Mon Sep 17 00:00:00 2001 From: Aastha Gupta Date: Tue, 16 Oct 2018 19:36:28 +0530 Subject: [PATCH 084/133] Fix markdown bug Fixes issue: https://github.com/Microsoft/monaco-editor/issues/1107 --- src/markdown/markdown.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/markdown/markdown.ts b/src/markdown/markdown.ts index 9edf2d66..c2b852fd 100644 --- a/src/markdown/markdown.ts +++ b/src/markdown/markdown.ts @@ -131,7 +131,7 @@ export const language = { [/`([^\\`]|@escapes)+`/, 'variable'], // links - [/\{[^}]+\}/, 'string.target'], + [/\{+[^}]+\}+/, 'string.target'], [/(!?\[)((?:[^\]\\]|@escapes)*)(\]\([^\)]+\))/, ['string.link', '', 'string.link']], [/(!?\[)((?:[^\]\\]|@escapes)*)(\])/, 'string.link'], From 0a2434505e1f16dce740de2588501d66802475d4 Mon Sep 17 00:00:00 2001 From: Pascal Berger Date: Thu, 18 Oct 2018 14:17:23 +0200 Subject: [PATCH 085/133] Use C# highlighting for Cake scripts --- src/csharp/csharp.contribution.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/csharp/csharp.contribution.ts b/src/csharp/csharp.contribution.ts index 2ac1a2a8..ba1b4c8a 100644 --- a/src/csharp/csharp.contribution.ts +++ b/src/csharp/csharp.contribution.ts @@ -11,7 +11,7 @@ const _monaco: typeof monaco = (typeof monaco === 'undefined' ? (self).mona registerLanguage({ id: 'csharp', - extensions: ['.cs', '.csx'], + extensions: ['.cs', '.csx', '.cake'], aliases: ['C#', 'csharp'], loader: () => _monaco.Promise.wrap(import('./csharp')) }); From 20a36a1d87322f186426274bc4ea557b01b122fb Mon Sep 17 00:00:00 2001 From: Alex Dima Date: Mon, 12 Nov 2018 10:36:49 +0100 Subject: [PATCH 086/133] Fixes Microsoft/monaco-editor#1148 --- package-lock.json | 457 ++++++++++++++++++++------------- src/objective-c/objective-c.ts | 12 +- src/python/python.ts | 12 +- src/scheme/scheme.ts | 6 +- 4 files changed, 290 insertions(+), 197 deletions(-) diff --git a/package-lock.json b/package-lock.json index 428ff67e..25dc5b2d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -7,69 +7,80 @@ "abab": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/abab/-/abab-2.0.0.tgz", - "integrity": "sha512-sY5AXXVZv4Y1VACTtR11UJCPHHudgY5i26Qj5TypE6DKlIApbwb5uqhXcJ5UUGbvZNRh7EeIoW+LrJumBsKp7w==" + "integrity": "sha512-sY5AXXVZv4Y1VACTtR11UJCPHHudgY5i26Qj5TypE6DKlIApbwb5uqhXcJ5UUGbvZNRh7EeIoW+LrJumBsKp7w==", + "dev": true }, "acorn": { "version": "5.7.1", "resolved": "https://registry.npmjs.org/acorn/-/acorn-5.7.1.tgz", - "integrity": "sha512-d+nbxBUGKg7Arpsvbnlq61mc12ek3EY8EQldM3GPAhWJ1UVxC6TDGbIvUMNU6obBX3i1+ptCIzV4vq0gFPEGVQ==" + "integrity": "sha512-d+nbxBUGKg7Arpsvbnlq61mc12ek3EY8EQldM3GPAhWJ1UVxC6TDGbIvUMNU6obBX3i1+ptCIzV4vq0gFPEGVQ==", + "dev": true }, "acorn-globals": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/acorn-globals/-/acorn-globals-4.1.0.tgz", "integrity": "sha512-KjZwU26uG3u6eZcfGbTULzFcsoz6pegNKtHPksZPOUsiKo5bUmiBPa38FuHZ/Eun+XYh/JCCkS9AS3Lu4McQOQ==", + "dev": true, "requires": { - "acorn": "5.7.1" + "acorn": "^5.0.0" } }, "ajv": { "version": "5.5.2", "resolved": "https://registry.npmjs.org/ajv/-/ajv-5.5.2.tgz", "integrity": "sha1-c7Xuyj+rZT49P5Qis0GtQiBdyWU=", + "dev": true, "requires": { - "co": "4.6.0", - "fast-deep-equal": "1.1.0", - "fast-json-stable-stringify": "2.0.0", - "json-schema-traverse": "0.3.1" + "co": "^4.6.0", + "fast-deep-equal": "^1.0.0", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.3.0" } }, "array-equal": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/array-equal/-/array-equal-1.0.0.tgz", - "integrity": "sha1-jCpe8kcv2ep0KwTHenUJO6J1fJM=" + "integrity": "sha1-jCpe8kcv2ep0KwTHenUJO6J1fJM=", + "dev": true }, "asn1": { "version": "0.2.4", "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.4.tgz", "integrity": "sha512-jxwzQpLQjSmWXgwaCZE9Nz+glAG01yF1QnWgbhGwHI5A6FRIEY6IVqtHhIepHqI7/kyEyQEagBC5mBEFlIYvdg==", + "dev": true, "requires": { - "safer-buffer": "2.1.2" + "safer-buffer": "~2.1.0" } }, "assert-plus": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", - "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=" + "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=", + "dev": true }, "async-limiter": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/async-limiter/-/async-limiter-1.0.0.tgz", - "integrity": "sha512-jp/uFnooOiO+L211eZOoSyzpOITMXx1rBITauYykG3BRYPu8h0UcxsPNB04RR5vo4Tyz3+ay17tR6JVf9qzYWg==" + "integrity": "sha512-jp/uFnooOiO+L211eZOoSyzpOITMXx1rBITauYykG3BRYPu8h0UcxsPNB04RR5vo4Tyz3+ay17tR6JVf9qzYWg==", + "dev": true }, "asynckit": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", - "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=" + "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=", + "dev": true }, "aws-sign2": { "version": "0.7.0", "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz", - "integrity": "sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg=" + "integrity": "sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg=", + "dev": true }, "aws4": { "version": "1.8.0", "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.8.0.tgz", - "integrity": "sha512-ReZxvNHIOv88FlT7rxcXIIC0fPt4KZqZbOlivyWtXLt8ESx84zd3kMC6iK5jVeS2qt+g7ftS7ye4fi06X5rtRQ==" + "integrity": "sha512-ReZxvNHIOv88FlT7rxcXIIC0fPt4KZqZbOlivyWtXLt8ESx84zd3kMC6iK5jVeS2qt+g7ftS7ye4fi06X5rtRQ==", + "dev": true }, "balanced-match": { "version": "1.0.0", @@ -81,9 +92,10 @@ "version": "1.0.2", "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz", "integrity": "sha1-pDAdOJtqQ/m2f/PKEaP2Y342Dp4=", + "dev": true, "optional": true, "requires": { - "tweetnacl": "0.14.5" + "tweetnacl": "^0.14.3" } }, "brace-expansion": { @@ -92,31 +104,35 @@ "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", "dev": true, "requires": { - "balanced-match": "1.0.0", + "balanced-match": "^1.0.0", "concat-map": "0.0.1" } }, "browser-process-hrtime": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/browser-process-hrtime/-/browser-process-hrtime-0.1.2.tgz", - "integrity": "sha1-Ql1opY00R/AqBKqJQYf86K+Le44=" + "integrity": "sha1-Ql1opY00R/AqBKqJQYf86K+Le44=", + "dev": true }, "caseless": { "version": "0.12.0", "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", - "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=" + "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=", + "dev": true }, "co": { "version": "4.6.0", "resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz", - "integrity": "sha1-bqa989hTrlTMuOR7+gvz+QMfsYQ=" + "integrity": "sha1-bqa989hTrlTMuOR7+gvz+QMfsYQ=", + "dev": true }, "combined-stream": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.6.tgz", "integrity": "sha1-cj599ugBrFYTETp+RFqbactjKBg=", + "dev": true, "requires": { - "delayed-stream": "1.0.0" + "delayed-stream": "~1.0.0" } }, "commander": { @@ -134,47 +150,53 @@ "core-util-is": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", - "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=" + "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=", + "dev": true }, "cssom": { "version": "0.3.4", "resolved": "https://registry.npmjs.org/cssom/-/cssom-0.3.4.tgz", - "integrity": "sha512-+7prCSORpXNeR4/fUP3rL+TzqtiFfhMvTd7uEqMdgPvLPt4+uzFUeufx5RHjGTACCargg/DiEt/moMQmvnfkog==" + "integrity": "sha512-+7prCSORpXNeR4/fUP3rL+TzqtiFfhMvTd7uEqMdgPvLPt4+uzFUeufx5RHjGTACCargg/DiEt/moMQmvnfkog==", + "dev": true }, "cssstyle": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/cssstyle/-/cssstyle-1.1.1.tgz", "integrity": "sha512-364AI1l/M5TYcFH83JnOH/pSqgaNnKmYgKrm0didZMGKWjQB60dymwWy1rKUgL3J1ffdq9xVi2yGLHdSjjSNog==", + "dev": true, "requires": { - "cssom": "0.3.4" + "cssom": "0.3.x" } }, "dashdash": { "version": "1.14.1", "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", "integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA=", + "dev": true, "requires": { - "assert-plus": "1.0.0" + "assert-plus": "^1.0.0" } }, "data-urls": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/data-urls/-/data-urls-1.0.1.tgz", "integrity": "sha512-0HdcMZzK6ubMUnsMmQmG0AcLQPvbvb47R0+7CCZQCYgcd8OUWG91CG7sM6GoXgjz+WLl4ArFzHtBMy/QqSF4eg==", + "dev": true, "requires": { - "abab": "2.0.0", - "whatwg-mimetype": "2.1.0", - "whatwg-url": "7.0.0" + "abab": "^2.0.0", + "whatwg-mimetype": "^2.1.0", + "whatwg-url": "^7.0.0" }, "dependencies": { "whatwg-url": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-7.0.0.tgz", "integrity": "sha512-37GeVSIJ3kn1JgKyjiYNmSLP1yzbpb29jdmwBSgkD9h40/hyrR/OifpVUndji3tmwGgD8qpw7iQu3RSbCrBpsQ==", + "dev": true, "requires": { - "lodash.sortby": "4.7.0", - "tr46": "1.0.1", - "webidl-conversions": "4.0.2" + "lodash.sortby": "^4.7.0", + "tr46": "^1.0.1", + "webidl-conversions": "^4.0.2" } } } @@ -182,29 +204,33 @@ "deep-is": { "version": "0.1.3", "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.3.tgz", - "integrity": "sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ=" + "integrity": "sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ=", + "dev": true }, "delayed-stream": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", - "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=" + "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=", + "dev": true }, "domexception": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/domexception/-/domexception-1.0.1.tgz", "integrity": "sha512-raigMkn7CJNNo6Ihro1fzG7wr3fHuYVytzquZKX5n0yizGsTcYgzdIUwj1X9pK0VvjeihV+XiclP+DjwbsSKug==", + "dev": true, "requires": { - "webidl-conversions": "4.0.2" + "webidl-conversions": "^4.0.2" } }, "ecc-jsbn": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz", "integrity": "sha1-OoOpBOVDUyh4dMVkt1SThoSamMk=", + "dev": true, "optional": true, "requires": { - "jsbn": "0.1.1", - "safer-buffer": "2.1.2" + "jsbn": "~0.1.0", + "safer-buffer": "^2.1.0" } }, "escape-string-regexp": { @@ -217,67 +243,78 @@ "version": "1.11.0", "resolved": "https://registry.npmjs.org/escodegen/-/escodegen-1.11.0.tgz", "integrity": "sha512-IeMV45ReixHS53K/OmfKAIztN/igDHzTJUhZM3k1jMhIZWjk45SMwAtBsEXiJp3vSPmTcu6CXn7mDvFHRN66fw==", + "dev": true, "requires": { - "esprima": "3.1.3", - "estraverse": "4.2.0", - "esutils": "2.0.2", - "optionator": "0.8.2", - "source-map": "0.6.1" + "esprima": "^3.1.3", + "estraverse": "^4.2.0", + "esutils": "^2.0.2", + "optionator": "^0.8.1", + "source-map": "~0.6.1" } }, "esprima": { "version": "3.1.3", "resolved": "https://registry.npmjs.org/esprima/-/esprima-3.1.3.tgz", - "integrity": "sha1-/cpRzuYTOJXjyI1TXOSdv/YqRjM=" + "integrity": "sha1-/cpRzuYTOJXjyI1TXOSdv/YqRjM=", + "dev": true }, "estraverse": { "version": "4.2.0", "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.2.0.tgz", - "integrity": "sha1-De4/7TH81GlhjOc0IJn8GvoL2xM=" + "integrity": "sha1-De4/7TH81GlhjOc0IJn8GvoL2xM=", + "dev": true }, "esutils": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.2.tgz", - "integrity": "sha1-Cr9PHKpbyx96nYrMbepPqqBLrJs=" + "integrity": "sha1-Cr9PHKpbyx96nYrMbepPqqBLrJs=", + "dev": true }, "extend": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", - "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==" + "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==", + "dev": true }, "extsprintf": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz", - "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=" + "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=", + "dev": true }, "fast-deep-equal": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-1.1.0.tgz", - "integrity": "sha1-wFNHeBfIa1HaqFPIHgWbcz0CNhQ=" + "integrity": "sha1-wFNHeBfIa1HaqFPIHgWbcz0CNhQ=", + "dev": true }, "fast-json-stable-stringify": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz", - "integrity": "sha1-1RQsDK7msRifh9OnYREGT4bIu/I=" + "integrity": "sha1-1RQsDK7msRifh9OnYREGT4bIu/I=", + "dev": true }, "fast-levenshtein": { "version": "2.0.6", "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", - "integrity": "sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=" + "integrity": "sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=", + "dev": true }, "forever-agent": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", - "integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=" + "integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=", + "dev": true }, "form-data": { "version": "2.3.2", "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.2.tgz", "integrity": "sha1-SXBJi+YEwgwAXU9cI67NIda0kJk=", + "dev": true, "requires": { - "asynckit": "0.4.0", + "asynckit": "^0.4.0", "combined-stream": "1.0.6", - "mime-types": "2.1.19" + "mime-types": "^2.1.12" } }, "fs.realpath": { @@ -290,22 +327,25 @@ "version": "0.1.7", "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", "integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=", + "dev": true, "requires": { - "assert-plus": "1.0.0" + "assert-plus": "^1.0.0" } }, "har-schema": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz", - "integrity": "sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI=" + "integrity": "sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI=", + "dev": true }, "har-validator": { "version": "5.1.0", "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.1.0.tgz", "integrity": "sha512-+qnmNjI4OfH2ipQ9VQOw23bBd/ibtfbVdK2fYbY4acTDqKTW/YDp9McimZdDbG8iV9fZizUqQMD5xvriB146TA==", + "dev": true, "requires": { - "ajv": "5.5.2", - "har-schema": "2.0.0" + "ajv": "^5.3.0", + "har-schema": "^2.0.0" } }, "he": { @@ -318,26 +358,29 @@ "version": "1.0.2", "resolved": "https://registry.npmjs.org/html-encoding-sniffer/-/html-encoding-sniffer-1.0.2.tgz", "integrity": "sha512-71lZziiDnsuabfdYiUeWdCVyKuqwWi23L8YeIgV9jSSZHCtb6wB1BKWooH7L3tn4/FuZJMVWyNaIDr4RGmaSYw==", + "dev": true, "requires": { - "whatwg-encoding": "1.0.4" + "whatwg-encoding": "^1.0.1" } }, "http-signature": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz", "integrity": "sha1-muzZJRFHcvPZW2WmCruPfBj7rOE=", + "dev": true, "requires": { - "assert-plus": "1.0.0", - "jsprim": "1.4.1", - "sshpk": "1.14.2" + "assert-plus": "^1.0.0", + "jsprim": "^1.2.2", + "sshpk": "^1.7.0" } }, "iconv-lite": { "version": "0.4.23", "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.23.tgz", "integrity": "sha512-neyTUVFtahjf0mB3dZT77u+8O0QB89jFdnBkd5P1JgYPbPaia3gXXOVL2fq8VyU2gMMD7SaN7QukTB/pmXYvDA==", + "dev": true, "requires": { - "safer-buffer": "2.1.2" + "safer-buffer": ">= 2.1.2 < 3" } }, "inflight": { @@ -346,8 +389,8 @@ "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", "dev": true, "requires": { - "once": "1.4.0", - "wrappy": "1.0.2" + "once": "^1.3.0", + "wrappy": "1" } }, "inherits": { @@ -359,71 +402,79 @@ "is-typedarray": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", - "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=" + "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=", + "dev": true }, "isstream": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", - "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=" + "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=", + "dev": true }, "jsbn": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=", + "dev": true, "optional": true }, "jsdom": { "version": "11.12.0", "resolved": "https://registry.npmjs.org/jsdom/-/jsdom-11.12.0.tgz", "integrity": "sha512-y8Px43oyiBM13Zc1z780FrfNLJCXTL40EWlty/LXUtcjykRBNgLlCjWXpfSPBl2iv+N7koQN+dvqszHZgT/Fjw==", + "dev": true, "requires": { - "abab": "2.0.0", - "acorn": "5.7.1", - "acorn-globals": "4.1.0", - "array-equal": "1.0.0", - "cssom": "0.3.4", - "cssstyle": "1.1.1", - "data-urls": "1.0.1", - "domexception": "1.0.1", - "escodegen": "1.11.0", - "html-encoding-sniffer": "1.0.2", - "left-pad": "1.3.0", - "nwsapi": "2.0.8", + "abab": "^2.0.0", + "acorn": "^5.5.3", + "acorn-globals": "^4.1.0", + "array-equal": "^1.0.0", + "cssom": ">= 0.3.2 < 0.4.0", + "cssstyle": "^1.0.0", + "data-urls": "^1.0.0", + "domexception": "^1.0.1", + "escodegen": "^1.9.1", + "html-encoding-sniffer": "^1.0.2", + "left-pad": "^1.3.0", + "nwsapi": "^2.0.7", "parse5": "4.0.0", - "pn": "1.1.0", - "request": "2.88.0", - "request-promise-native": "1.0.5", - "sax": "1.2.4", - "symbol-tree": "3.2.2", - "tough-cookie": "2.4.3", - "w3c-hr-time": "1.0.1", - "webidl-conversions": "4.0.2", - "whatwg-encoding": "1.0.4", - "whatwg-mimetype": "2.1.0", - "whatwg-url": "6.5.0", - "ws": "5.2.2", - "xml-name-validator": "3.0.0" + "pn": "^1.1.0", + "request": "^2.87.0", + "request-promise-native": "^1.0.5", + "sax": "^1.2.4", + "symbol-tree": "^3.2.2", + "tough-cookie": "^2.3.4", + "w3c-hr-time": "^1.0.1", + "webidl-conversions": "^4.0.2", + "whatwg-encoding": "^1.0.3", + "whatwg-mimetype": "^2.1.0", + "whatwg-url": "^6.4.1", + "ws": "^5.2.0", + "xml-name-validator": "^3.0.0" } }, "json-schema": { "version": "0.2.3", "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz", - "integrity": "sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM=" + "integrity": "sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM=", + "dev": true }, "json-schema-traverse": { "version": "0.3.1", "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.3.1.tgz", - "integrity": "sha1-NJptRMU6Ud6JtAgFxdXlm0F9M0A=" + "integrity": "sha1-NJptRMU6Ud6JtAgFxdXlm0F9M0A=", + "dev": true }, "json-stringify-safe": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", - "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=" + "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=", + "dev": true }, "jsprim": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz", "integrity": "sha1-MT5mvB5cwG5Di8G3SZwuXFastqI=", + "dev": true, "requires": { "assert-plus": "1.0.0", "extsprintf": "1.3.0", @@ -434,38 +485,44 @@ "left-pad": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/left-pad/-/left-pad-1.3.0.tgz", - "integrity": "sha512-XI5MPzVNApjAyhQzphX8BkmKsKUxD4LdyK24iZeQGinBN9yTQT3bFlCBy/aVx2HrNcqQGsdot8ghrjyrvMCoEA==" + "integrity": "sha512-XI5MPzVNApjAyhQzphX8BkmKsKUxD4LdyK24iZeQGinBN9yTQT3bFlCBy/aVx2HrNcqQGsdot8ghrjyrvMCoEA==", + "dev": true }, "levn": { "version": "0.3.0", "resolved": "https://registry.npmjs.org/levn/-/levn-0.3.0.tgz", "integrity": "sha1-OwmSTt+fCDwEkP3UwLxEIeBHZO4=", + "dev": true, "requires": { - "prelude-ls": "1.1.2", - "type-check": "0.3.2" + "prelude-ls": "~1.1.2", + "type-check": "~0.3.2" } }, "lodash": { "version": "4.17.10", "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.10.tgz", - "integrity": "sha512-UejweD1pDoXu+AD825lWwp4ZGtSwgnpZxb3JDViD7StjQz+Nb/6l093lx4OQ0foGWNRoc19mWy7BzL+UAK2iVg==" + "integrity": "sha512-UejweD1pDoXu+AD825lWwp4ZGtSwgnpZxb3JDViD7StjQz+Nb/6l093lx4OQ0foGWNRoc19mWy7BzL+UAK2iVg==", + "dev": true }, "lodash.sortby": { "version": "4.7.0", "resolved": "https://registry.npmjs.org/lodash.sortby/-/lodash.sortby-4.7.0.tgz", - "integrity": "sha1-7dFMgk4sycHgsKG0K7UhBRakJDg=" + "integrity": "sha1-7dFMgk4sycHgsKG0K7UhBRakJDg=", + "dev": true }, "mime-db": { "version": "1.35.0", "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.35.0.tgz", - "integrity": "sha512-JWT/IcCTsB0Io3AhWUMjRqucrHSPsSf2xKLaRldJVULioggvkJvggZ3VXNNSRkCddE6D+BUI4HEIZIA2OjwIvg==" + "integrity": "sha512-JWT/IcCTsB0Io3AhWUMjRqucrHSPsSf2xKLaRldJVULioggvkJvggZ3VXNNSRkCddE6D+BUI4HEIZIA2OjwIvg==", + "dev": true }, "mime-types": { "version": "2.1.19", "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.19.tgz", "integrity": "sha512-P1tKYHVSZ6uFo26mtnve4HQFE3koh1UWVkp8YUC+ESBHe945xWSoXuHHiGarDqcEZ+whpCDnlNw5LON0kLo+sw==", + "dev": true, "requires": { - "mime-db": "1.35.0" + "mime-db": "~1.35.0" } }, "minimatch": { @@ -474,7 +531,7 @@ "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", "dev": true, "requires": { - "brace-expansion": "1.1.11" + "brace-expansion": "^1.1.7" } }, "minimist": { @@ -544,12 +601,12 @@ "integrity": "sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ==", "dev": true, "requires": { - "fs.realpath": "1.0.0", - "inflight": "1.0.6", - "inherits": "2.0.3", - "minimatch": "3.0.4", - "once": "1.4.0", - "path-is-absolute": "1.0.1" + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" } }, "growl": { @@ -570,7 +627,7 @@ "integrity": "sha512-zjaXglF5nnWpsq470jSv6P9DwPvgLkuapYmfDm3JWOm0vkNTVF2tI4UrN2r6jH1qM/uc/WtxYY1hYoA2dOKj5w==", "dev": true, "requires": { - "has-flag": "3.0.0" + "has-flag": "^3.0.0" } } } @@ -587,7 +644,7 @@ "integrity": "sha512-7kUx8dtd5qVNVgUARBRhnM8oftPglYwlINfigC4yGUiuzqtIN22u1tly8umiOCIPR0eFiBLjt6aN23oZh2QJgg==", "dev": true, "requires": { - "typescript": "2.9.2" + "typescript": "^2.7.2" }, "dependencies": { "typescript": { @@ -607,12 +664,14 @@ "nwsapi": { "version": "2.0.8", "resolved": "https://registry.npmjs.org/nwsapi/-/nwsapi-2.0.8.tgz", - "integrity": "sha512-7RZ+qbFGiVc6v14Y8DSZjPN1wZPOaMbiiP4tzf5eNuyOITAeOIA3cMhjuKUypVIqBgCSg1KaSyAv8Ocq/0ZJ1A==" + "integrity": "sha512-7RZ+qbFGiVc6v14Y8DSZjPN1wZPOaMbiiP4tzf5eNuyOITAeOIA3cMhjuKUypVIqBgCSg1KaSyAv8Ocq/0ZJ1A==", + "dev": true }, "oauth-sign": { "version": "0.9.0", "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz", - "integrity": "sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ==" + "integrity": "sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ==", + "dev": true }, "once": { "version": "1.4.0", @@ -620,26 +679,28 @@ "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", "dev": true, "requires": { - "wrappy": "1.0.2" + "wrappy": "1" } }, "optionator": { "version": "0.8.2", "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.8.2.tgz", "integrity": "sha1-NkxeQJ0/TWMB1sC0wFu6UBgK62Q=", + "dev": true, "requires": { - "deep-is": "0.1.3", - "fast-levenshtein": "2.0.6", - "levn": "0.3.0", - "prelude-ls": "1.1.2", - "type-check": "0.3.2", - "wordwrap": "1.0.0" + "deep-is": "~0.1.3", + "fast-levenshtein": "~2.0.4", + "levn": "~0.3.0", + "prelude-ls": "~1.1.2", + "type-check": "~0.3.2", + "wordwrap": "~1.0.0" } }, "parse5": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/parse5/-/parse5-4.0.0.tgz", - "integrity": "sha512-VrZ7eOd3T1Fk4XWNXMgiGBK/z0MG48BWG2uQNU4I72fkQuKUTZpl+u9k+CxEG0twMVzSmXEEz12z5Fnw1jIQFA==" + "integrity": "sha512-VrZ7eOd3T1Fk4XWNXMgiGBK/z0MG48BWG2uQNU4I72fkQuKUTZpl+u9k+CxEG0twMVzSmXEEz12z5Fnw1jIQFA==", + "dev": true }, "path-is-absolute": { "version": "1.0.1", @@ -650,76 +711,85 @@ "performance-now": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", - "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=" + "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=", + "dev": true }, "pn": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/pn/-/pn-1.1.0.tgz", - "integrity": "sha512-2qHaIQr2VLRFoxe2nASzsV6ef4yOOH+Fi9FBOVH6cqeSgUnoyySPZkxzLuzd+RYOQTRpROA0ztTMqxROKSb/nA==" + "integrity": "sha512-2qHaIQr2VLRFoxe2nASzsV6ef4yOOH+Fi9FBOVH6cqeSgUnoyySPZkxzLuzd+RYOQTRpROA0ztTMqxROKSb/nA==", + "dev": true }, "prelude-ls": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.2.tgz", - "integrity": "sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ=" + "integrity": "sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ=", + "dev": true }, "psl": { "version": "1.1.29", "resolved": "https://registry.npmjs.org/psl/-/psl-1.1.29.tgz", - "integrity": "sha512-AeUmQ0oLN02flVHXWh9sSJF7mcdFq0ppid/JkErufc3hGIV/AMa8Fo9VgDo/cT2jFdOWoFvHp90qqBH54W+gjQ==" + "integrity": "sha512-AeUmQ0oLN02flVHXWh9sSJF7mcdFq0ppid/JkErufc3hGIV/AMa8Fo9VgDo/cT2jFdOWoFvHp90qqBH54W+gjQ==", + "dev": true }, "punycode": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", - "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==" + "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==", + "dev": true }, "qs": { "version": "6.5.2", "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz", - "integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==" + "integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==", + "dev": true }, "request": { "version": "2.88.0", "resolved": "https://registry.npmjs.org/request/-/request-2.88.0.tgz", "integrity": "sha512-NAqBSrijGLZdM0WZNsInLJpkJokL72XYjUpnB0iwsRgxh7dB6COrHnTBNwN0E+lHDAJzu7kLAkDeY08z2/A0hg==", + "dev": true, "requires": { - "aws-sign2": "0.7.0", - "aws4": "1.8.0", - "caseless": "0.12.0", - "combined-stream": "1.0.6", - "extend": "3.0.2", - "forever-agent": "0.6.1", - "form-data": "2.3.2", - "har-validator": "5.1.0", - "http-signature": "1.2.0", - "is-typedarray": "1.0.0", - "isstream": "0.1.2", - "json-stringify-safe": "5.0.1", - "mime-types": "2.1.19", - "oauth-sign": "0.9.0", - "performance-now": "2.1.0", - "qs": "6.5.2", - "safe-buffer": "5.1.2", - "tough-cookie": "2.4.3", - "tunnel-agent": "0.6.0", - "uuid": "3.3.2" + "aws-sign2": "~0.7.0", + "aws4": "^1.8.0", + "caseless": "~0.12.0", + "combined-stream": "~1.0.6", + "extend": "~3.0.2", + "forever-agent": "~0.6.1", + "form-data": "~2.3.2", + "har-validator": "~5.1.0", + "http-signature": "~1.2.0", + "is-typedarray": "~1.0.0", + "isstream": "~0.1.2", + "json-stringify-safe": "~5.0.1", + "mime-types": "~2.1.19", + "oauth-sign": "~0.9.0", + "performance-now": "^2.1.0", + "qs": "~6.5.2", + "safe-buffer": "^5.1.2", + "tough-cookie": "~2.4.3", + "tunnel-agent": "^0.6.0", + "uuid": "^3.3.2" } }, "request-promise-core": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/request-promise-core/-/request-promise-core-1.1.1.tgz", "integrity": "sha1-Pu4AssWqgyOc+wTFcA2jb4HNCLY=", + "dev": true, "requires": { - "lodash": "4.17.10" + "lodash": "^4.13.1" } }, "request-promise-native": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/request-promise-native/-/request-promise-native-1.0.5.tgz", "integrity": "sha1-UoF3D2jgyXGeUWP9P6tIIhX0/aU=", + "dev": true, "requires": { "request-promise-core": "1.1.1", - "stealthy-require": "1.1.1", - "tough-cookie": "2.4.3" + "stealthy-require": "^1.1.0", + "tough-cookie": ">=2.3.3" } }, "requirejs": { @@ -731,62 +801,71 @@ "safe-buffer": { "version": "5.1.2", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", + "dev": true }, "safer-buffer": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", - "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", + "dev": true }, "sax": { "version": "1.2.4", "resolved": "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz", - "integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==" + "integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==", + "dev": true }, "source-map": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==" + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true }, "sshpk": { "version": "1.14.2", "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.14.2.tgz", "integrity": "sha1-xvxhZIo9nE52T9P8306hBeSSupg=", + "dev": true, "requires": { - "asn1": "0.2.4", - "assert-plus": "1.0.0", - "bcrypt-pbkdf": "1.0.2", - "dashdash": "1.14.1", - "ecc-jsbn": "0.1.2", - "getpass": "0.1.7", - "jsbn": "0.1.1", - "safer-buffer": "2.1.2", - "tweetnacl": "0.14.5" + "asn1": "~0.2.3", + "assert-plus": "^1.0.0", + "bcrypt-pbkdf": "^1.0.0", + "dashdash": "^1.12.0", + "ecc-jsbn": "~0.1.1", + "getpass": "^0.1.1", + "jsbn": "~0.1.0", + "safer-buffer": "^2.0.2", + "tweetnacl": "~0.14.0" } }, "stealthy-require": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/stealthy-require/-/stealthy-require-1.1.1.tgz", - "integrity": "sha1-NbCYdbT/SfJqd35QmzCQoyJr8ks=" + "integrity": "sha1-NbCYdbT/SfJqd35QmzCQoyJr8ks=", + "dev": true }, "symbol-tree": { "version": "3.2.2", "resolved": "https://registry.npmjs.org/symbol-tree/-/symbol-tree-3.2.2.tgz", - "integrity": "sha1-rifbOPZgp64uHDt9G8KQgZuFGeY=" + "integrity": "sha1-rifbOPZgp64uHDt9G8KQgZuFGeY=", + "dev": true }, "tough-cookie": { "version": "2.4.3", "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.4.3.tgz", "integrity": "sha512-Q5srk/4vDM54WJsJio3XNn6K2sCG+CQ8G5Wz6bZhRZoAe/+TxjWB/GlFAnYEbkYVlON9FMk/fE3h2RLpPXo4lQ==", + "dev": true, "requires": { - "psl": "1.1.29", - "punycode": "1.4.1" + "psl": "^1.1.24", + "punycode": "^1.4.1" }, "dependencies": { "punycode": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz", - "integrity": "sha1-wNWmOycYgArY4esPpSachN1BhF4=" + "integrity": "sha1-wNWmOycYgArY4esPpSachN1BhF4=", + "dev": true } } }, @@ -794,30 +873,34 @@ "version": "1.0.1", "resolved": "https://registry.npmjs.org/tr46/-/tr46-1.0.1.tgz", "integrity": "sha1-qLE/1r/SSJUZZ0zN5VujaTtwbQk=", + "dev": true, "requires": { - "punycode": "2.1.1" + "punycode": "^2.1.0" } }, "tunnel-agent": { "version": "0.6.0", "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", "integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=", + "dev": true, "requires": { - "safe-buffer": "5.1.2" + "safe-buffer": "^5.0.1" } }, "tweetnacl": { "version": "0.14.5", "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=", + "dev": true, "optional": true }, "type-check": { "version": "0.3.2", "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.3.2.tgz", "integrity": "sha1-WITKtRLPHTVeP7eE8wgEsrUg23I=", + "dev": true, "requires": { - "prelude-ls": "1.1.2" + "prelude-ls": "~1.1.2" } }, "typescript": { @@ -832,42 +915,47 @@ "integrity": "sha512-J0M2i1mQA+ze3EdN9SBi751DNdAXmeFLfJrd/MDIkRc3G3Gbb9OPVSx7GIQvVwfWxQARcYV2DTxIkMyDAk3o9Q==", "dev": true, "requires": { - "commander": "2.16.0", - "source-map": "0.6.1" + "commander": "~2.16.0", + "source-map": "~0.6.1" } }, "uuid": { "version": "3.3.2", "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.2.tgz", - "integrity": "sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA==" + "integrity": "sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA==", + "dev": true }, "verror": { "version": "1.10.0", "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", "integrity": "sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=", + "dev": true, "requires": { - "assert-plus": "1.0.0", + "assert-plus": "^1.0.0", "core-util-is": "1.0.2", - "extsprintf": "1.3.0" + "extsprintf": "^1.2.0" } }, "w3c-hr-time": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/w3c-hr-time/-/w3c-hr-time-1.0.1.tgz", "integrity": "sha1-gqwr/2PZUOqeMYmlimViX+3xkEU=", + "dev": true, "requires": { - "browser-process-hrtime": "0.1.2" + "browser-process-hrtime": "^0.1.2" } }, "webidl-conversions": { "version": "4.0.2", "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-4.0.2.tgz", - "integrity": "sha512-YQ+BmxuTgd6UXZW3+ICGfyqRyHXVlD5GtQr5+qjiNW7bF0cqrzX500HVXPBOvgXb5YnzDd+h0zqyv61KUD7+Sg==" + "integrity": "sha512-YQ+BmxuTgd6UXZW3+ICGfyqRyHXVlD5GtQr5+qjiNW7bF0cqrzX500HVXPBOvgXb5YnzDd+h0zqyv61KUD7+Sg==", + "dev": true }, "whatwg-encoding": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/whatwg-encoding/-/whatwg-encoding-1.0.4.tgz", "integrity": "sha512-vM9KWN6MP2mIHZ86ytcyIv7e8Cj3KTfO2nd2c8PFDqcI4bxFmQp83ibq4wadq7rL9l9sZV6o9B0LTt8ygGAAXg==", + "dev": true, "requires": { "iconv-lite": "0.4.23" } @@ -875,22 +963,25 @@ "whatwg-mimetype": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/whatwg-mimetype/-/whatwg-mimetype-2.1.0.tgz", - "integrity": "sha512-FKxhYLytBQiUKjkYteN71fAUA3g6KpNXoho1isLiLSB3N1G4F35Q5vUxWfKFhBwi5IWF27VE6WxhrnnC+m0Mew==" + "integrity": "sha512-FKxhYLytBQiUKjkYteN71fAUA3g6KpNXoho1isLiLSB3N1G4F35Q5vUxWfKFhBwi5IWF27VE6WxhrnnC+m0Mew==", + "dev": true }, "whatwg-url": { "version": "6.5.0", "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-6.5.0.tgz", "integrity": "sha512-rhRZRqx/TLJQWUpQ6bmrt2UV4f0HCQ463yQuONJqC6fO2VoEb1pTYddbe59SkYq87aoM5A3bdhMZiUiVws+fzQ==", + "dev": true, "requires": { - "lodash.sortby": "4.7.0", - "tr46": "1.0.1", - "webidl-conversions": "4.0.2" + "lodash.sortby": "^4.7.0", + "tr46": "^1.0.1", + "webidl-conversions": "^4.0.2" } }, "wordwrap": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz", - "integrity": "sha1-J1hIEIkUVqQXHI0CJkQa3pDLyus=" + "integrity": "sha1-J1hIEIkUVqQXHI0CJkQa3pDLyus=", + "dev": true }, "wrappy": { "version": "1.0.2", @@ -902,14 +993,16 @@ "version": "5.2.2", "resolved": "https://registry.npmjs.org/ws/-/ws-5.2.2.tgz", "integrity": "sha512-jaHFD6PFv6UgoIVda6qZllptQsMlDEJkTQcybzzXDYM1XO9Y8em691FGMPmM46WGyLU4z9KMgQN+qrux/nhlHA==", + "dev": true, "requires": { - "async-limiter": "1.0.0" + "async-limiter": "~1.0.0" } }, "xml-name-validator": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/xml-name-validator/-/xml-name-validator-3.0.0.tgz", - "integrity": "sha512-A5CUptxDsvxKJEU3yO6DuWBSJz/qizqzJKOMIfUJHETbBw/sFaDxgd6fxm1ewUaM0jZ444Fc5vC5ROYurg/4Pw==" + "integrity": "sha512-A5CUptxDsvxKJEU3yO6DuWBSJz/qizqzJKOMIfUJHETbBw/sFaDxgd6fxm1ewUaM0jZ444Fc5vC5ROYurg/4Pw==", + "dev": true } } } diff --git a/src/objective-c/objective-c.ts b/src/objective-c/objective-c.ts index 7cc95412..a2414342 100644 --- a/src/objective-c/objective-c.ts +++ b/src/objective-c/objective-c.ts @@ -201,18 +201,18 @@ export const language = { [/"/, 'string.escape', '@dblStringBody'] ], stringBody: [ + [/[^\\']+$/, 'string', '@popall'], + [/[^\\']+/, 'string'], [/\\./, 'string'], [/'/, 'string.escape', '@popall'], - [/.(?=.*')/, 'string'], - [/.*\\$/, 'string'], - [/.*$/, 'string', '@popall'] + [/\\$/, 'string'] ], dblStringBody: [ + [/[^\\"]+$/, 'string', '@popall'], + [/[^\\"]+/, 'string'], [/\\./, 'string'], [/"/, 'string.escape', '@popall'], - [/.(?=.*")/, 'string'], - [/.*\\$/, 'string'], - [/.*$/, 'string', '@popall'] + [/\\$/, 'string'] ] } }; diff --git a/src/python/python.ts b/src/python/python.ts index 268769cd..90f624ca 100644 --- a/src/python/python.ts +++ b/src/python/python.ts @@ -244,18 +244,18 @@ export const language = { [/"/, 'string.escape', '@dblStringBody'] ], stringBody: [ + [/[^\\']+$/, 'string', '@popall'], + [/[^\\']+/, 'string'], [/\\./, 'string'], [/'/, 'string.escape', '@popall'], - [/.(?=.*')/, 'string'], - [/.*\\$/, 'string'], - [/.*$/, 'string', '@popall'] + [/\\$/, 'string'] ], dblStringBody: [ + [/[^\\"]+$/, 'string', '@popall'], + [/[^\\"]+/, 'string'], [/\\./, 'string'], [/"/, 'string.escape', '@popall'], - [/.(?=.*")/, 'string'], - [/.*\\$/, 'string'], - [/.*$/, 'string', '@popall'] + [/\\$/, 'string'] ] } }; diff --git a/src/scheme/scheme.ts b/src/scheme/scheme.ts index 7c3129f3..34657295 100644 --- a/src/scheme/scheme.ts +++ b/src/scheme/scheme.ts @@ -117,11 +117,11 @@ export const language = { ], multiLineString: [ + [/[^\\"]+$/, 'string', '@popall'], + [/[^\\"]+/, 'string'], [/\\./, 'string.escape'], [/"/, 'string', '@popall'], - [/.(?=.*")/, 'string'], - [/.*\\$/, 'string'], - [/.*$/, 'string', '@popall'], + [/\\$/, 'string'] ], }, }; From 70f12687bbfb7cacfeccffde062b4c11a7205e0b Mon Sep 17 00:00:00 2001 From: Alex Dima Date: Mon, 12 Nov 2018 13:44:24 +0100 Subject: [PATCH 087/133] Inline constants --- src/markdown/markdown.ts | 79 ++++++++++++++++------------------------ 1 file changed, 31 insertions(+), 48 deletions(-) diff --git a/src/markdown/markdown.ts b/src/markdown/markdown.ts index c2b852fd..79cbadf4 100644 --- a/src/markdown/markdown.ts +++ b/src/markdown/markdown.ts @@ -8,23 +8,6 @@ import IRichLanguageConfiguration = monaco.languages.LanguageConfiguration; import ILanguage = monaco.languages.IMonarchLanguage; -const TOKEN_HEADER_LEAD = 'keyword'; -const TOKEN_HEADER = 'keyword'; -const TOKEN_EXT_HEADER = 'keyword'; -const TOKEN_SEPARATOR = 'meta.separator'; -const TOKEN_QUOTE = 'comment'; -const TOKEN_LIST = 'keyword'; -const TOKEN_BLOCK = 'string'; -const TOKEN_BLOCK_CODE = 'variable.source'; - -const DELIM_ASSIGN = 'delimiter.html'; -const ATTRIB_NAME = 'attribute.name.html'; -const ATTRIB_VALUE = 'string.html'; - -function getTag(name: string) { - return 'tag'; -} - export const conf: IRichLanguageConfiguration = { comments: { blockComment: ['',] @@ -75,46 +58,46 @@ export const language = { root: [ // headers (with #) - [/^(\s{0,3})(#+)((?:[^\\#]|@escapes)+)((?:#+)?)/, ['white', TOKEN_HEADER_LEAD, TOKEN_HEADER, TOKEN_HEADER]], + [/^(\s{0,3})(#+)((?:[^\\#]|@escapes)+)((?:#+)?)/, ['white', 'keyword', 'keyword', 'keyword']], // headers (with =) - [/^\s*(=+|\-+)\s*$/, TOKEN_EXT_HEADER], + [/^\s*(=+|\-+)\s*$/, 'keyword'], // headers (with ***) - [/^\s*((\*[ ]?)+)\s*$/, TOKEN_SEPARATOR], + [/^\s*((\*[ ]?)+)\s*$/, 'meta.separator'], // quote - [/^\s*>+/, TOKEN_QUOTE], + [/^\s*>+/, 'comment'], // list (starting with * or number) - [/^\s*([\*\-+:]|\d+\.)\s/, TOKEN_LIST], + [/^\s*([\*\-+:]|\d+\.)\s/, 'keyword'], // code block (4 spaces indent) - [/^(\t|[ ]{4})[^ ].*$/, TOKEN_BLOCK], + [/^(\t|[ ]{4})[^ ].*$/, 'string'], // code block (3 tilde) - [/^\s*~~~\s*((?:\w|[\/\-#])+)?\s*$/, { token: TOKEN_BLOCK, next: '@codeblock' }], + [/^\s*~~~\s*((?:\w|[\/\-#])+)?\s*$/, { token: 'string', next: '@codeblock' }], // github style code blocks (with backticks and language) - [/^\s*```\s*((?:\w|[\/\-#])+)\s*$/, { token: TOKEN_BLOCK, next: '@codeblockgh', nextEmbedded: '$1' }], + [/^\s*```\s*((?:\w|[\/\-#])+)\s*$/, { token: 'string', next: '@codeblockgh', nextEmbedded: '$1' }], // github style code blocks (with backticks but no language) - [/^\s*```\s*$/, { token: TOKEN_BLOCK, next: '@codeblock' }], + [/^\s*```\s*$/, { token: 'string', next: '@codeblock' }], // markup within lines { include: '@linecontent' }, ], codeblock: [ - [/^\s*~~~\s*$/, { token: TOKEN_BLOCK, next: '@pop' }], - [/^\s*```\s*$/, { token: TOKEN_BLOCK, next: '@pop' }], - [/.*$/, TOKEN_BLOCK_CODE], + [/^\s*~~~\s*$/, { token: 'string', next: '@pop' }], + [/^\s*```\s*$/, { token: 'string', next: '@pop' }], + [/.*$/, 'variable.source'], ], // github style code blocks codeblockgh: [ - [/```\s*$/, { token: TOKEN_BLOCK_CODE, next: '@pop', nextEmbedded: '@pop' }], - [/[^`]+/, TOKEN_BLOCK_CODE], + [/```\s*$/, { token: 'variable.source', next: '@pop', nextEmbedded: '@pop' }], + [/[^`]+/, 'variable.source'], ], linecontent: [ @@ -146,14 +129,14 @@ export const language = { // we cannot correctly tokenize it in that mode yet. html: [ // html tags - [/<(\w+)\/>/, getTag('$1')], + [/<(\w+)\/>/, 'tag'], [/<(\w+)/, { cases: { - '@empty': { token: getTag('$1'), next: '@tag.$1' }, - '@default': { token: getTag('$1'), next: '@tag.$1' } + '@empty': { token: 'tag', next: '@tag.$1' }, + '@default': { token: 'tag', next: '@tag.$1' } } }], - [/<\/(\w+)\s*>/, { token: getTag('$1') }], + [/<\/(\w+)\s*>/, { token: 'tag' }], [/