Forráskód Böngészése

Merge branch 'master' of https://github.com/Microsoft/monaco-languages

Sergey Romanov 5 éve
szülő
commit
7e0f9bc899

+ 1 - 0
README.md

@@ -8,6 +8,7 @@ Colorization and configuration supports for multiple languages for the Monaco Ed
 * apex
 * azcli
 * bat
+* cameligo
 * clojure
 * coffee script
 * cpp

A különbségek nem kerülnek megjelenítésre, a fájl túl nagy
+ 240 - 375
package-lock.json


+ 4 - 4
package.json

@@ -18,12 +18,12 @@
     "url": "https://github.com/Microsoft/monaco-languages/issues"
   },
   "devDependencies": {
-    "jsdom": "^15.1.1",
-    "mocha": "^6.1.4",
+    "jsdom": "^15.2.1",
+    "mocha": "^6.2.2",
     "monaco-editor-core": "0.18.1",
     "monaco-plugin-helpers": "^1.0.2",
     "requirejs": "^2.3.6",
-    "typescript": "3.5.3",
-    "uglify-js": "^3.6.0"
+    "typescript": "3.7.3",
+    "uglify-js": "^3.7.2"
   }
 }

+ 1 - 0
scripts/bundle.js

@@ -23,6 +23,7 @@ const BUNDLED_FILE_HEADER = [
 bundleOne('monaco.contribution');
 bundleOne('abap/abap');
 bundleOne('bat/bat');
+bundleOne('cameligo/cameligo'),
 bundleOne('css/css');
 bundleOne('coffee/coffee');
 bundleOne('cpp/cpp');

+ 45 - 15
src/_.contribution.ts

@@ -16,31 +16,61 @@ interface ILangImpl {
 	language: monaco.languages.IMonarchLanguage;
 }
 
-let languageDefinitions: { [languageId: string]: ILang } = {};
+const languageDefinitions: { [languageId: string]: ILang; } = {};
+const lazyLanguageLoaders: { [languageId: string]: LazyLanguageLoader; } = {};
 
-function _loadLanguage(languageId: string): Promise<void> {
-	const loader = languageDefinitions[languageId].loader;
-	return loader().then((mod) => {
-		_monaco.languages.setMonarchTokensProvider(languageId, mod.language);
-		_monaco.languages.setLanguageConfiguration(languageId, mod.conf);
-	});
-}
+class LazyLanguageLoader {
+
+	public static getOrCreate(languageId: string): LazyLanguageLoader {
+		if (!lazyLanguageLoaders[languageId]) {
+			lazyLanguageLoaders[languageId] = new LazyLanguageLoader(languageId);
+		}
+		return lazyLanguageLoaders[languageId];
+	}
+
+	private readonly _languageId: string;
+	private _loadingTriggered: boolean;
+	private _lazyLoadPromise: Promise<ILangImpl>;
+	private _lazyLoadPromiseResolve!: (value: ILangImpl) => void;
+	private _lazyLoadPromiseReject!: (err: any) => void;
 
-let languagePromises: { [languageId: string]: Promise<void> } = {};
+	constructor(languageId: string) {
+		this._languageId = languageId;
+		this._loadingTriggered = false;
+		this._lazyLoadPromise = new Promise((resolve, reject) => {
+			this._lazyLoadPromiseResolve = resolve;
+			this._lazyLoadPromiseReject = reject;
+		});
+	}
 
-export function loadLanguage(languageId: string): Promise<void> {
-	if (!languagePromises[languageId]) {
-		languagePromises[languageId] = _loadLanguage(languageId);
+	public whenLoaded(): Promise<ILangImpl> {
+		return this._lazyLoadPromise;
+	}
+
+	public load(): Promise<ILangImpl> {
+		if (!this._loadingTriggered) {
+			this._loadingTriggered = true;
+			languageDefinitions[this._languageId].loader().then(mod => this._lazyLoadPromiseResolve(mod), err => this._lazyLoadPromiseReject(err));
+		}
+		return this._lazyLoadPromise;
 	}
-	return languagePromises[languageId];
+}
+
+export function loadLanguage(languageId: string): Promise<ILangImpl> {
+	return LazyLanguageLoader.getOrCreate(languageId).load();
 }
 
 export function registerLanguage(def: ILang): void {
-	let languageId = def.id;
+	const languageId = def.id;
 
 	languageDefinitions[languageId] = def;
 	_monaco.languages.register(def);
+
+	const lazyLanguageLoader = LazyLanguageLoader.getOrCreate(languageId);
+	_monaco.languages.setMonarchTokensProvider(languageId, lazyLanguageLoader.whenLoaded().then(mod => mod.language));
 	_monaco.languages.onLanguage(languageId, () => {
-		loadLanguage(languageId);
+		lazyLanguageLoader.load().then(mod => {
+			_monaco.languages.setLanguageConfiguration(languageId, mod.conf);
+		});
 	});
 }

+ 2 - 2
src/apex/apex.ts

@@ -189,9 +189,9 @@ const keywords = [
 
 // 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);
+const uppercaseFirstLetter = (lowercase: string) => lowercase.charAt(0).toUpperCase() + lowercase.substr(1);
 
-let keywordsWithCaseVariations = [];
+let keywordsWithCaseVariations: string[] = [];
 keywords.forEach(lowercase => {
 	keywordsWithCaseVariations.push(lowercase);
 	keywordsWithCaseVariations.push(lowercase.toUpperCase());

+ 14 - 0
src/cameligo/cameligo.contribution.ts

@@ -0,0 +1,14 @@
+/*---------------------------------------------------------------------------------------------
+ *  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';
+
+registerLanguage({
+	id: 'cameligo',
+	extensions: ['.mligo'],
+	aliases: ['Cameligo'],
+	loader: () => import('./cameligo')
+});

+ 140 - 0
src/cameligo/cameligo.test.ts

@@ -0,0 +1,140 @@
+/*---------------------------------------------------------------------------------------------
+ *  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('cameligo', [
+
+	// Comments - single line
+	[{
+		line: '//',
+		tokens: [
+			{ startIndex: 0, type: 'comment.cameligo' }
+		]
+	}],
+
+	[{
+		line: '    // a comment',
+		tokens: [
+			{ startIndex: 0, type: 'white.cameligo' },
+			{ startIndex: 4, type: 'comment.cameligo' }
+		]
+	}],
+
+	[{
+		line: '// a comment',
+		tokens: [
+			{ startIndex: 0, type: 'comment.cameligo' }
+		]
+	}],
+
+	[{
+		line: '//sticky comment',
+		tokens: [
+			{ startIndex: 0, type: 'comment.cameligo' }
+		]
+	}],
+
+	// Comments - multi line (single line)
+	[{
+		line: '(**)',
+		tokens: [
+			{ startIndex: 0, type: 'comment.cameligo' }
+		]
+	}],
+
+	[{
+		line: '    (* a comment *)',
+		tokens: [
+			{ startIndex: 0, type: 'white.cameligo' },
+			{ startIndex: 4, type: 'comment.cameligo' }
+		]
+	}],
+
+	[{
+		line: '(* a comment *)',
+		tokens: [
+			{ startIndex: 0, type: 'comment.cameligo' }
+		]
+	}],
+
+	[{
+		line: '(*sticky comment*)',
+		tokens: [
+			{ startIndex: 0, type: 'comment.cameligo' }
+		]
+	}],
+
+	// Comments - multi line (multi line)
+	[{
+		line: '(* start of multiline comment ',
+		tokens: [
+			{ startIndex: 0, type: 'comment.cameligo' }
+		]
+	}, {
+		line: 'a comment between curly',
+		tokens: [
+			{ startIndex: 0, type: 'comment.cameligo'}
+		]
+	}, {
+		line: 'end of multiline comment*)',
+		tokens: [
+			{ startIndex: 0, type: 'comment.cameligo'}
+		]
+	}],
+
+	// Keywords
+	[{
+		line: 'let check if Current.amount',
+		tokens: [
+			{ startIndex: 0, type: 'keyword.let.cameligo'},
+			{ startIndex: 3, type: 'white.cameligo'},
+			{ startIndex: 4, type: 'identifier.cameligo'},
+			{ startIndex: 9, type: 'white.cameligo'},
+			{ startIndex: 10, type: 'keyword.if.cameligo'},
+			{ startIndex: 12, type: 'white.cameligo'},
+			{ startIndex: 13, type: 'keyword.current.cameligo'},
+			{ startIndex: 20, type: 'delimiter.cameligo'},
+			{ startIndex: 21, type: 'identifier.cameligo'},
+		]
+	}],
+
+	// Numbers
+	[{
+		line: '0',
+		tokens: [
+			{ startIndex: 0, type: 'number.cameligo'}
+		]
+	}],
+	[{
+		line: '0;',
+		tokens: [
+			{ startIndex: 0, type: 'number.cameligo'},
+			{ startIndex: 1, type: 'delimiter.cameligo'}
+		]
+	}],
+	[{
+		line: '2.4',
+		tokens: [
+			{ startIndex: 0, type: 'number.float.cameligo'}
+		]
+	}],
+	[{
+		line: '2.4;',
+		tokens: [
+			{ startIndex: 0, type: 'number.float.cameligo'},
+			{ startIndex: 3, type: 'delimiter.cameligo'}
+		]
+	}],
+	[{
+		line: '$123FF',
+		tokens: [
+			{ startIndex: 0, type: 'number.hex.cameligo'}
+		]
+	}]
+
+]);

+ 131 - 0
src/cameligo/cameligo.ts

@@ -0,0 +1,131 @@
+/*---------------------------------------------------------------------------------------------
+ *  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: '>' },
+		{ open: '\'', close: '\'' },
+	],
+	surroundingPairs: [
+		{ open: '{', close: '}' },
+		{ open: '[', close: ']' },
+		{ open: '(', close: ')' },
+		{ open: '<', close: '>' },
+		{ open: '\'', close: '\'' },
+	]
+};
+
+export const language = <ILanguage>{
+	defaultToken: '',
+	tokenPostfix: '.cameligo',
+	ignoreCase: true,
+
+	brackets: [
+		{ open: '{', close: '}', token: 'delimiter.curly' },
+		{ open: '[', close: ']', token: 'delimiter.square' },
+		{ open: '(', close: ')', token: 'delimiter.parenthesis' },
+		{ open: '<', close: '>', token: 'delimiter.angle' }
+	],
+
+	keywords: [
+		'abs', 'begin', 'Bytes', 'Crypto',  'Current', 'else', 'end', 'failwith', 
+		'false', 'fun', 'if', 'in', 'let', 'let%entry', 'let%init', 'List', 'list',
+		'Map', 'map', 'match', 'match%nat', 'mod', 'not',  'operation', 'Operation',  'of',
+		'Set', 'set', 'sender', 'source', 'String', 'then',  'true', 'type', 'with',  
+	],
+
+	typeKeywords: [
+		'int', 'unit', 'string', 'tz',
+	],
+
+	operators: [
+		'=', '>', '<', '<=', '>=', '<>', ':', ':=', 'and', 'mod', 'or',
+		'+', '-', '*', '/', '@', '&', '^', '%', '->', '<-'
+	],
+
+	// we include these common regular expressions
+	symbols: /[=><:@\^&|+\-*\/\^%]+/,
+
+	// The main tokenizer for our languages
+	tokenizer: {
+		root: [
+			// identifiers and keywords
+			[/[a-zA-Z_][\w]*/, {
+				cases: {
+					'@keywords': { token: 'keyword.$0' },
+					'@default': 'identifier'
+				}
+			}],
+
+			// whitespace
+			{ include: '@whitespace' },
+
+			// delimiters and operators
+			[/[{}()\[\]]/, '@brackets'],
+			[/[<>](?!@symbols)/, '@brackets'],
+			[/@symbols/, {
+				cases: {
+					'@operators': 'delimiter',
+					'@default': ''
+				}
+			}],
+
+			// numbers
+			[/\d*\.\d+([eE][\-+]?\d+)?/, 'number.float'],
+			[/\$[0-9a-fA-F]{1,16}/, 'number.hex'],
+			[/\d+/, 'number'],
+
+			// delimiter: after number because of .\d floats
+			[/[;,.]/, 'delimiter'],
+
+			// strings
+			[/'([^'\\]|\\.)*$/, 'string.invalid'],  // non-teminated string
+			[/'/, 'string', '@string'],
+
+			// characters
+			[/'[^\\']'/, 'string'],
+			[/'/, 'string.invalid'],
+			[/\#\d+/,'string']
+		],
+		/* */
+
+		comment: [
+			[/[^\(\*]+/, 'comment' ],
+			//[/\(\*/,    'comment', '@push' ],    // nested comment  not allowed :-(
+			[/\*\)/,    'comment', '@pop'  ],
+			[/\(\*/,   'comment' ]
+		],
+
+		string: [
+		  [/[^\\']+/,  'string'],
+		  [/\\./,      'string.escape.invalid'],
+		  [/'/,        { token: 'string.quote', bracket: '@close', next: '@pop' } ]
+		],
+
+		whitespace: [
+			[/[ \t\r\n]+/, 'white'],
+			[/\(\*/,       'comment', '@comment' ],
+			[/\/\/.*$/,    'comment'],
+		  ],
+	},
+};

+ 12 - 0
src/handlebars/handlebars.test.ts

@@ -269,5 +269,17 @@ testTokenization(['handlebars', 'css'], [
 			{ startIndex: 8, type: 'attribute.value' },
 			{ startIndex: 30, type: 'delimiter.html' }
 		]
+	}],
+
+	[{
+		line: '{{test "coloring/looks broken"}}">',
+		tokens: [
+			{ startIndex: 0, type: 'delimiter.handlebars' },
+			{ startIndex: 2, type: 'variable.parameter.handlebars' },
+			{ startIndex: 6, type: '' },
+			{ startIndex: 7, type: 'string.handlebars' },
+			{ startIndex: 30, type: 'delimiter.handlebars' },
+			{ startIndex: 32, type: '' }
+		]
 	}]
 ]);

+ 1 - 0
src/handlebars/handlebars.ts

@@ -220,6 +220,7 @@ export const language = <ILanguage>{
 		],
 
 		handlebarsRoot: [
+			[/"[^"]*"/, 'string.handlebars'],
 			[/[#/][^\s}]+/, 'keyword.helper.handlebars'],
 			[/else\b/, 'keyword.helper.handlebars'],
 			[/[\s]+/],

+ 27 - 0
src/javascript/javascript.test.ts

@@ -725,6 +725,33 @@ testTokenization('javascript', [
 	}],
 
 
+	[{
+		line: 'test ? 1 : 2',
+		tokens: [
+			{ startIndex: 0, type: 'identifier.js' },
+			{ startIndex: 4, type: '' },
+			{ startIndex: 5, type: 'delimiter.js' },
+			{ startIndex: 6, type: '' },
+			{ startIndex: 7, type: 'number.js' },
+			{ startIndex: 8, type: '' },
+			{ startIndex: 9, type: 'delimiter.js' },
+			{ startIndex: 10, type: '' },
+			{ startIndex: 11, type: 'number.js' },
+		]
+	}],
+
+	[{
+		line: 'couldBeNullish ?? 1',
+		tokens: [
+			{ startIndex: 0, type: 'identifier.js' },
+			{ startIndex: 14, type: '' },
+			{ startIndex: 15, type: 'delimiter.js' },
+			{ startIndex: 17, type: '' },
+			{ startIndex: 18, type: 'number.js' }
+		]
+	}],
+
+
 	[{
 		line: '`${5 + \'x\' + 3}a${4}`',
 		tokens: [

+ 14 - 10
src/kotlin/kotlin.test.ts

@@ -62,16 +62,6 @@ testTokenization('kotlin', [
 		]
 	}],
 
-	// Broken nested tokens due to invalid comment tokenization
-	[{
-		line: '/* //*/ a',
-		tokens: [
-			{ startIndex: 0, type: 'comment.kt' },
-			{ startIndex: 7, type: '' },
-			{ startIndex: 8, type: 'identifier.kt' }
-		]
-	}],
-
 	[{
 		line: '// a comment',
 		tokens: [
@@ -666,6 +656,20 @@ testTokenization('kotlin', [
 			{ startIndex: 28, type: '' },
 			{ startIndex: 29, type: 'keyword.private.kt' }
 		]
+	}],
+
+	[{
+		line: 'fun /* /* */ */ main() {',
+		tokens: [
+			{ startIndex: 0, type: 'keyword.fun.kt' },
+			{ startIndex: 3, type: '' },
+			{ startIndex: 4, type: 'comment.kt' },
+			{ startIndex: 15, type: '' },
+			{ startIndex: 16, type: 'identifier.kt' },
+			{ startIndex: 20, type: 'delimiter.parenthesis.kt' },
+			{ startIndex: 22, type: '' },
+			{ startIndex: 23, type: 'delimiter.curly.kt' },
+		]
 	}]
 ]);
 

+ 2 - 1
src/kotlin/kotlin.ts

@@ -136,13 +136,14 @@ export const language = <ILanguage>{
 
 		comment: [
 			[/[^\/*]+/, 'comment'],
+			[/\/\*/, 'comment', '@comment'],
 			[/\*\//, 'comment', '@pop'],
 			[/[\/*]/, 'comment']
 		],
 		//Identical copy of comment above, except for the addition of .doc
 		javadoc: [
 			[/[^\/*]+/, 'comment.doc'],
-			// [/\/\*/, 'comment.doc', '@push' ],    // nested comment not allowed :-(
+			[/\/\*/, 'comment.doc', '@push' ],
 			[/\/\*/, 'comment.doc.invalid'],
 			[/\*\//, 'comment.doc', '@pop'],
 			[/[\/*]/, 'comment.doc']

+ 26 - 0
src/markdown/markdown.ts

@@ -57,6 +57,9 @@ export const language = <ILanguage>{
 	tokenizer: {
 		root: [
 
+			// markdown tables
+			[/^\s*\|/, '@rematch', '@table_header'],
+
 			// headers (with #)
 			[/^(\s{0,3})(#+)((?:[^\\#]|@escapes)+)((?:#+)?)/, ['white', 'keyword', 'keyword', 'keyword']],
 
@@ -88,6 +91,29 @@ export const language = <ILanguage>{
 			{ include: '@linecontent' },
 		],
 
+		table_header: [
+			{ include: '@table_common' },
+			[/[^\|]+/, 'keyword.table.header'], // table header
+		],
+
+		table_body: [
+			{ include: '@table_common' },
+			{ include: '@linecontent' },
+		],
+
+		table_common: [
+			[/\s*[\-:]+\s*/, { token: 'keyword', switchTo: 'table_body' }], // header-divider
+			[/^\s*\|/, 'keyword.table.left'], // opening |
+			[/^\s*[^\|]/, '@rematch', '@pop'], // exiting
+			[/^\s*$/, '@rematch', '@pop'], // exiting
+			[/\|/, {
+				cases: {
+					'@eos': 'keyword.table.right', // closing |
+					'@default': 'keyword.table.middle', // inner |
+				}
+			}],
+		],
+
 		codeblock: [
 			[/^\s*~~~\s*$/, { token: 'string', next: '@pop' }],
 			[/^\s*```\s*$/, { token: 'string', next: '@pop' }],

+ 6 - 6
src/mocha.d.ts

@@ -5,9 +5,9 @@
 
 declare function run(): void;
 
-declare function suite(name: string, fn: (err?)=>void);
-declare function test(name: string, fn: (done?: (err?)=>void)=>void);
-declare function suiteSetup(fn: (done?: (err?)=>void)=>void);
-declare function suiteTeardown(fn: (done?: (err?)=>void)=>void);
-declare function setup(fn: (done?: (err?)=>void)=>void);
-declare function teardown(fn: (done?: (err?)=>void)=>void);
+declare function suite(name: string, fn: (err?: any)=>void): void;
+declare function test(name: string, fn: (done: (err?: any)=>void)=>void): void;
+declare function suiteSetup(fn: (done: (err?: any)=>void)=>void): void;
+declare function suiteTeardown(fn: (done: (err?: any)=>void)=>void): void;
+declare function setup(fn: (done: (err?: any)=>void)=>void): void;
+declare function teardown(fn: (done: (err?: any)=>void)=>void): void;

+ 1 - 0
src/monaco.contribution.ts

@@ -6,6 +6,7 @@
 
 import './abap/abap.contribution';
 import './bat/bat.contribution';
+import './cameligo/cameligo.contribution';
 import './coffee/coffee.contribution';
 import './cpp/cpp.contribution';
 import './csharp/csharp.contribution';

+ 1 - 0
src/tsconfig.json

@@ -3,6 +3,7 @@
     "module": "amd",
     "outDir": "../release/dev",
     "target": "es5",
+	"strict": true,
     "lib": [
       "dom",
       "es5",

+ 47 - 0
src/typescript/typescript.test.ts

@@ -745,6 +745,33 @@ testTokenization('typescript', [
 	}],
 
 
+	[{
+		line: 'test ? 1 : 2',
+		tokens: [
+			{ startIndex: 0, type: 'identifier.ts' },
+			{ startIndex: 4, type: '' },
+			{ startIndex: 5, type: 'delimiter.ts' },
+			{ startIndex: 6, type: '' },
+			{ startIndex: 7, type: 'number.ts' },
+			{ startIndex: 8, type: '' },
+			{ startIndex: 9, type: 'delimiter.ts' },
+			{ startIndex: 10, type: '' },
+			{ startIndex: 11, type: 'number.ts' },
+		]
+	}],
+
+	[{
+		line: 'couldBeNullish ?? 1',
+		tokens: [
+			{ startIndex: 0, type: 'identifier.ts' },
+			{ startIndex: 14, type: '' },
+			{ startIndex: 15, type: 'delimiter.ts' },
+			{ startIndex: 17, type: '' },
+			{ startIndex: 18, type: 'number.ts' }
+		]
+	}],
+
+
 	[{
 		line: '`${5 + \'x\' + (<any>)3}a${4}`',
 		tokens: [
@@ -771,6 +798,26 @@ testTokenization('typescript', [
 			{ startIndex: 26, type: 'delimiter.bracket.ts' },
 			{ startIndex: 27, type: 'string.ts' },
 		]
+	}],
+
+	[{
+		line: 'let x = 2 / 2; //asd',
+		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: '' },
+			{ startIndex: 10, type: 'delimiter.ts' },
+			{ startIndex: 11, type: '' },
+			{ startIndex: 12, type: 'number.ts' },
+			{ startIndex: 13, type: 'delimiter.ts' },
+			{ startIndex: 14, type: '' },
+			{ startIndex: 15, type: 'comment.ts' },
+		]
 	}]
 
 ]);

+ 2 - 2
src/typescript/typescript.ts

@@ -91,7 +91,7 @@ export const language = {
 	operators: [
 		'<=', '>=', '==', '!=', '===', '!==', '=>', '+', '-', '**',
 		'*', '/', '%', '++', '--', '<<', '</', '>>', '>>>', '&',
-		'|', '^', '!', '~', '&&', '||', '?', ':', '=', '+=', '-=',
+		'|', '^', '!', '~', '&&', '||', '??', '?', ':', '=', '+=', '-=',
 		'*=', '**=', '/=', '%=', '<<=', '>>=', '>>>=', '&=', '|=',
 		'^=', '@',
 	],
@@ -130,7 +130,7 @@ export const language = {
 			{ include: '@whitespace' },
 
 			// regular expression: ensure it is terminated before beginning (otherwise it is an opeator)
-			[/\/(?=([^\\\/]|\\.)+\/([gimsuy]*)(\s*)(\.|;|\/|,|\)|\]|\}|$))/, { token: 'regexp', bracket: '@open', next: '@regexp' }],
+			[/\/(?=([^\\\/]|\\.)+\/([gimsuy]*)(\s*)(\.|;|,|\)|\]|\}|$))/, { token: 'regexp', bracket: '@open', next: '@regexp' }],
 
 			// delimiters and operators
 			[/[()\[\]]/, '@brackets'],

+ 29 - 1
src/vb/vb.test.ts

@@ -434,5 +434,33 @@ testTokenization('vb', [
 			{ startIndex: 13, type: '' },
 			{ startIndex: 14, type: 'keyword.tag-for.vb' }
 		]
-	}]
+	}],
+
+	[{
+		line: 'Dim x = "hello',
+		tokens: [
+			{ startIndex: 0, type: 'keyword.dim.vb' },
+			{ startIndex: 3, type: '' },
+			{ startIndex: 4, type: 'identifier.vb' },
+			{ startIndex: 5, type: '' },
+			{ startIndex: 6, type: 'delimiter.vb' },
+			{ startIndex: 7, type: '' },
+			{ startIndex: 8, type: 'string.vb' }
+		]
+	}, {
+		line: 'world"',
+		tokens: [
+			{ startIndex: 0, type: 'string.vb' },
+		]
+	}],
+
+	[{
+		line: `End qweqweqweqweqwe'here always becomes highlighted Loop `,
+		tokens: [
+			{ startIndex: 0, type: 'keyword.end.vb' },
+			{ startIndex: 3, type: '' },
+			{ startIndex: 4, type: 'identifier.vb' },
+			{ startIndex: 19, type: 'comment.vb' },
+		]
+	}],
 ]);

+ 1 - 2
src/vb/vb.ts

@@ -140,7 +140,7 @@ export const language = <ILanguage>{
 			[/loop(?!\w)/, { token: 'keyword.tag-do' }],
 
 			// usual ending tags
-			[/end\s+(?!for|do)([a-zA-Z_]\w*)/, { token: 'keyword.tag-$1' }],
+			[/end\s+(?!for|do)(addhandler|class|enum|event|function|get|if|interface|module|namespace|operator|property|raiseevent|removehandler|select|set|structure|sub|synclock|try|while|with|using)/, { token: 'keyword.tag-$1' }],
 
 			// identifiers, tagwords, and keywords
 			[/[a-zA-Z_]\w*/, {
@@ -169,7 +169,6 @@ export const language = <ILanguage>{
 			[/@symbols/, 'delimiter'],
 
 			// strings
-			[/"([^"\\]|\\.)*$/, 'string.invalid'],  // non-teminated string
 			[/"/, 'string', '@string'],
 
 		],

+ 1 - 0
test/setup.js

@@ -29,6 +29,7 @@ define(['require'], function () {
 			'release/dev/apex/apex.test',
 			'release/dev/azcli/azcli.test',
 			'release/dev/bat/bat.test',
+			'release/dev/cameligo/cameligo.test',
 			'release/dev/clojure/clojure.test',
 			'release/dev/coffee/coffee.test',
 			'release/dev/cpp/cpp.test',

Nem az összes módosított fájl került megjelenítésre, mert túl sok fájl változott