1 | (() => {
|
2 | var __webpack_modules__ = ({
|
3 |
|
4 | 68:
|
5 | ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 |
|
26 |
|
27 |
|
28 |
|
29 |
|
30 |
|
31 |
|
32 |
|
33 |
|
34 |
|
35 | var isHeadless = false;
|
36 |
|
37 | if (typeof module !== 'undefined') {
|
38 | isHeadless = true;
|
39 | }
|
40 |
|
41 | if (!isHeadless) {
|
42 | var exports = {};
|
43 | var module = {};
|
44 | var colors = exports;
|
45 | exports.mode = "browser";
|
46 | } else {
|
47 | exports.mode = "console";
|
48 | }
|
49 |
|
50 |
|
51 |
|
52 |
|
53 | var addProperty = function (color, func) {
|
54 | exports[color] = function (str) {
|
55 | return func.apply(str);
|
56 | };
|
57 | String.prototype.__defineGetter__(color, func);
|
58 | };
|
59 |
|
60 | function stylize(str, style) {
|
61 |
|
62 | var styles;
|
63 |
|
64 | if (exports.mode === 'console') {
|
65 | styles = {
|
66 |
|
67 | 'bold' : ['\x1B[1m', '\x1B[22m'],
|
68 | 'italic' : ['\x1B[3m', '\x1B[23m'],
|
69 | 'underline' : ['\x1B[4m', '\x1B[24m'],
|
70 | 'inverse' : ['\x1B[7m', '\x1B[27m'],
|
71 | 'strikethrough' : ['\x1B[9m', '\x1B[29m'],
|
72 |
|
73 |
|
74 | 'white' : ['\x1B[37m', '\x1B[39m'],
|
75 | 'grey' : ['\x1B[90m', '\x1B[39m'],
|
76 | 'black' : ['\x1B[30m', '\x1B[39m'],
|
77 |
|
78 | 'blue' : ['\x1B[34m', '\x1B[39m'],
|
79 | 'cyan' : ['\x1B[36m', '\x1B[39m'],
|
80 | 'green' : ['\x1B[32m', '\x1B[39m'],
|
81 | 'magenta' : ['\x1B[35m', '\x1B[39m'],
|
82 | 'red' : ['\x1B[31m', '\x1B[39m'],
|
83 | 'yellow' : ['\x1B[33m', '\x1B[39m'],
|
84 |
|
85 |
|
86 | 'whiteBG' : ['\x1B[47m', '\x1B[49m'],
|
87 | 'greyBG' : ['\x1B[49;5;8m', '\x1B[49m'],
|
88 | 'blackBG' : ['\x1B[40m', '\x1B[49m'],
|
89 |
|
90 | 'blueBG' : ['\x1B[44m', '\x1B[49m'],
|
91 | 'cyanBG' : ['\x1B[46m', '\x1B[49m'],
|
92 | 'greenBG' : ['\x1B[42m', '\x1B[49m'],
|
93 | 'magentaBG' : ['\x1B[45m', '\x1B[49m'],
|
94 | 'redBG' : ['\x1B[41m', '\x1B[49m'],
|
95 | 'yellowBG' : ['\x1B[43m', '\x1B[49m']
|
96 | };
|
97 | } else if (exports.mode === 'browser') {
|
98 | styles = {
|
99 |
|
100 | 'bold' : ['<b>', '</b>'],
|
101 | 'italic' : ['<i>', '</i>'],
|
102 | 'underline' : ['<u>', '</u>'],
|
103 | 'inverse' : ['<span style="background-color:black;color:white;">', '</span>'],
|
104 | 'strikethrough' : ['<del>', '</del>'],
|
105 |
|
106 |
|
107 | 'white' : ['<span style="color:white;">', '</span>'],
|
108 | 'grey' : ['<span style="color:gray;">', '</span>'],
|
109 | 'black' : ['<span style="color:black;">', '</span>'],
|
110 |
|
111 | 'blue' : ['<span style="color:blue;">', '</span>'],
|
112 | 'cyan' : ['<span style="color:cyan;">', '</span>'],
|
113 | 'green' : ['<span style="color:green;">', '</span>'],
|
114 | 'magenta' : ['<span style="color:magenta;">', '</span>'],
|
115 | 'red' : ['<span style="color:red;">', '</span>'],
|
116 | 'yellow' : ['<span style="color:yellow;">', '</span>'],
|
117 |
|
118 |
|
119 | 'whiteBG' : ['<span style="background-color:white;">', '</span>'],
|
120 | 'greyBG' : ['<span style="background-color:gray;">', '</span>'],
|
121 | 'blackBG' : ['<span style="background-color:black;">', '</span>'],
|
122 |
|
123 | 'blueBG' : ['<span style="background-color:blue;">', '</span>'],
|
124 | 'cyanBG' : ['<span style="background-color:cyan;">', '</span>'],
|
125 | 'greenBG' : ['<span style="background-color:green;">', '</span>'],
|
126 | 'magentaBG' : ['<span style="background-color:magenta;">', '</span>'],
|
127 | 'redBG' : ['<span style="background-color:red;">', '</span>'],
|
128 | 'yellowBG' : ['<span style="background-color:yellow;">', '</span>']
|
129 | };
|
130 | } else if (exports.mode === 'none') {
|
131 | return str + '';
|
132 | } else {
|
133 | console.log('unsupported mode, try "browser", "console" or "none"');
|
134 | }
|
135 | return styles[style][0] + str + styles[style][1];
|
136 | }
|
137 |
|
138 | function applyTheme(theme) {
|
139 |
|
140 |
|
141 |
|
142 |
|
143 |
|
144 | var stringPrototypeBlacklist = [
|
145 | '__defineGetter__', '__defineSetter__', '__lookupGetter__', '__lookupSetter__', 'charAt', 'constructor',
|
146 | 'hasOwnProperty', 'isPrototypeOf', 'propertyIsEnumerable', 'toLocaleString', 'toString', 'valueOf', 'charCodeAt',
|
147 | 'indexOf', 'lastIndexof', 'length', 'localeCompare', 'match', 'replace', 'search', 'slice', 'split', 'substring',
|
148 | 'toLocaleLowerCase', 'toLocaleUpperCase', 'toLowerCase', 'toUpperCase', 'trim', 'trimLeft', 'trimRight'
|
149 | ];
|
150 |
|
151 | Object.keys(theme).forEach(function (prop) {
|
152 | if (stringPrototypeBlacklist.indexOf(prop) !== -1) {
|
153 | console.log('warn: '.red + ('String.prototype' + prop).magenta + ' is probably something you don\'t want to override. Ignoring style name');
|
154 | }
|
155 | else {
|
156 | if (typeof(theme[prop]) === 'string') {
|
157 | addProperty(prop, function () {
|
158 | return exports[theme[prop]](this);
|
159 | });
|
160 | }
|
161 | else {
|
162 | addProperty(prop, function () {
|
163 | var ret = this;
|
164 | for (var t = 0; t < theme[prop].length; t++) {
|
165 | ret = exports[theme[prop][t]](ret);
|
166 | }
|
167 | return ret;
|
168 | });
|
169 | }
|
170 | }
|
171 | });
|
172 | }
|
173 |
|
174 |
|
175 |
|
176 |
|
177 |
|
178 | var x = ['bold', 'underline', 'strikethrough', 'italic', 'inverse', 'grey', 'black', 'yellow', 'red', 'green', 'blue', 'white', 'cyan', 'magenta', 'greyBG', 'blackBG', 'yellowBG', 'redBG', 'greenBG', 'blueBG', 'whiteBG', 'cyanBG', 'magentaBG'];
|
179 | x.forEach(function (style) {
|
180 |
|
181 |
|
182 |
|
183 |
|
184 | addProperty(style, function () {
|
185 | return stylize(this, style);
|
186 | });
|
187 | });
|
188 |
|
189 | function sequencer(map) {
|
190 | return function () {
|
191 | if (!isHeadless) {
|
192 | return this.replace(/( )/, '$1');
|
193 | }
|
194 | var exploded = this.split(""), i = 0;
|
195 | exploded = exploded.map(map);
|
196 | return exploded.join("");
|
197 | };
|
198 | }
|
199 |
|
200 | var rainbowMap = (function () {
|
201 | var rainbowColors = ['red', 'yellow', 'green', 'blue', 'magenta'];
|
202 | return function (letter, i, exploded) {
|
203 | if (letter === " ") {
|
204 | return letter;
|
205 | } else {
|
206 | return stylize(letter, rainbowColors[i++ % rainbowColors.length]);
|
207 | }
|
208 | };
|
209 | })();
|
210 |
|
211 | exports.themes = {};
|
212 |
|
213 | exports.addSequencer = function (name, map) {
|
214 | addProperty(name, sequencer(map));
|
215 | };
|
216 |
|
217 | exports.addSequencer('rainbow', rainbowMap);
|
218 | exports.addSequencer('zebra', function (letter, i, exploded) {
|
219 | return i % 2 === 0 ? letter : letter.inverse;
|
220 | });
|
221 |
|
222 | exports.setTheme = function (theme) {
|
223 | if (typeof theme === 'string') {
|
224 | try {
|
225 | exports.themes[theme] = __webpack_require__(69)(theme);
|
226 | applyTheme(exports.themes[theme]);
|
227 | return exports.themes[theme];
|
228 | } catch (err) {
|
229 | console.log(err);
|
230 | return err;
|
231 | }
|
232 | } else {
|
233 | applyTheme(theme);
|
234 | }
|
235 | };
|
236 |
|
237 |
|
238 | addProperty('stripColors', function () {
|
239 | return ("" + this).replace(/\x1B\[\d+m/g, '');
|
240 | });
|
241 |
|
242 |
|
243 | function zalgo(text, options) {
|
244 | var soul = {
|
245 | "up" : [
|
246 | '̍', '̎', '̄', '̅',
|
247 | '̿', '̑', '̆', '̐',
|
248 | '͒', '͗', '͑', '̇',
|
249 | '̈', '̊', '͂', '̓',
|
250 | '̈', '͊', '͋', '͌',
|
251 | '̃', '̂', '̌', '͐',
|
252 | '̀', '́', '̋', '̏',
|
253 | '̒', '̓', '̔', '̽',
|
254 | '̉', 'ͣ', 'ͤ', 'ͥ',
|
255 | 'ͦ', 'ͧ', 'ͨ', 'ͩ',
|
256 | 'ͪ', 'ͫ', 'ͬ', 'ͭ',
|
257 | 'ͮ', 'ͯ', '̾', '͛',
|
258 | '͆', '̚'
|
259 | ],
|
260 | "down" : [
|
261 | '̖', '̗', '̘', '̙',
|
262 | '̜', '̝', '̞', '̟',
|
263 | '̠', '̤', '̥', '̦',
|
264 | '̩', '̪', '̫', '̬',
|
265 | '̭', '̮', '̯', '̰',
|
266 | '̱', '̲', '̳', '̹',
|
267 | '̺', '̻', '̼', 'ͅ',
|
268 | '͇', '͈', '͉', '͍',
|
269 | '͎', '͓', '͔', '͕',
|
270 | '͖', '͙', '͚', '̣'
|
271 | ],
|
272 | "mid" : [
|
273 | '̕', '̛', '̀', '́',
|
274 | '͘', '̡', '̢', '̧',
|
275 | '̨', '̴', '̵', '̶',
|
276 | '͜', '͝', '͞',
|
277 | '͟', '͠', '͢', '̸',
|
278 | '̷', '͡', ' ҉'
|
279 | ]
|
280 | },
|
281 | all = [].concat(soul.up, soul.down, soul.mid),
|
282 | zalgo = {};
|
283 |
|
284 | function randomNumber(range) {
|
285 | var r = Math.floor(Math.random() * range);
|
286 | return r;
|
287 | }
|
288 |
|
289 | function is_char(character) {
|
290 | var bool = false;
|
291 | all.filter(function (i) {
|
292 | bool = (i === character);
|
293 | });
|
294 | return bool;
|
295 | }
|
296 |
|
297 | function heComes(text, options) {
|
298 | var result = '', counts, l;
|
299 | options = options || {};
|
300 | options["up"] = options["up"] || true;
|
301 | options["mid"] = options["mid"] || true;
|
302 | options["down"] = options["down"] || true;
|
303 | options["size"] = options["size"] || "maxi";
|
304 | text = text.split('');
|
305 | for (l in text) {
|
306 | if (is_char(l)) {
|
307 | continue;
|
308 | }
|
309 | result = result + text[l];
|
310 | counts = {"up" : 0, "down" : 0, "mid" : 0};
|
311 | switch (options.size) {
|
312 | case 'mini':
|
313 | counts.up = randomNumber(8);
|
314 | counts.min = randomNumber(2);
|
315 | counts.down = randomNumber(8);
|
316 | break;
|
317 | case 'maxi':
|
318 | counts.up = randomNumber(16) + 3;
|
319 | counts.min = randomNumber(4) + 1;
|
320 | counts.down = randomNumber(64) + 3;
|
321 | break;
|
322 | default:
|
323 | counts.up = randomNumber(8) + 1;
|
324 | counts.mid = randomNumber(6) / 2;
|
325 | counts.down = randomNumber(8) + 1;
|
326 | break;
|
327 | }
|
328 |
|
329 | var arr = ["up", "mid", "down"];
|
330 | for (var d in arr) {
|
331 | var index = arr[d];
|
332 | for (var i = 0 ; i <= counts[index]; i++) {
|
333 | if (options[index]) {
|
334 | result = result + soul[index][randomNumber(soul[index].length)];
|
335 | }
|
336 | }
|
337 | }
|
338 | }
|
339 | return result;
|
340 | }
|
341 | return heComes(text);
|
342 | }
|
343 |
|
344 |
|
345 |
|
346 | addProperty('zalgo', function () {
|
347 | return zalgo(this);
|
348 | });
|
349 |
|
350 |
|
351 | }),
|
352 |
|
353 | 69:
|
354 | ((module) => {
|
355 |
|
356 | function webpackEmptyContext(req) {
|
357 | var e = new Error("Cannot find module '" + req + "'");
|
358 | e.code = 'MODULE_NOT_FOUND';
|
359 | throw e;
|
360 | }
|
361 | webpackEmptyContext.keys = () => ([]);
|
362 | webpackEmptyContext.resolve = webpackEmptyContext;
|
363 | webpackEmptyContext.id = 69;
|
364 | module.exports = webpackEmptyContext;
|
365 |
|
366 | }),
|
367 |
|
368 | 67:
|
369 | ((module, __unused_webpack_exports, __webpack_require__) => {
|
370 |
|
371 | var fs = __webpack_require__(60),
|
372 | Path = __webpack_require__(23),
|
373 | util = __webpack_require__(10),
|
374 | colors = __webpack_require__(68),
|
375 | EE = __webpack_require__(70).EventEmitter,
|
376 | fsExists = fs.exists ? fs.exists : Path.exists,
|
377 | fsExistsSync = fs.existsSync ? fs.existsSync : Path.existsSync;
|
378 |
|
379 | module.exports = function(dir, iterator, options, callback){
|
380 | return FindUp(dir, iterator, options, callback);
|
381 | };
|
382 |
|
383 | function FindUp(dir, iterator, options, callback){
|
384 | if (!(this instanceof FindUp)) {
|
385 | return new FindUp(dir, iterator, options, callback);
|
386 | }
|
387 | if(typeof options === 'function'){
|
388 | callback = options;
|
389 | options = {};
|
390 | }
|
391 | options = options || {};
|
392 |
|
393 | EE.call(this);
|
394 | this.found = false;
|
395 | this.stopPlease = false;
|
396 | var self = this;
|
397 |
|
398 | if(typeof iterator === 'string'){
|
399 | var file = iterator;
|
400 | iterator = function(dir, cb){
|
401 | return fsExists(Path.join(dir, file), cb);
|
402 | };
|
403 | }
|
404 |
|
405 | if(callback) {
|
406 | this.on('found', function(dir){
|
407 | if(options.verbose) console.log(('found '+ dir ).green);
|
408 | callback(null, dir);
|
409 | self.stop();
|
410 | });
|
411 |
|
412 | this.on('end', function(){
|
413 | if(options.verbose) console.log('end'.grey);
|
414 | if(!self.found) callback(new Error('not found'));
|
415 | });
|
416 |
|
417 | this.on('error', function(err){
|
418 | if(options.verbose) console.log('error'.red, err);
|
419 | callback(err);
|
420 | });
|
421 | }
|
422 |
|
423 | this._find(dir, iterator, options, callback);
|
424 | }
|
425 | util.inherits(FindUp, EE);
|
426 |
|
427 | FindUp.prototype._find = function(dir, iterator, options, callback){
|
428 | var self = this;
|
429 |
|
430 | iterator(dir, function(exists){
|
431 | if(options.verbose) console.log(('traverse '+ dir).grey);
|
432 | if(exists) {
|
433 | self.found = true;
|
434 | self.emit('found', dir);
|
435 | }
|
436 |
|
437 | var parentDir = Path.join(dir, '..');
|
438 | if (self.stopPlease) return self.emit('end');
|
439 | if (dir === parentDir) return self.emit('end');
|
440 | if(dir.indexOf('../../') !== -1 ) return self.emit('error', new Error(dir + ' is not correct.'));
|
441 | self._find(parentDir, iterator, options, callback);
|
442 | });
|
443 | };
|
444 |
|
445 | FindUp.prototype.stop = function(){
|
446 | this.stopPlease = true;
|
447 | };
|
448 |
|
449 | module.exports.FindUp = FindUp;
|
450 |
|
451 | module.exports.sync = function(dir, iteratorSync){
|
452 | if(typeof iteratorSync === 'string'){
|
453 | var file = iteratorSync;
|
454 | iteratorSync = function(dir){
|
455 | return fsExistsSync(Path.join(dir, file));
|
456 | };
|
457 | }
|
458 | var initialDir = dir;
|
459 | while(dir !== Path.join(dir, '..')){
|
460 | if(dir.indexOf('../../') !== -1 ) throw new Error(initialDir + ' is not correct.');
|
461 | if(iteratorSync(dir)) return dir;
|
462 | dir = Path.join(dir, '..');
|
463 | }
|
464 | throw new Error('not found');
|
465 | };
|
466 |
|
467 |
|
468 | }),
|
469 |
|
470 | 64:
|
471 | ((__unused_webpack_module, exports) => {
|
472 |
|
473 | "use strict";
|
474 |
|
475 | Object.defineProperty(exports, "__esModule", ({ value: true }));
|
476 | exports.projectRootPatterns = exports.sortTexts = void 0;
|
477 | exports.sortTexts = {
|
478 | one: "00001",
|
479 | two: "00002",
|
480 | three: "00003",
|
481 | four: "00004",
|
482 | };
|
483 | exports.projectRootPatterns = [".git", "autoload", "plugin"];
|
484 |
|
485 |
|
486 | }),
|
487 |
|
488 | 72:
|
489 | ((__unused_webpack_module, exports) => {
|
490 |
|
491 | "use strict";
|
492 |
|
493 | Object.defineProperty(exports, "__esModule", ({ value: true }));
|
494 | exports.notIdentifierPattern = exports.expandPattern = exports.featurePattern = exports.commandPattern = exports.notFunctionPattern = exports.optionPattern = exports.builtinVariablePattern = exports.autocmdPattern = exports.highlightValuePattern = exports.highlightPattern = exports.highlightLinkPattern = exports.mapCommandPattern = exports.colorschemePattern = exports.wordNextPattern = exports.wordPrePattern = exports.builtinFunctionPattern = exports.keywordPattern = exports.commentPattern = exports.errorLinePattern = void 0;
|
495 | exports.errorLinePattern = /[^:]+:\s*(.+?):\s*line\s*([0-9]+)\s*col\s*([0-9]+)/;
|
496 | exports.commentPattern = /^[ \t]*("|')/;
|
497 | exports.keywordPattern = /[\w#&$<>.:]/;
|
498 | exports.builtinFunctionPattern = /^((<SID>|\b(v|g|b|s|l|a):)?[\w#&]+)[ \t]*\([^)]*\)/;
|
499 | exports.wordPrePattern = /^.*?(((<SID>|\b(v|g|b|s|l|a):)?[\w#&$.]+)|(<SID>|<SID|<SI|<S|<|\b(v|g|b|s|l|a):))$/;
|
500 | exports.wordNextPattern = /^((SID>|ID>|D>|>|<SID>|\b(v|g|b|s|l|a):)?[\w#&$.]+|(:[\w#&$.]+)).*?(\r\n|\r|\n)?$/;
|
501 | exports.colorschemePattern = /\bcolorscheme[ \t]+\w*$/;
|
502 | exports.mapCommandPattern = /^([ \t]*(\[ \t]*)?)\w*map[ \t]+/;
|
503 | exports.highlightLinkPattern = /^[ \t]*(hi|highlight)[ \t]+link([ \t]+[^ \t]+)*[ \t]*$/;
|
504 | exports.highlightPattern = /^[ \t]*(hi|highlight)([ \t]+[^ \t]+)*[ \t]*$/;
|
505 | exports.highlightValuePattern = /^[ \t]*(hi|highlight)([ \t]+[^ \t]+)*[ \t]+([^ \t=]+)=[^ \t=]*$/;
|
506 | exports.autocmdPattern = /^[ \t]*(au|autocmd)!?[ \t]+([^ \t,]+,)*[^ \t,]*$/;
|
507 | exports.builtinVariablePattern = [
|
508 | /\bv:\w*$/,
|
509 | ];
|
510 | exports.optionPattern = [
|
511 | /(^|[ \t]+)&\w*$/,
|
512 | /(^|[ \t]+)set(l|local|g|global)?[ \t]+\w+$/,
|
513 | ];
|
514 | exports.notFunctionPattern = [
|
515 | /^[ \t]*\\$/,
|
516 | /^[ \t]*\w+$/,
|
517 | /^[ \t]*"/,
|
518 | /(let|set|colorscheme)[ \t][^ \t]*$/,
|
519 | /[^([,\\ \t\w#>]\w*$/,
|
520 | /^[ \t]*(hi|highlight)([ \t]+link)?([ \t]+[^ \t]+)*[ \t]*$/,
|
521 | exports.autocmdPattern,
|
522 | ];
|
523 | exports.commandPattern = [
|
524 | /(^|[ \t]):\w+$/,
|
525 | /^[ \t]*\w+$/,
|
526 | /:?silent!?[ \t]\w+/,
|
527 | ];
|
528 | exports.featurePattern = [
|
529 | /\bhas\([ \t]*["']\w*/,
|
530 | ];
|
531 | exports.expandPattern = [
|
532 | /\bexpand\(['"]<\w*$/,
|
533 | /\bexpand\([ \t]*['"]\w*$/,
|
534 | ];
|
535 | exports.notIdentifierPattern = [
|
536 | exports.commentPattern,
|
537 | /("|'):\w*$/,
|
538 | /^[ \t]*\\$/,
|
539 | /^[ \t]*call[ \t]+[^ \t()]*$/,
|
540 | /('|"|#|&|\$|<)\w*$/,
|
541 | ];
|
542 |
|
543 |
|
544 | /***/ }),
|
545 |
|
546 | /***/ 66:
|
547 | /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
548 |
|
549 | "use strict";
|
550 |
|
551 | var __assign = (this && this.__assign) || function () {
|
552 | __assign = Object.assign || function(t) {
|
553 | for (var s, i = 1, n = arguments.length; i < n; i++) {
|
554 | s = arguments[i];
|
555 | for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
556 | t[p] = s[p];
|
557 | }
|
558 | return t;
|
559 | };
|
560 | return __assign.apply(this, arguments);
|
561 | };
|
562 | var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
563 | function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
564 | return new (P || (P = Promise))(function (resolve, reject) {
|
565 | function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
566 | function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
567 | function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
568 | step((generator = generator.apply(thisArg, _arguments || [])).next());
|
569 | });
|
570 | };
|
571 | var __generator = (this && this.__generator) || function (thisArg, body) {
|
572 | var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
573 | return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
574 | function verb(n) { return function (v) { return step([n, v]); }; }
|
575 | function step(op) {
|
576 | if (f) throw new TypeError("Generator is already executing.");
|
577 | while (_) try {
|
578 | if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
579 | if (y = 0, t) op = [op[0] & 2, t.value];
|
580 | switch (op[0]) {
|
581 | case 0: case 1: t = op; break;
|
582 | case 4: _.label++; return { value: op[1], done: false };
|
583 | case 5: _.label++; y = op[1]; op = [0]; continue;
|
584 | case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
585 | default:
|
586 | if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
587 | if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
588 | if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
589 | if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
590 | if (t[2]) _.ops.pop();
|
591 | _.trys.pop(); continue;
|
592 | }
|
593 | op = body.call(thisArg, _);
|
594 | } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
595 | if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
596 | }
|
597 | };
|
598 | var __spreadArray = (this && this.__spreadArray) || function (to, from) {
|
599 | for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
|
600 | to[j] = from[i];
|
601 | return to;
|
602 | };
|
603 | var __importDefault = (this && this.__importDefault) || function (mod) {
|
604 | return (mod && mod.__esModule) ? mod : { "default": mod };
|
605 | };
|
606 | Object.defineProperty(exports, "__esModule", ({ value: true }));
|
607 | exports.delay = exports.getRealPath = exports.isSymbolLink = exports.removeSnippets = exports.handleParse = exports.getWordFromPosition = exports.markupSnippets = exports.findProjectRoot = exports.pcb = exports.executeFile = exports.isSomeMatchPattern = void 0;
|
608 | var child_process_1 = __webpack_require__(61);
|
609 | var findup_1 = __importDefault(__webpack_require__(67));
|
610 | var fs_1 = __importDefault(__webpack_require__(60));
|
611 | var path_1 = __importDefault(__webpack_require__(23));
|
612 | var vscode_languageserver_1 = __webpack_require__(2);
|
613 | var vimparser_1 = __webpack_require__(71);
|
614 | var patterns_1 = __webpack_require__(72);
|
615 | var config_1 = __importDefault(__webpack_require__(73));
|
616 | function isSomeMatchPattern(patterns, line) {
|
617 | return patterns.some(function (p) { return p.test(line); });
|
618 | }
|
619 | exports.isSomeMatchPattern = isSomeMatchPattern;
|
620 | function executeFile(input, command, args, option) {
|
621 | return new Promise(function (resolve, reject) {
|
622 | var stdout = "";
|
623 | var stderr = "";
|
624 | var error;
|
625 | var isPassAsText = false;
|
626 | args = (args || []).map(function (arg) {
|
627 | if (/%text/.test(arg)) {
|
628 | isPassAsText = true;
|
629 | return arg.replace(/%text/g, input.toString());
|
630 | }
|
631 | return arg;
|
632 | });
|
633 | var cp = child_process_1.spawn(command, args, option);
|
634 | cp.stdout.on("data", function (data) {
|
635 | stdout += data;
|
636 | });
|
637 | cp.stderr.on("data", function (data) {
|
638 | stderr += data;
|
639 | });
|
640 | cp.on("error", function (err) {
|
641 | error = err;
|
642 | reject(error);
|
643 | });
|
644 | cp.on("close", function (code) {
|
645 | if (!error) {
|
646 | resolve({ code: code, stdout: stdout, stderr: stderr });
|
647 | }
|
648 | });
|
649 |
|
650 | if (!isPassAsText) {
|
651 | input.pipe(cp.stdin).on("error", function () { return; });
|
652 | }
|
653 | });
|
654 | }
|
655 | exports.executeFile = executeFile;
|
656 |
|
657 | function pcb(cb) {
|
658 | return function () {
|
659 | var args = [];
|
660 | for (var _i = 0; _i < arguments.length; _i++) {
|
661 | args[_i] = arguments[_i];
|
662 | }
|
663 | return new Promise(function (resolve) {
|
664 | cb.apply(void 0, __spreadArray(__spreadArray([], args), [function () {
|
665 | var params = [];
|
666 | for (var _i = 0; _i < arguments.length; _i++) {
|
667 | params[_i] = arguments[_i];
|
668 | }
|
669 | resolve(params);
|
670 | }]));
|
671 | });
|
672 | };
|
673 | }
|
674 | exports.pcb = pcb;
|
675 |
|
676 | function findProjectRoot(filePath, rootPatterns) {
|
677 | return __awaiter(this, void 0, void 0, function () {
|
678 | var dirname, patterns, dirCandidate, _i, patterns_2, pattern, _a, err, dir;
|
679 | return __generator(this, function (_b) {
|
680 | switch (_b.label) {
|
681 | case 0:
|
682 | dirname = path_1.default.dirname(filePath);
|
683 | patterns = [].concat(rootPatterns);
|
684 | dirCandidate = "";
|
685 | _i = 0, patterns_2 = patterns;
|
686 | _b.label = 1;
|
687 | case 1:
|
688 | if (!(_i < patterns_2.length)) return [3 , 4];
|
689 | pattern = patterns_2[_i];
|
690 | return [4 , pcb(findup_1.default)(dirname, pattern)];
|
691 | case 2:
|
692 | _a = _b.sent(), err = _a[0], dir = _a[1];
|
693 | if (!err && dir && dir !== "/" && dir.length > dirCandidate.length) {
|
694 | dirCandidate = dir;
|
695 | }
|
696 | _b.label = 3;
|
697 | case 3:
|
698 | _i++;
|
699 | return [3 , 1];
|
700 | case 4:
|
701 | if (dirCandidate.length) {
|
702 | return [2 , dirCandidate];
|
703 | }
|
704 | return [2 , dirname];
|
705 | }
|
706 | });
|
707 | });
|
708 | }
|
709 | exports.findProjectRoot = findProjectRoot;
|
710 | function markupSnippets(snippets) {
|
711 | return [
|
712 | "```vim",
|
713 | snippets.replace(/\$\{[0-9]+(:([^}]+))?\}/g, "$2"),
|
714 | "```",
|
715 | ].join("\n");
|
716 | }
|
717 | exports.markupSnippets = markupSnippets;
|
718 | function getWordFromPosition(doc, position) {
|
719 | if (!doc) {
|
720 | return;
|
721 | }
|
722 | var character = doc.getText(vscode_languageserver_1.Range.create(vscode_languageserver_1.Position.create(position.line, position.character), vscode_languageserver_1.Position.create(position.line, position.character + 1)));
|
723 |
|
724 | if (!character || !patterns_1.keywordPattern.test(character)) {
|
725 | return;
|
726 | }
|
727 | var currentLine = doc.getText(vscode_languageserver_1.Range.create(vscode_languageserver_1.Position.create(position.line, 0), vscode_languageserver_1.Position.create(position.line + 1, 0)));
|
728 |
|
729 | if (patterns_1.commentPattern.test(currentLine)) {
|
730 | return;
|
731 | }
|
732 | var preSegment = currentLine.slice(0, position.character);
|
733 | var nextSegment = currentLine.slice(position.character);
|
734 | var wordLeft = preSegment.match(patterns_1.wordPrePattern);
|
735 | var wordRight = nextSegment.match(patterns_1.wordNextPattern);
|
736 | var word = "" + (wordLeft && wordLeft[1] || "") + (wordRight && wordRight[1] || "");
|
737 | return {
|
738 | word: word,
|
739 | left: wordLeft && wordLeft[1] || "",
|
740 | right: wordRight && wordRight[1] || "",
|
741 | wordLeft: wordLeft && wordLeft[1]
|
742 | ? preSegment.replace(new RegExp(wordLeft[1] + "$"), word)
|
743 | : "" + preSegment + word,
|
744 | wordRight: wordRight && wordRight[1]
|
745 | ? nextSegment.replace(new RegExp("^" + wordRight[1]), word)
|
746 | : "" + word + nextSegment,
|
747 | };
|
748 | }
|
749 | exports.getWordFromPosition = getWordFromPosition;
|
750 |
|
751 | function handleParse(textDoc) {
|
752 | return __awaiter(this, void 0, void 0, function () {
|
753 | var text, tokens, node;
|
754 | return __generator(this, function (_a) {
|
755 | text = textDoc instanceof Object ? textDoc.getText() : textDoc;
|
756 | tokens = new vimparser_1.StringReader(text.split(/\r\n|\r|\n/));
|
757 | try {
|
758 | node = new vimparser_1.VimLParser(config_1.default.isNeovim).parse(tokens);
|
759 | return [2 , [node, ""]];
|
760 | }
|
761 | catch (error) {
|
762 | return [2 , [null, error]];
|
763 | }
|
764 | return [2 ];
|
765 | });
|
766 | });
|
767 | }
|
768 | exports.handleParse = handleParse;
|
769 |
|
770 | function removeSnippets(completionItems) {
|
771 | if (completionItems === void 0) { completionItems = []; }
|
772 | return completionItems.map(function (item) {
|
773 | if (item.insertTextFormat === vscode_languageserver_1.InsertTextFormat.Snippet) {
|
774 | return __assign(__assign({}, item), { insertText: item.label, insertTextFormat: vscode_languageserver_1.InsertTextFormat.PlainText });
|
775 | }
|
776 | return item;
|
777 | });
|
778 | }
|
779 | exports.removeSnippets = removeSnippets;
|
780 | var isSymbolLink = function (filePath) { return __awaiter(void 0, void 0, void 0, function () {
|
781 | return __generator(this, function (_a) {
|
782 | return [2 , new Promise(function (resolve) {
|
783 | fs_1.default.lstat(filePath, function (err, stats) {
|
784 | resolve({
|
785 | err: err,
|
786 | stats: stats && stats.isSymbolicLink(),
|
787 | });
|
788 | });
|
789 | })];
|
790 | });
|
791 | }); };
|
792 | exports.isSymbolLink = isSymbolLink;
|
793 | var getRealPath = function (filePath) { return __awaiter(void 0, void 0, void 0, function () {
|
794 | var _a, err, stats;
|
795 | return __generator(this, function (_b) {
|
796 | switch (_b.label) {
|
797 | case 0: return [4 , exports.isSymbolLink(filePath)];
|
798 | case 1:
|
799 | _a = _b.sent(), err = _a.err, stats = _a.stats;
|
800 | if (!err && stats) {
|
801 | return [2 , new Promise(function (resolve) {
|
802 | fs_1.default.realpath(filePath, function (error, realPath) {
|
803 | if (error) {
|
804 | return resolve(filePath);
|
805 | }
|
806 | resolve(realPath);
|
807 | });
|
808 | })];
|
809 | }
|
810 | return [2 , filePath];
|
811 | }
|
812 | });
|
813 | }); };
|
814 | exports.getRealPath = getRealPath;
|
815 | var delay = function (ms) { return __awaiter(void 0, void 0, void 0, function () {
|
816 | return __generator(this, function (_a) {
|
817 | switch (_a.label) {
|
818 | case 0: return [4 , new Promise(function (res) {
|
819 | setTimeout(function () {
|
820 | res();
|
821 | }, ms);
|
822 | })];
|
823 | case 1:
|
824 | _a.sent();
|
825 | return [2 ];
|
826 | }
|
827 | });
|
828 | }); };
|
829 | exports.delay = delay;
|
830 |
|
831 |
|
832 | }),
|
833 |
|
834 | 391:
|
835 | (function(__unused_webpack_module, exports, __webpack_require__) {
|
836 |
|
837 | "use strict";
|
838 |
|
839 | var __assign = (this && this.__assign) || function () {
|
840 | __assign = Object.assign || function(t) {
|
841 | for (var s, i = 1, n = arguments.length; i < n; i++) {
|
842 | s = arguments[i];
|
843 | for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
844 | t[p] = s[p];
|
845 | }
|
846 | return t;
|
847 | };
|
848 | return __assign.apply(this, arguments);
|
849 | };
|
850 | var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
851 | function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
852 | return new (P || (P = Promise))(function (resolve, reject) {
|
853 | function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
854 | function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
855 | function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
856 | step((generator = generator.apply(thisArg, _arguments || [])).next());
|
857 | });
|
858 | };
|
859 | var __generator = (this && this.__generator) || function (thisArg, body) {
|
860 | var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
861 | return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
862 | function verb(n) { return function (v) { return step([n, v]); }; }
|
863 | function step(op) {
|
864 | if (f) throw new TypeError("Generator is already executing.");
|
865 | while (_) try {
|
866 | if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
867 | if (y = 0, t) op = [op[0] & 2, t.value];
|
868 | switch (op[0]) {
|
869 | case 0: case 1: t = op; break;
|
870 | case 4: _.label++; return { value: op[1], done: false };
|
871 | case 5: _.label++; y = op[1]; op = [0]; continue;
|
872 | case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
873 | default:
|
874 | if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
875 | if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
876 | if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
877 | if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
878 | if (t[2]) _.ops.pop();
|
879 | _.trys.pop(); continue;
|
880 | }
|
881 | op = body.call(thisArg, _);
|
882 | } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
883 | if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
884 | }
|
885 | };
|
886 | Object.defineProperty(exports, "__esModule", ({ value: true }));
|
887 |
|
888 |
|
889 |
|
890 |
|
891 |
|
892 |
|
893 |
|
894 |
|
895 |
|
896 |
|
897 | var fs_1 = __webpack_require__(60);
|
898 | var path_1 = __webpack_require__(23);
|
899 | var vscode_languageserver_1 = __webpack_require__(2);
|
900 | var constant_1 = __webpack_require__(64);
|
901 | var util_1 = __webpack_require__(66);
|
902 | var EVAL_PATH = "/doc/eval.txt";
|
903 | var OPTIONS_PATH = "/doc/options.txt";
|
904 | var INDEX_PATH = "/doc/index.txt";
|
905 | var API_PATH = "/doc/api.txt";
|
906 | var AUTOCMD_PATH = "/doc/autocmd.txt";
|
907 | var POPUP_PATH = "/doc/popup.txt";
|
908 | var CHANNEL_PATH = "/doc/channel.txt";
|
909 | var TEXTPROP_PATH = "/doc/textprop.txt";
|
910 | var TERMINAL_PATH = "/doc/terminal.txt";
|
911 | var TESTING_PATH = "/doc/testing.txt";
|
912 | var Server = (function () {
|
913 | function Server(config) {
|
914 | this.config = config;
|
915 |
|
916 | this.vimPredefinedVariablesItems = [];
|
917 | this.vimOptionItems = [];
|
918 | this.vimBuiltinFunctionItems = [];
|
919 | this.vimCommandItems = [];
|
920 | this.vimFeatureItems = [];
|
921 | this.vimExpandKeywordItems = [];
|
922 | this.vimAutocmdItems = [];
|
923 |
|
924 | this.vimBuiltFunctionDocuments = {};
|
925 | this.vimOptionDocuments = {};
|
926 | this.vimPredefinedVariableDocuments = {};
|
927 | this.vimCommandDocuments = {};
|
928 | this.vimFeatureDocuments = {};
|
929 | this.expandKeywordDocuments = {};
|
930 |
|
931 | this.vimBuiltFunctionSignatureHelp = {};
|
932 |
|
933 | this.text = {};
|
934 | }
|
935 | Server.prototype.build = function () {
|
936 | return __awaiter(this, void 0, void 0, function () {
|
937 | var vimruntime, paths, index, p, _a, err, data;
|
938 | return __generator(this, function (_b) {
|
939 | switch (_b.label) {
|
940 | case 0:
|
941 | vimruntime = this.config.vimruntime;
|
942 | if (!vimruntime) return [3 , 5];
|
943 | paths = [
|
944 | EVAL_PATH,
|
945 | OPTIONS_PATH,
|
946 | INDEX_PATH,
|
947 | API_PATH,
|
948 | AUTOCMD_PATH,
|
949 | POPUP_PATH,
|
950 | CHANNEL_PATH,
|
951 | TEXTPROP_PATH,
|
952 | TERMINAL_PATH,
|
953 | TESTING_PATH,
|
954 | ];
|
955 | index = 0;
|
956 | _b.label = 1;
|
957 | case 1:
|
958 | if (!(index < paths.length)) return [3 , 4];
|
959 | p = path_1.join(vimruntime, paths[index]);
|
960 | return [4 , util_1.pcb(fs_1.readFile)(p, "utf-8")];
|
961 | case 2:
|
962 | _a = _b.sent(), err = _a[0], data = _a[1];
|
963 | if (err) {
|
964 |
|
965 | console.error("[vimls]: read " + p + " error: " + err.message);
|
966 | }
|
967 | this.text[paths[index]] = (data && data.toString().split("\n")) || [];
|
968 | _b.label = 3;
|
969 | case 3:
|
970 | index++;
|
971 | return [3 , 1];
|
972 | case 4:
|
973 | this.resolveVimPredefinedVariables();
|
974 | this.resolveVimOptions();
|
975 | this.resolveBuiltinFunctions();
|
976 | this.resolveBuiltinFunctionsDocument();
|
977 | this.resolveBuiltinVimPopupFunctionsDocument();
|
978 | this.resolveBuiltinVimChannelFunctionsDocument();
|
979 | this.resolveBuiltinVimJobFunctionsDocument();
|
980 | this.resolveBuiltinVimTextpropFunctionsDocument();
|
981 | this.resolveBuiltinVimTerminalFunctionsDocument();
|
982 | this.resolveBuiltinVimTestingFunctionsDocument();
|
983 | this.resolveBuiltinNvimFunctions();
|
984 | this.resolveExpandKeywords();
|
985 | this.resolveVimCommands();
|
986 | this.resolveVimFeatures();
|
987 | this.resolveVimAutocmds();
|
988 | _b.label = 5;
|
989 | case 5: return [2 ];
|
990 | }
|
991 | });
|
992 | });
|
993 | };
|
994 | Server.prototype.serialize = function () {
|
995 | var str = JSON.stringify({
|
996 | completionItems: {
|
997 | commands: this.vimCommandItems,
|
998 | functions: this.vimBuiltinFunctionItems,
|
999 | variables: this.vimPredefinedVariablesItems,
|
1000 | options: this.vimOptionItems,
|
1001 | features: this.vimFeatureItems,
|
1002 | expandKeywords: this.vimExpandKeywordItems,
|
1003 | autocmds: this.vimAutocmdItems,
|
1004 | },
|
1005 | signatureHelp: this.vimBuiltFunctionSignatureHelp,
|
1006 | documents: {
|
1007 | commands: this.vimCommandDocuments,
|
1008 | functions: this.vimBuiltFunctionDocuments,
|
1009 | variables: this.vimPredefinedVariableDocuments,
|
1010 | options: this.vimOptionDocuments,
|
1011 | features: this.vimFeatureDocuments,
|
1012 | expandKeywords: this.expandKeywordDocuments,
|
1013 | },
|
1014 | }, null, 2);
|
1015 | fs_1.writeFileSync("./src/docs/builtin-docs.json", str, "utf-8");
|
1016 | };
|
1017 | Server.prototype.formatFunctionSnippets = function (fname, snippets) {
|
1018 | if (snippets === "") {
|
1019 | return fname + "(${0})";
|
1020 | }
|
1021 | var idx = 0;
|
1022 | if (/^\[.+\]/.test(snippets)) {
|
1023 | return fname + "(${1})${0}";
|
1024 | }
|
1025 | var str = snippets.split("[")[0].trim().replace(/\{?(\w+)\}?/g, function (m, g1) {
|
1026 | return "${" + (idx += 1) + ":" + g1 + "}";
|
1027 | });
|
1028 | return fname + "(" + str + ")${0}";
|
1029 | };
|
1030 |
|
1031 | Server.prototype.resolveVimPredefinedVariables = function () {
|
1032 | var evalText = this.text[EVAL_PATH] || [];
|
1033 | var isMatchLine = false;
|
1034 | var completionItem;
|
1035 | for (var _i = 0, evalText_1 = evalText; _i < evalText_1.length; _i++) {
|
1036 | var line = evalText_1[_i];
|
1037 | if (!isMatchLine) {
|
1038 | if (/\*vim-variable\*/.test(line)) {
|
1039 | isMatchLine = true;
|
1040 | }
|
1041 | continue;
|
1042 | }
|
1043 | else {
|
1044 | var m = line.match(/^(v:[^ \t]+)[ \t]+([^ ].*)$/);
|
1045 | if (m) {
|
1046 | if (completionItem) {
|
1047 | this.vimPredefinedVariablesItems.push(completionItem);
|
1048 | this.vimPredefinedVariableDocuments[completionItem.label].pop();
|
1049 | completionItem = undefined;
|
1050 | }
|
1051 | var label = m[1];
|
1052 | completionItem = {
|
1053 | label: label,
|
1054 | kind: vscode_languageserver_1.CompletionItemKind.Variable,
|
1055 | sortText: constant_1.sortTexts.four,
|
1056 | insertText: label.slice(2),
|
1057 | insertTextFormat: vscode_languageserver_1.InsertTextFormat.PlainText,
|
1058 | };
|
1059 | if (!this.vimPredefinedVariableDocuments[label]) {
|
1060 | this.vimPredefinedVariableDocuments[label] = [];
|
1061 | }
|
1062 | this.vimPredefinedVariableDocuments[label].push(m[2]);
|
1063 | }
|
1064 | else if (/^\s*$/.test(line) && completionItem) {
|
1065 | this.vimPredefinedVariablesItems.push(completionItem);
|
1066 | completionItem = undefined;
|
1067 | }
|
1068 | else if (completionItem) {
|
1069 | this.vimPredefinedVariableDocuments[completionItem.label].push(line);
|
1070 | }
|
1071 | else if (/===============/.test(line)) {
|
1072 | break;
|
1073 | }
|
1074 | }
|
1075 | }
|
1076 | };
|
1077 |
|
1078 | Server.prototype.resolveVimOptions = function () {
|
1079 | var optionsText = this.text[OPTIONS_PATH] || [];
|
1080 | var isMatchLine = false;
|
1081 | var completionItem;
|
1082 | for (var _i = 0, optionsText_1 = optionsText; _i < optionsText_1.length; _i++) {
|
1083 | var line = optionsText_1[_i];
|
1084 | if (!isMatchLine) {
|
1085 | if (/\*'aleph'\*/.test(line)) {
|
1086 | isMatchLine = true;
|
1087 | }
|
1088 | continue;
|
1089 | }
|
1090 | else {
|
1091 | var m = line.match(/^'([^']+)'[ \t]+('[^']+')?[ \t]+([^ \t].*)$/);
|
1092 | if (m) {
|
1093 | var label = m[1];
|
1094 | completionItem = {
|
1095 | label: label,
|
1096 | kind: vscode_languageserver_1.CompletionItemKind.Property,
|
1097 | detail: m[3].trim().split(/[ \t]/)[0],
|
1098 | documentation: "",
|
1099 | sortText: "00004",
|
1100 | insertText: m[1],
|
1101 | insertTextFormat: vscode_languageserver_1.InsertTextFormat.PlainText,
|
1102 | };
|
1103 | if (!this.vimOptionDocuments[label]) {
|
1104 | this.vimOptionDocuments[label] = [];
|
1105 | }
|
1106 | this.vimOptionDocuments[label].push(m[3]);
|
1107 | }
|
1108 | else if (/^\s*$/.test(line) && completionItem) {
|
1109 | this.vimOptionItems.push(completionItem);
|
1110 | completionItem = undefined;
|
1111 | }
|
1112 | else if (completionItem) {
|
1113 | this.vimOptionDocuments[completionItem.label].push(line);
|
1114 | }
|
1115 | }
|
1116 | }
|
1117 | };
|
1118 |
|
1119 | Server.prototype.resolveBuiltinFunctions = function () {
|
1120 | var evalText = this.text[EVAL_PATH] || [];
|
1121 | var isMatchLine = false;
|
1122 | var completionItem;
|
1123 | for (var _i = 0, evalText_2 = evalText; _i < evalText_2.length; _i++) {
|
1124 | var line = evalText_2[_i];
|
1125 | if (!isMatchLine) {
|
1126 | if (/\*functions\*/.test(line)) {
|
1127 | isMatchLine = true;
|
1128 | }
|
1129 | continue;
|
1130 | }
|
1131 | else {
|
1132 | var m = line.match(/^((\w+)\(([^)]*)\))[ \t]*([^ \t].*)?$/);
|
1133 | if (m) {
|
1134 | if (completionItem) {
|
1135 | this.vimBuiltinFunctionItems.push(completionItem);
|
1136 | }
|
1137 | var label = m[2];
|
1138 | completionItem = {
|
1139 | label: label,
|
1140 | kind: vscode_languageserver_1.CompletionItemKind.Function,
|
1141 | detail: (m[4] || "").split(/[ \t]/)[0],
|
1142 | sortText: "00004",
|
1143 | insertText: this.formatFunctionSnippets(m[2], m[3]),
|
1144 | insertTextFormat: vscode_languageserver_1.InsertTextFormat.Snippet,
|
1145 | };
|
1146 | this.vimBuiltFunctionSignatureHelp[label] = [
|
1147 | m[3],
|
1148 | (m[4] || "").split(/[ \t]/)[0],
|
1149 | ];
|
1150 | }
|
1151 | else if (/^[ \t]*$/.test(line)) {
|
1152 | if (completionItem) {
|
1153 | this.vimBuiltinFunctionItems.push(completionItem);
|
1154 | completionItem = undefined;
|
1155 | break;
|
1156 | }
|
1157 | }
|
1158 | else if (completionItem) {
|
1159 | if (completionItem.detail === "") {
|
1160 | completionItem.detail = line.trim().split(/[ \t]/)[0];
|
1161 | if (this.vimBuiltFunctionSignatureHelp[completionItem.label]) {
|
1162 | this.vimBuiltFunctionSignatureHelp[completionItem.label][1] = line.trim().split(/[ \t]/)[0];
|
1163 | }
|
1164 | }
|
1165 | }
|
1166 | }
|
1167 | }
|
1168 | };
|
1169 | Server.prototype.resolveBuiltinFunctionsDocument = function () {
|
1170 | var evalText = this.text[EVAL_PATH] || [];
|
1171 | var isMatchLine = false;
|
1172 | var label = "";
|
1173 | for (var idx = 0; idx < evalText.length; idx++) {
|
1174 | var line = evalText[idx];
|
1175 | if (!isMatchLine) {
|
1176 | if (/\*abs\(\)\*/.test(line)) {
|
1177 | isMatchLine = true;
|
1178 | idx -= 1;
|
1179 | }
|
1180 | continue;
|
1181 | }
|
1182 | else {
|
1183 | var m = line.match(/^((\w+)\(([^)]*)\))[ \t]*([^ \t].*)?$/);
|
1184 | if (m) {
|
1185 | if (label) {
|
1186 | this.vimBuiltFunctionDocuments[label].pop();
|
1187 | }
|
1188 | label = m[2];
|
1189 | if (!this.vimBuiltFunctionDocuments[label]) {
|
1190 | this.vimBuiltFunctionDocuments[label] = [];
|
1191 | }
|
1192 | }
|
1193 | else if (/^[ \t]*\*string-match\*[ \t]*$/.test(line)) {
|
1194 | if (label) {
|
1195 | this.vimBuiltFunctionDocuments[label].pop();
|
1196 | }
|
1197 | break;
|
1198 | }
|
1199 | else if (label) {
|
1200 | this.vimBuiltFunctionDocuments[label].push(line);
|
1201 | }
|
1202 | }
|
1203 | }
|
1204 | };
|
1205 | Server.prototype.resolveBuiltinVimPopupFunctionsDocument = function () {
|
1206 | var popupText = this.text[POPUP_PATH] || [];
|
1207 | var isMatchLine = false;
|
1208 | var label = "";
|
1209 | for (var idx = 0; idx < popupText.length; idx++) {
|
1210 | var line = popupText[idx];
|
1211 | if (!isMatchLine) {
|
1212 | if (/^DETAILS\s+\*popup-function-details\*/.test(line)) {
|
1213 | isMatchLine = true;
|
1214 | idx += 1;
|
1215 | }
|
1216 | continue;
|
1217 | }
|
1218 | else {
|
1219 | var m = line.match(/^((\w+)\(([^)]*)\))[ \t]*([^ \t].*)?$/);
|
1220 | if (m) {
|
1221 | if (label) {
|
1222 | this.vimBuiltFunctionDocuments[label].pop();
|
1223 | }
|
1224 | label = m[2];
|
1225 | if (!this.vimBuiltFunctionDocuments[label]) {
|
1226 | this.vimBuiltFunctionDocuments[label] = [];
|
1227 | }
|
1228 | }
|
1229 | else if (/^=+$/.test(line)) {
|
1230 | if (label) {
|
1231 | this.vimBuiltFunctionDocuments[label].pop();
|
1232 | }
|
1233 | break;
|
1234 | }
|
1235 | else if (label) {
|
1236 | this.vimBuiltFunctionDocuments[label].push(line);
|
1237 | }
|
1238 | }
|
1239 | }
|
1240 | };
|
1241 | Server.prototype.resolveBuiltinVimChannelFunctionsDocument = function () {
|
1242 | var channelText = this.text[CHANNEL_PATH] || [];
|
1243 | var isMatchLine = false;
|
1244 | var label = "";
|
1245 | for (var idx = 0; idx < channelText.length; idx++) {
|
1246 | var line = channelText[idx];
|
1247 | if (!isMatchLine) {
|
1248 | if (/^8\.\sChannel\sfunctions\sdetails\s+\*channel-functions-details\*/.test(line)) {
|
1249 | isMatchLine = true;
|
1250 | idx += 1;
|
1251 | }
|
1252 | continue;
|
1253 | }
|
1254 | else {
|
1255 | var m = line.match(/^((\w+)\(([^)]*)\))[ \t]*([^ \t].*)?$/);
|
1256 | if (m) {
|
1257 | if (label) {
|
1258 | this.vimBuiltFunctionDocuments[label].pop();
|
1259 | }
|
1260 | label = m[2];
|
1261 | if (!this.vimBuiltFunctionDocuments[label]) {
|
1262 | this.vimBuiltFunctionDocuments[label] = [];
|
1263 | }
|
1264 | }
|
1265 | else if (/^=+$/.test(line)) {
|
1266 | if (label) {
|
1267 | this.vimBuiltFunctionDocuments[label].pop();
|
1268 | }
|
1269 | break;
|
1270 | }
|
1271 | else if (label) {
|
1272 | this.vimBuiltFunctionDocuments[label].push(line);
|
1273 | }
|
1274 | }
|
1275 | }
|
1276 | };
|
1277 | Server.prototype.resolveBuiltinVimJobFunctionsDocument = function () {
|
1278 | var channelText = this.text[CHANNEL_PATH] || [];
|
1279 | var isMatchLine = false;
|
1280 | var label = "";
|
1281 | for (var idx = 0; idx < channelText.length; idx++) {
|
1282 | var line = channelText[idx];
|
1283 | if (!isMatchLine) {
|
1284 | if (/^11\.\sJob\sfunctions\s+\*job-functions-details\*/.test(line)) {
|
1285 | isMatchLine = true;
|
1286 | idx += 1;
|
1287 | }
|
1288 | continue;
|
1289 | }
|
1290 | else {
|
1291 | var m = line.match(/^((\w+)\(([^)]*)\))[ \t]*([^ \t].*)?$/);
|
1292 | if (m) {
|
1293 | if (label) {
|
1294 | this.vimBuiltFunctionDocuments[label].pop();
|
1295 | }
|
1296 | label = m[2];
|
1297 | if (!this.vimBuiltFunctionDocuments[label]) {
|
1298 | this.vimBuiltFunctionDocuments[label] = [];
|
1299 | }
|
1300 | }
|
1301 | else if (/^=+$/.test(line)) {
|
1302 | if (label) {
|
1303 | this.vimBuiltFunctionDocuments[label].pop();
|
1304 | }
|
1305 | break;
|
1306 | }
|
1307 | else if (label) {
|
1308 | this.vimBuiltFunctionDocuments[label].push(line);
|
1309 | }
|
1310 | }
|
1311 | }
|
1312 | };
|
1313 | Server.prototype.resolveBuiltinVimTextpropFunctionsDocument = function () {
|
1314 | var textpropText = this.text[TEXTPROP_PATH] || [];
|
1315 | var isMatchLine = false;
|
1316 | var label = "";
|
1317 |
|
1318 | for (var idx = 0; idx < textpropText.length; idx++) {
|
1319 | var line = textpropText[idx];
|
1320 | if (!isMatchLine) {
|
1321 | if (/^\s+\*prop_add\(\)\*\s\*E965/.test(line)) {
|
1322 | isMatchLine = true;
|
1323 | }
|
1324 | continue;
|
1325 | }
|
1326 | else {
|
1327 | var m = line.match(/^((\w+)\(([^)]*)\))[ \t]*([^ \t].*)?$/);
|
1328 | if (m) {
|
1329 | if (label) {
|
1330 | this.vimBuiltFunctionDocuments[label].pop();
|
1331 | }
|
1332 | label = m[2];
|
1333 | if (!this.vimBuiltFunctionDocuments[label]) {
|
1334 | this.vimBuiltFunctionDocuments[label] = [];
|
1335 | }
|
1336 | }
|
1337 | else if (/^=+$/.test(line)) {
|
1338 | if (label) {
|
1339 | this.vimBuiltFunctionDocuments[label].pop();
|
1340 | }
|
1341 | break;
|
1342 | }
|
1343 | else if (label) {
|
1344 | this.vimBuiltFunctionDocuments[label].push(line);
|
1345 | }
|
1346 | }
|
1347 | }
|
1348 | };
|
1349 | Server.prototype.resolveBuiltinVimTerminalFunctionsDocument = function () {
|
1350 | var terminalText = this.text[TERMINAL_PATH] || [];
|
1351 | var isMatchLine = false;
|
1352 | var label = "";
|
1353 |
|
1354 | for (var idx = 0; idx < terminalText.length; idx++) {
|
1355 | var line = terminalText[idx];
|
1356 | if (!isMatchLine) {
|
1357 | if (/^\s+\*term_dumpdiff\(\)/.test(line)) {
|
1358 | isMatchLine = true;
|
1359 | }
|
1360 | continue;
|
1361 | }
|
1362 | else {
|
1363 | var m = line.match(/^((\w+)\(([^)]*)\))[ \t]*([^ \t].*)?$/);
|
1364 | if (m) {
|
1365 | if (label) {
|
1366 | this.vimBuiltFunctionDocuments[label].pop();
|
1367 | }
|
1368 | label = m[2];
|
1369 | if (!this.vimBuiltFunctionDocuments[label]) {
|
1370 | this.vimBuiltFunctionDocuments[label] = [];
|
1371 | }
|
1372 | }
|
1373 | else if (/^=+$/.test(line)) {
|
1374 | if (label) {
|
1375 | this.vimBuiltFunctionDocuments[label].pop();
|
1376 | }
|
1377 | break;
|
1378 | }
|
1379 | else if (label) {
|
1380 | this.vimBuiltFunctionDocuments[label].push(line);
|
1381 | }
|
1382 | }
|
1383 | }
|
1384 | };
|
1385 | Server.prototype.resolveBuiltinVimTestingFunctionsDocument = function () {
|
1386 | var testingText = this.text[TESTING_PATH] || [];
|
1387 | var isMatchLine = false;
|
1388 | var label = "";
|
1389 |
|
1390 | for (var idx = 0; idx < testingText.length; idx++) {
|
1391 | var line = testingText[idx];
|
1392 | if (!isMatchLine) {
|
1393 | if (/^2\.\sTest\sfunctions\s+\*test-functions-details\*/.test(line)) {
|
1394 | isMatchLine = true;
|
1395 | idx += 1;
|
1396 | }
|
1397 | continue;
|
1398 | }
|
1399 | else {
|
1400 | var m = line.match(/^((\w+)\(([^)]*)\))[ \t]*([^ \t].*)?$/);
|
1401 | if (m) {
|
1402 | if (label) {
|
1403 | this.vimBuiltFunctionDocuments[label].pop();
|
1404 | }
|
1405 | label = m[2];
|
1406 | if (!this.vimBuiltFunctionDocuments[label]) {
|
1407 | this.vimBuiltFunctionDocuments[label] = [];
|
1408 | }
|
1409 | }
|
1410 | else if (/^=+$/.test(line)) {
|
1411 | if (label) {
|
1412 | this.vimBuiltFunctionDocuments[label].pop();
|
1413 | }
|
1414 | break;
|
1415 | }
|
1416 | else if (label) {
|
1417 | this.vimBuiltFunctionDocuments[label].push(line);
|
1418 | }
|
1419 | }
|
1420 | }
|
1421 | };
|
1422 | Server.prototype.resolveBuiltinNvimFunctions = function () {
|
1423 | var evalText = this.text[API_PATH] || [];
|
1424 | var completionItem;
|
1425 | var pattern = /^((nvim_\w+)\(([^)]*)\))[ \t]*/m;
|
1426 | for (var idx = 0; idx < evalText.length; idx++) {
|
1427 | var line = evalText[idx];
|
1428 | var m = line.match(pattern);
|
1429 | if (!m && evalText[idx + 1]) {
|
1430 | m = [line, evalText[idx + 1].trim()].join(" ").match(pattern);
|
1431 | if (m) {
|
1432 | idx++;
|
1433 | }
|
1434 | }
|
1435 | if (m) {
|
1436 | if (completionItem) {
|
1437 | this.vimBuiltinFunctionItems.push(completionItem);
|
1438 | if (this.vimBuiltFunctionDocuments[completionItem.label]) {
|
1439 | this.vimBuiltFunctionDocuments[completionItem.label].pop();
|
1440 | }
|
1441 | }
|
1442 | var label = m[2];
|
1443 | completionItem = {
|
1444 | label: label,
|
1445 | kind: vscode_languageserver_1.CompletionItemKind.Function,
|
1446 | detail: "",
|
1447 | documentation: "",
|
1448 | sortText: "00004",
|
1449 | insertText: this.formatFunctionSnippets(m[2], m[3]),
|
1450 | insertTextFormat: vscode_languageserver_1.InsertTextFormat.Snippet,
|
1451 | };
|
1452 | if (!this.vimBuiltFunctionDocuments[label]) {
|
1453 | this.vimBuiltFunctionDocuments[label] = [];
|
1454 | }
|
1455 | this.vimBuiltFunctionSignatureHelp[label] = [
|
1456 | m[3],
|
1457 | "",
|
1458 | ];
|
1459 | }
|
1460 | else if (/^(================|[ \t]*vim:tw=78:ts=8:ft=help:norl:)/.test(line)) {
|
1461 | if (completionItem) {
|
1462 | this.vimBuiltinFunctionItems.push(completionItem);
|
1463 | if (this.vimBuiltFunctionDocuments[completionItem.label]) {
|
1464 | this.vimBuiltFunctionDocuments[completionItem.label].pop();
|
1465 | }
|
1466 | completionItem = undefined;
|
1467 | }
|
1468 | }
|
1469 | else if (completionItem && !/^[ \t]\*nvim(_\w+)+\(\)\*\s*$/.test(line)) {
|
1470 | this.vimBuiltFunctionDocuments[completionItem.label].push(line);
|
1471 | }
|
1472 | }
|
1473 | };
|
1474 | Server.prototype.resolveVimCommands = function () {
|
1475 | var indexText = this.text[INDEX_PATH] || [];
|
1476 | var isMatchLine = false;
|
1477 | var completionItem;
|
1478 | for (var _i = 0, indexText_1 = indexText; _i < indexText_1.length; _i++) {
|
1479 | var line = indexText_1[_i];
|
1480 | if (!isMatchLine) {
|
1481 | if (/\*ex-cmd-index\*/.test(line)) {
|
1482 | isMatchLine = true;
|
1483 | }
|
1484 | continue;
|
1485 | }
|
1486 | else {
|
1487 | var m = line.match(/^\|?:([^ \t]+?)\|?[ \t]+:([^ \t]+)[ \t]+([^ \t].*)$/);
|
1488 | if (m) {
|
1489 | if (completionItem) {
|
1490 | this.vimCommandItems.push(completionItem);
|
1491 | }
|
1492 | var label = m[1];
|
1493 | completionItem = {
|
1494 | label: m[1],
|
1495 | kind: vscode_languageserver_1.CompletionItemKind.Operator,
|
1496 | detail: m[2],
|
1497 | documentation: m[3],
|
1498 | sortText: "00004",
|
1499 | insertText: m[1],
|
1500 | insertTextFormat: vscode_languageserver_1.InsertTextFormat.PlainText,
|
1501 | };
|
1502 | if (!this.vimCommandDocuments[label]) {
|
1503 | this.vimCommandDocuments[label] = [];
|
1504 | }
|
1505 | this.vimCommandDocuments[label].push(m[3]);
|
1506 | }
|
1507 | else if (/^[ \t]*$/.test(line)) {
|
1508 | if (completionItem) {
|
1509 | this.vimCommandItems.push(completionItem);
|
1510 | completionItem = undefined;
|
1511 | break;
|
1512 | }
|
1513 | }
|
1514 | else if (completionItem) {
|
1515 | completionItem.documentation += " " + line.trim();
|
1516 | this.vimCommandDocuments[completionItem.label].push(line);
|
1517 | }
|
1518 | }
|
1519 | }
|
1520 | };
|
1521 | Server.prototype.resolveVimFeatures = function () {
|
1522 | var text = this.text[EVAL_PATH] || [];
|
1523 | var isMatchLine = false;
|
1524 | var completionItem;
|
1525 | var features = [];
|
1526 | for (var idx = 0; idx < text.length; idx++) {
|
1527 | var line = text[idx];
|
1528 | if (!isMatchLine) {
|
1529 | if (/^[ \t]*acl[ \t]/.test(line)) {
|
1530 | isMatchLine = true;
|
1531 | idx -= 1;
|
1532 | }
|
1533 | continue;
|
1534 | }
|
1535 | else {
|
1536 | var m = line.match(/^[ \t]*\*?([^ \t]+?)\*?[ \t]+([^ \t].*)$/);
|
1537 | if (m) {
|
1538 | if (completionItem) {
|
1539 | features.push(completionItem);
|
1540 | }
|
1541 | var label = m[1];
|
1542 | completionItem = {
|
1543 | label: m[1],
|
1544 | kind: vscode_languageserver_1.CompletionItemKind.EnumMember,
|
1545 | documentation: "",
|
1546 | sortText: "00004",
|
1547 | insertText: m[1],
|
1548 | insertTextFormat: vscode_languageserver_1.InsertTextFormat.PlainText,
|
1549 | };
|
1550 | if (!this.vimFeatureDocuments[label]) {
|
1551 | this.vimFeatureDocuments[label] = [];
|
1552 | }
|
1553 | this.vimFeatureDocuments[label].push(m[2]);
|
1554 | }
|
1555 | else if (/^[ \t]*$/.test(line)) {
|
1556 | if (completionItem) {
|
1557 | features.push(completionItem);
|
1558 | break;
|
1559 | }
|
1560 | }
|
1561 | else if (completionItem) {
|
1562 | this.vimFeatureDocuments[completionItem.label].push(line);
|
1563 | }
|
1564 | }
|
1565 | }
|
1566 | this.vimFeatureItems = features;
|
1567 | };
|
1568 | Server.prototype.resolveVimAutocmds = function () {
|
1569 | var text = this.text[AUTOCMD_PATH] || [];
|
1570 | var isMatchLine = false;
|
1571 | for (var idx = 0; idx < text.length; idx++) {
|
1572 | var line = text[idx];
|
1573 | if (!isMatchLine) {
|
1574 | if (/^\|BufNewFile\|/.test(line)) {
|
1575 | isMatchLine = true;
|
1576 | idx -= 1;
|
1577 | }
|
1578 | continue;
|
1579 | }
|
1580 | else {
|
1581 | var m = line.match(/^\|([^ \t]+)\|[ \t]+([^ \t].*)$/);
|
1582 | if (m) {
|
1583 | this.vimAutocmdItems.push({
|
1584 | label: m[1],
|
1585 | kind: vscode_languageserver_1.CompletionItemKind.EnumMember,
|
1586 | documentation: m[2],
|
1587 | sortText: "00004",
|
1588 | insertText: m[1],
|
1589 | insertTextFormat: vscode_languageserver_1.InsertTextFormat.PlainText,
|
1590 | });
|
1591 | if (m[1] === "Signal") {
|
1592 | break;
|
1593 | }
|
1594 | }
|
1595 | }
|
1596 | }
|
1597 | };
|
1598 | Server.prototype.resolveExpandKeywords = function () {
|
1599 | var _this = this;
|
1600 | this.vimExpandKeywordItems = [
|
1601 | "<cfile>,file name under the cursor",
|
1602 | "<afile>,autocmd file name",
|
1603 | "<abuf>,autocmd buffer number (as a String!)",
|
1604 | "<amatch>,autocmd matched name",
|
1605 | "<sfile>,sourced script file or function name",
|
1606 | "<slnum>,sourced script file line number",
|
1607 | "<cword>,word under the cursor",
|
1608 | "<cWORD>,WORD under the cursor",
|
1609 | "<client>,the {clientid} of the last received message `server2client()`",
|
1610 | ].map(function (line) {
|
1611 | var item = line.split(",");
|
1612 | _this.expandKeywordDocuments[item[0]] = [
|
1613 | item[1],
|
1614 | ];
|
1615 | return {
|
1616 | label: item[0],
|
1617 | kind: vscode_languageserver_1.CompletionItemKind.Keyword,
|
1618 | documentation: item[1],
|
1619 | sortText: "00004",
|
1620 | insertText: item[0],
|
1621 | insertTextFormat: vscode_languageserver_1.InsertTextFormat.PlainText,
|
1622 | };
|
1623 | });
|
1624 | };
|
1625 | return Server;
|
1626 | }());
|
1627 | function main() {
|
1628 | return __awaiter(this, void 0, void 0, function () {
|
1629 | var servers, idx, server;
|
1630 | return __generator(this, function (_a) {
|
1631 | switch (_a.label) {
|
1632 | case 0:
|
1633 | servers = [];
|
1634 | idx = 2;
|
1635 | _a.label = 1;
|
1636 | case 1:
|
1637 | if (!(idx < process.argv.length)) return [3 , 4];
|
1638 | servers.push(new Server({
|
1639 | vimruntime: process.argv[idx],
|
1640 | }));
|
1641 | return [4 , servers[servers.length - 1].build()];
|
1642 | case 2:
|
1643 | _a.sent();
|
1644 | _a.label = 3;
|
1645 | case 3:
|
1646 | idx++;
|
1647 | return [3 , 1];
|
1648 | case 4:
|
1649 | server = servers.reduce(function (pre, next) {
|
1650 |
|
1651 | next.vimBuiltinFunctionItems.forEach(function (item) {
|
1652 | var label = item.label;
|
1653 | if (!pre.vimBuiltFunctionDocuments[label]) {
|
1654 | pre.vimBuiltinFunctionItems.push(item);
|
1655 | pre.vimBuiltFunctionDocuments[label] = next.vimBuiltFunctionDocuments[label];
|
1656 | }
|
1657 | });
|
1658 |
|
1659 | next.vimCommandItems.forEach(function (item) {
|
1660 | var label = item.label;
|
1661 | if (!pre.vimCommandDocuments[label]) {
|
1662 | pre.vimCommandItems.push(item);
|
1663 | pre.vimCommandDocuments[label] = next.vimCommandDocuments[label];
|
1664 | }
|
1665 | });
|
1666 |
|
1667 | next.vimOptionItems.forEach(function (item) {
|
1668 | var label = item.label;
|
1669 | if (!pre.vimOptionDocuments[label]) {
|
1670 | pre.vimOptionItems.push(item);
|
1671 | pre.vimOptionDocuments[label] = next.vimOptionDocuments[label];
|
1672 | }
|
1673 | });
|
1674 |
|
1675 | next.vimPredefinedVariablesItems.forEach(function (item) {
|
1676 | var label = item.label;
|
1677 | if (!pre.vimPredefinedVariableDocuments[label]) {
|
1678 | pre.vimPredefinedVariablesItems.push(item);
|
1679 | pre.vimPredefinedVariableDocuments[label] = next.vimPredefinedVariableDocuments[label];
|
1680 | }
|
1681 | });
|
1682 |
|
1683 | next.vimFeatureItems.forEach(function (item) {
|
1684 | var label = item.label;
|
1685 | if (!pre.vimFeatureDocuments[label]) {
|
1686 | pre.vimFeatureItems.push(item);
|
1687 | pre.vimFeatureDocuments[label] = next.vimFeatureDocuments[label];
|
1688 | }
|
1689 | });
|
1690 |
|
1691 | next.vimExpandKeywordItems.forEach(function (item) {
|
1692 | var label = item.label;
|
1693 | if (!pre.expandKeywordDocuments[label]) {
|
1694 | pre.vimExpandKeywordItems.push(item);
|
1695 | pre.expandKeywordDocuments[label] = next.expandKeywordDocuments[label];
|
1696 | }
|
1697 | });
|
1698 |
|
1699 | next.vimAutocmdItems.forEach(function (item) {
|
1700 | var label = item.label;
|
1701 | if (!pre.vimAutocmdItems.some(function (n) { return n.label === label; })) {
|
1702 | pre.vimAutocmdItems.push(item);
|
1703 | }
|
1704 | });
|
1705 |
|
1706 | pre.vimBuiltFunctionSignatureHelp = __assign(__assign({}, next.vimBuiltFunctionSignatureHelp), pre.vimBuiltFunctionSignatureHelp);
|
1707 | return pre;
|
1708 | });
|
1709 | server.serialize();
|
1710 | return [2 ];
|
1711 | }
|
1712 | });
|
1713 | });
|
1714 | }
|
1715 | main();
|
1716 |
|
1717 |
|
1718 | }),
|
1719 |
|
1720 | 73:
|
1721 | ((__unused_webpack_module, exports, __webpack_require__) => {
|
1722 |
|
1723 | "use strict";
|
1724 |
|
1725 | Object.defineProperty(exports, "__esModule", ({ value: true }));
|
1726 | var constant_1 = __webpack_require__(64);
|
1727 | var conf;
|
1728 | exports.default = {
|
1729 | init: function (config) {
|
1730 | conf = config;
|
1731 | },
|
1732 | changeByKey: function (key, value) {
|
1733 | if (conf) {
|
1734 | conf[key] = value;
|
1735 | }
|
1736 | },
|
1737 | get isNeovim() {
|
1738 | return conf && conf.isNeovim || false;
|
1739 | },
|
1740 | get iskeyword() {
|
1741 | return conf && conf.iskeyword || "";
|
1742 | },
|
1743 | get vimruntime() {
|
1744 | return conf && conf.vimruntime || "";
|
1745 | },
|
1746 | get runtimepath() {
|
1747 | return conf && conf.runtimepath || [];
|
1748 | },
|
1749 | get diagnostic() {
|
1750 | return conf && conf.diagnostic || {
|
1751 | enable: true,
|
1752 | };
|
1753 | },
|
1754 | get snippetSupport() {
|
1755 | return conf && conf.snippetSupport || false;
|
1756 | },
|
1757 | get suggest() {
|
1758 | return conf && conf.suggest || {
|
1759 | fromRuntimepath: false,
|
1760 | fromVimruntime: true,
|
1761 | };
|
1762 | },
|
1763 | get indexes() {
|
1764 | var defaults = {
|
1765 | runtimepath: true,
|
1766 | gap: 100,
|
1767 | count: 1,
|
1768 | projectRootPatterns: constant_1.projectRootPatterns,
|
1769 | };
|
1770 | if (!conf || !conf.indexes) {
|
1771 | return defaults;
|
1772 | }
|
1773 | if (conf.indexes.gap !== undefined) {
|
1774 | defaults.gap = conf.indexes.gap;
|
1775 | }
|
1776 | if (conf.indexes.count !== undefined) {
|
1777 | defaults.count = conf.indexes.count;
|
1778 | }
|
1779 | if (conf.indexes.projectRootPatterns !== undefined
|
1780 | && Array.isArray(conf.indexes.projectRootPatterns)
|
1781 | && conf.indexes.projectRootPatterns.length) {
|
1782 | defaults.projectRootPatterns = conf.indexes.projectRootPatterns;
|
1783 | }
|
1784 | return defaults;
|
1785 | },
|
1786 | get capabilities() {
|
1787 | return conf && conf.capabilities;
|
1788 | }
|
1789 | };
|
1790 |
|
1791 |
|
1792 | }),
|
1793 |
|
1794 | 13:
|
1795 | ((__unused_webpack_module, exports, __webpack_require__) => {
|
1796 |
|
1797 | "use strict";
|
1798 |
|
1799 |
|
1800 |
|
1801 |
|
1802 |
|
1803 |
|
1804 | Object.defineProperty(exports, "__esModule", ({ value: true }));
|
1805 | exports.CancellationSenderStrategy = exports.CancellationReceiverStrategy = exports.ConnectionError = exports.ConnectionErrors = exports.LogTraceNotification = exports.SetTraceNotification = exports.TraceFormat = exports.Trace = exports.ProgressType = exports.createMessageConnection = exports.NullLogger = exports.ConnectionOptions = exports.ConnectionStrategy = exports.WriteableStreamMessageWriter = exports.AbstractMessageWriter = exports.MessageWriter = exports.ReadableStreamMessageReader = exports.AbstractMessageReader = exports.MessageReader = exports.CancellationToken = exports.CancellationTokenSource = exports.Emitter = exports.Event = exports.Disposable = exports.ParameterStructures = exports.NotificationType9 = exports.NotificationType8 = exports.NotificationType7 = exports.NotificationType6 = exports.NotificationType5 = exports.NotificationType4 = exports.NotificationType3 = exports.NotificationType2 = exports.NotificationType1 = exports.NotificationType0 = exports.NotificationType = exports.ErrorCodes = exports.ResponseError = exports.RequestType9 = exports.RequestType8 = exports.RequestType7 = exports.RequestType6 = exports.RequestType5 = exports.RequestType4 = exports.RequestType3 = exports.RequestType2 = exports.RequestType1 = exports.RequestType0 = exports.RequestType = exports.RAL = void 0;
|
1806 | exports.CancellationStrategy = void 0;
|
1807 | const messages_1 = __webpack_require__(14);
|
1808 | Object.defineProperty(exports, "RequestType", ({ enumerable: true, get: function () { return messages_1.RequestType; } }));
|
1809 | Object.defineProperty(exports, "RequestType0", ({ enumerable: true, get: function () { return messages_1.RequestType0; } }));
|
1810 | Object.defineProperty(exports, "RequestType1", ({ enumerable: true, get: function () { return messages_1.RequestType1; } }));
|
1811 | Object.defineProperty(exports, "RequestType2", ({ enumerable: true, get: function () { return messages_1.RequestType2; } }));
|
1812 | Object.defineProperty(exports, "RequestType3", ({ enumerable: true, get: function () { return messages_1.RequestType3; } }));
|
1813 | Object.defineProperty(exports, "RequestType4", ({ enumerable: true, get: function () { return messages_1.RequestType4; } }));
|
1814 | Object.defineProperty(exports, "RequestType5", ({ enumerable: true, get: function () { return messages_1.RequestType5; } }));
|
1815 | Object.defineProperty(exports, "RequestType6", ({ enumerable: true, get: function () { return messages_1.RequestType6; } }));
|
1816 | Object.defineProperty(exports, "RequestType7", ({ enumerable: true, get: function () { return messages_1.RequestType7; } }));
|
1817 | Object.defineProperty(exports, "RequestType8", ({ enumerable: true, get: function () { return messages_1.RequestType8; } }));
|
1818 | Object.defineProperty(exports, "RequestType9", ({ enumerable: true, get: function () { return messages_1.RequestType9; } }));
|
1819 | Object.defineProperty(exports, "ResponseError", ({ enumerable: true, get: function () { return messages_1.ResponseError; } }));
|
1820 | Object.defineProperty(exports, "ErrorCodes", ({ enumerable: true, get: function () { return messages_1.ErrorCodes; } }));
|
1821 | Object.defineProperty(exports, "NotificationType", ({ enumerable: true, get: function () { return messages_1.NotificationType; } }));
|
1822 | Object.defineProperty(exports, "NotificationType0", ({ enumerable: true, get: function () { return messages_1.NotificationType0; } }));
|
1823 | Object.defineProperty(exports, "NotificationType1", ({ enumerable: true, get: function () { return messages_1.NotificationType1; } }));
|
1824 | Object.defineProperty(exports, "NotificationType2", ({ enumerable: true, get: function () { return messages_1.NotificationType2; } }));
|
1825 | Object.defineProperty(exports, "NotificationType3", ({ enumerable: true, get: function () { return messages_1.NotificationType3; } }));
|
1826 | Object.defineProperty(exports, "NotificationType4", ({ enumerable: true, get: function () { return messages_1.NotificationType4; } }));
|
1827 | Object.defineProperty(exports, "NotificationType5", ({ enumerable: true, get: function () { return messages_1.NotificationType5; } }));
|
1828 | Object.defineProperty(exports, "NotificationType6", ({ enumerable: true, get: function () { return messages_1.NotificationType6; } }));
|
1829 | Object.defineProperty(exports, "NotificationType7", ({ enumerable: true, get: function () { return messages_1.NotificationType7; } }));
|
1830 | Object.defineProperty(exports, "NotificationType8", ({ enumerable: true, get: function () { return messages_1.NotificationType8; } }));
|
1831 | Object.defineProperty(exports, "NotificationType9", ({ enumerable: true, get: function () { return messages_1.NotificationType9; } }));
|
1832 | Object.defineProperty(exports, "ParameterStructures", ({ enumerable: true, get: function () { return messages_1.ParameterStructures; } }));
|
1833 | const disposable_1 = __webpack_require__(11);
|
1834 | Object.defineProperty(exports, "Disposable", ({ enumerable: true, get: function () { return disposable_1.Disposable; } }));
|
1835 | const events_1 = __webpack_require__(16);
|
1836 | Object.defineProperty(exports, "Event", ({ enumerable: true, get: function () { return events_1.Event; } }));
|
1837 | Object.defineProperty(exports, "Emitter", ({ enumerable: true, get: function () { return events_1.Emitter; } }));
|
1838 | const cancellation_1 = __webpack_require__(17);
|
1839 | Object.defineProperty(exports, "CancellationTokenSource", ({ enumerable: true, get: function () { return cancellation_1.CancellationTokenSource; } }));
|
1840 | Object.defineProperty(exports, "CancellationToken", ({ enumerable: true, get: function () { return cancellation_1.CancellationToken; } }));
|
1841 | const messageReader_1 = __webpack_require__(18);
|
1842 | Object.defineProperty(exports, "MessageReader", ({ enumerable: true, get: function () { return messageReader_1.MessageReader; } }));
|
1843 | Object.defineProperty(exports, "AbstractMessageReader", ({ enumerable: true, get: function () { return messageReader_1.AbstractMessageReader; } }));
|
1844 | Object.defineProperty(exports, "ReadableStreamMessageReader", ({ enumerable: true, get: function () { return messageReader_1.ReadableStreamMessageReader; } }));
|
1845 | const messageWriter_1 = __webpack_require__(19);
|
1846 | Object.defineProperty(exports, "MessageWriter", ({ enumerable: true, get: function () { return messageWriter_1.MessageWriter; } }));
|
1847 | Object.defineProperty(exports, "AbstractMessageWriter", ({ enumerable: true, get: function () { return messageWriter_1.AbstractMessageWriter; } }));
|
1848 | Object.defineProperty(exports, "WriteableStreamMessageWriter", ({ enumerable: true, get: function () { return messageWriter_1.WriteableStreamMessageWriter; } }));
|
1849 | const connection_1 = __webpack_require__(21);
|
1850 | Object.defineProperty(exports, "ConnectionStrategy", ({ enumerable: true, get: function () { return connection_1.ConnectionStrategy; } }));
|
1851 | Object.defineProperty(exports, "ConnectionOptions", ({ enumerable: true, get: function () { return connection_1.ConnectionOptions; } }));
|
1852 | Object.defineProperty(exports, "NullLogger", ({ enumerable: true, get: function () { return connection_1.NullLogger; } }));
|
1853 | Object.defineProperty(exports, "createMessageConnection", ({ enumerable: true, get: function () { return connection_1.createMessageConnection; } }));
|
1854 | Object.defineProperty(exports, "ProgressType", ({ enumerable: true, get: function () { return connection_1.ProgressType; } }));
|
1855 | Object.defineProperty(exports, "Trace", ({ enumerable: true, get: function () { return connection_1.Trace; } }));
|
1856 | Object.defineProperty(exports, "TraceFormat", ({ enumerable: true, get: function () { return connection_1.TraceFormat; } }));
|
1857 | Object.defineProperty(exports, "SetTraceNotification", ({ enumerable: true, get: function () { return connection_1.SetTraceNotification; } }));
|
1858 | Object.defineProperty(exports, "LogTraceNotification", ({ enumerable: true, get: function () { return connection_1.LogTraceNotification; } }));
|
1859 | Object.defineProperty(exports, "ConnectionErrors", ({ enumerable: true, get: function () { return connection_1.ConnectionErrors; } }));
|
1860 | Object.defineProperty(exports, "ConnectionError", ({ enumerable: true, get: function () { return connection_1.ConnectionError; } }));
|
1861 | Object.defineProperty(exports, "CancellationReceiverStrategy", ({ enumerable: true, get: function () { return connection_1.CancellationReceiverStrategy; } }));
|
1862 | Object.defineProperty(exports, "CancellationSenderStrategy", ({ enumerable: true, get: function () { return connection_1.CancellationSenderStrategy; } }));
|
1863 | Object.defineProperty(exports, "CancellationStrategy", ({ enumerable: true, get: function () { return connection_1.CancellationStrategy; } }));
|
1864 | const ral_1 = __webpack_require__(9);
|
1865 | exports.RAL = ral_1.default;
|
1866 |
|
1867 |
|
1868 | }),
|
1869 |
|
1870 | 17:
|
1871 | ((__unused_webpack_module, exports, __webpack_require__) => {
|
1872 |
|
1873 | "use strict";
|
1874 |
|
1875 |
|
1876 |
|
1877 |
|
1878 |
|
1879 | Object.defineProperty(exports, "__esModule", ({ value: true }));
|
1880 | exports.CancellationTokenSource = exports.CancellationToken = void 0;
|
1881 | const ral_1 = __webpack_require__(9);
|
1882 | const Is = __webpack_require__(15);
|
1883 | const events_1 = __webpack_require__(16);
|
1884 | var CancellationToken;
|
1885 | (function (CancellationToken) {
|
1886 | CancellationToken.None = Object.freeze({
|
1887 | isCancellationRequested: false,
|
1888 | onCancellationRequested: events_1.Event.None
|
1889 | });
|
1890 | CancellationToken.Cancelled = Object.freeze({
|
1891 | isCancellationRequested: true,
|
1892 | onCancellationRequested: events_1.Event.None
|
1893 | });
|
1894 | function is(value) {
|
1895 | const candidate = value;
|
1896 | return candidate && (candidate === CancellationToken.None
|
1897 | || candidate === CancellationToken.Cancelled
|
1898 | || (Is.boolean(candidate.isCancellationRequested) && !!candidate.onCancellationRequested));
|
1899 | }
|
1900 | CancellationToken.is = is;
|
1901 | })(CancellationToken = exports.CancellationToken || (exports.CancellationToken = {}));
|
1902 | const shortcutEvent = Object.freeze(function (callback, context) {
|
1903 | const handle = ral_1.default().timer.setTimeout(callback.bind(context), 0);
|
1904 | return { dispose() { ral_1.default().timer.clearTimeout(handle); } };
|
1905 | });
|
1906 | class MutableToken {
|
1907 | constructor() {
|
1908 | this._isCancelled = false;
|
1909 | }
|
1910 | cancel() {
|
1911 | if (!this._isCancelled) {
|
1912 | this._isCancelled = true;
|
1913 | if (this._emitter) {
|
1914 | this._emitter.fire(undefined);
|
1915 | this.dispose();
|
1916 | }
|
1917 | }
|
1918 | }
|
1919 | get isCancellationRequested() {
|
1920 | return this._isCancelled;
|
1921 | }
|
1922 | get onCancellationRequested() {
|
1923 | if (this._isCancelled) {
|
1924 | return shortcutEvent;
|
1925 | }
|
1926 | if (!this._emitter) {
|
1927 | this._emitter = new events_1.Emitter();
|
1928 | }
|
1929 | return this._emitter.event;
|
1930 | }
|
1931 | dispose() {
|
1932 | if (this._emitter) {
|
1933 | this._emitter.dispose();
|
1934 | this._emitter = undefined;
|
1935 | }
|
1936 | }
|
1937 | }
|
1938 | class CancellationTokenSource {
|
1939 | get token() {
|
1940 | if (!this._token) {
|
1941 |
|
1942 |
|
1943 | this._token = new MutableToken();
|
1944 | }
|
1945 | return this._token;
|
1946 | }
|
1947 | cancel() {
|
1948 | if (!this._token) {
|
1949 |
|
1950 |
|
1951 |
|
1952 | this._token = CancellationToken.Cancelled;
|
1953 | }
|
1954 | else {
|
1955 | this._token.cancel();
|
1956 | }
|
1957 | }
|
1958 | dispose() {
|
1959 | if (!this._token) {
|
1960 |
|
1961 | this._token = CancellationToken.None;
|
1962 | }
|
1963 | else if (this._token instanceof MutableToken) {
|
1964 |
|
1965 | this._token.dispose();
|
1966 | }
|
1967 | }
|
1968 | }
|
1969 | exports.CancellationTokenSource = CancellationTokenSource;
|
1970 |
|
1971 |
|
1972 | }),
|
1973 |
|
1974 | 21:
|
1975 | ((__unused_webpack_module, exports, __webpack_require__) => {
|
1976 |
|
1977 | "use strict";
|
1978 |
|
1979 |
|
1980 |
|
1981 |
|
1982 |
|
1983 | Object.defineProperty(exports, "__esModule", ({ value: true }));
|
1984 | exports.createMessageConnection = exports.ConnectionOptions = exports.CancellationStrategy = exports.CancellationSenderStrategy = exports.CancellationReceiverStrategy = exports.ConnectionStrategy = exports.ConnectionError = exports.ConnectionErrors = exports.LogTraceNotification = exports.SetTraceNotification = exports.TraceFormat = exports.Trace = exports.NullLogger = exports.ProgressType = void 0;
|
1985 | const ral_1 = __webpack_require__(9);
|
1986 | const Is = __webpack_require__(15);
|
1987 | const messages_1 = __webpack_require__(14);
|
1988 | const linkedMap_1 = __webpack_require__(22);
|
1989 | const events_1 = __webpack_require__(16);
|
1990 | const cancellation_1 = __webpack_require__(17);
|
1991 | var CancelNotification;
|
1992 | (function (CancelNotification) {
|
1993 | CancelNotification.type = new messages_1.NotificationType('$/cancelRequest');
|
1994 | })(CancelNotification || (CancelNotification = {}));
|
1995 | var ProgressNotification;
|
1996 | (function (ProgressNotification) {
|
1997 | ProgressNotification.type = new messages_1.NotificationType('$/progress');
|
1998 | })(ProgressNotification || (ProgressNotification = {}));
|
1999 | class ProgressType {
|
2000 | constructor() {
|
2001 | }
|
2002 | }
|
2003 | exports.ProgressType = ProgressType;
|
2004 | var StarRequestHandler;
|
2005 | (function (StarRequestHandler) {
|
2006 | function is(value) {
|
2007 | return Is.func(value);
|
2008 | }
|
2009 | StarRequestHandler.is = is;
|
2010 | })(StarRequestHandler || (StarRequestHandler = {}));
|
2011 | exports.NullLogger = Object.freeze({
|
2012 | error: () => { },
|
2013 | warn: () => { },
|
2014 | info: () => { },
|
2015 | log: () => { }
|
2016 | });
|
2017 | var Trace;
|
2018 | (function (Trace) {
|
2019 | Trace[Trace["Off"] = 0] = "Off";
|
2020 | Trace[Trace["Messages"] = 1] = "Messages";
|
2021 | Trace[Trace["Verbose"] = 2] = "Verbose";
|
2022 | })(Trace = exports.Trace || (exports.Trace = {}));
|
2023 | (function (Trace) {
|
2024 | function fromString(value) {
|
2025 | if (!Is.string(value)) {
|
2026 | return Trace.Off;
|
2027 | }
|
2028 | value = value.toLowerCase();
|
2029 | switch (value) {
|
2030 | case 'off':
|
2031 | return Trace.Off;
|
2032 | case 'messages':
|
2033 | return Trace.Messages;
|
2034 | case 'verbose':
|
2035 | return Trace.Verbose;
|
2036 | default:
|
2037 | return Trace.Off;
|
2038 | }
|
2039 | }
|
2040 | Trace.fromString = fromString;
|
2041 | function toString(value) {
|
2042 | switch (value) {
|
2043 | case Trace.Off:
|
2044 | return 'off';
|
2045 | case Trace.Messages:
|
2046 | return 'messages';
|
2047 | case Trace.Verbose:
|
2048 | return 'verbose';
|
2049 | default:
|
2050 | return 'off';
|
2051 | }
|
2052 | }
|
2053 | Trace.toString = toString;
|
2054 | })(Trace = exports.Trace || (exports.Trace = {}));
|
2055 | var TraceFormat;
|
2056 | (function (TraceFormat) {
|
2057 | TraceFormat["Text"] = "text";
|
2058 | TraceFormat["JSON"] = "json";
|
2059 | })(TraceFormat = exports.TraceFormat || (exports.TraceFormat = {}));
|
2060 | (function (TraceFormat) {
|
2061 | function fromString(value) {
|
2062 | value = value.toLowerCase();
|
2063 | if (value === 'json') {
|
2064 | return TraceFormat.JSON;
|
2065 | }
|
2066 | else {
|
2067 | return TraceFormat.Text;
|
2068 | }
|
2069 | }
|
2070 | TraceFormat.fromString = fromString;
|
2071 | })(TraceFormat = exports.TraceFormat || (exports.TraceFormat = {}));
|
2072 | var SetTraceNotification;
|
2073 | (function (SetTraceNotification) {
|
2074 | SetTraceNotification.type = new messages_1.NotificationType('$/setTrace');
|
2075 | })(SetTraceNotification = exports.SetTraceNotification || (exports.SetTraceNotification = {}));
|
2076 | var LogTraceNotification;
|
2077 | (function (LogTraceNotification) {
|
2078 | LogTraceNotification.type = new messages_1.NotificationType('$/logTrace');
|
2079 | })(LogTraceNotification = exports.LogTraceNotification || (exports.LogTraceNotification = {}));
|
2080 | var ConnectionErrors;
|
2081 | (function (ConnectionErrors) {
|
2082 | |
2083 |
|
2084 |
|
2085 | ConnectionErrors[ConnectionErrors["Closed"] = 1] = "Closed";
|
2086 | |
2087 |
|
2088 |
|
2089 | ConnectionErrors[ConnectionErrors["Disposed"] = 2] = "Disposed";
|
2090 | |
2091 |
|
2092 |
|
2093 | ConnectionErrors[ConnectionErrors["AlreadyListening"] = 3] = "AlreadyListening";
|
2094 | })(ConnectionErrors = exports.ConnectionErrors || (exports.ConnectionErrors = {}));
|
2095 | class ConnectionError extends Error {
|
2096 | constructor(code, message) {
|
2097 | super(message);
|
2098 | this.code = code;
|
2099 | Object.setPrototypeOf(this, ConnectionError.prototype);
|
2100 | }
|
2101 | }
|
2102 | exports.ConnectionError = ConnectionError;
|
2103 | var ConnectionStrategy;
|
2104 | (function (ConnectionStrategy) {
|
2105 | function is(value) {
|
2106 | const candidate = value;
|
2107 | return candidate && Is.func(candidate.cancelUndispatched);
|
2108 | }
|
2109 | ConnectionStrategy.is = is;
|
2110 | })(ConnectionStrategy = exports.ConnectionStrategy || (exports.ConnectionStrategy = {}));
|
2111 | var CancellationReceiverStrategy;
|
2112 | (function (CancellationReceiverStrategy) {
|
2113 | CancellationReceiverStrategy.Message = Object.freeze({
|
2114 | createCancellationTokenSource(_) {
|
2115 | return new cancellation_1.CancellationTokenSource();
|
2116 | }
|
2117 | });
|
2118 | function is(value) {
|
2119 | const candidate = value;
|
2120 | return candidate && Is.func(candidate.createCancellationTokenSource);
|
2121 | }
|
2122 | CancellationReceiverStrategy.is = is;
|
2123 | })(CancellationReceiverStrategy = exports.CancellationReceiverStrategy || (exports.CancellationReceiverStrategy = {}));
|
2124 | var CancellationSenderStrategy;
|
2125 | (function (CancellationSenderStrategy) {
|
2126 | CancellationSenderStrategy.Message = Object.freeze({
|
2127 | sendCancellation(conn, id) {
|
2128 | conn.sendNotification(CancelNotification.type, { id });
|
2129 | },
|
2130 | cleanup(_) { }
|
2131 | });
|
2132 | function is(value) {
|
2133 | const candidate = value;
|
2134 | return candidate && Is.func(candidate.sendCancellation) && Is.func(candidate.cleanup);
|
2135 | }
|
2136 | CancellationSenderStrategy.is = is;
|
2137 | })(CancellationSenderStrategy = exports.CancellationSenderStrategy || (exports.CancellationSenderStrategy = {}));
|
2138 | var CancellationStrategy;
|
2139 | (function (CancellationStrategy) {
|
2140 | CancellationStrategy.Message = Object.freeze({
|
2141 | receiver: CancellationReceiverStrategy.Message,
|
2142 | sender: CancellationSenderStrategy.Message
|
2143 | });
|
2144 | function is(value) {
|
2145 | const candidate = value;
|
2146 | return candidate && CancellationReceiverStrategy.is(candidate.receiver) && CancellationSenderStrategy.is(candidate.sender);
|
2147 | }
|
2148 | CancellationStrategy.is = is;
|
2149 | })(CancellationStrategy = exports.CancellationStrategy || (exports.CancellationStrategy = {}));
|
2150 | var ConnectionOptions;
|
2151 | (function (ConnectionOptions) {
|
2152 | function is(value) {
|
2153 | const candidate = value;
|
2154 | return candidate && (CancellationStrategy.is(candidate.cancellationStrategy) || ConnectionStrategy.is(candidate.connectionStrategy));
|
2155 | }
|
2156 | ConnectionOptions.is = is;
|
2157 | })(ConnectionOptions = exports.ConnectionOptions || (exports.ConnectionOptions = {}));
|
2158 | var ConnectionState;
|
2159 | (function (ConnectionState) {
|
2160 | ConnectionState[ConnectionState["New"] = 1] = "New";
|
2161 | ConnectionState[ConnectionState["Listening"] = 2] = "Listening";
|
2162 | ConnectionState[ConnectionState["Closed"] = 3] = "Closed";
|
2163 | ConnectionState[ConnectionState["Disposed"] = 4] = "Disposed";
|
2164 | })(ConnectionState || (ConnectionState = {}));
|
2165 | function createMessageConnection(messageReader, messageWriter, _logger, options) {
|
2166 | const logger = _logger !== undefined ? _logger : exports.NullLogger;
|
2167 | let sequenceNumber = 0;
|
2168 | let notificationSquenceNumber = 0;
|
2169 | let unknownResponseSquenceNumber = 0;
|
2170 | const version = '2.0';
|
2171 | let starRequestHandler = undefined;
|
2172 | const requestHandlers = Object.create(null);
|
2173 | let starNotificationHandler = undefined;
|
2174 | const notificationHandlers = Object.create(null);
|
2175 | const progressHandlers = new Map();
|
2176 | let timer;
|
2177 | let messageQueue = new linkedMap_1.LinkedMap();
|
2178 | let responsePromises = Object.create(null);
|
2179 | let requestTokens = Object.create(null);
|
2180 | let trace = Trace.Off;
|
2181 | let traceFormat = TraceFormat.Text;
|
2182 | let tracer;
|
2183 | let state = ConnectionState.New;
|
2184 | const errorEmitter = new events_1.Emitter();
|
2185 | const closeEmitter = new events_1.Emitter();
|
2186 | const unhandledNotificationEmitter = new events_1.Emitter();
|
2187 | const unhandledProgressEmitter = new events_1.Emitter();
|
2188 | const disposeEmitter = new events_1.Emitter();
|
2189 | const cancellationStrategy = (options && options.cancellationStrategy) ? options.cancellationStrategy : CancellationStrategy.Message;
|
2190 | function createRequestQueueKey(id) {
|
2191 | if (id === null) {
|
2192 | throw new Error(`Can't send requests with id null since the response can't be correlated.`);
|
2193 | }
|
2194 | return 'req-' + id.toString();
|
2195 | }
|
2196 | function createResponseQueueKey(id) {
|
2197 | if (id === null) {
|
2198 | return 'res-unknown-' + (++unknownResponseSquenceNumber).toString();
|
2199 | }
|
2200 | else {
|
2201 | return 'res-' + id.toString();
|
2202 | }
|
2203 | }
|
2204 | function createNotificationQueueKey() {
|
2205 | return 'not-' + (++notificationSquenceNumber).toString();
|
2206 | }
|
2207 | function addMessageToQueue(queue, message) {
|
2208 | if (messages_1.isRequestMessage(message)) {
|
2209 | queue.set(createRequestQueueKey(message.id), message);
|
2210 | }
|
2211 | else if (messages_1.isResponseMessage(message)) {
|
2212 | queue.set(createResponseQueueKey(message.id), message);
|
2213 | }
|
2214 | else {
|
2215 | queue.set(createNotificationQueueKey(), message);
|
2216 | }
|
2217 | }
|
2218 | function cancelUndispatched(_message) {
|
2219 | return undefined;
|
2220 | }
|
2221 | function isListening() {
|
2222 | return state === ConnectionState.Listening;
|
2223 | }
|
2224 | function isClosed() {
|
2225 | return state === ConnectionState.Closed;
|
2226 | }
|
2227 | function isDisposed() {
|
2228 | return state === ConnectionState.Disposed;
|
2229 | }
|
2230 | function closeHandler() {
|
2231 | if (state === ConnectionState.New || state === ConnectionState.Listening) {
|
2232 | state = ConnectionState.Closed;
|
2233 | closeEmitter.fire(undefined);
|
2234 | }
|
2235 |
|
2236 | }
|
2237 | function readErrorHandler(error) {
|
2238 | errorEmitter.fire([error, undefined, undefined]);
|
2239 | }
|
2240 | function writeErrorHandler(data) {
|
2241 | errorEmitter.fire(data);
|
2242 | }
|
2243 | messageReader.onClose(closeHandler);
|
2244 | messageReader.onError(readErrorHandler);
|
2245 | messageWriter.onClose(closeHandler);
|
2246 | messageWriter.onError(writeErrorHandler);
|
2247 | function triggerMessageQueue() {
|
2248 | if (timer || messageQueue.size === 0) {
|
2249 | return;
|
2250 | }
|
2251 | timer = ral_1.default().timer.setImmediate(() => {
|
2252 | timer = undefined;
|
2253 | processMessageQueue();
|
2254 | });
|
2255 | }
|
2256 | function processMessageQueue() {
|
2257 | if (messageQueue.size === 0) {
|
2258 | return;
|
2259 | }
|
2260 | const message = messageQueue.shift();
|
2261 | try {
|
2262 | if (messages_1.isRequestMessage(message)) {
|
2263 | handleRequest(message);
|
2264 | }
|
2265 | else if (messages_1.isNotificationMessage(message)) {
|
2266 | handleNotification(message);
|
2267 | }
|
2268 | else if (messages_1.isResponseMessage(message)) {
|
2269 | handleResponse(message);
|
2270 | }
|
2271 | else {
|
2272 | handleInvalidMessage(message);
|
2273 | }
|
2274 | }
|
2275 | finally {
|
2276 | triggerMessageQueue();
|
2277 | }
|
2278 | }
|
2279 | const callback = (message) => {
|
2280 | try {
|
2281 |
|
2282 |
|
2283 | if (messages_1.isNotificationMessage(message) && message.method === CancelNotification.type.method) {
|
2284 | const key = createRequestQueueKey(message.params.id);
|
2285 | const toCancel = messageQueue.get(key);
|
2286 | if (messages_1.isRequestMessage(toCancel)) {
|
2287 | const strategy = options === null || options === void 0 ? void 0 : options.connectionStrategy;
|
2288 | const response = (strategy && strategy.cancelUndispatched) ? strategy.cancelUndispatched(toCancel, cancelUndispatched) : cancelUndispatched(toCancel);
|
2289 | if (response && (response.error !== undefined || response.result !== undefined)) {
|
2290 | messageQueue.delete(key);
|
2291 | response.id = toCancel.id;
|
2292 | traceSendingResponse(response, message.method, Date.now());
|
2293 | messageWriter.write(response);
|
2294 | return;
|
2295 | }
|
2296 | }
|
2297 | }
|
2298 | addMessageToQueue(messageQueue, message);
|
2299 | }
|
2300 | finally {
|
2301 | triggerMessageQueue();
|
2302 | }
|
2303 | };
|
2304 | function handleRequest(requestMessage) {
|
2305 | if (isDisposed()) {
|
2306 |
|
2307 |
|
2308 | return;
|
2309 | }
|
2310 | function reply(resultOrError, method, startTime) {
|
2311 | const message = {
|
2312 | jsonrpc: version,
|
2313 | id: requestMessage.id
|
2314 | };
|
2315 | if (resultOrError instanceof messages_1.ResponseError) {
|
2316 | message.error = resultOrError.toJson();
|
2317 | }
|
2318 | else {
|
2319 | message.result = resultOrError === undefined ? null : resultOrError;
|
2320 | }
|
2321 | traceSendingResponse(message, method, startTime);
|
2322 | messageWriter.write(message);
|
2323 | }
|
2324 | function replyError(error, method, startTime) {
|
2325 | const message = {
|
2326 | jsonrpc: version,
|
2327 | id: requestMessage.id,
|
2328 | error: error.toJson()
|
2329 | };
|
2330 | traceSendingResponse(message, method, startTime);
|
2331 | messageWriter.write(message);
|
2332 | }
|
2333 | function replySuccess(result, method, startTime) {
|
2334 |
|
2335 |
|
2336 | if (result === undefined) {
|
2337 | result = null;
|
2338 | }
|
2339 | const message = {
|
2340 | jsonrpc: version,
|
2341 | id: requestMessage.id,
|
2342 | result: result
|
2343 | };
|
2344 | traceSendingResponse(message, method, startTime);
|
2345 | messageWriter.write(message);
|
2346 | }
|
2347 | traceReceivedRequest(requestMessage);
|
2348 | const element = requestHandlers[requestMessage.method];
|
2349 | let type;
|
2350 | let requestHandler;
|
2351 | if (element) {
|
2352 | type = element.type;
|
2353 | requestHandler = element.handler;
|
2354 | }
|
2355 | const startTime = Date.now();
|
2356 | if (requestHandler || starRequestHandler) {
|
2357 | const tokenKey = String(requestMessage.id);
|
2358 | const cancellationSource = cancellationStrategy.receiver.createCancellationTokenSource(tokenKey);
|
2359 | requestTokens[tokenKey] = cancellationSource;
|
2360 | try {
|
2361 | let handlerResult;
|
2362 | if (requestHandler) {
|
2363 | if (requestMessage.params === undefined) {
|
2364 | if (type !== undefined && type.numberOfParams !== 0) {
|
2365 | replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InvalidParams, `Request ${requestMessage.method} defines ${type.numberOfParams} params but recevied none.`), requestMessage.method, startTime);
|
2366 | return;
|
2367 | }
|
2368 | handlerResult = requestHandler(cancellationSource.token);
|
2369 | }
|
2370 | else if (Array.isArray(requestMessage.params)) {
|
2371 | if (type !== undefined && type.parameterStructures === messages_1.ParameterStructures.byName) {
|
2372 | replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InvalidParams, `Request ${requestMessage.method} defines parameters by name but received parameters by position`), requestMessage.method, startTime);
|
2373 | return;
|
2374 | }
|
2375 | handlerResult = requestHandler(...requestMessage.params, cancellationSource.token);
|
2376 | }
|
2377 | else {
|
2378 | if (type !== undefined && type.parameterStructures === messages_1.ParameterStructures.byPosition) {
|
2379 | replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InvalidParams, `Request ${requestMessage.method} defines parameters by position but received parameters by name`), requestMessage.method, startTime);
|
2380 | return;
|
2381 | }
|
2382 | handlerResult = requestHandler(requestMessage.params, cancellationSource.token);
|
2383 | }
|
2384 | }
|
2385 | else if (starRequestHandler) {
|
2386 | handlerResult = starRequestHandler(requestMessage.method, requestMessage.params, cancellationSource.token);
|
2387 | }
|
2388 | const promise = handlerResult;
|
2389 | if (!handlerResult) {
|
2390 | delete requestTokens[tokenKey];
|
2391 | replySuccess(handlerResult, requestMessage.method, startTime);
|
2392 | }
|
2393 | else if (promise.then) {
|
2394 | promise.then((resultOrError) => {
|
2395 | delete requestTokens[tokenKey];
|
2396 | reply(resultOrError, requestMessage.method, startTime);
|
2397 | }, error => {
|
2398 | delete requestTokens[tokenKey];
|
2399 | if (error instanceof messages_1.ResponseError) {
|
2400 | replyError(error, requestMessage.method, startTime);
|
2401 | }
|
2402 | else if (error && Is.string(error.message)) {
|
2403 | replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InternalError, `Request ${requestMessage.method} failed with message: ${error.message}`), requestMessage.method, startTime);
|
2404 | }
|
2405 | else {
|
2406 | replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InternalError, `Request ${requestMessage.method} failed unexpectedly without providing any details.`), requestMessage.method, startTime);
|
2407 | }
|
2408 | });
|
2409 | }
|
2410 | else {
|
2411 | delete requestTokens[tokenKey];
|
2412 | reply(handlerResult, requestMessage.method, startTime);
|
2413 | }
|
2414 | }
|
2415 | catch (error) {
|
2416 | delete requestTokens[tokenKey];
|
2417 | if (error instanceof messages_1.ResponseError) {
|
2418 | reply(error, requestMessage.method, startTime);
|
2419 | }
|
2420 | else if (error && Is.string(error.message)) {
|
2421 | replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InternalError, `Request ${requestMessage.method} failed with message: ${error.message}`), requestMessage.method, startTime);
|
2422 | }
|
2423 | else {
|
2424 | replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InternalError, `Request ${requestMessage.method} failed unexpectedly without providing any details.`), requestMessage.method, startTime);
|
2425 | }
|
2426 | }
|
2427 | }
|
2428 | else {
|
2429 | replyError(new messages_1.ResponseError(messages_1.ErrorCodes.MethodNotFound, `Unhandled method ${requestMessage.method}`), requestMessage.method, startTime);
|
2430 | }
|
2431 | }
|
2432 | function handleResponse(responseMessage) {
|
2433 | if (isDisposed()) {
|
2434 |
|
2435 | return;
|
2436 | }
|
2437 | if (responseMessage.id === null) {
|
2438 | if (responseMessage.error) {
|
2439 | logger.error(`Received response message without id: Error is: \n${JSON.stringify(responseMessage.error, undefined, 4)}`);
|
2440 | }
|
2441 | else {
|
2442 | logger.error(`Received response message without id. No further error information provided.`);
|
2443 | }
|
2444 | }
|
2445 | else {
|
2446 | const key = String(responseMessage.id);
|
2447 | const responsePromise = responsePromises[key];
|
2448 | traceReceivedResponse(responseMessage, responsePromise);
|
2449 | if (responsePromise) {
|
2450 | delete responsePromises[key];
|
2451 | try {
|
2452 | if (responseMessage.error) {
|
2453 | const error = responseMessage.error;
|
2454 | responsePromise.reject(new messages_1.ResponseError(error.code, error.message, error.data));
|
2455 | }
|
2456 | else if (responseMessage.result !== undefined) {
|
2457 | responsePromise.resolve(responseMessage.result);
|
2458 | }
|
2459 | else {
|
2460 | throw new Error('Should never happen.');
|
2461 | }
|
2462 | }
|
2463 | catch (error) {
|
2464 | if (error.message) {
|
2465 | logger.error(`Response handler '${responsePromise.method}' failed with message: ${error.message}`);
|
2466 | }
|
2467 | else {
|
2468 | logger.error(`Response handler '${responsePromise.method}' failed unexpectedly.`);
|
2469 | }
|
2470 | }
|
2471 | }
|
2472 | }
|
2473 | }
|
2474 | function handleNotification(message) {
|
2475 | if (isDisposed()) {
|
2476 |
|
2477 | return;
|
2478 | }
|
2479 | let type = undefined;
|
2480 | let notificationHandler;
|
2481 | if (message.method === CancelNotification.type.method) {
|
2482 | notificationHandler = (params) => {
|
2483 | const id = params.id;
|
2484 | const source = requestTokens[String(id)];
|
2485 | if (source) {
|
2486 | source.cancel();
|
2487 | }
|
2488 | };
|
2489 | }
|
2490 | else {
|
2491 | const element = notificationHandlers[message.method];
|
2492 | if (element) {
|
2493 | notificationHandler = element.handler;
|
2494 | type = element.type;
|
2495 | }
|
2496 | }
|
2497 | if (notificationHandler || starNotificationHandler) {
|
2498 | try {
|
2499 | traceReceivedNotification(message);
|
2500 | if (notificationHandler) {
|
2501 | if (message.params === undefined) {
|
2502 | if (type !== undefined) {
|
2503 | if (type.numberOfParams !== 0 && type.parameterStructures !== messages_1.ParameterStructures.byName) {
|
2504 | logger.error(`Notification ${message.method} defines ${type.numberOfParams} params but recevied none.`);
|
2505 | }
|
2506 | }
|
2507 | notificationHandler();
|
2508 | }
|
2509 | else if (Array.isArray(message.params)) {
|
2510 | if (type !== undefined) {
|
2511 | if (type.parameterStructures === messages_1.ParameterStructures.byName) {
|
2512 | logger.error(`Notification ${message.method} defines parameters by name but received parameters by position`);
|
2513 | }
|
2514 | if (type.numberOfParams !== message.params.length) {
|
2515 | logger.error(`Notification ${message.method} defines ${type.numberOfParams} params but received ${message.params.length} argumennts`);
|
2516 | }
|
2517 | }
|
2518 | notificationHandler(...message.params);
|
2519 | }
|
2520 | else {
|
2521 | if (type !== undefined && type.parameterStructures === messages_1.ParameterStructures.byPosition) {
|
2522 | logger.error(`Notification ${message.method} defines parameters by position but received parameters by name`);
|
2523 | }
|
2524 | notificationHandler(message.params);
|
2525 | }
|
2526 | }
|
2527 | else if (starNotificationHandler) {
|
2528 | starNotificationHandler(message.method, message.params);
|
2529 | }
|
2530 | }
|
2531 | catch (error) {
|
2532 | if (error.message) {
|
2533 | logger.error(`Notification handler '${message.method}' failed with message: ${error.message}`);
|
2534 | }
|
2535 | else {
|
2536 | logger.error(`Notification handler '${message.method}' failed unexpectedly.`);
|
2537 | }
|
2538 | }
|
2539 | }
|
2540 | else {
|
2541 | unhandledNotificationEmitter.fire(message);
|
2542 | }
|
2543 | }
|
2544 | function handleInvalidMessage(message) {
|
2545 | if (!message) {
|
2546 | logger.error('Received empty message.');
|
2547 | return;
|
2548 | }
|
2549 | logger.error(`Received message which is neither a response nor a notification message:\n${JSON.stringify(message, null, 4)}`);
|
2550 |
|
2551 | const responseMessage = message;
|
2552 | if (Is.string(responseMessage.id) || Is.number(responseMessage.id)) {
|
2553 | const key = String(responseMessage.id);
|
2554 | const responseHandler = responsePromises[key];
|
2555 | if (responseHandler) {
|
2556 | responseHandler.reject(new Error('The received response has neither a result nor an error property.'));
|
2557 | }
|
2558 | }
|
2559 | }
|
2560 | function traceSendingRequest(message) {
|
2561 | if (trace === Trace.Off || !tracer) {
|
2562 | return;
|
2563 | }
|
2564 | if (traceFormat === TraceFormat.Text) {
|
2565 | let data = undefined;
|
2566 | if (trace === Trace.Verbose && message.params) {
|
2567 | data = `Params: ${JSON.stringify(message.params, null, 4)}\n\n`;
|
2568 | }
|
2569 | tracer.log(`Sending request '${message.method} - (${message.id})'.`, data);
|
2570 | }
|
2571 | else {
|
2572 | logLSPMessage('send-request', message);
|
2573 | }
|
2574 | }
|
2575 | function traceSendingNotification(message) {
|
2576 | if (trace === Trace.Off || !tracer) {
|
2577 | return;
|
2578 | }
|
2579 | if (traceFormat === TraceFormat.Text) {
|
2580 | let data = undefined;
|
2581 | if (trace === Trace.Verbose) {
|
2582 | if (message.params) {
|
2583 | data = `Params: ${JSON.stringify(message.params, null, 4)}\n\n`;
|
2584 | }
|
2585 | else {
|
2586 | data = 'No parameters provided.\n\n';
|
2587 | }
|
2588 | }
|
2589 | tracer.log(`Sending notification '${message.method}'.`, data);
|
2590 | }
|
2591 | else {
|
2592 | logLSPMessage('send-notification', message);
|
2593 | }
|
2594 | }
|
2595 | function traceSendingResponse(message, method, startTime) {
|
2596 | if (trace === Trace.Off || !tracer) {
|
2597 | return;
|
2598 | }
|
2599 | if (traceFormat === TraceFormat.Text) {
|
2600 | let data = undefined;
|
2601 | if (trace === Trace.Verbose) {
|
2602 | if (message.error && message.error.data) {
|
2603 | data = `Error data: ${JSON.stringify(message.error.data, null, 4)}\n\n`;
|
2604 | }
|
2605 | else {
|
2606 | if (message.result) {
|
2607 | data = `Result: ${JSON.stringify(message.result, null, 4)}\n\n`;
|
2608 | }
|
2609 | else if (message.error === undefined) {
|
2610 | data = 'No result returned.\n\n';
|
2611 | }
|
2612 | }
|
2613 | }
|
2614 | tracer.log(`Sending response '${method} - (${message.id})'. Processing request took ${Date.now() - startTime}ms`, data);
|
2615 | }
|
2616 | else {
|
2617 | logLSPMessage('send-response', message);
|
2618 | }
|
2619 | }
|
2620 | function traceReceivedRequest(message) {
|
2621 | if (trace === Trace.Off || !tracer) {
|
2622 | return;
|
2623 | }
|
2624 | if (traceFormat === TraceFormat.Text) {
|
2625 | let data = undefined;
|
2626 | if (trace === Trace.Verbose && message.params) {
|
2627 | data = `Params: ${JSON.stringify(message.params, null, 4)}\n\n`;
|
2628 | }
|
2629 | tracer.log(`Received request '${message.method} - (${message.id})'.`, data);
|
2630 | }
|
2631 | else {
|
2632 | logLSPMessage('receive-request', message);
|
2633 | }
|
2634 | }
|
2635 | function traceReceivedNotification(message) {
|
2636 | if (trace === Trace.Off || !tracer || message.method === LogTraceNotification.type.method) {
|
2637 | return;
|
2638 | }
|
2639 | if (traceFormat === TraceFormat.Text) {
|
2640 | let data = undefined;
|
2641 | if (trace === Trace.Verbose) {
|
2642 | if (message.params) {
|
2643 | data = `Params: ${JSON.stringify(message.params, null, 4)}\n\n`;
|
2644 | }
|
2645 | else {
|
2646 | data = 'No parameters provided.\n\n';
|
2647 | }
|
2648 | }
|
2649 | tracer.log(`Received notification '${message.method}'.`, data);
|
2650 | }
|
2651 | else {
|
2652 | logLSPMessage('receive-notification', message);
|
2653 | }
|
2654 | }
|
2655 | function traceReceivedResponse(message, responsePromise) {
|
2656 | if (trace === Trace.Off || !tracer) {
|
2657 | return;
|
2658 | }
|
2659 | if (traceFormat === TraceFormat.Text) {
|
2660 | let data = undefined;
|
2661 | if (trace === Trace.Verbose) {
|
2662 | if (message.error && message.error.data) {
|
2663 | data = `Error data: ${JSON.stringify(message.error.data, null, 4)}\n\n`;
|
2664 | }
|
2665 | else {
|
2666 | if (message.result) {
|
2667 | data = `Result: ${JSON.stringify(message.result, null, 4)}\n\n`;
|
2668 | }
|
2669 | else if (message.error === undefined) {
|
2670 | data = 'No result returned.\n\n';
|
2671 | }
|
2672 | }
|
2673 | }
|
2674 | if (responsePromise) {
|
2675 | const error = message.error ? ` Request failed: ${message.error.message} (${message.error.code}).` : '';
|
2676 | tracer.log(`Received response '${responsePromise.method} - (${message.id})' in ${Date.now() - responsePromise.timerStart}ms.${error}`, data);
|
2677 | }
|
2678 | else {
|
2679 | tracer.log(`Received response ${message.id} without active response promise.`, data);
|
2680 | }
|
2681 | }
|
2682 | else {
|
2683 | logLSPMessage('receive-response', message);
|
2684 | }
|
2685 | }
|
2686 | function logLSPMessage(type, message) {
|
2687 | if (!tracer || trace === Trace.Off) {
|
2688 | return;
|
2689 | }
|
2690 | const lspMessage = {
|
2691 | isLSPMessage: true,
|
2692 | type,
|
2693 | message,
|
2694 | timestamp: Date.now()
|
2695 | };
|
2696 | tracer.log(lspMessage);
|
2697 | }
|
2698 | function throwIfClosedOrDisposed() {
|
2699 | if (isClosed()) {
|
2700 | throw new ConnectionError(ConnectionErrors.Closed, 'Connection is closed.');
|
2701 | }
|
2702 | if (isDisposed()) {
|
2703 | throw new ConnectionError(ConnectionErrors.Disposed, 'Connection is disposed.');
|
2704 | }
|
2705 | }
|
2706 | function throwIfListening() {
|
2707 | if (isListening()) {
|
2708 | throw new ConnectionError(ConnectionErrors.AlreadyListening, 'Connection is already listening');
|
2709 | }
|
2710 | }
|
2711 | function throwIfNotListening() {
|
2712 | if (!isListening()) {
|
2713 | throw new Error('Call listen() first.');
|
2714 | }
|
2715 | }
|
2716 | function undefinedToNull(param) {
|
2717 | if (param === undefined) {
|
2718 | return null;
|
2719 | }
|
2720 | else {
|
2721 | return param;
|
2722 | }
|
2723 | }
|
2724 | function nullToUndefined(param) {
|
2725 | if (param === null) {
|
2726 | return undefined;
|
2727 | }
|
2728 | else {
|
2729 | return param;
|
2730 | }
|
2731 | }
|
2732 | function isNamedParam(param) {
|
2733 | return param !== undefined && param !== null && !Array.isArray(param) && typeof param === 'object';
|
2734 | }
|
2735 | function computeSingleParam(parameterStructures, param) {
|
2736 | switch (parameterStructures) {
|
2737 | case messages_1.ParameterStructures.auto:
|
2738 | if (isNamedParam(param)) {
|
2739 | return nullToUndefined(param);
|
2740 | }
|
2741 | else {
|
2742 | return [undefinedToNull(param)];
|
2743 | }
|
2744 | break;
|
2745 | case messages_1.ParameterStructures.byName:
|
2746 | if (!isNamedParam(param)) {
|
2747 | throw new Error(`Recevied parameters by name but param is not an object literal.`);
|
2748 | }
|
2749 | return nullToUndefined(param);
|
2750 | case messages_1.ParameterStructures.byPosition:
|
2751 | return [undefinedToNull(param)];
|
2752 | default:
|
2753 | throw new Error(`Unknown parameter structure ${parameterStructures.toString()}`);
|
2754 | }
|
2755 | }
|
2756 | function computeMessageParams(type, params) {
|
2757 | let result;
|
2758 | const numberOfParams = type.numberOfParams;
|
2759 | switch (numberOfParams) {
|
2760 | case 0:
|
2761 | result = undefined;
|
2762 | break;
|
2763 | case 1:
|
2764 | result = computeSingleParam(type.parameterStructures, params[0]);
|
2765 | break;
|
2766 | default:
|
2767 | result = [];
|
2768 | for (let i = 0; i < params.length && i < numberOfParams; i++) {
|
2769 | result.push(undefinedToNull(params[i]));
|
2770 | }
|
2771 | if (params.length < numberOfParams) {
|
2772 | for (let i = params.length; i < numberOfParams; i++) {
|
2773 | result.push(null);
|
2774 | }
|
2775 | }
|
2776 | break;
|
2777 | }
|
2778 | return result;
|
2779 | }
|
2780 | const connection = {
|
2781 | sendNotification: (type, ...args) => {
|
2782 | throwIfClosedOrDisposed();
|
2783 | let method;
|
2784 | let messageParams;
|
2785 | if (Is.string(type)) {
|
2786 | method = type;
|
2787 | const first = args[0];
|
2788 | let paramStart = 0;
|
2789 | let parameterStructures = messages_1.ParameterStructures.auto;
|
2790 | if (messages_1.ParameterStructures.is(first)) {
|
2791 | paramStart = 1;
|
2792 | parameterStructures = first;
|
2793 | }
|
2794 | let paramEnd = args.length;
|
2795 | const numberOfParams = paramEnd - paramStart;
|
2796 | switch (numberOfParams) {
|
2797 | case 0:
|
2798 | messageParams = undefined;
|
2799 | break;
|
2800 | case 1:
|
2801 | messageParams = computeSingleParam(parameterStructures, args[paramStart]);
|
2802 | break;
|
2803 | default:
|
2804 | if (parameterStructures === messages_1.ParameterStructures.byName) {
|
2805 | throw new Error(`Recevied ${numberOfParams} parameters for 'by Name' notification parameter structure.`);
|
2806 | }
|
2807 | messageParams = args.slice(paramStart, paramEnd).map(value => undefinedToNull(value));
|
2808 | break;
|
2809 | }
|
2810 | }
|
2811 | else {
|
2812 | const params = args;
|
2813 | method = type.method;
|
2814 | messageParams = computeMessageParams(type, params);
|
2815 | }
|
2816 | const notificationMessage = {
|
2817 | jsonrpc: version,
|
2818 | method: method,
|
2819 | params: messageParams
|
2820 | };
|
2821 | traceSendingNotification(notificationMessage);
|
2822 | messageWriter.write(notificationMessage);
|
2823 | },
|
2824 | onNotification: (type, handler) => {
|
2825 | throwIfClosedOrDisposed();
|
2826 | let method;
|
2827 | if (Is.func(type)) {
|
2828 | starNotificationHandler = type;
|
2829 | }
|
2830 | else if (handler) {
|
2831 | if (Is.string(type)) {
|
2832 | method = type;
|
2833 | notificationHandlers[type] = { type: undefined, handler };
|
2834 | }
|
2835 | else {
|
2836 | method = type.method;
|
2837 | notificationHandlers[type.method] = { type, handler };
|
2838 | }
|
2839 | }
|
2840 | return {
|
2841 | dispose: () => {
|
2842 | if (method !== undefined) {
|
2843 | delete notificationHandlers[method];
|
2844 | }
|
2845 | else {
|
2846 | starNotificationHandler = undefined;
|
2847 | }
|
2848 | }
|
2849 | };
|
2850 | },
|
2851 | onProgress: (_type, token, handler) => {
|
2852 | if (progressHandlers.has(token)) {
|
2853 | throw new Error(`Progress handler for token ${token} already registered`);
|
2854 | }
|
2855 | progressHandlers.set(token, handler);
|
2856 | return {
|
2857 | dispose: () => {
|
2858 | progressHandlers.delete(token);
|
2859 | }
|
2860 | };
|
2861 | },
|
2862 | sendProgress: (_type, token, value) => {
|
2863 | connection.sendNotification(ProgressNotification.type, { token, value });
|
2864 | },
|
2865 | onUnhandledProgress: unhandledProgressEmitter.event,
|
2866 | sendRequest: (type, ...args) => {
|
2867 | throwIfClosedOrDisposed();
|
2868 | throwIfNotListening();
|
2869 | let method;
|
2870 | let messageParams;
|
2871 | let token = undefined;
|
2872 | if (Is.string(type)) {
|
2873 | method = type;
|
2874 | const first = args[0];
|
2875 | const last = args[args.length - 1];
|
2876 | let paramStart = 0;
|
2877 | let parameterStructures = messages_1.ParameterStructures.auto;
|
2878 | if (messages_1.ParameterStructures.is(first)) {
|
2879 | paramStart = 1;
|
2880 | parameterStructures = first;
|
2881 | }
|
2882 | let paramEnd = args.length;
|
2883 | if (cancellation_1.CancellationToken.is(last)) {
|
2884 | paramEnd = paramEnd - 1;
|
2885 | token = last;
|
2886 | }
|
2887 | const numberOfParams = paramEnd - paramStart;
|
2888 | switch (numberOfParams) {
|
2889 | case 0:
|
2890 | messageParams = undefined;
|
2891 | break;
|
2892 | case 1:
|
2893 | messageParams = computeSingleParam(parameterStructures, args[paramStart]);
|
2894 | break;
|
2895 | default:
|
2896 | if (parameterStructures === messages_1.ParameterStructures.byName) {
|
2897 | throw new Error(`Recevied ${numberOfParams} parameters for 'by Name' request parameter structure.`);
|
2898 | }
|
2899 | messageParams = args.slice(paramStart, paramEnd).map(value => undefinedToNull(value));
|
2900 | break;
|
2901 | }
|
2902 | }
|
2903 | else {
|
2904 | const params = args;
|
2905 | method = type.method;
|
2906 | messageParams = computeMessageParams(type, params);
|
2907 | const numberOfParams = type.numberOfParams;
|
2908 | token = cancellation_1.CancellationToken.is(params[numberOfParams]) ? params[numberOfParams] : undefined;
|
2909 | }
|
2910 | const id = sequenceNumber++;
|
2911 | let disposable;
|
2912 | if (token) {
|
2913 | disposable = token.onCancellationRequested(() => {
|
2914 | cancellationStrategy.sender.sendCancellation(connection, id);
|
2915 | });
|
2916 | }
|
2917 | const result = new Promise((resolve, reject) => {
|
2918 | const requestMessage = {
|
2919 | jsonrpc: version,
|
2920 | id: id,
|
2921 | method: method,
|
2922 | params: messageParams
|
2923 | };
|
2924 | const resolveWithCleanup = (r) => {
|
2925 | resolve(r);
|
2926 | cancellationStrategy.sender.cleanup(id);
|
2927 | disposable === null || disposable === void 0 ? void 0 : disposable.dispose();
|
2928 | };
|
2929 | const rejectWithCleanup = (r) => {
|
2930 | reject(r);
|
2931 | cancellationStrategy.sender.cleanup(id);
|
2932 | disposable === null || disposable === void 0 ? void 0 : disposable.dispose();
|
2933 | };
|
2934 | let responsePromise = { method: method, timerStart: Date.now(), resolve: resolveWithCleanup, reject: rejectWithCleanup };
|
2935 | traceSendingRequest(requestMessage);
|
2936 | try {
|
2937 | messageWriter.write(requestMessage);
|
2938 | }
|
2939 | catch (e) {
|
2940 |
|
2941 | responsePromise.reject(new messages_1.ResponseError(messages_1.ErrorCodes.MessageWriteError, e.message ? e.message : 'Unknown reason'));
|
2942 | responsePromise = null;
|
2943 | }
|
2944 | if (responsePromise) {
|
2945 | responsePromises[String(id)] = responsePromise;
|
2946 | }
|
2947 | });
|
2948 | return result;
|
2949 | },
|
2950 | onRequest: (type, handler) => {
|
2951 | throwIfClosedOrDisposed();
|
2952 | let method = null;
|
2953 | if (StarRequestHandler.is(type)) {
|
2954 | method = undefined;
|
2955 | starRequestHandler = type;
|
2956 | }
|
2957 | else if (Is.string(type)) {
|
2958 | method = null;
|
2959 | if (handler !== undefined) {
|
2960 | method = type;
|
2961 | requestHandlers[type] = { handler: handler, type: undefined };
|
2962 | }
|
2963 | }
|
2964 | else {
|
2965 | if (handler !== undefined) {
|
2966 | method = type.method;
|
2967 | requestHandlers[type.method] = { type, handler };
|
2968 | }
|
2969 | }
|
2970 | return {
|
2971 | dispose: () => {
|
2972 | if (method === null) {
|
2973 | return;
|
2974 | }
|
2975 | if (method !== undefined) {
|
2976 | delete requestHandlers[method];
|
2977 | }
|
2978 | else {
|
2979 | starRequestHandler = undefined;
|
2980 | }
|
2981 | }
|
2982 | };
|
2983 | },
|
2984 | trace: (_value, _tracer, sendNotificationOrTraceOptions) => {
|
2985 | let _sendNotification = false;
|
2986 | let _traceFormat = TraceFormat.Text;
|
2987 | if (sendNotificationOrTraceOptions !== undefined) {
|
2988 | if (Is.boolean(sendNotificationOrTraceOptions)) {
|
2989 | _sendNotification = sendNotificationOrTraceOptions;
|
2990 | }
|
2991 | else {
|
2992 | _sendNotification = sendNotificationOrTraceOptions.sendNotification || false;
|
2993 | _traceFormat = sendNotificationOrTraceOptions.traceFormat || TraceFormat.Text;
|
2994 | }
|
2995 | }
|
2996 | trace = _value;
|
2997 | traceFormat = _traceFormat;
|
2998 | if (trace === Trace.Off) {
|
2999 | tracer = undefined;
|
3000 | }
|
3001 | else {
|
3002 | tracer = _tracer;
|
3003 | }
|
3004 | if (_sendNotification && !isClosed() && !isDisposed()) {
|
3005 | connection.sendNotification(SetTraceNotification.type, { value: Trace.toString(_value) });
|
3006 | }
|
3007 | },
|
3008 | onError: errorEmitter.event,
|
3009 | onClose: closeEmitter.event,
|
3010 | onUnhandledNotification: unhandledNotificationEmitter.event,
|
3011 | onDispose: disposeEmitter.event,
|
3012 | end: () => {
|
3013 | messageWriter.end();
|
3014 | },
|
3015 | dispose: () => {
|
3016 | if (isDisposed()) {
|
3017 | return;
|
3018 | }
|
3019 | state = ConnectionState.Disposed;
|
3020 | disposeEmitter.fire(undefined);
|
3021 | const error = new Error('Connection got disposed.');
|
3022 | Object.keys(responsePromises).forEach((key) => {
|
3023 | responsePromises[key].reject(error);
|
3024 | });
|
3025 | responsePromises = Object.create(null);
|
3026 | requestTokens = Object.create(null);
|
3027 | messageQueue = new linkedMap_1.LinkedMap();
|
3028 |
|
3029 | if (Is.func(messageWriter.dispose)) {
|
3030 | messageWriter.dispose();
|
3031 | }
|
3032 | if (Is.func(messageReader.dispose)) {
|
3033 | messageReader.dispose();
|
3034 | }
|
3035 | },
|
3036 | listen: () => {
|
3037 | throwIfClosedOrDisposed();
|
3038 | throwIfListening();
|
3039 | state = ConnectionState.Listening;
|
3040 | messageReader.listen(callback);
|
3041 | },
|
3042 | inspect: () => {
|
3043 |
|
3044 | ral_1.default().console.log('inspect');
|
3045 | }
|
3046 | };
|
3047 | connection.onNotification(LogTraceNotification.type, (params) => {
|
3048 | if (trace === Trace.Off || !tracer) {
|
3049 | return;
|
3050 | }
|
3051 | tracer.log(params.message, trace === Trace.Verbose ? params.verbose : undefined);
|
3052 | });
|
3053 | connection.onNotification(ProgressNotification.type, (params) => {
|
3054 | const handler = progressHandlers.get(params.token);
|
3055 | if (handler) {
|
3056 | handler(params.value);
|
3057 | }
|
3058 | else {
|
3059 | unhandledProgressEmitter.fire(params);
|
3060 | }
|
3061 | });
|
3062 | return connection;
|
3063 | }
|
3064 | exports.createMessageConnection = createMessageConnection;
|
3065 |
|
3066 |
|
3067 | }),
|
3068 |
|
3069 | 11:
|
3070 | ((__unused_webpack_module, exports) => {
|
3071 |
|
3072 | "use strict";
|
3073 |
|
3074 |
|
3075 |
|
3076 |
|
3077 |
|
3078 | Object.defineProperty(exports, "__esModule", ({ value: true }));
|
3079 | exports.Disposable = void 0;
|
3080 | var Disposable;
|
3081 | (function (Disposable) {
|
3082 | function create(func) {
|
3083 | return {
|
3084 | dispose: func
|
3085 | };
|
3086 | }
|
3087 | Disposable.create = create;
|
3088 | })(Disposable = exports.Disposable || (exports.Disposable = {}));
|
3089 |
|
3090 |
|
3091 | }),
|
3092 |
|
3093 | 16:
|
3094 | ((__unused_webpack_module, exports, __webpack_require__) => {
|
3095 |
|
3096 | "use strict";
|
3097 |
|
3098 |
|
3099 |
|
3100 |
|
3101 |
|
3102 | Object.defineProperty(exports, "__esModule", ({ value: true }));
|
3103 | exports.Emitter = exports.Event = void 0;
|
3104 | const ral_1 = __webpack_require__(9);
|
3105 | var Event;
|
3106 | (function (Event) {
|
3107 | const _disposable = { dispose() { } };
|
3108 | Event.None = function () { return _disposable; };
|
3109 | })(Event = exports.Event || (exports.Event = {}));
|
3110 | class CallbackList {
|
3111 | add(callback, context = null, bucket) {
|
3112 | if (!this._callbacks) {
|
3113 | this._callbacks = [];
|
3114 | this._contexts = [];
|
3115 | }
|
3116 | this._callbacks.push(callback);
|
3117 | this._contexts.push(context);
|
3118 | if (Array.isArray(bucket)) {
|
3119 | bucket.push({ dispose: () => this.remove(callback, context) });
|
3120 | }
|
3121 | }
|
3122 | remove(callback, context = null) {
|
3123 | if (!this._callbacks) {
|
3124 | return;
|
3125 | }
|
3126 | let foundCallbackWithDifferentContext = false;
|
3127 | for (let i = 0, len = this._callbacks.length; i < len; i++) {
|
3128 | if (this._callbacks[i] === callback) {
|
3129 | if (this._contexts[i] === context) {
|
3130 |
|
3131 | this._callbacks.splice(i, 1);
|
3132 | this._contexts.splice(i, 1);
|
3133 | return;
|
3134 | }
|
3135 | else {
|
3136 | foundCallbackWithDifferentContext = true;
|
3137 | }
|
3138 | }
|
3139 | }
|
3140 | if (foundCallbackWithDifferentContext) {
|
3141 | throw new Error('When adding a listener with a context, you should remove it with the same context');
|
3142 | }
|
3143 | }
|
3144 | invoke(...args) {
|
3145 | if (!this._callbacks) {
|
3146 | return [];
|
3147 | }
|
3148 | const ret = [], callbacks = this._callbacks.slice(0), contexts = this._contexts.slice(0);
|
3149 | for (let i = 0, len = callbacks.length; i < len; i++) {
|
3150 | try {
|
3151 | ret.push(callbacks[i].apply(contexts[i], args));
|
3152 | }
|
3153 | catch (e) {
|
3154 |
|
3155 | ral_1.default().console.error(e);
|
3156 | }
|
3157 | }
|
3158 | return ret;
|
3159 | }
|
3160 | isEmpty() {
|
3161 | return !this._callbacks || this._callbacks.length === 0;
|
3162 | }
|
3163 | dispose() {
|
3164 | this._callbacks = undefined;
|
3165 | this._contexts = undefined;
|
3166 | }
|
3167 | }
|
3168 | class Emitter {
|
3169 | constructor(_options) {
|
3170 | this._options = _options;
|
3171 | }
|
3172 | |
3173 |
|
3174 |
|
3175 |
|
3176 | get event() {
|
3177 | if (!this._event) {
|
3178 | this._event = (listener, thisArgs, disposables) => {
|
3179 | if (!this._callbacks) {
|
3180 | this._callbacks = new CallbackList();
|
3181 | }
|
3182 | if (this._options && this._options.onFirstListenerAdd && this._callbacks.isEmpty()) {
|
3183 | this._options.onFirstListenerAdd(this);
|
3184 | }
|
3185 | this._callbacks.add(listener, thisArgs);
|
3186 | const result = {
|
3187 | dispose: () => {
|
3188 | if (!this._callbacks) {
|
3189 |
|
3190 | return;
|
3191 | }
|
3192 | this._callbacks.remove(listener, thisArgs);
|
3193 | result.dispose = Emitter._noop;
|
3194 | if (this._options && this._options.onLastListenerRemove && this._callbacks.isEmpty()) {
|
3195 | this._options.onLastListenerRemove(this);
|
3196 | }
|
3197 | }
|
3198 | };
|
3199 | if (Array.isArray(disposables)) {
|
3200 | disposables.push(result);
|
3201 | }
|
3202 | return result;
|
3203 | };
|
3204 | }
|
3205 | return this._event;
|
3206 | }
|
3207 | |
3208 |
|
3209 |
|
3210 |
|
3211 | fire(event) {
|
3212 | if (this._callbacks) {
|
3213 | this._callbacks.invoke.call(this._callbacks, event);
|
3214 | }
|
3215 | }
|
3216 | dispose() {
|
3217 | if (this._callbacks) {
|
3218 | this._callbacks.dispose();
|
3219 | this._callbacks = undefined;
|
3220 | }
|
3221 | }
|
3222 | }
|
3223 | exports.Emitter = Emitter;
|
3224 | Emitter._noop = function () { };
|
3225 |
|
3226 |
|
3227 | }),
|
3228 |
|
3229 | 15:
|
3230 | ((__unused_webpack_module, exports) => {
|
3231 |
|
3232 | "use strict";
|
3233 |
|
3234 |
|
3235 |
|
3236 |
|
3237 |
|
3238 | Object.defineProperty(exports, "__esModule", ({ value: true }));
|
3239 | exports.stringArray = exports.array = exports.func = exports.error = exports.number = exports.string = exports.boolean = void 0;
|
3240 | function boolean(value) {
|
3241 | return value === true || value === false;
|
3242 | }
|
3243 | exports.boolean = boolean;
|
3244 | function string(value) {
|
3245 | return typeof value === 'string' || value instanceof String;
|
3246 | }
|
3247 | exports.string = string;
|
3248 | function number(value) {
|
3249 | return typeof value === 'number' || value instanceof Number;
|
3250 | }
|
3251 | exports.number = number;
|
3252 | function error(value) {
|
3253 | return value instanceof Error;
|
3254 | }
|
3255 | exports.error = error;
|
3256 | function func(value) {
|
3257 | return typeof value === 'function';
|
3258 | }
|
3259 | exports.func = func;
|
3260 | function array(value) {
|
3261 | return Array.isArray(value);
|
3262 | }
|
3263 | exports.array = array;
|
3264 | function stringArray(value) {
|
3265 | return array(value) && value.every(elem => string(elem));
|
3266 | }
|
3267 | exports.stringArray = stringArray;
|
3268 |
|
3269 |
|
3270 | }),
|
3271 |
|
3272 | 22:
|
3273 | ((__unused_webpack_module, exports) => {
|
3274 |
|
3275 | "use strict";
|
3276 |
|
3277 |
|
3278 |
|
3279 |
|
3280 |
|
3281 | Object.defineProperty(exports, "__esModule", ({ value: true }));
|
3282 | exports.LRUCache = exports.LinkedMap = exports.Touch = void 0;
|
3283 | var Touch;
|
3284 | (function (Touch) {
|
3285 | Touch.None = 0;
|
3286 | Touch.First = 1;
|
3287 | Touch.AsOld = Touch.First;
|
3288 | Touch.Last = 2;
|
3289 | Touch.AsNew = Touch.Last;
|
3290 | })(Touch = exports.Touch || (exports.Touch = {}));
|
3291 | class LinkedMap {
|
3292 | constructor() {
|
3293 | this[Symbol.toStringTag] = 'LinkedMap';
|
3294 | this._map = new Map();
|
3295 | this._head = undefined;
|
3296 | this._tail = undefined;
|
3297 | this._size = 0;
|
3298 | this._state = 0;
|
3299 | }
|
3300 | clear() {
|
3301 | this._map.clear();
|
3302 | this._head = undefined;
|
3303 | this._tail = undefined;
|
3304 | this._size = 0;
|
3305 | this._state++;
|
3306 | }
|
3307 | isEmpty() {
|
3308 | return !this._head && !this._tail;
|
3309 | }
|
3310 | get size() {
|
3311 | return this._size;
|
3312 | }
|
3313 | get first() {
|
3314 | var _a;
|
3315 | return (_a = this._head) === null || _a === void 0 ? void 0 : _a.value;
|
3316 | }
|
3317 | get last() {
|
3318 | var _a;
|
3319 | return (_a = this._tail) === null || _a === void 0 ? void 0 : _a.value;
|
3320 | }
|
3321 | has(key) {
|
3322 | return this._map.has(key);
|
3323 | }
|
3324 | get(key, touch = Touch.None) {
|
3325 | const item = this._map.get(key);
|
3326 | if (!item) {
|
3327 | return undefined;
|
3328 | }
|
3329 | if (touch !== Touch.None) {
|
3330 | this.touch(item, touch);
|
3331 | }
|
3332 | return item.value;
|
3333 | }
|
3334 | set(key, value, touch = Touch.None) {
|
3335 | let item = this._map.get(key);
|
3336 | if (item) {
|
3337 | item.value = value;
|
3338 | if (touch !== Touch.None) {
|
3339 | this.touch(item, touch);
|
3340 | }
|
3341 | }
|
3342 | else {
|
3343 | item = { key, value, next: undefined, previous: undefined };
|
3344 | switch (touch) {
|
3345 | case Touch.None:
|
3346 | this.addItemLast(item);
|
3347 | break;
|
3348 | case Touch.First:
|
3349 | this.addItemFirst(item);
|
3350 | break;
|
3351 | case Touch.Last:
|
3352 | this.addItemLast(item);
|
3353 | break;
|
3354 | default:
|
3355 | this.addItemLast(item);
|
3356 | break;
|
3357 | }
|
3358 | this._map.set(key, item);
|
3359 | this._size++;
|
3360 | }
|
3361 | return this;
|
3362 | }
|
3363 | delete(key) {
|
3364 | return !!this.remove(key);
|
3365 | }
|
3366 | remove(key) {
|
3367 | const item = this._map.get(key);
|
3368 | if (!item) {
|
3369 | return undefined;
|
3370 | }
|
3371 | this._map.delete(key);
|
3372 | this.removeItem(item);
|
3373 | this._size--;
|
3374 | return item.value;
|
3375 | }
|
3376 | shift() {
|
3377 | if (!this._head && !this._tail) {
|
3378 | return undefined;
|
3379 | }
|
3380 | if (!this._head || !this._tail) {
|
3381 | throw new Error('Invalid list');
|
3382 | }
|
3383 | const item = this._head;
|
3384 | this._map.delete(item.key);
|
3385 | this.removeItem(item);
|
3386 | this._size--;
|
3387 | return item.value;
|
3388 | }
|
3389 | forEach(callbackfn, thisArg) {
|
3390 | const state = this._state;
|
3391 | let current = this._head;
|
3392 | while (current) {
|
3393 | if (thisArg) {
|
3394 | callbackfn.bind(thisArg)(current.value, current.key, this);
|
3395 | }
|
3396 | else {
|
3397 | callbackfn(current.value, current.key, this);
|
3398 | }
|
3399 | if (this._state !== state) {
|
3400 | throw new Error(`LinkedMap got modified during iteration.`);
|
3401 | }
|
3402 | current = current.next;
|
3403 | }
|
3404 | }
|
3405 | keys() {
|
3406 | const map = this;
|
3407 | const state = this._state;
|
3408 | let current = this._head;
|
3409 | const iterator = {
|
3410 | [Symbol.iterator]() {
|
3411 | return iterator;
|
3412 | },
|
3413 | next() {
|
3414 | if (map._state !== state) {
|
3415 | throw new Error(`LinkedMap got modified during iteration.`);
|
3416 | }
|
3417 | if (current) {
|
3418 | const result = { value: current.key, done: false };
|
3419 | current = current.next;
|
3420 | return result;
|
3421 | }
|
3422 | else {
|
3423 | return { value: undefined, done: true };
|
3424 | }
|
3425 | }
|
3426 | };
|
3427 | return iterator;
|
3428 | }
|
3429 | values() {
|
3430 | const map = this;
|
3431 | const state = this._state;
|
3432 | let current = this._head;
|
3433 | const iterator = {
|
3434 | [Symbol.iterator]() {
|
3435 | return iterator;
|
3436 | },
|
3437 | next() {
|
3438 | if (map._state !== state) {
|
3439 | throw new Error(`LinkedMap got modified during iteration.`);
|
3440 | }
|
3441 | if (current) {
|
3442 | const result = { value: current.value, done: false };
|
3443 | current = current.next;
|
3444 | return result;
|
3445 | }
|
3446 | else {
|
3447 | return { value: undefined, done: true };
|
3448 | }
|
3449 | }
|
3450 | };
|
3451 | return iterator;
|
3452 | }
|
3453 | entries() {
|
3454 | const map = this;
|
3455 | const state = this._state;
|
3456 | let current = this._head;
|
3457 | const iterator = {
|
3458 | [Symbol.iterator]() {
|
3459 | return iterator;
|
3460 | },
|
3461 | next() {
|
3462 | if (map._state !== state) {
|
3463 | throw new Error(`LinkedMap got modified during iteration.`);
|
3464 | }
|
3465 | if (current) {
|
3466 | const result = { value: [current.key, current.value], done: false };
|
3467 | current = current.next;
|
3468 | return result;
|
3469 | }
|
3470 | else {
|
3471 | return { value: undefined, done: true };
|
3472 | }
|
3473 | }
|
3474 | };
|
3475 | return iterator;
|
3476 | }
|
3477 | [Symbol.iterator]() {
|
3478 | return this.entries();
|
3479 | }
|
3480 | trimOld(newSize) {
|
3481 | if (newSize >= this.size) {
|
3482 | return;
|
3483 | }
|
3484 | if (newSize === 0) {
|
3485 | this.clear();
|
3486 | return;
|
3487 | }
|
3488 | let current = this._head;
|
3489 | let currentSize = this.size;
|
3490 | while (current && currentSize > newSize) {
|
3491 | this._map.delete(current.key);
|
3492 | current = current.next;
|
3493 | currentSize--;
|
3494 | }
|
3495 | this._head = current;
|
3496 | this._size = currentSize;
|
3497 | if (current) {
|
3498 | current.previous = undefined;
|
3499 | }
|
3500 | this._state++;
|
3501 | }
|
3502 | addItemFirst(item) {
|
3503 |
|
3504 | if (!this._head && !this._tail) {
|
3505 | this._tail = item;
|
3506 | }
|
3507 | else if (!this._head) {
|
3508 | throw new Error('Invalid list');
|
3509 | }
|
3510 | else {
|
3511 | item.next = this._head;
|
3512 | this._head.previous = item;
|
3513 | }
|
3514 | this._head = item;
|
3515 | this._state++;
|
3516 | }
|
3517 | addItemLast(item) {
|
3518 |
|
3519 | if (!this._head && !this._tail) {
|
3520 | this._head = item;
|
3521 | }
|
3522 | else if (!this._tail) {
|
3523 | throw new Error('Invalid list');
|
3524 | }
|
3525 | else {
|
3526 | item.previous = this._tail;
|
3527 | this._tail.next = item;
|
3528 | }
|
3529 | this._tail = item;
|
3530 | this._state++;
|
3531 | }
|
3532 | removeItem(item) {
|
3533 | if (item === this._head && item === this._tail) {
|
3534 | this._head = undefined;
|
3535 | this._tail = undefined;
|
3536 | }
|
3537 | else if (item === this._head) {
|
3538 |
|
3539 |
|
3540 | if (!item.next) {
|
3541 | throw new Error('Invalid list');
|
3542 | }
|
3543 | item.next.previous = undefined;
|
3544 | this._head = item.next;
|
3545 | }
|
3546 | else if (item === this._tail) {
|
3547 |
|
3548 |
|
3549 | if (!item.previous) {
|
3550 | throw new Error('Invalid list');
|
3551 | }
|
3552 | item.previous.next = undefined;
|
3553 | this._tail = item.previous;
|
3554 | }
|
3555 | else {
|
3556 | const next = item.next;
|
3557 | const previous = item.previous;
|
3558 | if (!next || !previous) {
|
3559 | throw new Error('Invalid list');
|
3560 | }
|
3561 | next.previous = previous;
|
3562 | previous.next = next;
|
3563 | }
|
3564 | item.next = undefined;
|
3565 | item.previous = undefined;
|
3566 | this._state++;
|
3567 | }
|
3568 | touch(item, touch) {
|
3569 | if (!this._head || !this._tail) {
|
3570 | throw new Error('Invalid list');
|
3571 | }
|
3572 | if ((touch !== Touch.First && touch !== Touch.Last)) {
|
3573 | return;
|
3574 | }
|
3575 | if (touch === Touch.First) {
|
3576 | if (item === this._head) {
|
3577 | return;
|
3578 | }
|
3579 | const next = item.next;
|
3580 | const previous = item.previous;
|
3581 |
|
3582 | if (item === this._tail) {
|
3583 |
|
3584 |
|
3585 | previous.next = undefined;
|
3586 | this._tail = previous;
|
3587 | }
|
3588 | else {
|
3589 |
|
3590 | next.previous = previous;
|
3591 | previous.next = next;
|
3592 | }
|
3593 |
|
3594 | item.previous = undefined;
|
3595 | item.next = this._head;
|
3596 | this._head.previous = item;
|
3597 | this._head = item;
|
3598 | this._state++;
|
3599 | }
|
3600 | else if (touch === Touch.Last) {
|
3601 | if (item === this._tail) {
|
3602 | return;
|
3603 | }
|
3604 | const next = item.next;
|
3605 | const previous = item.previous;
|
3606 |
|
3607 | if (item === this._head) {
|
3608 |
|
3609 |
|
3610 | next.previous = undefined;
|
3611 | this._head = next;
|
3612 | }
|
3613 | else {
|
3614 |
|
3615 | next.previous = previous;
|
3616 | previous.next = next;
|
3617 | }
|
3618 | item.next = undefined;
|
3619 | item.previous = this._tail;
|
3620 | this._tail.next = item;
|
3621 | this._tail = item;
|
3622 | this._state++;
|
3623 | }
|
3624 | }
|
3625 | toJSON() {
|
3626 | const data = [];
|
3627 | this.forEach((value, key) => {
|
3628 | data.push([key, value]);
|
3629 | });
|
3630 | return data;
|
3631 | }
|
3632 | fromJSON(data) {
|
3633 | this.clear();
|
3634 | for (const [key, value] of data) {
|
3635 | this.set(key, value);
|
3636 | }
|
3637 | }
|
3638 | }
|
3639 | exports.LinkedMap = LinkedMap;
|
3640 | class LRUCache extends LinkedMap {
|
3641 | constructor(limit, ratio = 1) {
|
3642 | super();
|
3643 | this._limit = limit;
|
3644 | this._ratio = Math.min(Math.max(0, ratio), 1);
|
3645 | }
|
3646 | get limit() {
|
3647 | return this._limit;
|
3648 | }
|
3649 | set limit(limit) {
|
3650 | this._limit = limit;
|
3651 | this.checkTrim();
|
3652 | }
|
3653 | get ratio() {
|
3654 | return this._ratio;
|
3655 | }
|
3656 | set ratio(ratio) {
|
3657 | this._ratio = Math.min(Math.max(0, ratio), 1);
|
3658 | this.checkTrim();
|
3659 | }
|
3660 | get(key, touch = Touch.AsNew) {
|
3661 | return super.get(key, touch);
|
3662 | }
|
3663 | peek(key) {
|
3664 | return super.get(key, Touch.None);
|
3665 | }
|
3666 | set(key, value) {
|
3667 | super.set(key, value, Touch.Last);
|
3668 | this.checkTrim();
|
3669 | return this;
|
3670 | }
|
3671 | checkTrim() {
|
3672 | if (this.size > this._limit) {
|
3673 | this.trimOld(Math.round(this._limit * this._ratio));
|
3674 | }
|
3675 | }
|
3676 | }
|
3677 | exports.LRUCache = LRUCache;
|
3678 |
|
3679 |
|
3680 | }),
|
3681 |
|
3682 | 12:
|
3683 | ((__unused_webpack_module, exports) => {
|
3684 |
|
3685 | "use strict";
|
3686 |
|
3687 |
|
3688 |
|
3689 |
|
3690 |
|
3691 | Object.defineProperty(exports, "__esModule", ({ value: true }));
|
3692 | exports.AbstractMessageBuffer = void 0;
|
3693 | const CR = 13;
|
3694 | const LF = 10;
|
3695 | const CRLF = '\r\n';
|
3696 | class AbstractMessageBuffer {
|
3697 | constructor(encoding = 'utf-8') {
|
3698 | this._encoding = encoding;
|
3699 | this._chunks = [];
|
3700 | this._totalLength = 0;
|
3701 | }
|
3702 | get encoding() {
|
3703 | return this._encoding;
|
3704 | }
|
3705 | append(chunk) {
|
3706 | const toAppend = typeof chunk === 'string' ? this.fromString(chunk, this._encoding) : chunk;
|
3707 | this._chunks.push(toAppend);
|
3708 | this._totalLength += toAppend.byteLength;
|
3709 | }
|
3710 | tryReadHeaders() {
|
3711 | if (this._chunks.length === 0) {
|
3712 | return undefined;
|
3713 | }
|
3714 | let state = 0;
|
3715 | let chunkIndex = 0;
|
3716 | let offset = 0;
|
3717 | let chunkBytesRead = 0;
|
3718 | row: while (chunkIndex < this._chunks.length) {
|
3719 | const chunk = this._chunks[chunkIndex];
|
3720 | offset = 0;
|
3721 | column: while (offset < chunk.length) {
|
3722 | const value = chunk[offset];
|
3723 | switch (value) {
|
3724 | case CR:
|
3725 | switch (state) {
|
3726 | case 0:
|
3727 | state = 1;
|
3728 | break;
|
3729 | case 2:
|
3730 | state = 3;
|
3731 | break;
|
3732 | default:
|
3733 | state = 0;
|
3734 | }
|
3735 | break;
|
3736 | case LF:
|
3737 | switch (state) {
|
3738 | case 1:
|
3739 | state = 2;
|
3740 | break;
|
3741 | case 3:
|
3742 | state = 4;
|
3743 | offset++;
|
3744 | break row;
|
3745 | default:
|
3746 | state = 0;
|
3747 | }
|
3748 | break;
|
3749 | default:
|
3750 | state = 0;
|
3751 | }
|
3752 | offset++;
|
3753 | }
|
3754 | chunkBytesRead += chunk.byteLength;
|
3755 | chunkIndex++;
|
3756 | }
|
3757 | if (state !== 4) {
|
3758 | return undefined;
|
3759 | }
|
3760 |
|
3761 |
|
3762 | const buffer = this._read(chunkBytesRead + offset);
|
3763 | const result = new Map();
|
3764 | const headers = this.toString(buffer, 'ascii').split(CRLF);
|
3765 | if (headers.length < 2) {
|
3766 | return result;
|
3767 | }
|
3768 | for (let i = 0; i < headers.length - 2; i++) {
|
3769 | const header = headers[i];
|
3770 | const index = header.indexOf(':');
|
3771 | if (index === -1) {
|
3772 | throw new Error('Message header must separate key and value using :');
|
3773 | }
|
3774 | const key = header.substr(0, index);
|
3775 | const value = header.substr(index + 1).trim();
|
3776 | result.set(key, value);
|
3777 | }
|
3778 | return result;
|
3779 | }
|
3780 | tryReadBody(length) {
|
3781 | if (this._totalLength < length) {
|
3782 | return undefined;
|
3783 | }
|
3784 | return this._read(length);
|
3785 | }
|
3786 | get numberOfBytes() {
|
3787 | return this._totalLength;
|
3788 | }
|
3789 | _read(byteCount) {
|
3790 | if (byteCount === 0) {
|
3791 | return this.emptyBuffer();
|
3792 | }
|
3793 | if (byteCount > this._totalLength) {
|
3794 | throw new Error(`Cannot read so many bytes!`);
|
3795 | }
|
3796 | if (this._chunks[0].byteLength === byteCount) {
|
3797 |
|
3798 | const chunk = this._chunks[0];
|
3799 | this._chunks.shift();
|
3800 | this._totalLength -= byteCount;
|
3801 | return this.asNative(chunk);
|
3802 | }
|
3803 | if (this._chunks[0].byteLength > byteCount) {
|
3804 |
|
3805 | const chunk = this._chunks[0];
|
3806 | const result = this.asNative(chunk, byteCount);
|
3807 | this._chunks[0] = chunk.slice(byteCount);
|
3808 | this._totalLength -= byteCount;
|
3809 | return result;
|
3810 | }
|
3811 | const result = this.allocNative(byteCount);
|
3812 | let resultOffset = 0;
|
3813 | let chunkIndex = 0;
|
3814 | while (byteCount > 0) {
|
3815 | const chunk = this._chunks[chunkIndex];
|
3816 | if (chunk.byteLength > byteCount) {
|
3817 |
|
3818 | const chunkPart = chunk.slice(0, byteCount);
|
3819 | result.set(chunkPart, resultOffset);
|
3820 | resultOffset += byteCount;
|
3821 | this._chunks[chunkIndex] = chunk.slice(byteCount);
|
3822 | this._totalLength -= byteCount;
|
3823 | byteCount -= byteCount;
|
3824 | }
|
3825 | else {
|
3826 |
|
3827 | result.set(chunk, resultOffset);
|
3828 | resultOffset += chunk.byteLength;
|
3829 | this._chunks.shift();
|
3830 | this._totalLength -= chunk.byteLength;
|
3831 | byteCount -= chunk.byteLength;
|
3832 | }
|
3833 | }
|
3834 | return result;
|
3835 | }
|
3836 | }
|
3837 | exports.AbstractMessageBuffer = AbstractMessageBuffer;
|
3838 |
|
3839 |
|
3840 | }),
|
3841 |
|
3842 | 18:
|
3843 | ((__unused_webpack_module, exports, __webpack_require__) => {
|
3844 |
|
3845 | "use strict";
|
3846 |
|
3847 |
|
3848 |
|
3849 |
|
3850 |
|
3851 | Object.defineProperty(exports, "__esModule", ({ value: true }));
|
3852 | exports.ReadableStreamMessageReader = exports.AbstractMessageReader = exports.MessageReader = void 0;
|
3853 | const ral_1 = __webpack_require__(9);
|
3854 | const Is = __webpack_require__(15);
|
3855 | const events_1 = __webpack_require__(16);
|
3856 | var MessageReader;
|
3857 | (function (MessageReader) {
|
3858 | function is(value) {
|
3859 | let candidate = value;
|
3860 | return candidate && Is.func(candidate.listen) && Is.func(candidate.dispose) &&
|
3861 | Is.func(candidate.onError) && Is.func(candidate.onClose) && Is.func(candidate.onPartialMessage);
|
3862 | }
|
3863 | MessageReader.is = is;
|
3864 | })(MessageReader = exports.MessageReader || (exports.MessageReader = {}));
|
3865 | class AbstractMessageReader {
|
3866 | constructor() {
|
3867 | this.errorEmitter = new events_1.Emitter();
|
3868 | this.closeEmitter = new events_1.Emitter();
|
3869 | this.partialMessageEmitter = new events_1.Emitter();
|
3870 | }
|
3871 | dispose() {
|
3872 | this.errorEmitter.dispose();
|
3873 | this.closeEmitter.dispose();
|
3874 | }
|
3875 | get onError() {
|
3876 | return this.errorEmitter.event;
|
3877 | }
|
3878 | fireError(error) {
|
3879 | this.errorEmitter.fire(this.asError(error));
|
3880 | }
|
3881 | get onClose() {
|
3882 | return this.closeEmitter.event;
|
3883 | }
|
3884 | fireClose() {
|
3885 | this.closeEmitter.fire(undefined);
|
3886 | }
|
3887 | get onPartialMessage() {
|
3888 | return this.partialMessageEmitter.event;
|
3889 | }
|
3890 | firePartialMessage(info) {
|
3891 | this.partialMessageEmitter.fire(info);
|
3892 | }
|
3893 | asError(error) {
|
3894 | if (error instanceof Error) {
|
3895 | return error;
|
3896 | }
|
3897 | else {
|
3898 | return new Error(`Reader received error. Reason: ${Is.string(error.message) ? error.message : 'unknown'}`);
|
3899 | }
|
3900 | }
|
3901 | }
|
3902 | exports.AbstractMessageReader = AbstractMessageReader;
|
3903 | var ResolvedMessageReaderOptions;
|
3904 | (function (ResolvedMessageReaderOptions) {
|
3905 | function fromOptions(options) {
|
3906 | var _a;
|
3907 | let charset;
|
3908 | let result;
|
3909 | let contentDecoder;
|
3910 | const contentDecoders = new Map();
|
3911 | let contentTypeDecoder;
|
3912 | const contentTypeDecoders = new Map();
|
3913 | if (options === undefined || typeof options === 'string') {
|
3914 | charset = options !== null && options !== void 0 ? options : 'utf-8';
|
3915 | }
|
3916 | else {
|
3917 | charset = (_a = options.charset) !== null && _a !== void 0 ? _a : 'utf-8';
|
3918 | if (options.contentDecoder !== undefined) {
|
3919 | contentDecoder = options.contentDecoder;
|
3920 | contentDecoders.set(contentDecoder.name, contentDecoder);
|
3921 | }
|
3922 | if (options.contentDecoders !== undefined) {
|
3923 | for (const decoder of options.contentDecoders) {
|
3924 | contentDecoders.set(decoder.name, decoder);
|
3925 | }
|
3926 | }
|
3927 | if (options.contentTypeDecoder !== undefined) {
|
3928 | contentTypeDecoder = options.contentTypeDecoder;
|
3929 | contentTypeDecoders.set(contentTypeDecoder.name, contentTypeDecoder);
|
3930 | }
|
3931 | if (options.contentTypeDecoders !== undefined) {
|
3932 | for (const decoder of options.contentTypeDecoders) {
|
3933 | contentTypeDecoders.set(decoder.name, decoder);
|
3934 | }
|
3935 | }
|
3936 | }
|
3937 | if (contentTypeDecoder === undefined) {
|
3938 | contentTypeDecoder = ral_1.default().applicationJson.decoder;
|
3939 | contentTypeDecoders.set(contentTypeDecoder.name, contentTypeDecoder);
|
3940 | }
|
3941 | return { charset, contentDecoder, contentDecoders, contentTypeDecoder, contentTypeDecoders };
|
3942 | }
|
3943 | ResolvedMessageReaderOptions.fromOptions = fromOptions;
|
3944 | })(ResolvedMessageReaderOptions || (ResolvedMessageReaderOptions = {}));
|
3945 | class ReadableStreamMessageReader extends AbstractMessageReader {
|
3946 | constructor(readable, options) {
|
3947 | super();
|
3948 | this.readable = readable;
|
3949 | this.options = ResolvedMessageReaderOptions.fromOptions(options);
|
3950 | this.buffer = ral_1.default().messageBuffer.create(this.options.charset);
|
3951 | this._partialMessageTimeout = 10000;
|
3952 | this.nextMessageLength = -1;
|
3953 | this.messageToken = 0;
|
3954 | }
|
3955 | set partialMessageTimeout(timeout) {
|
3956 | this._partialMessageTimeout = timeout;
|
3957 | }
|
3958 | get partialMessageTimeout() {
|
3959 | return this._partialMessageTimeout;
|
3960 | }
|
3961 | listen(callback) {
|
3962 | this.nextMessageLength = -1;
|
3963 | this.messageToken = 0;
|
3964 | this.partialMessageTimer = undefined;
|
3965 | this.callback = callback;
|
3966 | const result = this.readable.onData((data) => {
|
3967 | this.onData(data);
|
3968 | });
|
3969 | this.readable.onError((error) => this.fireError(error));
|
3970 | this.readable.onClose(() => this.fireClose());
|
3971 | return result;
|
3972 | }
|
3973 | onData(data) {
|
3974 | this.buffer.append(data);
|
3975 | while (true) {
|
3976 | if (this.nextMessageLength === -1) {
|
3977 | const headers = this.buffer.tryReadHeaders();
|
3978 | if (!headers) {
|
3979 | return;
|
3980 | }
|
3981 | const contentLength = headers.get('Content-Length');
|
3982 | if (!contentLength) {
|
3983 | throw new Error('Header must provide a Content-Length property.');
|
3984 | }
|
3985 | const length = parseInt(contentLength);
|
3986 | if (isNaN(length)) {
|
3987 | throw new Error('Content-Length value must be a number.');
|
3988 | }
|
3989 | this.nextMessageLength = length;
|
3990 | }
|
3991 | const body = this.buffer.tryReadBody(this.nextMessageLength);
|
3992 | if (body === undefined) {
|
3993 |
|
3994 | this.setPartialMessageTimer();
|
3995 | return;
|
3996 | }
|
3997 | this.clearPartialMessageTimer();
|
3998 | this.nextMessageLength = -1;
|
3999 | let p;
|
4000 | if (this.options.contentDecoder !== undefined) {
|
4001 | p = this.options.contentDecoder.decode(body);
|
4002 | }
|
4003 | else {
|
4004 | p = Promise.resolve(body);
|
4005 | }
|
4006 | p.then((value) => {
|
4007 | this.options.contentTypeDecoder.decode(value, this.options).then((msg) => {
|
4008 | this.callback(msg);
|
4009 | }, (error) => {
|
4010 | this.fireError(error);
|
4011 | });
|
4012 | }, (error) => {
|
4013 | this.fireError(error);
|
4014 | });
|
4015 | }
|
4016 | }
|
4017 | clearPartialMessageTimer() {
|
4018 | if (this.partialMessageTimer) {
|
4019 | ral_1.default().timer.clearTimeout(this.partialMessageTimer);
|
4020 | this.partialMessageTimer = undefined;
|
4021 | }
|
4022 | }
|
4023 | setPartialMessageTimer() {
|
4024 | this.clearPartialMessageTimer();
|
4025 | if (this._partialMessageTimeout <= 0) {
|
4026 | return;
|
4027 | }
|
4028 | this.partialMessageTimer = ral_1.default().timer.setTimeout((token, timeout) => {
|
4029 | this.partialMessageTimer = undefined;
|
4030 | if (token === this.messageToken) {
|
4031 | this.firePartialMessage({ messageToken: token, waitingTime: timeout });
|
4032 | this.setPartialMessageTimer();
|
4033 | }
|
4034 | }, this._partialMessageTimeout, this.messageToken, this._partialMessageTimeout);
|
4035 | }
|
4036 | }
|
4037 | exports.ReadableStreamMessageReader = ReadableStreamMessageReader;
|
4038 |
|
4039 |
|
4040 | }),
|
4041 |
|
4042 | 19:
|
4043 | ((__unused_webpack_module, exports, __webpack_require__) => {
|
4044 |
|
4045 | "use strict";
|
4046 |
|
4047 |
|
4048 |
|
4049 |
|
4050 |
|
4051 | Object.defineProperty(exports, "__esModule", ({ value: true }));
|
4052 | exports.WriteableStreamMessageWriter = exports.AbstractMessageWriter = exports.MessageWriter = void 0;
|
4053 | const ral_1 = __webpack_require__(9);
|
4054 | const Is = __webpack_require__(15);
|
4055 | const semaphore_1 = __webpack_require__(20);
|
4056 | const events_1 = __webpack_require__(16);
|
4057 | const ContentLength = 'Content-Length: ';
|
4058 | const CRLF = '\r\n';
|
4059 | var MessageWriter;
|
4060 | (function (MessageWriter) {
|
4061 | function is(value) {
|
4062 | let candidate = value;
|
4063 | return candidate && Is.func(candidate.dispose) && Is.func(candidate.onClose) &&
|
4064 | Is.func(candidate.onError) && Is.func(candidate.write);
|
4065 | }
|
4066 | MessageWriter.is = is;
|
4067 | })(MessageWriter = exports.MessageWriter || (exports.MessageWriter = {}));
|
4068 | class AbstractMessageWriter {
|
4069 | constructor() {
|
4070 | this.errorEmitter = new events_1.Emitter();
|
4071 | this.closeEmitter = new events_1.Emitter();
|
4072 | }
|
4073 | dispose() {
|
4074 | this.errorEmitter.dispose();
|
4075 | this.closeEmitter.dispose();
|
4076 | }
|
4077 | get onError() {
|
4078 | return this.errorEmitter.event;
|
4079 | }
|
4080 | fireError(error, message, count) {
|
4081 | this.errorEmitter.fire([this.asError(error), message, count]);
|
4082 | }
|
4083 | get onClose() {
|
4084 | return this.closeEmitter.event;
|
4085 | }
|
4086 | fireClose() {
|
4087 | this.closeEmitter.fire(undefined);
|
4088 | }
|
4089 | asError(error) {
|
4090 | if (error instanceof Error) {
|
4091 | return error;
|
4092 | }
|
4093 | else {
|
4094 | return new Error(`Writer received error. Reason: ${Is.string(error.message) ? error.message : 'unknown'}`);
|
4095 | }
|
4096 | }
|
4097 | }
|
4098 | exports.AbstractMessageWriter = AbstractMessageWriter;
|
4099 | var ResolvedMessageWriterOptions;
|
4100 | (function (ResolvedMessageWriterOptions) {
|
4101 | function fromOptions(options) {
|
4102 | var _a, _b;
|
4103 | if (options === undefined || typeof options === 'string') {
|
4104 | return { charset: options !== null && options !== void 0 ? options : 'utf-8', contentTypeEncoder: ral_1.default().applicationJson.encoder };
|
4105 | }
|
4106 | else {
|
4107 | return { charset: (_a = options.charset) !== null && _a !== void 0 ? _a : 'utf-8', contentEncoder: options.contentEncoder, contentTypeEncoder: (_b = options.contentTypeEncoder) !== null && _b !== void 0 ? _b : ral_1.default().applicationJson.encoder };
|
4108 | }
|
4109 | }
|
4110 | ResolvedMessageWriterOptions.fromOptions = fromOptions;
|
4111 | })(ResolvedMessageWriterOptions || (ResolvedMessageWriterOptions = {}));
|
4112 | class WriteableStreamMessageWriter extends AbstractMessageWriter {
|
4113 | constructor(writable, options) {
|
4114 | super();
|
4115 | this.writable = writable;
|
4116 | this.options = ResolvedMessageWriterOptions.fromOptions(options);
|
4117 | this.errorCount = 0;
|
4118 | this.writeSemaphore = new semaphore_1.Semaphore(1);
|
4119 | this.writable.onError((error) => this.fireError(error));
|
4120 | this.writable.onClose(() => this.fireClose());
|
4121 | }
|
4122 | async write(msg) {
|
4123 | return this.writeSemaphore.lock(async () => {
|
4124 | const payload = this.options.contentTypeEncoder.encode(msg, this.options).then((buffer) => {
|
4125 | if (this.options.contentEncoder !== undefined) {
|
4126 | return this.options.contentEncoder.encode(buffer);
|
4127 | }
|
4128 | else {
|
4129 | return buffer;
|
4130 | }
|
4131 | });
|
4132 | return payload.then((buffer) => {
|
4133 | const headers = [];
|
4134 | headers.push(ContentLength, buffer.byteLength.toString(), CRLF);
|
4135 | headers.push(CRLF);
|
4136 | return this.doWrite(msg, headers, buffer);
|
4137 | }, (error) => {
|
4138 | this.fireError(error);
|
4139 | throw error;
|
4140 | });
|
4141 | });
|
4142 | }
|
4143 | async doWrite(msg, headers, data) {
|
4144 | try {
|
4145 | await this.writable.write(headers.join(''), 'ascii');
|
4146 | return this.writable.write(data);
|
4147 | }
|
4148 | catch (error) {
|
4149 | this.handleError(error, msg);
|
4150 | return Promise.reject(error);
|
4151 | }
|
4152 | }
|
4153 | handleError(error, msg) {
|
4154 | this.errorCount++;
|
4155 | this.fireError(error, msg, this.errorCount);
|
4156 | }
|
4157 | end() {
|
4158 | this.writable.end();
|
4159 | }
|
4160 | }
|
4161 | exports.WriteableStreamMessageWriter = WriteableStreamMessageWriter;
|
4162 |
|
4163 |
|
4164 | }),
|
4165 |
|
4166 | 14:
|
4167 | ((__unused_webpack_module, exports, __webpack_require__) => {
|
4168 |
|
4169 | "use strict";
|
4170 |
|
4171 |
|
4172 |
|
4173 |
|
4174 |
|
4175 | Object.defineProperty(exports, "__esModule", ({ value: true }));
|
4176 | exports.isResponseMessage = exports.isNotificationMessage = exports.isRequestMessage = exports.NotificationType9 = exports.NotificationType8 = exports.NotificationType7 = exports.NotificationType6 = exports.NotificationType5 = exports.NotificationType4 = exports.NotificationType3 = exports.NotificationType2 = exports.NotificationType1 = exports.NotificationType0 = exports.NotificationType = exports.RequestType9 = exports.RequestType8 = exports.RequestType7 = exports.RequestType6 = exports.RequestType5 = exports.RequestType4 = exports.RequestType3 = exports.RequestType2 = exports.RequestType1 = exports.RequestType = exports.RequestType0 = exports.AbstractMessageSignature = exports.ParameterStructures = exports.ResponseError = exports.ErrorCodes = void 0;
|
4177 | const is = __webpack_require__(15);
|
4178 |
|
4179 |
|
4180 |
|
4181 | var ErrorCodes;
|
4182 | (function (ErrorCodes) {
|
4183 |
|
4184 | ErrorCodes.ParseError = -32700;
|
4185 | ErrorCodes.InvalidRequest = -32600;
|
4186 | ErrorCodes.MethodNotFound = -32601;
|
4187 | ErrorCodes.InvalidParams = -32602;
|
4188 | ErrorCodes.InternalError = -32603;
|
4189 | |
4190 |
|
4191 |
|
4192 |
|
4193 |
|
4194 |
|
4195 |
|
4196 |
|
4197 |
|
4198 | ErrorCodes.jsonrpcReservedErrorRangeStart = -32099;
|
4199 |
|
4200 | ErrorCodes.serverErrorStart = ErrorCodes.jsonrpcReservedErrorRangeStart;
|
4201 | ErrorCodes.MessageWriteError = -32099;
|
4202 | ErrorCodes.MessageReadError = -32098;
|
4203 | ErrorCodes.ServerNotInitialized = -32002;
|
4204 | ErrorCodes.UnknownErrorCode = -32001;
|
4205 | |
4206 |
|
4207 |
|
4208 |
|
4209 |
|
4210 |
|
4211 | ErrorCodes.jsonrpcReservedErrorRangeEnd = -32000;
|
4212 |
|
4213 | ErrorCodes.serverErrorEnd = ErrorCodes.jsonrpcReservedErrorRangeEnd;
|
4214 | })(ErrorCodes = exports.ErrorCodes || (exports.ErrorCodes = {}));
|
4215 |
|
4216 |
|
4217 |
|
4218 |
|
4219 | class ResponseError extends Error {
|
4220 | constructor(code, message, data) {
|
4221 | super(message);
|
4222 | this.code = is.number(code) ? code : ErrorCodes.UnknownErrorCode;
|
4223 | this.data = data;
|
4224 | Object.setPrototypeOf(this, ResponseError.prototype);
|
4225 | }
|
4226 | toJson() {
|
4227 | return {
|
4228 | code: this.code,
|
4229 | message: this.message,
|
4230 | data: this.data,
|
4231 | };
|
4232 | }
|
4233 | }
|
4234 | exports.ResponseError = ResponseError;
|
4235 | class ParameterStructures {
|
4236 | constructor(kind) {
|
4237 | this.kind = kind;
|
4238 | }
|
4239 | static is(value) {
|
4240 | return value === ParameterStructures.auto || value === ParameterStructures.byName || value === ParameterStructures.byPosition;
|
4241 | }
|
4242 | toString() {
|
4243 | return this.kind;
|
4244 | }
|
4245 | }
|
4246 | exports.ParameterStructures = ParameterStructures;
|
4247 |
|
4248 |
|
4249 |
|
4250 |
|
4251 | ParameterStructures.auto = new ParameterStructures('auto');
|
4252 |
|
4253 |
|
4254 |
|
4255 |
|
4256 | ParameterStructures.byPosition = new ParameterStructures('byPosition');
|
4257 |
|
4258 |
|
4259 |
|
4260 |
|
4261 |
|
4262 | ParameterStructures.byName = new ParameterStructures('byName');
|
4263 |
|
4264 |
|
4265 |
|
4266 | class AbstractMessageSignature {
|
4267 | constructor(method, numberOfParams) {
|
4268 | this.method = method;
|
4269 | this.numberOfParams = numberOfParams;
|
4270 | }
|
4271 | get parameterStructures() {
|
4272 | return ParameterStructures.auto;
|
4273 | }
|
4274 | }
|
4275 | exports.AbstractMessageSignature = AbstractMessageSignature;
|
4276 |
|
4277 |
|
4278 |
|
4279 | class RequestType0 extends AbstractMessageSignature {
|
4280 | constructor(method) {
|
4281 | super(method, 0);
|
4282 | }
|
4283 | }
|
4284 | exports.RequestType0 = RequestType0;
|
4285 | class RequestType extends AbstractMessageSignature {
|
4286 | constructor(method, _parameterStructures = ParameterStructures.auto) {
|
4287 | super(method, 1);
|
4288 | this._parameterStructures = _parameterStructures;
|
4289 | }
|
4290 | get parameterStructures() {
|
4291 | return this._parameterStructures;
|
4292 | }
|
4293 | }
|
4294 | exports.RequestType = RequestType;
|
4295 | class RequestType1 extends AbstractMessageSignature {
|
4296 | constructor(method, _parameterStructures = ParameterStructures.auto) {
|
4297 | super(method, 1);
|
4298 | this._parameterStructures = _parameterStructures;
|
4299 | }
|
4300 | get parameterStructures() {
|
4301 | return this._parameterStructures;
|
4302 | }
|
4303 | }
|
4304 | exports.RequestType1 = RequestType1;
|
4305 | class RequestType2 extends AbstractMessageSignature {
|
4306 | constructor(method) {
|
4307 | super(method, 2);
|
4308 | }
|
4309 | }
|
4310 | exports.RequestType2 = RequestType2;
|
4311 | class RequestType3 extends AbstractMessageSignature {
|
4312 | constructor(method) {
|
4313 | super(method, 3);
|
4314 | }
|
4315 | }
|
4316 | exports.RequestType3 = RequestType3;
|
4317 | class RequestType4 extends AbstractMessageSignature {
|
4318 | constructor(method) {
|
4319 | super(method, 4);
|
4320 | }
|
4321 | }
|
4322 | exports.RequestType4 = RequestType4;
|
4323 | class RequestType5 extends AbstractMessageSignature {
|
4324 | constructor(method) {
|
4325 | super(method, 5);
|
4326 | }
|
4327 | }
|
4328 | exports.RequestType5 = RequestType5;
|
4329 | class RequestType6 extends AbstractMessageSignature {
|
4330 | constructor(method) {
|
4331 | super(method, 6);
|
4332 | }
|
4333 | }
|
4334 | exports.RequestType6 = RequestType6;
|
4335 | class RequestType7 extends AbstractMessageSignature {
|
4336 | constructor(method) {
|
4337 | super(method, 7);
|
4338 | }
|
4339 | }
|
4340 | exports.RequestType7 = RequestType7;
|
4341 | class RequestType8 extends AbstractMessageSignature {
|
4342 | constructor(method) {
|
4343 | super(method, 8);
|
4344 | }
|
4345 | }
|
4346 | exports.RequestType8 = RequestType8;
|
4347 | class RequestType9 extends AbstractMessageSignature {
|
4348 | constructor(method) {
|
4349 | super(method, 9);
|
4350 | }
|
4351 | }
|
4352 | exports.RequestType9 = RequestType9;
|
4353 | class NotificationType extends AbstractMessageSignature {
|
4354 | constructor(method, _parameterStructures = ParameterStructures.auto) {
|
4355 | super(method, 1);
|
4356 | this._parameterStructures = _parameterStructures;
|
4357 | }
|
4358 | get parameterStructures() {
|
4359 | return this._parameterStructures;
|
4360 | }
|
4361 | }
|
4362 | exports.NotificationType = NotificationType;
|
4363 | class NotificationType0 extends AbstractMessageSignature {
|
4364 | constructor(method) {
|
4365 | super(method, 0);
|
4366 | }
|
4367 | }
|
4368 | exports.NotificationType0 = NotificationType0;
|
4369 | class NotificationType1 extends AbstractMessageSignature {
|
4370 | constructor(method, _parameterStructures = ParameterStructures.auto) {
|
4371 | super(method, 1);
|
4372 | this._parameterStructures = _parameterStructures;
|
4373 | }
|
4374 | get parameterStructures() {
|
4375 | return this._parameterStructures;
|
4376 | }
|
4377 | }
|
4378 | exports.NotificationType1 = NotificationType1;
|
4379 | class NotificationType2 extends AbstractMessageSignature {
|
4380 | constructor(method) {
|
4381 | super(method, 2);
|
4382 | }
|
4383 | }
|
4384 | exports.NotificationType2 = NotificationType2;
|
4385 | class NotificationType3 extends AbstractMessageSignature {
|
4386 | constructor(method) {
|
4387 | super(method, 3);
|
4388 | }
|
4389 | }
|
4390 | exports.NotificationType3 = NotificationType3;
|
4391 | class NotificationType4 extends AbstractMessageSignature {
|
4392 | constructor(method) {
|
4393 | super(method, 4);
|
4394 | }
|
4395 | }
|
4396 | exports.NotificationType4 = NotificationType4;
|
4397 | class NotificationType5 extends AbstractMessageSignature {
|
4398 | constructor(method) {
|
4399 | super(method, 5);
|
4400 | }
|
4401 | }
|
4402 | exports.NotificationType5 = NotificationType5;
|
4403 | class NotificationType6 extends AbstractMessageSignature {
|
4404 | constructor(method) {
|
4405 | super(method, 6);
|
4406 | }
|
4407 | }
|
4408 | exports.NotificationType6 = NotificationType6;
|
4409 | class NotificationType7 extends AbstractMessageSignature {
|
4410 | constructor(method) {
|
4411 | super(method, 7);
|
4412 | }
|
4413 | }
|
4414 | exports.NotificationType7 = NotificationType7;
|
4415 | class NotificationType8 extends AbstractMessageSignature {
|
4416 | constructor(method) {
|
4417 | super(method, 8);
|
4418 | }
|
4419 | }
|
4420 | exports.NotificationType8 = NotificationType8;
|
4421 | class NotificationType9 extends AbstractMessageSignature {
|
4422 | constructor(method) {
|
4423 | super(method, 9);
|
4424 | }
|
4425 | }
|
4426 | exports.NotificationType9 = NotificationType9;
|
4427 |
|
4428 |
|
4429 |
|
4430 | function isRequestMessage(message) {
|
4431 | const candidate = message;
|
4432 | return candidate && is.string(candidate.method) && (is.string(candidate.id) || is.number(candidate.id));
|
4433 | }
|
4434 | exports.isRequestMessage = isRequestMessage;
|
4435 |
|
4436 |
|
4437 |
|
4438 | function isNotificationMessage(message) {
|
4439 | const candidate = message;
|
4440 | return candidate && is.string(candidate.method) && message.id === void 0;
|
4441 | }
|
4442 | exports.isNotificationMessage = isNotificationMessage;
|
4443 |
|
4444 |
|
4445 |
|
4446 | function isResponseMessage(message) {
|
4447 | const candidate = message;
|
4448 | return candidate && (candidate.result !== void 0 || !!candidate.error) && (is.string(candidate.id) || is.number(candidate.id) || candidate.id === null);
|
4449 | }
|
4450 | exports.isResponseMessage = isResponseMessage;
|
4451 |
|
4452 |
|
4453 | }),
|
4454 |
|
4455 | 9:
|
4456 | ((__unused_webpack_module, exports) => {
|
4457 |
|
4458 | "use strict";
|
4459 |
|
4460 |
|
4461 |
|
4462 |
|
4463 |
|
4464 | Object.defineProperty(exports, "__esModule", ({ value: true }));
|
4465 | let _ral;
|
4466 | function RAL() {
|
4467 | if (_ral === undefined) {
|
4468 | throw new Error(`No runtime abstraction layer installed`);
|
4469 | }
|
4470 | return _ral;
|
4471 | }
|
4472 | (function (RAL) {
|
4473 | function install(ral) {
|
4474 | if (ral === undefined) {
|
4475 | throw new Error(`No runtime abstraction layer provided`);
|
4476 | }
|
4477 | _ral = ral;
|
4478 | }
|
4479 | RAL.install = install;
|
4480 | })(RAL || (RAL = {}));
|
4481 | exports.default = RAL;
|
4482 |
|
4483 |
|
4484 | }),
|
4485 |
|
4486 | 20:
|
4487 | ((__unused_webpack_module, exports, __webpack_require__) => {
|
4488 |
|
4489 | "use strict";
|
4490 |
|
4491 |
|
4492 |
|
4493 |
|
4494 |
|
4495 | Object.defineProperty(exports, "__esModule", ({ value: true }));
|
4496 | exports.Semaphore = void 0;
|
4497 | const ral_1 = __webpack_require__(9);
|
4498 | class Semaphore {
|
4499 | constructor(capacity = 1) {
|
4500 | if (capacity <= 0) {
|
4501 | throw new Error('Capacity must be greater than 0');
|
4502 | }
|
4503 | this._capacity = capacity;
|
4504 | this._active = 0;
|
4505 | this._waiting = [];
|
4506 | }
|
4507 | lock(thunk) {
|
4508 | return new Promise((resolve, reject) => {
|
4509 | this._waiting.push({ thunk, resolve, reject });
|
4510 | this.runNext();
|
4511 | });
|
4512 | }
|
4513 | get active() {
|
4514 | return this._active;
|
4515 | }
|
4516 | runNext() {
|
4517 | if (this._waiting.length === 0 || this._active === this._capacity) {
|
4518 | return;
|
4519 | }
|
4520 | ral_1.default().timer.setImmediate(() => this.doRunNext());
|
4521 | }
|
4522 | doRunNext() {
|
4523 | if (this._waiting.length === 0 || this._active === this._capacity) {
|
4524 | return;
|
4525 | }
|
4526 | const next = this._waiting.shift();
|
4527 | this._active++;
|
4528 | if (this._active > this._capacity) {
|
4529 | throw new Error(`To many thunks active`);
|
4530 | }
|
4531 | try {
|
4532 | const result = next.thunk();
|
4533 | if (result instanceof Promise) {
|
4534 | result.then((value) => {
|
4535 | this._active--;
|
4536 | next.resolve(value);
|
4537 | this.runNext();
|
4538 | }, (err) => {
|
4539 | this._active--;
|
4540 | next.reject(err);
|
4541 | this.runNext();
|
4542 | });
|
4543 | }
|
4544 | else {
|
4545 | this._active--;
|
4546 | next.resolve(result);
|
4547 | this.runNext();
|
4548 | }
|
4549 | }
|
4550 | catch (err) {
|
4551 | this._active--;
|
4552 | next.reject(err);
|
4553 | this.runNext();
|
4554 | }
|
4555 | }
|
4556 | }
|
4557 | exports.Semaphore = Semaphore;
|
4558 |
|
4559 |
|
4560 | }),
|
4561 |
|
4562 | 7:
|
4563 | (function(__unused_webpack_module, exports, __webpack_require__) {
|
4564 |
|
4565 | "use strict";
|
4566 |
|
4567 | var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
4568 | if (k2 === undefined) k2 = k;
|
4569 | Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
4570 | }) : (function(o, m, k, k2) {
|
4571 | if (k2 === undefined) k2 = k;
|
4572 | o[k2] = m[k];
|
4573 | }));
|
4574 | var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
4575 | for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
4576 | };
|
4577 | Object.defineProperty(exports, "__esModule", ({ value: true }));
|
4578 | exports.createMessageConnection = exports.createServerSocketTransport = exports.createClientSocketTransport = exports.createServerPipeTransport = exports.createClientPipeTransport = exports.generateRandomPipeName = exports.StreamMessageWriter = exports.StreamMessageReader = exports.SocketMessageWriter = exports.SocketMessageReader = exports.IPCMessageWriter = exports.IPCMessageReader = void 0;
|
4579 |
|
4580 |
|
4581 |
|
4582 |
|
4583 | const ril_1 = __webpack_require__(8);
|
4584 |
|
4585 | ril_1.default.install();
|
4586 | const api_1 = __webpack_require__(13);
|
4587 | const path = __webpack_require__(23);
|
4588 | const os = __webpack_require__(24);
|
4589 | const crypto_1 = __webpack_require__(25);
|
4590 | const net_1 = __webpack_require__(26);
|
4591 | __exportStar(__webpack_require__(13), exports);
|
4592 | class IPCMessageReader extends api_1.AbstractMessageReader {
|
4593 | constructor(process) {
|
4594 | super();
|
4595 | this.process = process;
|
4596 | let eventEmitter = this.process;
|
4597 | eventEmitter.on('error', (error) => this.fireError(error));
|
4598 | eventEmitter.on('close', () => this.fireClose());
|
4599 | }
|
4600 | listen(callback) {
|
4601 | this.process.on('message', callback);
|
4602 | return api_1.Disposable.create(() => this.process.off('message', callback));
|
4603 | }
|
4604 | }
|
4605 | exports.IPCMessageReader = IPCMessageReader;
|
4606 | class IPCMessageWriter extends api_1.AbstractMessageWriter {
|
4607 | constructor(process) {
|
4608 | super();
|
4609 | this.process = process;
|
4610 | this.errorCount = 0;
|
4611 | let eventEmitter = this.process;
|
4612 | eventEmitter.on('error', (error) => this.fireError(error));
|
4613 | eventEmitter.on('close', () => this.fireClose);
|
4614 | }
|
4615 | write(msg) {
|
4616 | try {
|
4617 | if (typeof this.process.send === 'function') {
|
4618 | this.process.send(msg, undefined, undefined, (error) => {
|
4619 | if (error) {
|
4620 | this.errorCount++;
|
4621 | this.handleError(error, msg);
|
4622 | }
|
4623 | else {
|
4624 | this.errorCount = 0;
|
4625 | }
|
4626 | });
|
4627 | }
|
4628 | return Promise.resolve();
|
4629 | }
|
4630 | catch (error) {
|
4631 | this.handleError(error, msg);
|
4632 | return Promise.reject(error);
|
4633 | }
|
4634 | }
|
4635 | handleError(error, msg) {
|
4636 | this.errorCount++;
|
4637 | this.fireError(error, msg, this.errorCount);
|
4638 | }
|
4639 | end() {
|
4640 | }
|
4641 | }
|
4642 | exports.IPCMessageWriter = IPCMessageWriter;
|
4643 | class SocketMessageReader extends api_1.ReadableStreamMessageReader {
|
4644 | constructor(socket, encoding = 'utf-8') {
|
4645 | super(ril_1.default().stream.asReadableStream(socket), encoding);
|
4646 | }
|
4647 | }
|
4648 | exports.SocketMessageReader = SocketMessageReader;
|
4649 | class SocketMessageWriter extends api_1.WriteableStreamMessageWriter {
|
4650 | constructor(socket, options) {
|
4651 | super(ril_1.default().stream.asWritableStream(socket), options);
|
4652 | this.socket = socket;
|
4653 | }
|
4654 | dispose() {
|
4655 | super.dispose();
|
4656 | this.socket.destroy();
|
4657 | }
|
4658 | }
|
4659 | exports.SocketMessageWriter = SocketMessageWriter;
|
4660 | class StreamMessageReader extends api_1.ReadableStreamMessageReader {
|
4661 | constructor(readble, encoding) {
|
4662 | super(ril_1.default().stream.asReadableStream(readble), encoding);
|
4663 | }
|
4664 | }
|
4665 | exports.StreamMessageReader = StreamMessageReader;
|
4666 | class StreamMessageWriter extends api_1.WriteableStreamMessageWriter {
|
4667 | constructor(writable, options) {
|
4668 | super(ril_1.default().stream.asWritableStream(writable), options);
|
4669 | }
|
4670 | }
|
4671 | exports.StreamMessageWriter = StreamMessageWriter;
|
4672 | const XDG_RUNTIME_DIR = process.env['XDG_RUNTIME_DIR'];
|
4673 | const safeIpcPathLengths = new Map([
|
4674 | ['linux', 107],
|
4675 | ['darwin', 103]
|
4676 | ]);
|
4677 | function generateRandomPipeName() {
|
4678 | const randomSuffix = crypto_1.randomBytes(21).toString('hex');
|
4679 | if (process.platform === 'win32') {
|
4680 | return `\\\\.\\pipe\\vscode-jsonrpc-${randomSuffix}-sock`;
|
4681 | }
|
4682 | let result;
|
4683 | if (XDG_RUNTIME_DIR) {
|
4684 | result = path.join(XDG_RUNTIME_DIR, `vscode-ipc-${randomSuffix}.sock`);
|
4685 | }
|
4686 | else {
|
4687 | result = path.join(os.tmpdir(), `vscode-${randomSuffix}.sock`);
|
4688 | }
|
4689 | const limit = safeIpcPathLengths.get(process.platform);
|
4690 | if (limit !== undefined && result.length >= limit) {
|
4691 | ril_1.default().console.warn(`WARNING: IPC handle "${result}" is longer than ${limit} characters.`);
|
4692 | }
|
4693 | return result;
|
4694 | }
|
4695 | exports.generateRandomPipeName = generateRandomPipeName;
|
4696 | function createClientPipeTransport(pipeName, encoding = 'utf-8') {
|
4697 | let connectResolve;
|
4698 | const connected = new Promise((resolve, _reject) => {
|
4699 | connectResolve = resolve;
|
4700 | });
|
4701 | return new Promise((resolve, reject) => {
|
4702 | let server = net_1.createServer((socket) => {
|
4703 | server.close();
|
4704 | connectResolve([
|
4705 | new SocketMessageReader(socket, encoding),
|
4706 | new SocketMessageWriter(socket, encoding)
|
4707 | ]);
|
4708 | });
|
4709 | server.on('error', reject);
|
4710 | server.listen(pipeName, () => {
|
4711 | server.removeListener('error', reject);
|
4712 | resolve({
|
4713 | onConnected: () => { return connected; }
|
4714 | });
|
4715 | });
|
4716 | });
|
4717 | }
|
4718 | exports.createClientPipeTransport = createClientPipeTransport;
|
4719 | function createServerPipeTransport(pipeName, encoding = 'utf-8') {
|
4720 | const socket = net_1.createConnection(pipeName);
|
4721 | return [
|
4722 | new SocketMessageReader(socket, encoding),
|
4723 | new SocketMessageWriter(socket, encoding)
|
4724 | ];
|
4725 | }
|
4726 | exports.createServerPipeTransport = createServerPipeTransport;
|
4727 | function createClientSocketTransport(port, encoding = 'utf-8') {
|
4728 | let connectResolve;
|
4729 | const connected = new Promise((resolve, _reject) => {
|
4730 | connectResolve = resolve;
|
4731 | });
|
4732 | return new Promise((resolve, reject) => {
|
4733 | const server = net_1.createServer((socket) => {
|
4734 | server.close();
|
4735 | connectResolve([
|
4736 | new SocketMessageReader(socket, encoding),
|
4737 | new SocketMessageWriter(socket, encoding)
|
4738 | ]);
|
4739 | });
|
4740 | server.on('error', reject);
|
4741 | server.listen(port, '127.0.0.1', () => {
|
4742 | server.removeListener('error', reject);
|
4743 | resolve({
|
4744 | onConnected: () => { return connected; }
|
4745 | });
|
4746 | });
|
4747 | });
|
4748 | }
|
4749 | exports.createClientSocketTransport = createClientSocketTransport;
|
4750 | function createServerSocketTransport(port, encoding = 'utf-8') {
|
4751 | const socket = net_1.createConnection(port, '127.0.0.1');
|
4752 | return [
|
4753 | new SocketMessageReader(socket, encoding),
|
4754 | new SocketMessageWriter(socket, encoding)
|
4755 | ];
|
4756 | }
|
4757 | exports.createServerSocketTransport = createServerSocketTransport;
|
4758 | function isReadableStream(value) {
|
4759 | const candidate = value;
|
4760 | return candidate.read !== undefined && candidate.addListener !== undefined;
|
4761 | }
|
4762 | function isWritableStream(value) {
|
4763 | const candidate = value;
|
4764 | return candidate.write !== undefined && candidate.addListener !== undefined;
|
4765 | }
|
4766 | function createMessageConnection(input, output, logger, options) {
|
4767 | if (!logger) {
|
4768 | logger = api_1.NullLogger;
|
4769 | }
|
4770 | const reader = isReadableStream(input) ? new StreamMessageReader(input) : input;
|
4771 | const writer = isWritableStream(output) ? new StreamMessageWriter(output) : output;
|
4772 | if (api_1.ConnectionStrategy.is(options)) {
|
4773 | options = { connectionStrategy: options };
|
4774 | }
|
4775 | return api_1.createMessageConnection(reader, writer, logger, options);
|
4776 | }
|
4777 | exports.createMessageConnection = createMessageConnection;
|
4778 |
|
4779 |
|
4780 | }),
|
4781 |
|
4782 | 8:
|
4783 | ((__unused_webpack_module, exports, __webpack_require__) => {
|
4784 |
|
4785 | "use strict";
|
4786 |
|
4787 |
|
4788 |
|
4789 |
|
4790 |
|
4791 | Object.defineProperty(exports, "__esModule", ({ value: true }));
|
4792 | const ral_1 = __webpack_require__(9);
|
4793 | const util_1 = __webpack_require__(10);
|
4794 | const disposable_1 = __webpack_require__(11);
|
4795 | const messageBuffer_1 = __webpack_require__(12);
|
4796 | class MessageBuffer extends messageBuffer_1.AbstractMessageBuffer {
|
4797 | constructor(encoding = 'utf-8') {
|
4798 | super(encoding);
|
4799 | }
|
4800 | emptyBuffer() {
|
4801 | return MessageBuffer.emptyBuffer;
|
4802 | }
|
4803 | fromString(value, encoding) {
|
4804 | return Buffer.from(value, encoding);
|
4805 | }
|
4806 | toString(value, encoding) {
|
4807 | if (value instanceof Buffer) {
|
4808 | return value.toString(encoding);
|
4809 | }
|
4810 | else {
|
4811 | return new util_1.TextDecoder(encoding).decode(value);
|
4812 | }
|
4813 | }
|
4814 | asNative(buffer, length) {
|
4815 | if (length === undefined) {
|
4816 | return buffer instanceof Buffer ? buffer : Buffer.from(buffer);
|
4817 | }
|
4818 | else {
|
4819 | return buffer instanceof Buffer ? buffer.slice(0, length) : Buffer.from(buffer, 0, length);
|
4820 | }
|
4821 | }
|
4822 | allocNative(length) {
|
4823 | return Buffer.allocUnsafe(length);
|
4824 | }
|
4825 | }
|
4826 | MessageBuffer.emptyBuffer = Buffer.allocUnsafe(0);
|
4827 | class ReadableStreamWrapper {
|
4828 | constructor(stream) {
|
4829 | this.stream = stream;
|
4830 | }
|
4831 | onClose(listener) {
|
4832 | this.stream.on('close', listener);
|
4833 | return disposable_1.Disposable.create(() => this.stream.off('close', listener));
|
4834 | }
|
4835 | onError(listener) {
|
4836 | this.stream.on('error', listener);
|
4837 | return disposable_1.Disposable.create(() => this.stream.off('error', listener));
|
4838 | }
|
4839 | onEnd(listener) {
|
4840 | this.stream.on('end', listener);
|
4841 | return disposable_1.Disposable.create(() => this.stream.off('end', listener));
|
4842 | }
|
4843 | onData(listener) {
|
4844 | this.stream.on('data', listener);
|
4845 | return disposable_1.Disposable.create(() => this.stream.off('data', listener));
|
4846 | }
|
4847 | }
|
4848 | class WritableStreamWrapper {
|
4849 | constructor(stream) {
|
4850 | this.stream = stream;
|
4851 | }
|
4852 | onClose(listener) {
|
4853 | this.stream.on('close', listener);
|
4854 | return disposable_1.Disposable.create(() => this.stream.off('close', listener));
|
4855 | }
|
4856 | onError(listener) {
|
4857 | this.stream.on('error', listener);
|
4858 | return disposable_1.Disposable.create(() => this.stream.off('error', listener));
|
4859 | }
|
4860 | onEnd(listener) {
|
4861 | this.stream.on('end', listener);
|
4862 | return disposable_1.Disposable.create(() => this.stream.off('end', listener));
|
4863 | }
|
4864 | write(data, encoding) {
|
4865 | return new Promise((resolve, reject) => {
|
4866 | const callback = (error) => {
|
4867 | if (error === undefined || error === null) {
|
4868 | resolve();
|
4869 | }
|
4870 | else {
|
4871 | reject(error);
|
4872 | }
|
4873 | };
|
4874 | if (typeof data === 'string') {
|
4875 | this.stream.write(data, encoding, callback);
|
4876 | }
|
4877 | else {
|
4878 | this.stream.write(data, callback);
|
4879 | }
|
4880 | });
|
4881 | }
|
4882 | end() {
|
4883 | this.stream.end();
|
4884 | }
|
4885 | }
|
4886 | const _ril = Object.freeze({
|
4887 | messageBuffer: Object.freeze({
|
4888 | create: (encoding) => new MessageBuffer(encoding)
|
4889 | }),
|
4890 | applicationJson: Object.freeze({
|
4891 | encoder: Object.freeze({
|
4892 | name: 'application/json',
|
4893 | encode: (msg, options) => {
|
4894 | try {
|
4895 | return Promise.resolve(Buffer.from(JSON.stringify(msg, undefined, 0), options.charset));
|
4896 | }
|
4897 | catch (err) {
|
4898 | return Promise.reject(err);
|
4899 | }
|
4900 | }
|
4901 | }),
|
4902 | decoder: Object.freeze({
|
4903 | name: 'application/json',
|
4904 | decode: (buffer, options) => {
|
4905 | try {
|
4906 | if (buffer instanceof Buffer) {
|
4907 | return Promise.resolve(JSON.parse(buffer.toString(options.charset)));
|
4908 | }
|
4909 | else {
|
4910 | return Promise.resolve(JSON.parse(new util_1.TextDecoder(options.charset).decode(buffer)));
|
4911 | }
|
4912 | }
|
4913 | catch (err) {
|
4914 | return Promise.reject(err);
|
4915 | }
|
4916 | }
|
4917 | })
|
4918 | }),
|
4919 | stream: Object.freeze({
|
4920 | asReadableStream: (stream) => new ReadableStreamWrapper(stream),
|
4921 | asWritableStream: (stream) => new WritableStreamWrapper(stream)
|
4922 | }),
|
4923 | console: console,
|
4924 | timer: Object.freeze({
|
4925 | setTimeout(callback, ms, ...args) {
|
4926 | return setTimeout(callback, ms, ...args);
|
4927 | },
|
4928 | clearTimeout(handle) {
|
4929 | clearTimeout(handle);
|
4930 | },
|
4931 | setImmediate(callback, ...args) {
|
4932 | return setImmediate(callback, ...args);
|
4933 | },
|
4934 | clearImmediate(handle) {
|
4935 | clearImmediate(handle);
|
4936 | }
|
4937 | })
|
4938 | });
|
4939 | function RIL() {
|
4940 | return _ril;
|
4941 | }
|
4942 | (function (RIL) {
|
4943 | function install() {
|
4944 | ral_1.default.install(_ril);
|
4945 | }
|
4946 | RIL.install = install;
|
4947 | })(RIL || (RIL = {}));
|
4948 | exports.default = RIL;
|
4949 |
|
4950 |
|
4951 | }),
|
4952 |
|
4953 | 6:
|
4954 | ((module, __unused_webpack_exports, __webpack_require__) => {
|
4955 |
|
4956 | "use strict";
|
4957 |
|
4958 |
|
4959 |
|
4960 |
|
4961 |
|
4962 |
|
4963 | module.exports = __webpack_require__(7);
|
4964 |
|
4965 | }),
|
4966 |
|
4967 | 27:
|
4968 | (function(__unused_webpack_module, exports, __webpack_require__) {
|
4969 |
|
4970 | "use strict";
|
4971 |
|
4972 |
|
4973 |
|
4974 |
|
4975 |
|
4976 | var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
4977 | if (k2 === undefined) k2 = k;
|
4978 | Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
4979 | }) : (function(o, m, k, k2) {
|
4980 | if (k2 === undefined) k2 = k;
|
4981 | o[k2] = m[k];
|
4982 | }));
|
4983 | var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
4984 | for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
4985 | };
|
4986 | Object.defineProperty(exports, "__esModule", ({ value: true }));
|
4987 | exports.LSPErrorCodes = exports.createProtocolConnection = void 0;
|
4988 | __exportStar(__webpack_require__(7), exports);
|
4989 | __exportStar(__webpack_require__(28), exports);
|
4990 | __exportStar(__webpack_require__(29), exports);
|
4991 | __exportStar(__webpack_require__(30), exports);
|
4992 | var connection_1 = __webpack_require__(47);
|
4993 | Object.defineProperty(exports, "createProtocolConnection", ({ enumerable: true, get: function () { return connection_1.createProtocolConnection; } }));
|
4994 | var LSPErrorCodes;
|
4995 | (function (LSPErrorCodes) {
|
4996 | |
4997 |
|
4998 |
|
4999 |
|
5000 |
|
5001 |
|
5002 | LSPErrorCodes.lspReservedErrorRangeStart = -32899;
|
5003 | LSPErrorCodes.ContentModified = -32801;
|
5004 | LSPErrorCodes.RequestCancelled = -32800;
|
5005 | |
5006 |
|
5007 |
|
5008 |
|
5009 |
|
5010 |
|
5011 | LSPErrorCodes.lspReservedErrorRangeEnd = -32800;
|
5012 | })(LSPErrorCodes = exports.LSPErrorCodes || (exports.LSPErrorCodes = {}));
|
5013 |
|
5014 |
|
5015 | }),
|
5016 |
|
5017 | 47:
|
5018 | ((__unused_webpack_module, exports, __webpack_require__) => {
|
5019 |
|
5020 | "use strict";
|
5021 |
|
5022 |
|
5023 |
|
5024 |
|
5025 |
|
5026 | Object.defineProperty(exports, "__esModule", ({ value: true }));
|
5027 | exports.createProtocolConnection = void 0;
|
5028 | const vscode_jsonrpc_1 = __webpack_require__(7);
|
5029 | function createProtocolConnection(input, output, logger, options) {
|
5030 | if (vscode_jsonrpc_1.ConnectionStrategy.is(options)) {
|
5031 | options = { connectionStrategy: options };
|
5032 | }
|
5033 | return vscode_jsonrpc_1.createMessageConnection(input, output, logger, options);
|
5034 | }
|
5035 | exports.createProtocolConnection = createProtocolConnection;
|
5036 |
|
5037 |
|
5038 | }),
|
5039 |
|
5040 | 29:
|
5041 | ((__unused_webpack_module, exports, __webpack_require__) => {
|
5042 |
|
5043 | "use strict";
|
5044 |
|
5045 |
|
5046 |
|
5047 |
|
5048 |
|
5049 | Object.defineProperty(exports, "__esModule", ({ value: true }));
|
5050 | exports.ProtocolNotificationType = exports.ProtocolNotificationType0 = exports.ProtocolRequestType = exports.ProtocolRequestType0 = exports.RegistrationType = void 0;
|
5051 | const vscode_jsonrpc_1 = __webpack_require__(7);
|
5052 | class RegistrationType {
|
5053 | constructor(method) {
|
5054 | this.method = method;
|
5055 | }
|
5056 | }
|
5057 | exports.RegistrationType = RegistrationType;
|
5058 | class ProtocolRequestType0 extends vscode_jsonrpc_1.RequestType0 {
|
5059 | constructor(method) {
|
5060 | super(method);
|
5061 | }
|
5062 | }
|
5063 | exports.ProtocolRequestType0 = ProtocolRequestType0;
|
5064 | class ProtocolRequestType extends vscode_jsonrpc_1.RequestType {
|
5065 | constructor(method) {
|
5066 | super(method, vscode_jsonrpc_1.ParameterStructures.byName);
|
5067 | }
|
5068 | }
|
5069 | exports.ProtocolRequestType = ProtocolRequestType;
|
5070 | class ProtocolNotificationType0 extends vscode_jsonrpc_1.NotificationType0 {
|
5071 | constructor(method) {
|
5072 | super(method);
|
5073 | }
|
5074 | }
|
5075 | exports.ProtocolNotificationType0 = ProtocolNotificationType0;
|
5076 | class ProtocolNotificationType extends vscode_jsonrpc_1.NotificationType {
|
5077 | constructor(method) {
|
5078 | super(method, vscode_jsonrpc_1.ParameterStructures.byName);
|
5079 | }
|
5080 | }
|
5081 | exports.ProtocolNotificationType = ProtocolNotificationType;
|
5082 |
|
5083 |
|
5084 |
|
5085 |
|
5086 |
|
5087 | }),
|
5088 |
|
5089 | 41:
|
5090 | ((__unused_webpack_module, exports, __webpack_require__) => {
|
5091 |
|
5092 | "use strict";
|
5093 |
|
5094 |
|
5095 |
|
5096 |
|
5097 |
|
5098 | Object.defineProperty(exports, "__esModule", ({ value: true }));
|
5099 | exports.CallHierarchyOutgoingCallsRequest = exports.CallHierarchyIncomingCallsRequest = exports.CallHierarchyPrepareRequest = void 0;
|
5100 | const messages_1 = __webpack_require__(29);
|
5101 |
|
5102 |
|
5103 |
|
5104 |
|
5105 |
|
5106 |
|
5107 | var CallHierarchyPrepareRequest;
|
5108 | (function (CallHierarchyPrepareRequest) {
|
5109 | CallHierarchyPrepareRequest.method = 'textDocument/prepareCallHierarchy';
|
5110 | CallHierarchyPrepareRequest.type = new messages_1.ProtocolRequestType(CallHierarchyPrepareRequest.method);
|
5111 | })(CallHierarchyPrepareRequest = exports.CallHierarchyPrepareRequest || (exports.CallHierarchyPrepareRequest = {}));
|
5112 |
|
5113 |
|
5114 |
|
5115 |
|
5116 |
|
5117 | var CallHierarchyIncomingCallsRequest;
|
5118 | (function (CallHierarchyIncomingCallsRequest) {
|
5119 | CallHierarchyIncomingCallsRequest.method = 'callHierarchy/incomingCalls';
|
5120 | CallHierarchyIncomingCallsRequest.type = new messages_1.ProtocolRequestType(CallHierarchyIncomingCallsRequest.method);
|
5121 | })(CallHierarchyIncomingCallsRequest = exports.CallHierarchyIncomingCallsRequest || (exports.CallHierarchyIncomingCallsRequest = {}));
|
5122 |
|
5123 |
|
5124 |
|
5125 |
|
5126 |
|
5127 | var CallHierarchyOutgoingCallsRequest;
|
5128 | (function (CallHierarchyOutgoingCallsRequest) {
|
5129 | CallHierarchyOutgoingCallsRequest.method = 'callHierarchy/outgoingCalls';
|
5130 | CallHierarchyOutgoingCallsRequest.type = new messages_1.ProtocolRequestType(CallHierarchyOutgoingCallsRequest.method);
|
5131 | })(CallHierarchyOutgoingCallsRequest = exports.CallHierarchyOutgoingCallsRequest || (exports.CallHierarchyOutgoingCallsRequest = {}));
|
5132 |
|
5133 |
|
5134 | }),
|
5135 |
|
5136 | 36:
|
5137 | ((__unused_webpack_module, exports, __webpack_require__) => {
|
5138 |
|
5139 | "use strict";
|
5140 |
|
5141 |
|
5142 |
|
5143 |
|
5144 |
|
5145 | Object.defineProperty(exports, "__esModule", ({ value: true }));
|
5146 | exports.ColorPresentationRequest = exports.DocumentColorRequest = void 0;
|
5147 | const messages_1 = __webpack_require__(29);
|
5148 |
|
5149 |
|
5150 |
|
5151 |
|
5152 |
|
5153 |
|
5154 | var DocumentColorRequest;
|
5155 | (function (DocumentColorRequest) {
|
5156 | DocumentColorRequest.method = 'textDocument/documentColor';
|
5157 | DocumentColorRequest.type = new messages_1.ProtocolRequestType(DocumentColorRequest.method);
|
5158 | })(DocumentColorRequest = exports.DocumentColorRequest || (exports.DocumentColorRequest = {}));
|
5159 |
|
5160 |
|
5161 |
|
5162 |
|
5163 |
|
5164 |
|
5165 | var ColorPresentationRequest;
|
5166 | (function (ColorPresentationRequest) {
|
5167 | ColorPresentationRequest.type = new messages_1.ProtocolRequestType('textDocument/colorPresentation');
|
5168 | })(ColorPresentationRequest = exports.ColorPresentationRequest || (exports.ColorPresentationRequest = {}));
|
5169 |
|
5170 |
|
5171 | }),
|
5172 |
|
5173 | 35:
|
5174 | ((__unused_webpack_module, exports, __webpack_require__) => {
|
5175 |
|
5176 | "use strict";
|
5177 |
|
5178 |
|
5179 |
|
5180 |
|
5181 |
|
5182 | Object.defineProperty(exports, "__esModule", ({ value: true }));
|
5183 | exports.ConfigurationRequest = void 0;
|
5184 | const messages_1 = __webpack_require__(29);
|
5185 |
|
5186 |
|
5187 |
|
5188 |
|
5189 |
|
5190 |
|
5191 |
|
5192 |
|
5193 |
|
5194 | var ConfigurationRequest;
|
5195 | (function (ConfigurationRequest) {
|
5196 | ConfigurationRequest.type = new messages_1.ProtocolRequestType('workspace/configuration');
|
5197 | })(ConfigurationRequest = exports.ConfigurationRequest || (exports.ConfigurationRequest = {}));
|
5198 |
|
5199 |
|
5200 | }),
|
5201 |
|
5202 | 38:
|
5203 | ((__unused_webpack_module, exports, __webpack_require__) => {
|
5204 |
|
5205 | "use strict";
|
5206 |
|
5207 |
|
5208 |
|
5209 |
|
5210 |
|
5211 | Object.defineProperty(exports, "__esModule", ({ value: true }));
|
5212 | exports.DeclarationRequest = void 0;
|
5213 | const messages_1 = __webpack_require__(29);
|
5214 |
|
5215 | let __noDynamicImport;
|
5216 |
|
5217 |
|
5218 |
|
5219 |
|
5220 |
|
5221 |
|
5222 |
|
5223 | var DeclarationRequest;
|
5224 | (function (DeclarationRequest) {
|
5225 | DeclarationRequest.method = 'textDocument/declaration';
|
5226 | DeclarationRequest.type = new messages_1.ProtocolRequestType(DeclarationRequest.method);
|
5227 | })(DeclarationRequest = exports.DeclarationRequest || (exports.DeclarationRequest = {}));
|
5228 |
|
5229 |
|
5230 | }),
|
5231 |
|
5232 | 45:
|
5233 | ((__unused_webpack_module, exports, __webpack_require__) => {
|
5234 |
|
5235 | "use strict";
|
5236 |
|
5237 |
|
5238 |
|
5239 |
|
5240 |
|
5241 | Object.defineProperty(exports, "__esModule", ({ value: true }));
|
5242 | exports.WillDeleteFilesRequest = exports.DidDeleteFilesNotification = exports.DidRenameFilesNotification = exports.WillRenameFilesRequest = exports.DidCreateFilesNotification = exports.WillCreateFilesRequest = exports.FileOperationPatternKind = void 0;
|
5243 | const messages_1 = __webpack_require__(29);
|
5244 |
|
5245 |
|
5246 |
|
5247 |
|
5248 |
|
5249 |
|
5250 | var FileOperationPatternKind;
|
5251 | (function (FileOperationPatternKind) {
|
5252 | |
5253 |
|
5254 |
|
5255 | FileOperationPatternKind.file = 'file';
|
5256 | |
5257 |
|
5258 |
|
5259 | FileOperationPatternKind.folder = 'folder';
|
5260 | })(FileOperationPatternKind = exports.FileOperationPatternKind || (exports.FileOperationPatternKind = {}));
|
5261 |
|
5262 |
|
5263 |
|
5264 |
|
5265 |
|
5266 |
|
5267 | var WillCreateFilesRequest;
|
5268 | (function (WillCreateFilesRequest) {
|
5269 | WillCreateFilesRequest.method = 'workspace/willCreateFiles';
|
5270 | WillCreateFilesRequest.type = new messages_1.ProtocolRequestType(WillCreateFilesRequest.method);
|
5271 | })(WillCreateFilesRequest = exports.WillCreateFilesRequest || (exports.WillCreateFilesRequest = {}));
|
5272 |
|
5273 |
|
5274 |
|
5275 |
|
5276 |
|
5277 |
|
5278 | var DidCreateFilesNotification;
|
5279 | (function (DidCreateFilesNotification) {
|
5280 | DidCreateFilesNotification.method = 'workspace/didCreateFiles';
|
5281 | DidCreateFilesNotification.type = new messages_1.ProtocolNotificationType(DidCreateFilesNotification.method);
|
5282 | })(DidCreateFilesNotification = exports.DidCreateFilesNotification || (exports.DidCreateFilesNotification = {}));
|
5283 |
|
5284 |
|
5285 |
|
5286 |
|
5287 |
|
5288 |
|
5289 | var WillRenameFilesRequest;
|
5290 | (function (WillRenameFilesRequest) {
|
5291 | WillRenameFilesRequest.method = 'workspace/willRenameFiles';
|
5292 | WillRenameFilesRequest.type = new messages_1.ProtocolRequestType(WillRenameFilesRequest.method);
|
5293 | })(WillRenameFilesRequest = exports.WillRenameFilesRequest || (exports.WillRenameFilesRequest = {}));
|
5294 |
|
5295 |
|
5296 |
|
5297 |
|
5298 |
|
5299 |
|
5300 | var DidRenameFilesNotification;
|
5301 | (function (DidRenameFilesNotification) {
|
5302 | DidRenameFilesNotification.method = 'workspace/didRenameFiles';
|
5303 | DidRenameFilesNotification.type = new messages_1.ProtocolNotificationType(DidRenameFilesNotification.method);
|
5304 | })(DidRenameFilesNotification = exports.DidRenameFilesNotification || (exports.DidRenameFilesNotification = {}));
|
5305 |
|
5306 |
|
5307 |
|
5308 |
|
5309 |
|
5310 |
|
5311 | var DidDeleteFilesNotification;
|
5312 | (function (DidDeleteFilesNotification) {
|
5313 | DidDeleteFilesNotification.method = 'workspace/didDeleteFiles';
|
5314 | DidDeleteFilesNotification.type = new messages_1.ProtocolNotificationType(DidDeleteFilesNotification.method);
|
5315 | })(DidDeleteFilesNotification = exports.DidDeleteFilesNotification || (exports.DidDeleteFilesNotification = {}));
|
5316 |
|
5317 |
|
5318 |
|
5319 |
|
5320 |
|
5321 |
|
5322 | var WillDeleteFilesRequest;
|
5323 | (function (WillDeleteFilesRequest) {
|
5324 | WillDeleteFilesRequest.method = 'workspace/willDeleteFiles';
|
5325 | WillDeleteFilesRequest.type = new messages_1.ProtocolRequestType(WillDeleteFilesRequest.method);
|
5326 | })(WillDeleteFilesRequest = exports.WillDeleteFilesRequest || (exports.WillDeleteFilesRequest = {}));
|
5327 |
|
5328 |
|
5329 | }),
|
5330 |
|
5331 | 37:
|
5332 | ((__unused_webpack_module, exports, __webpack_require__) => {
|
5333 |
|
5334 | "use strict";
|
5335 |
|
5336 |
|
5337 |
|
5338 |
|
5339 |
|
5340 | Object.defineProperty(exports, "__esModule", ({ value: true }));
|
5341 | exports.FoldingRangeRequest = exports.FoldingRangeKind = void 0;
|
5342 | const messages_1 = __webpack_require__(29);
|
5343 |
|
5344 |
|
5345 |
|
5346 | var FoldingRangeKind;
|
5347 | (function (FoldingRangeKind) {
|
5348 | |
5349 |
|
5350 |
|
5351 | FoldingRangeKind["Comment"] = "comment";
|
5352 | |
5353 |
|
5354 |
|
5355 | FoldingRangeKind["Imports"] = "imports";
|
5356 | |
5357 |
|
5358 |
|
5359 | FoldingRangeKind["Region"] = "region";
|
5360 | })(FoldingRangeKind = exports.FoldingRangeKind || (exports.FoldingRangeKind = {}));
|
5361 |
|
5362 |
|
5363 |
|
5364 |
|
5365 |
|
5366 |
|
5367 | var FoldingRangeRequest;
|
5368 | (function (FoldingRangeRequest) {
|
5369 | FoldingRangeRequest.method = 'textDocument/foldingRange';
|
5370 | FoldingRangeRequest.type = new messages_1.ProtocolRequestType(FoldingRangeRequest.method);
|
5371 | })(FoldingRangeRequest = exports.FoldingRangeRequest || (exports.FoldingRangeRequest = {}));
|
5372 |
|
5373 |
|
5374 | }),
|
5375 |
|
5376 | 32:
|
5377 | ((__unused_webpack_module, exports, __webpack_require__) => {
|
5378 |
|
5379 | "use strict";
|
5380 |
|
5381 |
|
5382 |
|
5383 |
|
5384 |
|
5385 | Object.defineProperty(exports, "__esModule", ({ value: true }));
|
5386 | exports.ImplementationRequest = void 0;
|
5387 | const messages_1 = __webpack_require__(29);
|
5388 |
|
5389 | let __noDynamicImport;
|
5390 |
|
5391 |
|
5392 |
|
5393 |
|
5394 |
|
5395 |
|
5396 | var ImplementationRequest;
|
5397 | (function (ImplementationRequest) {
|
5398 | ImplementationRequest.method = 'textDocument/implementation';
|
5399 | ImplementationRequest.type = new messages_1.ProtocolRequestType(ImplementationRequest.method);
|
5400 | })(ImplementationRequest = exports.ImplementationRequest || (exports.ImplementationRequest = {}));
|
5401 |
|
5402 |
|
5403 | }),
|
5404 |
|
5405 | 30:
|
5406 | ((__unused_webpack_module, exports, __webpack_require__) => {
|
5407 |
|
5408 | "use strict";
|
5409 |
|
5410 |
|
5411 |
|
5412 |
|
5413 |
|
5414 | Object.defineProperty(exports, "__esModule", ({ value: true }));
|
5415 | exports.DocumentLinkRequest = exports.CodeLensRefreshRequest = exports.CodeLensResolveRequest = exports.CodeLensRequest = exports.WorkspaceSymbolRequest = exports.CodeActionResolveRequest = exports.CodeActionRequest = exports.DocumentSymbolRequest = exports.DocumentHighlightRequest = exports.ReferencesRequest = exports.DefinitionRequest = exports.SignatureHelpRequest = exports.SignatureHelpTriggerKind = exports.HoverRequest = exports.CompletionResolveRequest = exports.CompletionRequest = exports.CompletionTriggerKind = exports.PublishDiagnosticsNotification = exports.WatchKind = exports.FileChangeType = exports.DidChangeWatchedFilesNotification = exports.WillSaveTextDocumentWaitUntilRequest = exports.WillSaveTextDocumentNotification = exports.TextDocumentSaveReason = exports.DidSaveTextDocumentNotification = exports.DidCloseTextDocumentNotification = exports.DidChangeTextDocumentNotification = exports.TextDocumentContentChangeEvent = exports.DidOpenTextDocumentNotification = exports.TextDocumentSyncKind = exports.TelemetryEventNotification = exports.LogMessageNotification = exports.ShowMessageRequest = exports.ShowMessageNotification = exports.MessageType = exports.DidChangeConfigurationNotification = exports.ExitNotification = exports.ShutdownRequest = exports.InitializedNotification = exports.InitializeError = exports.InitializeRequest = exports.WorkDoneProgressOptions = exports.TextDocumentRegistrationOptions = exports.StaticRegistrationOptions = exports.FailureHandlingKind = exports.ResourceOperationKind = exports.UnregistrationRequest = exports.RegistrationRequest = exports.DocumentSelector = exports.DocumentFilter = void 0;
|
5416 | exports.MonikerRequest = exports.MonikerKind = exports.UniquenessLevel = exports.WillDeleteFilesRequest = exports.DidDeleteFilesNotification = exports.WillRenameFilesRequest = exports.DidRenameFilesNotification = exports.WillCreateFilesRequest = exports.DidCreateFilesNotification = exports.FileOperationPatternKind = exports.LinkedEditingRangeRequest = exports.ShowDocumentRequest = exports.SemanticTokensRegistrationType = exports.SemanticTokensRefreshRequest = exports.SemanticTokensRangeRequest = exports.SemanticTokensDeltaRequest = exports.SemanticTokensRequest = exports.TokenFormat = exports.SemanticTokens = exports.SemanticTokenModifiers = exports.SemanticTokenTypes = exports.CallHierarchyPrepareRequest = exports.CallHierarchyOutgoingCallsRequest = exports.CallHierarchyIncomingCallsRequest = exports.WorkDoneProgressCancelNotification = exports.WorkDoneProgressCreateRequest = exports.WorkDoneProgress = exports.SelectionRangeRequest = exports.DeclarationRequest = exports.FoldingRangeRequest = exports.ColorPresentationRequest = exports.DocumentColorRequest = exports.ConfigurationRequest = exports.DidChangeWorkspaceFoldersNotification = exports.WorkspaceFoldersRequest = exports.TypeDefinitionRequest = exports.ImplementationRequest = exports.ApplyWorkspaceEditRequest = exports.ExecuteCommandRequest = exports.PrepareRenameRequest = exports.RenameRequest = exports.PrepareSupportDefaultBehavior = exports.DocumentOnTypeFormattingRequest = exports.DocumentRangeFormattingRequest = exports.DocumentFormattingRequest = exports.DocumentLinkResolveRequest = void 0;
|
5417 | const Is = __webpack_require__(31);
|
5418 | const messages_1 = __webpack_require__(29);
|
5419 | const protocol_implementation_1 = __webpack_require__(32);
|
5420 | Object.defineProperty(exports, "ImplementationRequest", ({ enumerable: true, get: function () { return protocol_implementation_1.ImplementationRequest; } }));
|
5421 | const protocol_typeDefinition_1 = __webpack_require__(33);
|
5422 | Object.defineProperty(exports, "TypeDefinitionRequest", ({ enumerable: true, get: function () { return protocol_typeDefinition_1.TypeDefinitionRequest; } }));
|
5423 | const protocol_workspaceFolders_1 = __webpack_require__(34);
|
5424 | Object.defineProperty(exports, "WorkspaceFoldersRequest", ({ enumerable: true, get: function () { return protocol_workspaceFolders_1.WorkspaceFoldersRequest; } }));
|
5425 | Object.defineProperty(exports, "DidChangeWorkspaceFoldersNotification", ({ enumerable: true, get: function () { return protocol_workspaceFolders_1.DidChangeWorkspaceFoldersNotification; } }));
|
5426 | const protocol_configuration_1 = __webpack_require__(35);
|
5427 | Object.defineProperty(exports, "ConfigurationRequest", ({ enumerable: true, get: function () { return protocol_configuration_1.ConfigurationRequest; } }));
|
5428 | const protocol_colorProvider_1 = __webpack_require__(36);
|
5429 | Object.defineProperty(exports, "DocumentColorRequest", ({ enumerable: true, get: function () { return protocol_colorProvider_1.DocumentColorRequest; } }));
|
5430 | Object.defineProperty(exports, "ColorPresentationRequest", ({ enumerable: true, get: function () { return protocol_colorProvider_1.ColorPresentationRequest; } }));
|
5431 | const protocol_foldingRange_1 = __webpack_require__(37);
|
5432 | Object.defineProperty(exports, "FoldingRangeRequest", ({ enumerable: true, get: function () { return protocol_foldingRange_1.FoldingRangeRequest; } }));
|
5433 | const protocol_declaration_1 = __webpack_require__(38);
|
5434 | Object.defineProperty(exports, "DeclarationRequest", ({ enumerable: true, get: function () { return protocol_declaration_1.DeclarationRequest; } }));
|
5435 | const protocol_selectionRange_1 = __webpack_require__(39);
|
5436 | Object.defineProperty(exports, "SelectionRangeRequest", ({ enumerable: true, get: function () { return protocol_selectionRange_1.SelectionRangeRequest; } }));
|
5437 | const protocol_progress_1 = __webpack_require__(40);
|
5438 | Object.defineProperty(exports, "WorkDoneProgress", ({ enumerable: true, get: function () { return protocol_progress_1.WorkDoneProgress; } }));
|
5439 | Object.defineProperty(exports, "WorkDoneProgressCreateRequest", ({ enumerable: true, get: function () { return protocol_progress_1.WorkDoneProgressCreateRequest; } }));
|
5440 | Object.defineProperty(exports, "WorkDoneProgressCancelNotification", ({ enumerable: true, get: function () { return protocol_progress_1.WorkDoneProgressCancelNotification; } }));
|
5441 | const protocol_callHierarchy_1 = __webpack_require__(41);
|
5442 | Object.defineProperty(exports, "CallHierarchyIncomingCallsRequest", ({ enumerable: true, get: function () { return protocol_callHierarchy_1.CallHierarchyIncomingCallsRequest; } }));
|
5443 | Object.defineProperty(exports, "CallHierarchyOutgoingCallsRequest", ({ enumerable: true, get: function () { return protocol_callHierarchy_1.CallHierarchyOutgoingCallsRequest; } }));
|
5444 | Object.defineProperty(exports, "CallHierarchyPrepareRequest", ({ enumerable: true, get: function () { return protocol_callHierarchy_1.CallHierarchyPrepareRequest; } }));
|
5445 | const protocol_semanticTokens_1 = __webpack_require__(42);
|
5446 | Object.defineProperty(exports, "SemanticTokenTypes", ({ enumerable: true, get: function () { return protocol_semanticTokens_1.SemanticTokenTypes; } }));
|
5447 | Object.defineProperty(exports, "SemanticTokenModifiers", ({ enumerable: true, get: function () { return protocol_semanticTokens_1.SemanticTokenModifiers; } }));
|
5448 | Object.defineProperty(exports, "SemanticTokens", ({ enumerable: true, get: function () { return protocol_semanticTokens_1.SemanticTokens; } }));
|
5449 | Object.defineProperty(exports, "TokenFormat", ({ enumerable: true, get: function () { return protocol_semanticTokens_1.TokenFormat; } }));
|
5450 | Object.defineProperty(exports, "SemanticTokensRequest", ({ enumerable: true, get: function () { return protocol_semanticTokens_1.SemanticTokensRequest; } }));
|
5451 | Object.defineProperty(exports, "SemanticTokensDeltaRequest", ({ enumerable: true, get: function () { return protocol_semanticTokens_1.SemanticTokensDeltaRequest; } }));
|
5452 | Object.defineProperty(exports, "SemanticTokensRangeRequest", ({ enumerable: true, get: function () { return protocol_semanticTokens_1.SemanticTokensRangeRequest; } }));
|
5453 | Object.defineProperty(exports, "SemanticTokensRefreshRequest", ({ enumerable: true, get: function () { return protocol_semanticTokens_1.SemanticTokensRefreshRequest; } }));
|
5454 | Object.defineProperty(exports, "SemanticTokensRegistrationType", ({ enumerable: true, get: function () { return protocol_semanticTokens_1.SemanticTokensRegistrationType; } }));
|
5455 | const protocol_showDocument_1 = __webpack_require__(43);
|
5456 | Object.defineProperty(exports, "ShowDocumentRequest", ({ enumerable: true, get: function () { return protocol_showDocument_1.ShowDocumentRequest; } }));
|
5457 | const protocol_linkedEditingRange_1 = __webpack_require__(44);
|
5458 | Object.defineProperty(exports, "LinkedEditingRangeRequest", ({ enumerable: true, get: function () { return protocol_linkedEditingRange_1.LinkedEditingRangeRequest; } }));
|
5459 | const protocol_fileOperations_1 = __webpack_require__(45);
|
5460 | Object.defineProperty(exports, "FileOperationPatternKind", ({ enumerable: true, get: function () { return protocol_fileOperations_1.FileOperationPatternKind; } }));
|
5461 | Object.defineProperty(exports, "DidCreateFilesNotification", ({ enumerable: true, get: function () { return protocol_fileOperations_1.DidCreateFilesNotification; } }));
|
5462 | Object.defineProperty(exports, "WillCreateFilesRequest", ({ enumerable: true, get: function () { return protocol_fileOperations_1.WillCreateFilesRequest; } }));
|
5463 | Object.defineProperty(exports, "DidRenameFilesNotification", ({ enumerable: true, get: function () { return protocol_fileOperations_1.DidRenameFilesNotification; } }));
|
5464 | Object.defineProperty(exports, "WillRenameFilesRequest", ({ enumerable: true, get: function () { return protocol_fileOperations_1.WillRenameFilesRequest; } }));
|
5465 | Object.defineProperty(exports, "DidDeleteFilesNotification", ({ enumerable: true, get: function () { return protocol_fileOperations_1.DidDeleteFilesNotification; } }));
|
5466 | Object.defineProperty(exports, "WillDeleteFilesRequest", ({ enumerable: true, get: function () { return protocol_fileOperations_1.WillDeleteFilesRequest; } }));
|
5467 | const protocol_moniker_1 = __webpack_require__(46);
|
5468 | Object.defineProperty(exports, "UniquenessLevel", ({ enumerable: true, get: function () { return protocol_moniker_1.UniquenessLevel; } }));
|
5469 | Object.defineProperty(exports, "MonikerKind", ({ enumerable: true, get: function () { return protocol_moniker_1.MonikerKind; } }));
|
5470 | Object.defineProperty(exports, "MonikerRequest", ({ enumerable: true, get: function () { return protocol_moniker_1.MonikerRequest; } }));
|
5471 |
|
5472 | let __noDynamicImport;
|
5473 |
|
5474 |
|
5475 |
|
5476 |
|
5477 | var DocumentFilter;
|
5478 | (function (DocumentFilter) {
|
5479 | function is(value) {
|
5480 | const candidate = value;
|
5481 | return Is.string(candidate.language) || Is.string(candidate.scheme) || Is.string(candidate.pattern);
|
5482 | }
|
5483 | DocumentFilter.is = is;
|
5484 | })(DocumentFilter = exports.DocumentFilter || (exports.DocumentFilter = {}));
|
5485 |
|
5486 |
|
5487 |
|
5488 |
|
5489 | var DocumentSelector;
|
5490 | (function (DocumentSelector) {
|
5491 | function is(value) {
|
5492 | if (!Array.isArray(value)) {
|
5493 | return false;
|
5494 | }
|
5495 | for (let elem of value) {
|
5496 | if (!Is.string(elem) && !DocumentFilter.is(elem)) {
|
5497 | return false;
|
5498 | }
|
5499 | }
|
5500 | return true;
|
5501 | }
|
5502 | DocumentSelector.is = is;
|
5503 | })(DocumentSelector = exports.DocumentSelector || (exports.DocumentSelector = {}));
|
5504 |
|
5505 |
|
5506 |
|
5507 |
|
5508 | var RegistrationRequest;
|
5509 | (function (RegistrationRequest) {
|
5510 | RegistrationRequest.type = new messages_1.ProtocolRequestType('client/registerCapability');
|
5511 | })(RegistrationRequest = exports.RegistrationRequest || (exports.RegistrationRequest = {}));
|
5512 |
|
5513 |
|
5514 |
|
5515 |
|
5516 | var UnregistrationRequest;
|
5517 | (function (UnregistrationRequest) {
|
5518 | UnregistrationRequest.type = new messages_1.ProtocolRequestType('client/unregisterCapability');
|
5519 | })(UnregistrationRequest = exports.UnregistrationRequest || (exports.UnregistrationRequest = {}));
|
5520 | var ResourceOperationKind;
|
5521 | (function (ResourceOperationKind) {
|
5522 | |
5523 |
|
5524 |
|
5525 | ResourceOperationKind.Create = 'create';
|
5526 | |
5527 |
|
5528 |
|
5529 | ResourceOperationKind.Rename = 'rename';
|
5530 | |
5531 |
|
5532 |
|
5533 | ResourceOperationKind.Delete = 'delete';
|
5534 | })(ResourceOperationKind = exports.ResourceOperationKind || (exports.ResourceOperationKind = {}));
|
5535 | var FailureHandlingKind;
|
5536 | (function (FailureHandlingKind) {
|
5537 | |
5538 |
|
5539 |
|
5540 |
|
5541 | FailureHandlingKind.Abort = 'abort';
|
5542 | |
5543 |
|
5544 |
|
5545 |
|
5546 | FailureHandlingKind.Transactional = 'transactional';
|
5547 | |
5548 |
|
5549 |
|
5550 |
|
5551 |
|
5552 | FailureHandlingKind.TextOnlyTransactional = 'textOnlyTransactional';
|
5553 | |
5554 |
|
5555 |
|
5556 |
|
5557 | FailureHandlingKind.Undo = 'undo';
|
5558 | })(FailureHandlingKind = exports.FailureHandlingKind || (exports.FailureHandlingKind = {}));
|
5559 |
|
5560 |
|
5561 |
|
5562 |
|
5563 | var StaticRegistrationOptions;
|
5564 | (function (StaticRegistrationOptions) {
|
5565 | function hasId(value) {
|
5566 | const candidate = value;
|
5567 | return candidate && Is.string(candidate.id) && candidate.id.length > 0;
|
5568 | }
|
5569 | StaticRegistrationOptions.hasId = hasId;
|
5570 | })(StaticRegistrationOptions = exports.StaticRegistrationOptions || (exports.StaticRegistrationOptions = {}));
|
5571 |
|
5572 |
|
5573 |
|
5574 |
|
5575 | var TextDocumentRegistrationOptions;
|
5576 | (function (TextDocumentRegistrationOptions) {
|
5577 | function is(value) {
|
5578 | const candidate = value;
|
5579 | return candidate && (candidate.documentSelector === null || DocumentSelector.is(candidate.documentSelector));
|
5580 | }
|
5581 | TextDocumentRegistrationOptions.is = is;
|
5582 | })(TextDocumentRegistrationOptions = exports.TextDocumentRegistrationOptions || (exports.TextDocumentRegistrationOptions = {}));
|
5583 |
|
5584 |
|
5585 |
|
5586 |
|
5587 | var WorkDoneProgressOptions;
|
5588 | (function (WorkDoneProgressOptions) {
|
5589 | function is(value) {
|
5590 | const candidate = value;
|
5591 | return Is.objectLiteral(candidate) && (candidate.workDoneProgress === undefined || Is.boolean(candidate.workDoneProgress));
|
5592 | }
|
5593 | WorkDoneProgressOptions.is = is;
|
5594 | function hasWorkDoneProgress(value) {
|
5595 | const candidate = value;
|
5596 | return candidate && Is.boolean(candidate.workDoneProgress);
|
5597 | }
|
5598 | WorkDoneProgressOptions.hasWorkDoneProgress = hasWorkDoneProgress;
|
5599 | })(WorkDoneProgressOptions = exports.WorkDoneProgressOptions || (exports.WorkDoneProgressOptions = {}));
|
5600 |
|
5601 |
|
5602 |
|
5603 |
|
5604 |
|
5605 |
|
5606 |
|
5607 | var InitializeRequest;
|
5608 | (function (InitializeRequest) {
|
5609 | InitializeRequest.type = new messages_1.ProtocolRequestType('initialize');
|
5610 | })(InitializeRequest = exports.InitializeRequest || (exports.InitializeRequest = {}));
|
5611 |
|
5612 |
|
5613 |
|
5614 | var InitializeError;
|
5615 | (function (InitializeError) {
|
5616 | |
5617 |
|
5618 |
|
5619 |
|
5620 |
|
5621 | InitializeError.unknownProtocolVersion = 1;
|
5622 | })(InitializeError = exports.InitializeError || (exports.InitializeError = {}));
|
5623 |
|
5624 |
|
5625 |
|
5626 |
|
5627 |
|
5628 | var InitializedNotification;
|
5629 | (function (InitializedNotification) {
|
5630 | InitializedNotification.type = new messages_1.ProtocolNotificationType('initialized');
|
5631 | })(InitializedNotification = exports.InitializedNotification || (exports.InitializedNotification = {}));
|
5632 |
|
5633 |
|
5634 |
|
5635 |
|
5636 |
|
5637 |
|
5638 |
|
5639 | var ShutdownRequest;
|
5640 | (function (ShutdownRequest) {
|
5641 | ShutdownRequest.type = new messages_1.ProtocolRequestType0('shutdown');
|
5642 | })(ShutdownRequest = exports.ShutdownRequest || (exports.ShutdownRequest = {}));
|
5643 |
|
5644 |
|
5645 |
|
5646 |
|
5647 |
|
5648 | var ExitNotification;
|
5649 | (function (ExitNotification) {
|
5650 | ExitNotification.type = new messages_1.ProtocolNotificationType0('exit');
|
5651 | })(ExitNotification = exports.ExitNotification || (exports.ExitNotification = {}));
|
5652 |
|
5653 |
|
5654 |
|
5655 |
|
5656 |
|
5657 | var DidChangeConfigurationNotification;
|
5658 | (function (DidChangeConfigurationNotification) {
|
5659 | DidChangeConfigurationNotification.type = new messages_1.ProtocolNotificationType('workspace/didChangeConfiguration');
|
5660 | })(DidChangeConfigurationNotification = exports.DidChangeConfigurationNotification || (exports.DidChangeConfigurationNotification = {}));
|
5661 |
|
5662 |
|
5663 |
|
5664 |
|
5665 | var MessageType;
|
5666 | (function (MessageType) {
|
5667 | |
5668 |
|
5669 |
|
5670 | MessageType.Error = 1;
|
5671 | |
5672 |
|
5673 |
|
5674 | MessageType.Warning = 2;
|
5675 | |
5676 |
|
5677 |
|
5678 | MessageType.Info = 3;
|
5679 | |
5680 |
|
5681 |
|
5682 | MessageType.Log = 4;
|
5683 | })(MessageType = exports.MessageType || (exports.MessageType = {}));
|
5684 |
|
5685 |
|
5686 |
|
5687 |
|
5688 | var ShowMessageNotification;
|
5689 | (function (ShowMessageNotification) {
|
5690 | ShowMessageNotification.type = new messages_1.ProtocolNotificationType('window/showMessage');
|
5691 | })(ShowMessageNotification = exports.ShowMessageNotification || (exports.ShowMessageNotification = {}));
|
5692 |
|
5693 |
|
5694 |
|
5695 |
|
5696 | var ShowMessageRequest;
|
5697 | (function (ShowMessageRequest) {
|
5698 | ShowMessageRequest.type = new messages_1.ProtocolRequestType('window/showMessageRequest');
|
5699 | })(ShowMessageRequest = exports.ShowMessageRequest || (exports.ShowMessageRequest = {}));
|
5700 |
|
5701 |
|
5702 |
|
5703 |
|
5704 | var LogMessageNotification;
|
5705 | (function (LogMessageNotification) {
|
5706 | LogMessageNotification.type = new messages_1.ProtocolNotificationType('window/logMessage');
|
5707 | })(LogMessageNotification = exports.LogMessageNotification || (exports.LogMessageNotification = {}));
|
5708 |
|
5709 |
|
5710 |
|
5711 |
|
5712 |
|
5713 | var TelemetryEventNotification;
|
5714 | (function (TelemetryEventNotification) {
|
5715 | TelemetryEventNotification.type = new messages_1.ProtocolNotificationType('telemetry/event');
|
5716 | })(TelemetryEventNotification = exports.TelemetryEventNotification || (exports.TelemetryEventNotification = {}));
|
5717 |
|
5718 |
|
5719 |
|
5720 |
|
5721 | var TextDocumentSyncKind;
|
5722 | (function (TextDocumentSyncKind) {
|
5723 | |
5724 |
|
5725 |
|
5726 | TextDocumentSyncKind.None = 0;
|
5727 | |
5728 |
|
5729 |
|
5730 |
|
5731 | TextDocumentSyncKind.Full = 1;
|
5732 | |
5733 |
|
5734 |
|
5735 |
|
5736 |
|
5737 | TextDocumentSyncKind.Incremental = 2;
|
5738 | })(TextDocumentSyncKind = exports.TextDocumentSyncKind || (exports.TextDocumentSyncKind = {}));
|
5739 |
|
5740 |
|
5741 |
|
5742 |
|
5743 |
|
5744 |
|
5745 |
|
5746 |
|
5747 |
|
5748 |
|
5749 | var DidOpenTextDocumentNotification;
|
5750 | (function (DidOpenTextDocumentNotification) {
|
5751 | DidOpenTextDocumentNotification.method = 'textDocument/didOpen';
|
5752 | DidOpenTextDocumentNotification.type = new messages_1.ProtocolNotificationType(DidOpenTextDocumentNotification.method);
|
5753 | })(DidOpenTextDocumentNotification = exports.DidOpenTextDocumentNotification || (exports.DidOpenTextDocumentNotification = {}));
|
5754 | var TextDocumentContentChangeEvent;
|
5755 | (function (TextDocumentContentChangeEvent) {
|
5756 | |
5757 |
|
5758 |
|
5759 | function isIncremental(event) {
|
5760 | let candidate = event;
|
5761 | return candidate !== undefined && candidate !== null &&
|
5762 | typeof candidate.text === 'string' && candidate.range !== undefined &&
|
5763 | (candidate.rangeLength === undefined || typeof candidate.rangeLength === 'number');
|
5764 | }
|
5765 | TextDocumentContentChangeEvent.isIncremental = isIncremental;
|
5766 | |
5767 |
|
5768 |
|
5769 | function isFull(event) {
|
5770 | let candidate = event;
|
5771 | return candidate !== undefined && candidate !== null &&
|
5772 | typeof candidate.text === 'string' && candidate.range === undefined && candidate.rangeLength === undefined;
|
5773 | }
|
5774 | TextDocumentContentChangeEvent.isFull = isFull;
|
5775 | })(TextDocumentContentChangeEvent = exports.TextDocumentContentChangeEvent || (exports.TextDocumentContentChangeEvent = {}));
|
5776 |
|
5777 |
|
5778 |
|
5779 |
|
5780 | var DidChangeTextDocumentNotification;
|
5781 | (function (DidChangeTextDocumentNotification) {
|
5782 | DidChangeTextDocumentNotification.method = 'textDocument/didChange';
|
5783 | DidChangeTextDocumentNotification.type = new messages_1.ProtocolNotificationType(DidChangeTextDocumentNotification.method);
|
5784 | })(DidChangeTextDocumentNotification = exports.DidChangeTextDocumentNotification || (exports.DidChangeTextDocumentNotification = {}));
|
5785 |
|
5786 |
|
5787 |
|
5788 |
|
5789 |
|
5790 |
|
5791 |
|
5792 |
|
5793 |
|
5794 | var DidCloseTextDocumentNotification;
|
5795 | (function (DidCloseTextDocumentNotification) {
|
5796 | DidCloseTextDocumentNotification.method = 'textDocument/didClose';
|
5797 | DidCloseTextDocumentNotification.type = new messages_1.ProtocolNotificationType(DidCloseTextDocumentNotification.method);
|
5798 | })(DidCloseTextDocumentNotification = exports.DidCloseTextDocumentNotification || (exports.DidCloseTextDocumentNotification = {}));
|
5799 |
|
5800 |
|
5801 |
|
5802 |
|
5803 | var DidSaveTextDocumentNotification;
|
5804 | (function (DidSaveTextDocumentNotification) {
|
5805 | DidSaveTextDocumentNotification.method = 'textDocument/didSave';
|
5806 | DidSaveTextDocumentNotification.type = new messages_1.ProtocolNotificationType(DidSaveTextDocumentNotification.method);
|
5807 | })(DidSaveTextDocumentNotification = exports.DidSaveTextDocumentNotification || (exports.DidSaveTextDocumentNotification = {}));
|
5808 |
|
5809 |
|
5810 |
|
5811 | var TextDocumentSaveReason;
|
5812 | (function (TextDocumentSaveReason) {
|
5813 | |
5814 |
|
5815 |
|
5816 |
|
5817 | TextDocumentSaveReason.Manual = 1;
|
5818 | |
5819 |
|
5820 |
|
5821 | TextDocumentSaveReason.AfterDelay = 2;
|
5822 | |
5823 |
|
5824 |
|
5825 | TextDocumentSaveReason.FocusOut = 3;
|
5826 | })(TextDocumentSaveReason = exports.TextDocumentSaveReason || (exports.TextDocumentSaveReason = {}));
|
5827 |
|
5828 |
|
5829 |
|
5830 |
|
5831 | var WillSaveTextDocumentNotification;
|
5832 | (function (WillSaveTextDocumentNotification) {
|
5833 | WillSaveTextDocumentNotification.method = 'textDocument/willSave';
|
5834 | WillSaveTextDocumentNotification.type = new messages_1.ProtocolNotificationType(WillSaveTextDocumentNotification.method);
|
5835 | })(WillSaveTextDocumentNotification = exports.WillSaveTextDocumentNotification || (exports.WillSaveTextDocumentNotification = {}));
|
5836 |
|
5837 |
|
5838 |
|
5839 |
|
5840 |
|
5841 |
|
5842 |
|
5843 |
|
5844 | var WillSaveTextDocumentWaitUntilRequest;
|
5845 | (function (WillSaveTextDocumentWaitUntilRequest) {
|
5846 | WillSaveTextDocumentWaitUntilRequest.method = 'textDocument/willSaveWaitUntil';
|
5847 | WillSaveTextDocumentWaitUntilRequest.type = new messages_1.ProtocolRequestType(WillSaveTextDocumentWaitUntilRequest.method);
|
5848 | })(WillSaveTextDocumentWaitUntilRequest = exports.WillSaveTextDocumentWaitUntilRequest || (exports.WillSaveTextDocumentWaitUntilRequest = {}));
|
5849 |
|
5850 |
|
5851 |
|
5852 |
|
5853 | var DidChangeWatchedFilesNotification;
|
5854 | (function (DidChangeWatchedFilesNotification) {
|
5855 | DidChangeWatchedFilesNotification.type = new messages_1.ProtocolNotificationType('workspace/didChangeWatchedFiles');
|
5856 | })(DidChangeWatchedFilesNotification = exports.DidChangeWatchedFilesNotification || (exports.DidChangeWatchedFilesNotification = {}));
|
5857 |
|
5858 |
|
5859 |
|
5860 | var FileChangeType;
|
5861 | (function (FileChangeType) {
|
5862 | |
5863 |
|
5864 |
|
5865 | FileChangeType.Created = 1;
|
5866 | |
5867 |
|
5868 |
|
5869 | FileChangeType.Changed = 2;
|
5870 | |
5871 |
|
5872 |
|
5873 | FileChangeType.Deleted = 3;
|
5874 | })(FileChangeType = exports.FileChangeType || (exports.FileChangeType = {}));
|
5875 | var WatchKind;
|
5876 | (function (WatchKind) {
|
5877 | |
5878 |
|
5879 |
|
5880 | WatchKind.Create = 1;
|
5881 | |
5882 |
|
5883 |
|
5884 | WatchKind.Change = 2;
|
5885 | |
5886 |
|
5887 |
|
5888 | WatchKind.Delete = 4;
|
5889 | })(WatchKind = exports.WatchKind || (exports.WatchKind = {}));
|
5890 |
|
5891 |
|
5892 |
|
5893 |
|
5894 | var PublishDiagnosticsNotification;
|
5895 | (function (PublishDiagnosticsNotification) {
|
5896 | PublishDiagnosticsNotification.type = new messages_1.ProtocolNotificationType('textDocument/publishDiagnostics');
|
5897 | })(PublishDiagnosticsNotification = exports.PublishDiagnosticsNotification || (exports.PublishDiagnosticsNotification = {}));
|
5898 |
|
5899 |
|
5900 |
|
5901 | var CompletionTriggerKind;
|
5902 | (function (CompletionTriggerKind) {
|
5903 | |
5904 |
|
5905 |
|
5906 |
|
5907 | CompletionTriggerKind.Invoked = 1;
|
5908 | |
5909 |
|
5910 |
|
5911 |
|
5912 | CompletionTriggerKind.TriggerCharacter = 2;
|
5913 | |
5914 |
|
5915 |
|
5916 | CompletionTriggerKind.TriggerForIncompleteCompletions = 3;
|
5917 | })(CompletionTriggerKind = exports.CompletionTriggerKind || (exports.CompletionTriggerKind = {}));
|
5918 |
|
5919 |
|
5920 |
|
5921 |
|
5922 |
|
5923 |
|
5924 |
|
5925 |
|
5926 |
|
5927 |
|
5928 |
|
5929 | var CompletionRequest;
|
5930 | (function (CompletionRequest) {
|
5931 | CompletionRequest.method = 'textDocument/completion';
|
5932 | CompletionRequest.type = new messages_1.ProtocolRequestType(CompletionRequest.method);
|
5933 | })(CompletionRequest = exports.CompletionRequest || (exports.CompletionRequest = {}));
|
5934 |
|
5935 |
|
5936 |
|
5937 |
|
5938 |
|
5939 | var CompletionResolveRequest;
|
5940 | (function (CompletionResolveRequest) {
|
5941 | CompletionResolveRequest.method = 'completionItem/resolve';
|
5942 | CompletionResolveRequest.type = new messages_1.ProtocolRequestType(CompletionResolveRequest.method);
|
5943 | })(CompletionResolveRequest = exports.CompletionResolveRequest || (exports.CompletionResolveRequest = {}));
|
5944 |
|
5945 |
|
5946 |
|
5947 |
|
5948 |
|
5949 | var HoverRequest;
|
5950 | (function (HoverRequest) {
|
5951 | HoverRequest.method = 'textDocument/hover';
|
5952 | HoverRequest.type = new messages_1.ProtocolRequestType(HoverRequest.method);
|
5953 | })(HoverRequest = exports.HoverRequest || (exports.HoverRequest = {}));
|
5954 |
|
5955 |
|
5956 |
|
5957 |
|
5958 |
|
5959 | var SignatureHelpTriggerKind;
|
5960 | (function (SignatureHelpTriggerKind) {
|
5961 | |
5962 |
|
5963 |
|
5964 | SignatureHelpTriggerKind.Invoked = 1;
|
5965 | |
5966 |
|
5967 |
|
5968 | SignatureHelpTriggerKind.TriggerCharacter = 2;
|
5969 | |
5970 |
|
5971 |
|
5972 | SignatureHelpTriggerKind.ContentChange = 3;
|
5973 | })(SignatureHelpTriggerKind = exports.SignatureHelpTriggerKind || (exports.SignatureHelpTriggerKind = {}));
|
5974 | var SignatureHelpRequest;
|
5975 | (function (SignatureHelpRequest) {
|
5976 | SignatureHelpRequest.method = 'textDocument/signatureHelp';
|
5977 | SignatureHelpRequest.type = new messages_1.ProtocolRequestType(SignatureHelpRequest.method);
|
5978 | })(SignatureHelpRequest = exports.SignatureHelpRequest || (exports.SignatureHelpRequest = {}));
|
5979 |
|
5980 |
|
5981 |
|
5982 |
|
5983 |
|
5984 |
|
5985 |
|
5986 | var DefinitionRequest;
|
5987 | (function (DefinitionRequest) {
|
5988 | DefinitionRequest.method = 'textDocument/definition';
|
5989 | DefinitionRequest.type = new messages_1.ProtocolRequestType(DefinitionRequest.method);
|
5990 | })(DefinitionRequest = exports.DefinitionRequest || (exports.DefinitionRequest = {}));
|
5991 |
|
5992 |
|
5993 |
|
5994 |
|
5995 |
|
5996 |
|
5997 | var ReferencesRequest;
|
5998 | (function (ReferencesRequest) {
|
5999 | ReferencesRequest.method = 'textDocument/references';
|
6000 | ReferencesRequest.type = new messages_1.ProtocolRequestType(ReferencesRequest.method);
|
6001 | })(ReferencesRequest = exports.ReferencesRequest || (exports.ReferencesRequest = {}));
|
6002 |
|
6003 |
|
6004 |
|
6005 |
|
6006 |
|
6007 |
|
6008 | var DocumentHighlightRequest;
|
6009 | (function (DocumentHighlightRequest) {
|
6010 | DocumentHighlightRequest.method = 'textDocument/documentHighlight';
|
6011 | DocumentHighlightRequest.type = new messages_1.ProtocolRequestType(DocumentHighlightRequest.method);
|
6012 | })(DocumentHighlightRequest = exports.DocumentHighlightRequest || (exports.DocumentHighlightRequest = {}));
|
6013 |
|
6014 |
|
6015 |
|
6016 |
|
6017 |
|
6018 |
|
6019 | var DocumentSymbolRequest;
|
6020 | (function (DocumentSymbolRequest) {
|
6021 | DocumentSymbolRequest.method = 'textDocument/documentSymbol';
|
6022 | DocumentSymbolRequest.type = new messages_1.ProtocolRequestType(DocumentSymbolRequest.method);
|
6023 | })(DocumentSymbolRequest = exports.DocumentSymbolRequest || (exports.DocumentSymbolRequest = {}));
|
6024 |
|
6025 |
|
6026 |
|
6027 | var CodeActionRequest;
|
6028 | (function (CodeActionRequest) {
|
6029 | CodeActionRequest.method = 'textDocument/codeAction';
|
6030 | CodeActionRequest.type = new messages_1.ProtocolRequestType(CodeActionRequest.method);
|
6031 | })(CodeActionRequest = exports.CodeActionRequest || (exports.CodeActionRequest = {}));
|
6032 |
|
6033 |
|
6034 |
|
6035 |
|
6036 |
|
6037 | var CodeActionResolveRequest;
|
6038 | (function (CodeActionResolveRequest) {
|
6039 | CodeActionResolveRequest.method = 'codeAction/resolve';
|
6040 | CodeActionResolveRequest.type = new messages_1.ProtocolRequestType(CodeActionResolveRequest.method);
|
6041 | })(CodeActionResolveRequest = exports.CodeActionResolveRequest || (exports.CodeActionResolveRequest = {}));
|
6042 |
|
6043 |
|
6044 |
|
6045 |
|
6046 |
|
6047 |
|
6048 | var WorkspaceSymbolRequest;
|
6049 | (function (WorkspaceSymbolRequest) {
|
6050 | WorkspaceSymbolRequest.method = 'workspace/symbol';
|
6051 | WorkspaceSymbolRequest.type = new messages_1.ProtocolRequestType(WorkspaceSymbolRequest.method);
|
6052 | })(WorkspaceSymbolRequest = exports.WorkspaceSymbolRequest || (exports.WorkspaceSymbolRequest = {}));
|
6053 |
|
6054 |
|
6055 |
|
6056 | var CodeLensRequest;
|
6057 | (function (CodeLensRequest) {
|
6058 | CodeLensRequest.method = 'textDocument/codeLens';
|
6059 | CodeLensRequest.type = new messages_1.ProtocolRequestType(CodeLensRequest.method);
|
6060 | })(CodeLensRequest = exports.CodeLensRequest || (exports.CodeLensRequest = {}));
|
6061 |
|
6062 |
|
6063 |
|
6064 | var CodeLensResolveRequest;
|
6065 | (function (CodeLensResolveRequest) {
|
6066 | CodeLensResolveRequest.method = 'codeLens/resolve';
|
6067 | CodeLensResolveRequest.type = new messages_1.ProtocolRequestType(CodeLensResolveRequest.method);
|
6068 | })(CodeLensResolveRequest = exports.CodeLensResolveRequest || (exports.CodeLensResolveRequest = {}));
|
6069 |
|
6070 |
|
6071 |
|
6072 |
|
6073 |
|
6074 | var CodeLensRefreshRequest;
|
6075 | (function (CodeLensRefreshRequest) {
|
6076 | CodeLensRefreshRequest.method = `workspace/codeLens/refresh`;
|
6077 | CodeLensRefreshRequest.type = new messages_1.ProtocolRequestType0(CodeLensRefreshRequest.method);
|
6078 | })(CodeLensRefreshRequest = exports.CodeLensRefreshRequest || (exports.CodeLensRefreshRequest = {}));
|
6079 |
|
6080 |
|
6081 |
|
6082 | var DocumentLinkRequest;
|
6083 | (function (DocumentLinkRequest) {
|
6084 | DocumentLinkRequest.method = 'textDocument/documentLink';
|
6085 | DocumentLinkRequest.type = new messages_1.ProtocolRequestType(DocumentLinkRequest.method);
|
6086 | })(DocumentLinkRequest = exports.DocumentLinkRequest || (exports.DocumentLinkRequest = {}));
|
6087 |
|
6088 |
|
6089 |
|
6090 |
|
6091 |
|
6092 | var DocumentLinkResolveRequest;
|
6093 | (function (DocumentLinkResolveRequest) {
|
6094 | DocumentLinkResolveRequest.method = 'documentLink/resolve';
|
6095 | DocumentLinkResolveRequest.type = new messages_1.ProtocolRequestType(DocumentLinkResolveRequest.method);
|
6096 | })(DocumentLinkResolveRequest = exports.DocumentLinkResolveRequest || (exports.DocumentLinkResolveRequest = {}));
|
6097 |
|
6098 |
|
6099 |
|
6100 | var DocumentFormattingRequest;
|
6101 | (function (DocumentFormattingRequest) {
|
6102 | DocumentFormattingRequest.method = 'textDocument/formatting';
|
6103 | DocumentFormattingRequest.type = new messages_1.ProtocolRequestType(DocumentFormattingRequest.method);
|
6104 | })(DocumentFormattingRequest = exports.DocumentFormattingRequest || (exports.DocumentFormattingRequest = {}));
|
6105 |
|
6106 |
|
6107 |
|
6108 | var DocumentRangeFormattingRequest;
|
6109 | (function (DocumentRangeFormattingRequest) {
|
6110 | DocumentRangeFormattingRequest.method = 'textDocument/rangeFormatting';
|
6111 | DocumentRangeFormattingRequest.type = new messages_1.ProtocolRequestType(DocumentRangeFormattingRequest.method);
|
6112 | })(DocumentRangeFormattingRequest = exports.DocumentRangeFormattingRequest || (exports.DocumentRangeFormattingRequest = {}));
|
6113 |
|
6114 |
|
6115 |
|
6116 | var DocumentOnTypeFormattingRequest;
|
6117 | (function (DocumentOnTypeFormattingRequest) {
|
6118 | DocumentOnTypeFormattingRequest.method = 'textDocument/onTypeFormatting';
|
6119 | DocumentOnTypeFormattingRequest.type = new messages_1.ProtocolRequestType(DocumentOnTypeFormattingRequest.method);
|
6120 | })(DocumentOnTypeFormattingRequest = exports.DocumentOnTypeFormattingRequest || (exports.DocumentOnTypeFormattingRequest = {}));
|
6121 |
|
6122 | var PrepareSupportDefaultBehavior;
|
6123 | (function (PrepareSupportDefaultBehavior) {
|
6124 | |
6125 |
|
6126 |
|
6127 |
|
6128 | PrepareSupportDefaultBehavior.Identifier = 1;
|
6129 | })(PrepareSupportDefaultBehavior = exports.PrepareSupportDefaultBehavior || (exports.PrepareSupportDefaultBehavior = {}));
|
6130 |
|
6131 |
|
6132 |
|
6133 | var RenameRequest;
|
6134 | (function (RenameRequest) {
|
6135 | RenameRequest.method = 'textDocument/rename';
|
6136 | RenameRequest.type = new messages_1.ProtocolRequestType(RenameRequest.method);
|
6137 | })(RenameRequest = exports.RenameRequest || (exports.RenameRequest = {}));
|
6138 |
|
6139 |
|
6140 |
|
6141 |
|
6142 |
|
6143 | var PrepareRenameRequest;
|
6144 | (function (PrepareRenameRequest) {
|
6145 | PrepareRenameRequest.method = 'textDocument/prepareRename';
|
6146 | PrepareRenameRequest.type = new messages_1.ProtocolRequestType(PrepareRenameRequest.method);
|
6147 | })(PrepareRenameRequest = exports.PrepareRenameRequest || (exports.PrepareRenameRequest = {}));
|
6148 |
|
6149 |
|
6150 |
|
6151 |
|
6152 | var ExecuteCommandRequest;
|
6153 | (function (ExecuteCommandRequest) {
|
6154 | ExecuteCommandRequest.type = new messages_1.ProtocolRequestType('workspace/executeCommand');
|
6155 | })(ExecuteCommandRequest = exports.ExecuteCommandRequest || (exports.ExecuteCommandRequest = {}));
|
6156 |
|
6157 |
|
6158 |
|
6159 | var ApplyWorkspaceEditRequest;
|
6160 | (function (ApplyWorkspaceEditRequest) {
|
6161 | ApplyWorkspaceEditRequest.type = new messages_1.ProtocolRequestType('workspace/applyEdit');
|
6162 | })(ApplyWorkspaceEditRequest = exports.ApplyWorkspaceEditRequest || (exports.ApplyWorkspaceEditRequest = {}));
|
6163 |
|
6164 |
|
6165 | }),
|
6166 |
|
6167 | 44:
|
6168 | ((__unused_webpack_module, exports, __webpack_require__) => {
|
6169 |
|
6170 | "use strict";
|
6171 |
|
6172 |
|
6173 |
|
6174 |
|
6175 |
|
6176 | Object.defineProperty(exports, "__esModule", ({ value: true }));
|
6177 | exports.LinkedEditingRangeRequest = void 0;
|
6178 | const messages_1 = __webpack_require__(29);
|
6179 |
|
6180 |
|
6181 |
|
6182 |
|
6183 |
|
6184 | var LinkedEditingRangeRequest;
|
6185 | (function (LinkedEditingRangeRequest) {
|
6186 | LinkedEditingRangeRequest.method = 'textDocument/linkedEditingRange';
|
6187 | LinkedEditingRangeRequest.type = new messages_1.ProtocolRequestType(LinkedEditingRangeRequest.method);
|
6188 | })(LinkedEditingRangeRequest = exports.LinkedEditingRangeRequest || (exports.LinkedEditingRangeRequest = {}));
|
6189 |
|
6190 |
|
6191 | }),
|
6192 |
|
6193 | 46:
|
6194 | ((__unused_webpack_module, exports, __webpack_require__) => {
|
6195 |
|
6196 | "use strict";
|
6197 |
|
6198 |
|
6199 |
|
6200 |
|
6201 |
|
6202 | Object.defineProperty(exports, "__esModule", ({ value: true }));
|
6203 | exports.MonikerRequest = exports.MonikerKind = exports.UniquenessLevel = void 0;
|
6204 | const messages_1 = __webpack_require__(29);
|
6205 |
|
6206 |
|
6207 |
|
6208 |
|
6209 |
|
6210 | var UniquenessLevel;
|
6211 | (function (UniquenessLevel) {
|
6212 | |
6213 |
|
6214 |
|
6215 | UniquenessLevel["document"] = "document";
|
6216 | |
6217 |
|
6218 |
|
6219 | UniquenessLevel["project"] = "project";
|
6220 | |
6221 |
|
6222 |
|
6223 | UniquenessLevel["group"] = "group";
|
6224 | |
6225 |
|
6226 |
|
6227 | UniquenessLevel["scheme"] = "scheme";
|
6228 | |
6229 |
|
6230 |
|
6231 | UniquenessLevel["global"] = "global";
|
6232 | })(UniquenessLevel = exports.UniquenessLevel || (exports.UniquenessLevel = {}));
|
6233 |
|
6234 |
|
6235 |
|
6236 |
|
6237 |
|
6238 | var MonikerKind;
|
6239 | (function (MonikerKind) {
|
6240 | |
6241 |
|
6242 |
|
6243 | MonikerKind["import"] = "import";
|
6244 | |
6245 |
|
6246 |
|
6247 | MonikerKind["export"] = "export";
|
6248 | |
6249 |
|
6250 |
|
6251 |
|
6252 | MonikerKind["local"] = "local";
|
6253 | })(MonikerKind = exports.MonikerKind || (exports.MonikerKind = {}));
|
6254 |
|
6255 |
|
6256 |
|
6257 |
|
6258 |
|
6259 | var MonikerRequest;
|
6260 | (function (MonikerRequest) {
|
6261 | MonikerRequest.method = 'textDocument/moniker';
|
6262 | MonikerRequest.type = new messages_1.ProtocolRequestType(MonikerRequest.method);
|
6263 | })(MonikerRequest = exports.MonikerRequest || (exports.MonikerRequest = {}));
|
6264 |
|
6265 |
|
6266 | }),
|
6267 |
|
6268 | 40:
|
6269 | ((__unused_webpack_module, exports, __webpack_require__) => {
|
6270 |
|
6271 | "use strict";
|
6272 |
|
6273 |
|
6274 |
|
6275 |
|
6276 |
|
6277 | Object.defineProperty(exports, "__esModule", ({ value: true }));
|
6278 | exports.WorkDoneProgressCancelNotification = exports.WorkDoneProgressCreateRequest = exports.WorkDoneProgress = void 0;
|
6279 | const vscode_jsonrpc_1 = __webpack_require__(7);
|
6280 | const messages_1 = __webpack_require__(29);
|
6281 | var WorkDoneProgress;
|
6282 | (function (WorkDoneProgress) {
|
6283 | WorkDoneProgress.type = new vscode_jsonrpc_1.ProgressType();
|
6284 | function is(value) {
|
6285 | return value === WorkDoneProgress.type;
|
6286 | }
|
6287 | WorkDoneProgress.is = is;
|
6288 | })(WorkDoneProgress = exports.WorkDoneProgress || (exports.WorkDoneProgress = {}));
|
6289 |
|
6290 |
|
6291 |
|
6292 |
|
6293 | var WorkDoneProgressCreateRequest;
|
6294 | (function (WorkDoneProgressCreateRequest) {
|
6295 | WorkDoneProgressCreateRequest.type = new messages_1.ProtocolRequestType('window/workDoneProgress/create');
|
6296 | })(WorkDoneProgressCreateRequest = exports.WorkDoneProgressCreateRequest || (exports.WorkDoneProgressCreateRequest = {}));
|
6297 |
|
6298 |
|
6299 |
|
6300 |
|
6301 | var WorkDoneProgressCancelNotification;
|
6302 | (function (WorkDoneProgressCancelNotification) {
|
6303 | WorkDoneProgressCancelNotification.type = new messages_1.ProtocolNotificationType('window/workDoneProgress/cancel');
|
6304 | })(WorkDoneProgressCancelNotification = exports.WorkDoneProgressCancelNotification || (exports.WorkDoneProgressCancelNotification = {}));
|
6305 |
|
6306 |
|
6307 | }),
|
6308 |
|
6309 | 39:
|
6310 | ((__unused_webpack_module, exports, __webpack_require__) => {
|
6311 |
|
6312 | "use strict";
|
6313 |
|
6314 |
|
6315 |
|
6316 |
|
6317 |
|
6318 | Object.defineProperty(exports, "__esModule", ({ value: true }));
|
6319 | exports.SelectionRangeRequest = void 0;
|
6320 | const messages_1 = __webpack_require__(29);
|
6321 |
|
6322 |
|
6323 |
|
6324 |
|
6325 |
|
6326 |
|
6327 | var SelectionRangeRequest;
|
6328 | (function (SelectionRangeRequest) {
|
6329 | SelectionRangeRequest.method = 'textDocument/selectionRange';
|
6330 | SelectionRangeRequest.type = new messages_1.ProtocolRequestType(SelectionRangeRequest.method);
|
6331 | })(SelectionRangeRequest = exports.SelectionRangeRequest || (exports.SelectionRangeRequest = {}));
|
6332 |
|
6333 |
|
6334 | }),
|
6335 |
|
6336 | 42:
|
6337 | ((__unused_webpack_module, exports, __webpack_require__) => {
|
6338 |
|
6339 | "use strict";
|
6340 |
|
6341 |
|
6342 |
|
6343 |
|
6344 |
|
6345 | Object.defineProperty(exports, "__esModule", ({ value: true }));
|
6346 | exports.SemanticTokensRefreshRequest = exports.SemanticTokensRangeRequest = exports.SemanticTokensDeltaRequest = exports.SemanticTokensRequest = exports.SemanticTokensRegistrationType = exports.TokenFormat = exports.SemanticTokens = exports.SemanticTokenModifiers = exports.SemanticTokenTypes = void 0;
|
6347 | const messages_1 = __webpack_require__(29);
|
6348 |
|
6349 |
|
6350 |
|
6351 |
|
6352 |
|
6353 |
|
6354 |
|
6355 | var SemanticTokenTypes;
|
6356 | (function (SemanticTokenTypes) {
|
6357 | SemanticTokenTypes["namespace"] = "namespace";
|
6358 | |
6359 |
|
6360 |
|
6361 |
|
6362 | SemanticTokenTypes["type"] = "type";
|
6363 | SemanticTokenTypes["class"] = "class";
|
6364 | SemanticTokenTypes["enum"] = "enum";
|
6365 | SemanticTokenTypes["interface"] = "interface";
|
6366 | SemanticTokenTypes["struct"] = "struct";
|
6367 | SemanticTokenTypes["typeParameter"] = "typeParameter";
|
6368 | SemanticTokenTypes["parameter"] = "parameter";
|
6369 | SemanticTokenTypes["variable"] = "variable";
|
6370 | SemanticTokenTypes["property"] = "property";
|
6371 | SemanticTokenTypes["enumMember"] = "enumMember";
|
6372 | SemanticTokenTypes["event"] = "event";
|
6373 | SemanticTokenTypes["function"] = "function";
|
6374 | SemanticTokenTypes["method"] = "method";
|
6375 | SemanticTokenTypes["macro"] = "macro";
|
6376 | SemanticTokenTypes["keyword"] = "keyword";
|
6377 | SemanticTokenTypes["modifier"] = "modifier";
|
6378 | SemanticTokenTypes["comment"] = "comment";
|
6379 | SemanticTokenTypes["string"] = "string";
|
6380 | SemanticTokenTypes["number"] = "number";
|
6381 | SemanticTokenTypes["regexp"] = "regexp";
|
6382 | SemanticTokenTypes["operator"] = "operator";
|
6383 | })(SemanticTokenTypes = exports.SemanticTokenTypes || (exports.SemanticTokenTypes = {}));
|
6384 |
|
6385 |
|
6386 |
|
6387 |
|
6388 |
|
6389 |
|
6390 |
|
6391 | var SemanticTokenModifiers;
|
6392 | (function (SemanticTokenModifiers) {
|
6393 | SemanticTokenModifiers["declaration"] = "declaration";
|
6394 | SemanticTokenModifiers["definition"] = "definition";
|
6395 | SemanticTokenModifiers["readonly"] = "readonly";
|
6396 | SemanticTokenModifiers["static"] = "static";
|
6397 | SemanticTokenModifiers["deprecated"] = "deprecated";
|
6398 | SemanticTokenModifiers["abstract"] = "abstract";
|
6399 | SemanticTokenModifiers["async"] = "async";
|
6400 | SemanticTokenModifiers["modification"] = "modification";
|
6401 | SemanticTokenModifiers["documentation"] = "documentation";
|
6402 | SemanticTokenModifiers["defaultLibrary"] = "defaultLibrary";
|
6403 | })(SemanticTokenModifiers = exports.SemanticTokenModifiers || (exports.SemanticTokenModifiers = {}));
|
6404 |
|
6405 |
|
6406 |
|
6407 | var SemanticTokens;
|
6408 | (function (SemanticTokens) {
|
6409 | function is(value) {
|
6410 | const candidate = value;
|
6411 | return candidate !== undefined && (candidate.resultId === undefined || typeof candidate.resultId === 'string') &&
|
6412 | Array.isArray(candidate.data) && (candidate.data.length === 0 || typeof candidate.data[0] === 'number');
|
6413 | }
|
6414 | SemanticTokens.is = is;
|
6415 | })(SemanticTokens = exports.SemanticTokens || (exports.SemanticTokens = {}));
|
6416 |
|
6417 | var TokenFormat;
|
6418 | (function (TokenFormat) {
|
6419 | TokenFormat.Relative = 'relative';
|
6420 | })(TokenFormat = exports.TokenFormat || (exports.TokenFormat = {}));
|
6421 | var SemanticTokensRegistrationType;
|
6422 | (function (SemanticTokensRegistrationType) {
|
6423 | SemanticTokensRegistrationType.method = 'textDocument/semanticTokens';
|
6424 | SemanticTokensRegistrationType.type = new messages_1.RegistrationType(SemanticTokensRegistrationType.method);
|
6425 | })(SemanticTokensRegistrationType = exports.SemanticTokensRegistrationType || (exports.SemanticTokensRegistrationType = {}));
|
6426 |
|
6427 |
|
6428 |
|
6429 | var SemanticTokensRequest;
|
6430 | (function (SemanticTokensRequest) {
|
6431 | SemanticTokensRequest.method = 'textDocument/semanticTokens/full';
|
6432 | SemanticTokensRequest.type = new messages_1.ProtocolRequestType(SemanticTokensRequest.method);
|
6433 | })(SemanticTokensRequest = exports.SemanticTokensRequest || (exports.SemanticTokensRequest = {}));
|
6434 |
|
6435 |
|
6436 |
|
6437 | var SemanticTokensDeltaRequest;
|
6438 | (function (SemanticTokensDeltaRequest) {
|
6439 | SemanticTokensDeltaRequest.method = 'textDocument/semanticTokens/full/delta';
|
6440 | SemanticTokensDeltaRequest.type = new messages_1.ProtocolRequestType(SemanticTokensDeltaRequest.method);
|
6441 | })(SemanticTokensDeltaRequest = exports.SemanticTokensDeltaRequest || (exports.SemanticTokensDeltaRequest = {}));
|
6442 |
|
6443 |
|
6444 |
|
6445 | var SemanticTokensRangeRequest;
|
6446 | (function (SemanticTokensRangeRequest) {
|
6447 | SemanticTokensRangeRequest.method = 'textDocument/semanticTokens/range';
|
6448 | SemanticTokensRangeRequest.type = new messages_1.ProtocolRequestType(SemanticTokensRangeRequest.method);
|
6449 | })(SemanticTokensRangeRequest = exports.SemanticTokensRangeRequest || (exports.SemanticTokensRangeRequest = {}));
|
6450 |
|
6451 |
|
6452 |
|
6453 | var SemanticTokensRefreshRequest;
|
6454 | (function (SemanticTokensRefreshRequest) {
|
6455 | SemanticTokensRefreshRequest.method = `workspace/semanticTokens/refresh`;
|
6456 | SemanticTokensRefreshRequest.type = new messages_1.ProtocolRequestType0(SemanticTokensRefreshRequest.method);
|
6457 | })(SemanticTokensRefreshRequest = exports.SemanticTokensRefreshRequest || (exports.SemanticTokensRefreshRequest = {}));
|
6458 |
|
6459 |
|
6460 | }),
|
6461 |
|
6462 | 43:
|
6463 | ((__unused_webpack_module, exports, __webpack_require__) => {
|
6464 |
|
6465 | "use strict";
|
6466 |
|
6467 |
|
6468 |
|
6469 |
|
6470 |
|
6471 | Object.defineProperty(exports, "__esModule", ({ value: true }));
|
6472 | exports.ShowDocumentRequest = void 0;
|
6473 | const messages_1 = __webpack_require__(29);
|
6474 |
|
6475 |
|
6476 |
|
6477 |
|
6478 |
|
6479 |
|
6480 |
|
6481 |
|
6482 | var ShowDocumentRequest;
|
6483 | (function (ShowDocumentRequest) {
|
6484 | ShowDocumentRequest.method = 'window/showDocument';
|
6485 | ShowDocumentRequest.type = new messages_1.ProtocolRequestType(ShowDocumentRequest.method);
|
6486 | })(ShowDocumentRequest = exports.ShowDocumentRequest || (exports.ShowDocumentRequest = {}));
|
6487 |
|
6488 |
|
6489 | }),
|
6490 |
|
6491 | 33:
|
6492 | ((__unused_webpack_module, exports, __webpack_require__) => {
|
6493 |
|
6494 | "use strict";
|
6495 |
|
6496 |
|
6497 |
|
6498 |
|
6499 |
|
6500 | Object.defineProperty(exports, "__esModule", ({ value: true }));
|
6501 | exports.TypeDefinitionRequest = void 0;
|
6502 | const messages_1 = __webpack_require__(29);
|
6503 |
|
6504 | let __noDynamicImport;
|
6505 |
|
6506 |
|
6507 |
|
6508 |
|
6509 |
|
6510 |
|
6511 | var TypeDefinitionRequest;
|
6512 | (function (TypeDefinitionRequest) {
|
6513 | TypeDefinitionRequest.method = 'textDocument/typeDefinition';
|
6514 | TypeDefinitionRequest.type = new messages_1.ProtocolRequestType(TypeDefinitionRequest.method);
|
6515 | })(TypeDefinitionRequest = exports.TypeDefinitionRequest || (exports.TypeDefinitionRequest = {}));
|
6516 |
|
6517 |
|
6518 | }),
|
6519 |
|
6520 | 34:
|
6521 | ((__unused_webpack_module, exports, __webpack_require__) => {
|
6522 |
|
6523 | "use strict";
|
6524 |
|
6525 |
|
6526 |
|
6527 |
|
6528 |
|
6529 | Object.defineProperty(exports, "__esModule", ({ value: true }));
|
6530 | exports.DidChangeWorkspaceFoldersNotification = exports.WorkspaceFoldersRequest = void 0;
|
6531 | const messages_1 = __webpack_require__(29);
|
6532 |
|
6533 |
|
6534 |
|
6535 | var WorkspaceFoldersRequest;
|
6536 | (function (WorkspaceFoldersRequest) {
|
6537 | WorkspaceFoldersRequest.type = new messages_1.ProtocolRequestType0('workspace/workspaceFolders');
|
6538 | })(WorkspaceFoldersRequest = exports.WorkspaceFoldersRequest || (exports.WorkspaceFoldersRequest = {}));
|
6539 |
|
6540 |
|
6541 |
|
6542 |
|
6543 | var DidChangeWorkspaceFoldersNotification;
|
6544 | (function (DidChangeWorkspaceFoldersNotification) {
|
6545 | DidChangeWorkspaceFoldersNotification.type = new messages_1.ProtocolNotificationType('workspace/didChangeWorkspaceFolders');
|
6546 | })(DidChangeWorkspaceFoldersNotification = exports.DidChangeWorkspaceFoldersNotification || (exports.DidChangeWorkspaceFoldersNotification = {}));
|
6547 |
|
6548 |
|
6549 | }),
|
6550 |
|
6551 | 31:
|
6552 | ((__unused_webpack_module, exports) => {
|
6553 |
|
6554 | "use strict";
|
6555 |
|
6556 |
|
6557 |
|
6558 |
|
6559 |
|
6560 | Object.defineProperty(exports, "__esModule", ({ value: true }));
|
6561 | exports.objectLiteral = exports.typedArray = exports.stringArray = exports.array = exports.func = exports.error = exports.number = exports.string = exports.boolean = void 0;
|
6562 | function boolean(value) {
|
6563 | return value === true || value === false;
|
6564 | }
|
6565 | exports.boolean = boolean;
|
6566 | function string(value) {
|
6567 | return typeof value === 'string' || value instanceof String;
|
6568 | }
|
6569 | exports.string = string;
|
6570 | function number(value) {
|
6571 | return typeof value === 'number' || value instanceof Number;
|
6572 | }
|
6573 | exports.number = number;
|
6574 | function error(value) {
|
6575 | return value instanceof Error;
|
6576 | }
|
6577 | exports.error = error;
|
6578 | function func(value) {
|
6579 | return typeof value === 'function';
|
6580 | }
|
6581 | exports.func = func;
|
6582 | function array(value) {
|
6583 | return Array.isArray(value);
|
6584 | }
|
6585 | exports.array = array;
|
6586 | function stringArray(value) {
|
6587 | return array(value) && value.every(elem => string(elem));
|
6588 | }
|
6589 | exports.stringArray = stringArray;
|
6590 | function typedArray(value, check) {
|
6591 | return Array.isArray(value) && value.every(check);
|
6592 | }
|
6593 | exports.typedArray = typedArray;
|
6594 | function objectLiteral(value) {
|
6595 |
|
6596 |
|
6597 |
|
6598 | return value !== null && typeof value === 'object';
|
6599 | }
|
6600 | exports.objectLiteral = objectLiteral;
|
6601 |
|
6602 |
|
6603 | }),
|
6604 |
|
6605 | 5:
|
6606 | (function(__unused_webpack_module, exports, __webpack_require__) {
|
6607 |
|
6608 | "use strict";
|
6609 |
|
6610 |
|
6611 |
|
6612 |
|
6613 |
|
6614 | var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
6615 | if (k2 === undefined) k2 = k;
|
6616 | Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
6617 | }) : (function(o, m, k, k2) {
|
6618 | if (k2 === undefined) k2 = k;
|
6619 | o[k2] = m[k];
|
6620 | }));
|
6621 | var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
6622 | for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
6623 | };
|
6624 | Object.defineProperty(exports, "__esModule", ({ value: true }));
|
6625 | exports.createProtocolConnection = void 0;
|
6626 | const node_1 = __webpack_require__(6);
|
6627 | __exportStar(__webpack_require__(6), exports);
|
6628 | __exportStar(__webpack_require__(27), exports);
|
6629 | function createProtocolConnection(input, output, logger, options) {
|
6630 | return node_1.createMessageConnection(input, output, logger, options);
|
6631 | }
|
6632 | exports.createProtocolConnection = createProtocolConnection;
|
6633 |
|
6634 |
|
6635 | }),
|
6636 |
|
6637 | 62:
|
6638 | ((module, __unused_webpack_exports, __webpack_require__) => {
|
6639 |
|
6640 | "use strict";
|
6641 |
|
6642 |
|
6643 |
|
6644 |
|
6645 |
|
6646 |
|
6647 | module.exports = __webpack_require__(5);
|
6648 |
|
6649 | }),
|
6650 |
|
6651 | 28:
|
6652 | ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
6653 |
|
6654 | "use strict";
|
6655 | __webpack_require__.r(__webpack_exports__);
|
6656 | __webpack_require__.d(__webpack_exports__, {
|
6657 | "integer": () => ( integer),
|
6658 | "uinteger": () => ( uinteger),
|
6659 | "Position": () => ( Position),
|
6660 | "Range": () => ( Range),
|
6661 | "Location": () => ( Location),
|
6662 | "LocationLink": () => ( LocationLink),
|
6663 | "Color": () => ( Color),
|
6664 | "ColorInformation": () => ( ColorInformation),
|
6665 | "ColorPresentation": () => ( ColorPresentation),
|
6666 | "FoldingRangeKind": () => ( FoldingRangeKind),
|
6667 | "FoldingRange": () => ( FoldingRange),
|
6668 | "DiagnosticRelatedInformation": () => ( DiagnosticRelatedInformation),
|
6669 | "DiagnosticSeverity": () => ( DiagnosticSeverity),
|
6670 | "DiagnosticTag": () => ( DiagnosticTag),
|
6671 | "CodeDescription": () => ( CodeDescription),
|
6672 | "Diagnostic": () => ( Diagnostic),
|
6673 | "Command": () => ( Command),
|
6674 | "TextEdit": () => ( TextEdit),
|
6675 | "ChangeAnnotation": () => ( ChangeAnnotation),
|
6676 | "ChangeAnnotationIdentifier": () => ( ChangeAnnotationIdentifier),
|
6677 | "AnnotatedTextEdit": () => ( AnnotatedTextEdit),
|
6678 | "TextDocumentEdit": () => ( TextDocumentEdit),
|
6679 | "CreateFile": () => ( CreateFile),
|
6680 | "RenameFile": () => ( RenameFile),
|
6681 | "DeleteFile": () => ( DeleteFile),
|
6682 | "WorkspaceEdit": () => ( WorkspaceEdit),
|
6683 | "WorkspaceChange": () => ( WorkspaceChange),
|
6684 | "TextDocumentIdentifier": () => ( TextDocumentIdentifier),
|
6685 | "VersionedTextDocumentIdentifier": () => ( VersionedTextDocumentIdentifier),
|
6686 | "OptionalVersionedTextDocumentIdentifier": () => ( OptionalVersionedTextDocumentIdentifier),
|
6687 | "TextDocumentItem": () => ( TextDocumentItem),
|
6688 | "MarkupKind": () => ( MarkupKind),
|
6689 | "MarkupContent": () => ( MarkupContent),
|
6690 | "CompletionItemKind": () => ( CompletionItemKind),
|
6691 | "InsertTextFormat": () => ( InsertTextFormat),
|
6692 | "CompletionItemTag": () => ( CompletionItemTag),
|
6693 | "InsertReplaceEdit": () => ( InsertReplaceEdit),
|
6694 | "InsertTextMode": () => ( InsertTextMode),
|
6695 | "CompletionItem": () => ( CompletionItem),
|
6696 | "CompletionList": () => ( CompletionList),
|
6697 | "MarkedString": () => ( MarkedString),
|
6698 | "Hover": () => ( Hover),
|
6699 | "ParameterInformation": () => ( ParameterInformation),
|
6700 | "SignatureInformation": () => ( SignatureInformation),
|
6701 | "DocumentHighlightKind": () => ( DocumentHighlightKind),
|
6702 | "DocumentHighlight": () => ( DocumentHighlight),
|
6703 | "SymbolKind": () => ( SymbolKind),
|
6704 | "SymbolTag": () => ( SymbolTag),
|
6705 | "SymbolInformation": () => ( SymbolInformation),
|
6706 | "DocumentSymbol": () => ( DocumentSymbol),
|
6707 | "CodeActionKind": () => ( CodeActionKind),
|
6708 | "CodeActionContext": () => ( CodeActionContext),
|
6709 | "CodeAction": () => ( CodeAction),
|
6710 | "CodeLens": () => ( CodeLens),
|
6711 | "FormattingOptions": () => ( FormattingOptions),
|
6712 | "DocumentLink": () => ( DocumentLink),
|
6713 | "SelectionRange": () => ( SelectionRange),
|
6714 | "EOL": () => ( EOL),
|
6715 | "TextDocument": () => ( TextDocument)
|
6716 | });
|
6717 |
|
6718 |
|
6719 |
|
6720 |
|
6721 |
|
6722 | var integer;
|
6723 | (function (integer) {
|
6724 | integer.MIN_VALUE = -2147483648;
|
6725 | integer.MAX_VALUE = 2147483647;
|
6726 | })(integer || (integer = {}));
|
6727 | var uinteger;
|
6728 | (function (uinteger) {
|
6729 | uinteger.MIN_VALUE = 0;
|
6730 | uinteger.MAX_VALUE = 2147483647;
|
6731 | })(uinteger || (uinteger = {}));
|
6732 |
|
6733 |
|
6734 |
|
6735 |
|
6736 | var Position;
|
6737 | (function (Position) {
|
6738 | |
6739 |
|
6740 |
|
6741 |
|
6742 |
|
6743 | function create(line, character) {
|
6744 | if (line === Number.MAX_VALUE) {
|
6745 | line = uinteger.MAX_VALUE;
|
6746 | }
|
6747 | if (character === Number.MAX_VALUE) {
|
6748 | character = uinteger.MAX_VALUE;
|
6749 | }
|
6750 | return { line: line, character: character };
|
6751 | }
|
6752 | Position.create = create;
|
6753 | |
6754 |
|
6755 |
|
6756 | function is(value) {
|
6757 | var candidate = value;
|
6758 | return Is.objectLiteral(candidate) && Is.uinteger(candidate.line) && Is.uinteger(candidate.character);
|
6759 | }
|
6760 | Position.is = is;
|
6761 | })(Position || (Position = {}));
|
6762 |
|
6763 |
|
6764 |
|
6765 |
|
6766 | var Range;
|
6767 | (function (Range) {
|
6768 | function create(one, two, three, four) {
|
6769 | if (Is.uinteger(one) && Is.uinteger(two) && Is.uinteger(three) && Is.uinteger(four)) {
|
6770 | return { start: Position.create(one, two), end: Position.create(three, four) };
|
6771 | }
|
6772 | else if (Position.is(one) && Position.is(two)) {
|
6773 | return { start: one, end: two };
|
6774 | }
|
6775 | else {
|
6776 | throw new Error("Range#create called with invalid arguments[" + one + ", " + two + ", " + three + ", " + four + "]");
|
6777 | }
|
6778 | }
|
6779 | Range.create = create;
|
6780 | |
6781 |
|
6782 |
|
6783 | function is(value) {
|
6784 | var candidate = value;
|
6785 | return Is.objectLiteral(candidate) && Position.is(candidate.start) && Position.is(candidate.end);
|
6786 | }
|
6787 | Range.is = is;
|
6788 | })(Range || (Range = {}));
|
6789 |
|
6790 |
|
6791 |
|
6792 |
|
6793 | var Location;
|
6794 | (function (Location) {
|
6795 | |
6796 |
|
6797 |
|
6798 |
|
6799 |
|
6800 | function create(uri, range) {
|
6801 | return { uri: uri, range: range };
|
6802 | }
|
6803 | Location.create = create;
|
6804 | |
6805 |
|
6806 |
|
6807 | function is(value) {
|
6808 | var candidate = value;
|
6809 | return Is.defined(candidate) && Range.is(candidate.range) && (Is.string(candidate.uri) || Is.undefined(candidate.uri));
|
6810 | }
|
6811 | Location.is = is;
|
6812 | })(Location || (Location = {}));
|
6813 |
|
6814 |
|
6815 |
|
6816 |
|
6817 | var LocationLink;
|
6818 | (function (LocationLink) {
|
6819 | |
6820 |
|
6821 |
|
6822 |
|
6823 |
|
6824 |
|
6825 |
|
6826 | function create(targetUri, targetRange, targetSelectionRange, originSelectionRange) {
|
6827 | return { targetUri: targetUri, targetRange: targetRange, targetSelectionRange: targetSelectionRange, originSelectionRange: originSelectionRange };
|
6828 | }
|
6829 | LocationLink.create = create;
|
6830 | |
6831 |
|
6832 |
|
6833 | function is(value) {
|
6834 | var candidate = value;
|
6835 | return Is.defined(candidate) && Range.is(candidate.targetRange) && Is.string(candidate.targetUri)
|
6836 | && (Range.is(candidate.targetSelectionRange) || Is.undefined(candidate.targetSelectionRange))
|
6837 | && (Range.is(candidate.originSelectionRange) || Is.undefined(candidate.originSelectionRange));
|
6838 | }
|
6839 | LocationLink.is = is;
|
6840 | })(LocationLink || (LocationLink = {}));
|
6841 |
|
6842 |
|
6843 |
|
6844 |
|
6845 | var Color;
|
6846 | (function (Color) {
|
6847 | |
6848 |
|
6849 |
|
6850 | function create(red, green, blue, alpha) {
|
6851 | return {
|
6852 | red: red,
|
6853 | green: green,
|
6854 | blue: blue,
|
6855 | alpha: alpha,
|
6856 | };
|
6857 | }
|
6858 | Color.create = create;
|
6859 | |
6860 |
|
6861 |
|
6862 | function is(value) {
|
6863 | var candidate = value;
|
6864 | return Is.numberRange(candidate.red, 0, 1)
|
6865 | && Is.numberRange(candidate.green, 0, 1)
|
6866 | && Is.numberRange(candidate.blue, 0, 1)
|
6867 | && Is.numberRange(candidate.alpha, 0, 1);
|
6868 | }
|
6869 | Color.is = is;
|
6870 | })(Color || (Color = {}));
|
6871 |
|
6872 |
|
6873 |
|
6874 |
|
6875 | var ColorInformation;
|
6876 | (function (ColorInformation) {
|
6877 | |
6878 |
|
6879 |
|
6880 | function create(range, color) {
|
6881 | return {
|
6882 | range: range,
|
6883 | color: color,
|
6884 | };
|
6885 | }
|
6886 | ColorInformation.create = create;
|
6887 | |
6888 |
|
6889 |
|
6890 | function is(value) {
|
6891 | var candidate = value;
|
6892 | return Range.is(candidate.range) && Color.is(candidate.color);
|
6893 | }
|
6894 | ColorInformation.is = is;
|
6895 | })(ColorInformation || (ColorInformation = {}));
|
6896 |
|
6897 |
|
6898 |
|
6899 |
|
6900 | var ColorPresentation;
|
6901 | (function (ColorPresentation) {
|
6902 | |
6903 |
|
6904 |
|
6905 | function create(label, textEdit, additionalTextEdits) {
|
6906 | return {
|
6907 | label: label,
|
6908 | textEdit: textEdit,
|
6909 | additionalTextEdits: additionalTextEdits,
|
6910 | };
|
6911 | }
|
6912 | ColorPresentation.create = create;
|
6913 | |
6914 |
|
6915 |
|
6916 | function is(value) {
|
6917 | var candidate = value;
|
6918 | return Is.string(candidate.label)
|
6919 | && (Is.undefined(candidate.textEdit) || TextEdit.is(candidate))
|
6920 | && (Is.undefined(candidate.additionalTextEdits) || Is.typedArray(candidate.additionalTextEdits, TextEdit.is));
|
6921 | }
|
6922 | ColorPresentation.is = is;
|
6923 | })(ColorPresentation || (ColorPresentation = {}));
|
6924 |
|
6925 |
|
6926 |
|
6927 | var FoldingRangeKind;
|
6928 | (function (FoldingRangeKind) {
|
6929 | |
6930 |
|
6931 |
|
6932 | FoldingRangeKind["Comment"] = "comment";
|
6933 | |
6934 |
|
6935 |
|
6936 | FoldingRangeKind["Imports"] = "imports";
|
6937 | |
6938 |
|
6939 |
|
6940 | FoldingRangeKind["Region"] = "region";
|
6941 | })(FoldingRangeKind || (FoldingRangeKind = {}));
|
6942 |
|
6943 |
|
6944 |
|
6945 |
|
6946 | var FoldingRange;
|
6947 | (function (FoldingRange) {
|
6948 | |
6949 |
|
6950 |
|
6951 | function create(startLine, endLine, startCharacter, endCharacter, kind) {
|
6952 | var result = {
|
6953 | startLine: startLine,
|
6954 | endLine: endLine
|
6955 | };
|
6956 | if (Is.defined(startCharacter)) {
|
6957 | result.startCharacter = startCharacter;
|
6958 | }
|
6959 | if (Is.defined(endCharacter)) {
|
6960 | result.endCharacter = endCharacter;
|
6961 | }
|
6962 | if (Is.defined(kind)) {
|
6963 | result.kind = kind;
|
6964 | }
|
6965 | return result;
|
6966 | }
|
6967 | FoldingRange.create = create;
|
6968 | |
6969 |
|
6970 |
|
6971 | function is(value) {
|
6972 | var candidate = value;
|
6973 | return Is.uinteger(candidate.startLine) && Is.uinteger(candidate.startLine)
|
6974 | && (Is.undefined(candidate.startCharacter) || Is.uinteger(candidate.startCharacter))
|
6975 | && (Is.undefined(candidate.endCharacter) || Is.uinteger(candidate.endCharacter))
|
6976 | && (Is.undefined(candidate.kind) || Is.string(candidate.kind));
|
6977 | }
|
6978 | FoldingRange.is = is;
|
6979 | })(FoldingRange || (FoldingRange = {}));
|
6980 |
|
6981 |
|
6982 |
|
6983 |
|
6984 | var DiagnosticRelatedInformation;
|
6985 | (function (DiagnosticRelatedInformation) {
|
6986 | |
6987 |
|
6988 |
|
6989 | function create(location, message) {
|
6990 | return {
|
6991 | location: location,
|
6992 | message: message
|
6993 | };
|
6994 | }
|
6995 | DiagnosticRelatedInformation.create = create;
|
6996 | |
6997 |
|
6998 |
|
6999 | function is(value) {
|
7000 | var candidate = value;
|
7001 | return Is.defined(candidate) && Location.is(candidate.location) && Is.string(candidate.message);
|
7002 | }
|
7003 | DiagnosticRelatedInformation.is = is;
|
7004 | })(DiagnosticRelatedInformation || (DiagnosticRelatedInformation = {}));
|
7005 |
|
7006 |
|
7007 |
|
7008 | var DiagnosticSeverity;
|
7009 | (function (DiagnosticSeverity) {
|
7010 | |
7011 |
|
7012 |
|
7013 | DiagnosticSeverity.Error = 1;
|
7014 | |
7015 |
|
7016 |
|
7017 | DiagnosticSeverity.Warning = 2;
|
7018 | |
7019 |
|
7020 |
|
7021 | DiagnosticSeverity.Information = 3;
|
7022 | |
7023 |
|
7024 |
|
7025 | DiagnosticSeverity.Hint = 4;
|
7026 | })(DiagnosticSeverity || (DiagnosticSeverity = {}));
|
7027 |
|
7028 |
|
7029 |
|
7030 |
|
7031 |
|
7032 | var DiagnosticTag;
|
7033 | (function (DiagnosticTag) {
|
7034 | |
7035 |
|
7036 |
|
7037 |
|
7038 |
|
7039 |
|
7040 | DiagnosticTag.Unnecessary = 1;
|
7041 | |
7042 |
|
7043 |
|
7044 |
|
7045 |
|
7046 | DiagnosticTag.Deprecated = 2;
|
7047 | })(DiagnosticTag || (DiagnosticTag = {}));
|
7048 |
|
7049 |
|
7050 |
|
7051 |
|
7052 |
|
7053 | var CodeDescription;
|
7054 | (function (CodeDescription) {
|
7055 | function is(value) {
|
7056 | var candidate = value;
|
7057 | return candidate !== undefined && candidate !== null && Is.string(candidate.href);
|
7058 | }
|
7059 | CodeDescription.is = is;
|
7060 | })(CodeDescription || (CodeDescription = {}));
|
7061 |
|
7062 |
|
7063 |
|
7064 |
|
7065 | var Diagnostic;
|
7066 | (function (Diagnostic) {
|
7067 | |
7068 |
|
7069 |
|
7070 | function create(range, message, severity, code, source, relatedInformation) {
|
7071 | var result = { range: range, message: message };
|
7072 | if (Is.defined(severity)) {
|
7073 | result.severity = severity;
|
7074 | }
|
7075 | if (Is.defined(code)) {
|
7076 | result.code = code;
|
7077 | }
|
7078 | if (Is.defined(source)) {
|
7079 | result.source = source;
|
7080 | }
|
7081 | if (Is.defined(relatedInformation)) {
|
7082 | result.relatedInformation = relatedInformation;
|
7083 | }
|
7084 | return result;
|
7085 | }
|
7086 | Diagnostic.create = create;
|
7087 | |
7088 |
|
7089 |
|
7090 | function is(value) {
|
7091 | var _a;
|
7092 | var candidate = value;
|
7093 | return Is.defined(candidate)
|
7094 | && Range.is(candidate.range)
|
7095 | && Is.string(candidate.message)
|
7096 | && (Is.number(candidate.severity) || Is.undefined(candidate.severity))
|
7097 | && (Is.integer(candidate.code) || Is.string(candidate.code) || Is.undefined(candidate.code))
|
7098 | && (Is.undefined(candidate.codeDescription) || (Is.string((_a = candidate.codeDescription) === null || _a === void 0 ? void 0 : _a.href)))
|
7099 | && (Is.string(candidate.source) || Is.undefined(candidate.source))
|
7100 | && (Is.undefined(candidate.relatedInformation) || Is.typedArray(candidate.relatedInformation, DiagnosticRelatedInformation.is));
|
7101 | }
|
7102 | Diagnostic.is = is;
|
7103 | })(Diagnostic || (Diagnostic = {}));
|
7104 |
|
7105 |
|
7106 |
|
7107 |
|
7108 | var Command;
|
7109 | (function (Command) {
|
7110 | |
7111 |
|
7112 |
|
7113 | function create(title, command) {
|
7114 | var args = [];
|
7115 | for (var _i = 2; _i < arguments.length; _i++) {
|
7116 | args[_i - 2] = arguments[_i];
|
7117 | }
|
7118 | var result = { title: title, command: command };
|
7119 | if (Is.defined(args) && args.length > 0) {
|
7120 | result.arguments = args;
|
7121 | }
|
7122 | return result;
|
7123 | }
|
7124 | Command.create = create;
|
7125 | |
7126 |
|
7127 |
|
7128 | function is(value) {
|
7129 | var candidate = value;
|
7130 | return Is.defined(candidate) && Is.string(candidate.title) && Is.string(candidate.command);
|
7131 | }
|
7132 | Command.is = is;
|
7133 | })(Command || (Command = {}));
|
7134 |
|
7135 |
|
7136 |
|
7137 |
|
7138 | var TextEdit;
|
7139 | (function (TextEdit) {
|
7140 | |
7141 |
|
7142 |
|
7143 |
|
7144 |
|
7145 | function replace(range, newText) {
|
7146 | return { range: range, newText: newText };
|
7147 | }
|
7148 | TextEdit.replace = replace;
|
7149 | |
7150 |
|
7151 |
|
7152 |
|
7153 |
|
7154 | function insert(position, newText) {
|
7155 | return { range: { start: position, end: position }, newText: newText };
|
7156 | }
|
7157 | TextEdit.insert = insert;
|
7158 | |
7159 |
|
7160 |
|
7161 |
|
7162 | function del(range) {
|
7163 | return { range: range, newText: '' };
|
7164 | }
|
7165 | TextEdit.del = del;
|
7166 | function is(value) {
|
7167 | var candidate = value;
|
7168 | return Is.objectLiteral(candidate)
|
7169 | && Is.string(candidate.newText)
|
7170 | && Range.is(candidate.range);
|
7171 | }
|
7172 | TextEdit.is = is;
|
7173 | })(TextEdit || (TextEdit = {}));
|
7174 | var ChangeAnnotation;
|
7175 | (function (ChangeAnnotation) {
|
7176 | function create(label, needsConfirmation, description) {
|
7177 | var result = { label: label };
|
7178 | if (needsConfirmation !== undefined) {
|
7179 | result.needsConfirmation = needsConfirmation;
|
7180 | }
|
7181 | if (description !== undefined) {
|
7182 | result.description = description;
|
7183 | }
|
7184 | return result;
|
7185 | }
|
7186 | ChangeAnnotation.create = create;
|
7187 | function is(value) {
|
7188 | var candidate = value;
|
7189 | return candidate !== undefined && Is.objectLiteral(candidate) && Is.string(candidate.label) &&
|
7190 | (Is.boolean(candidate.needsConfirmation) || candidate.needsConfirmation === undefined) &&
|
7191 | (Is.string(candidate.description) || candidate.description === undefined);
|
7192 | }
|
7193 | ChangeAnnotation.is = is;
|
7194 | })(ChangeAnnotation || (ChangeAnnotation = {}));
|
7195 | var ChangeAnnotationIdentifier;
|
7196 | (function (ChangeAnnotationIdentifier) {
|
7197 | function is(value) {
|
7198 | var candidate = value;
|
7199 | return typeof candidate === 'string';
|
7200 | }
|
7201 | ChangeAnnotationIdentifier.is = is;
|
7202 | })(ChangeAnnotationIdentifier || (ChangeAnnotationIdentifier = {}));
|
7203 | var AnnotatedTextEdit;
|
7204 | (function (AnnotatedTextEdit) {
|
7205 | |
7206 |
|
7207 |
|
7208 |
|
7209 |
|
7210 |
|
7211 |
|
7212 | function replace(range, newText, annotation) {
|
7213 | return { range: range, newText: newText, annotationId: annotation };
|
7214 | }
|
7215 | AnnotatedTextEdit.replace = replace;
|
7216 | |
7217 |
|
7218 |
|
7219 |
|
7220 |
|
7221 |
|
7222 |
|
7223 | function insert(position, newText, annotation) {
|
7224 | return { range: { start: position, end: position }, newText: newText, annotationId: annotation };
|
7225 | }
|
7226 | AnnotatedTextEdit.insert = insert;
|
7227 | |
7228 |
|
7229 |
|
7230 |
|
7231 |
|
7232 |
|
7233 | function del(range, annotation) {
|
7234 | return { range: range, newText: '', annotationId: annotation };
|
7235 | }
|
7236 | AnnotatedTextEdit.del = del;
|
7237 | function is(value) {
|
7238 | var candidate = value;
|
7239 | return TextEdit.is(candidate) && (ChangeAnnotation.is(candidate.annotationId) || ChangeAnnotationIdentifier.is(candidate.annotationId));
|
7240 | }
|
7241 | AnnotatedTextEdit.is = is;
|
7242 | })(AnnotatedTextEdit || (AnnotatedTextEdit = {}));
|
7243 |
|
7244 |
|
7245 |
|
7246 |
|
7247 | var TextDocumentEdit;
|
7248 | (function (TextDocumentEdit) {
|
7249 | |
7250 |
|
7251 |
|
7252 | function create(textDocument, edits) {
|
7253 | return { textDocument: textDocument, edits: edits };
|
7254 | }
|
7255 | TextDocumentEdit.create = create;
|
7256 | function is(value) {
|
7257 | var candidate = value;
|
7258 | return Is.defined(candidate)
|
7259 | && OptionalVersionedTextDocumentIdentifier.is(candidate.textDocument)
|
7260 | && Array.isArray(candidate.edits);
|
7261 | }
|
7262 | TextDocumentEdit.is = is;
|
7263 | })(TextDocumentEdit || (TextDocumentEdit = {}));
|
7264 | var CreateFile;
|
7265 | (function (CreateFile) {
|
7266 | function create(uri, options, annotation) {
|
7267 | var result = {
|
7268 | kind: 'create',
|
7269 | uri: uri
|
7270 | };
|
7271 | if (options !== undefined && (options.overwrite !== undefined || options.ignoreIfExists !== undefined)) {
|
7272 | result.options = options;
|
7273 | }
|
7274 | if (annotation !== undefined) {
|
7275 | result.annotationId = annotation;
|
7276 | }
|
7277 | return result;
|
7278 | }
|
7279 | CreateFile.create = create;
|
7280 | function is(value) {
|
7281 | var candidate = value;
|
7282 | return candidate && candidate.kind === 'create' && Is.string(candidate.uri) && (candidate.options === undefined ||
|
7283 | ((candidate.options.overwrite === undefined || Is.boolean(candidate.options.overwrite)) && (candidate.options.ignoreIfExists === undefined || Is.boolean(candidate.options.ignoreIfExists)))) && (candidate.annotationId === undefined || ChangeAnnotationIdentifier.is(candidate.annotationId));
|
7284 | }
|
7285 | CreateFile.is = is;
|
7286 | })(CreateFile || (CreateFile = {}));
|
7287 | var RenameFile;
|
7288 | (function (RenameFile) {
|
7289 | function create(oldUri, newUri, options, annotation) {
|
7290 | var result = {
|
7291 | kind: 'rename',
|
7292 | oldUri: oldUri,
|
7293 | newUri: newUri
|
7294 | };
|
7295 | if (options !== undefined && (options.overwrite !== undefined || options.ignoreIfExists !== undefined)) {
|
7296 | result.options = options;
|
7297 | }
|
7298 | if (annotation !== undefined) {
|
7299 | result.annotationId = annotation;
|
7300 | }
|
7301 | return result;
|
7302 | }
|
7303 | RenameFile.create = create;
|
7304 | function is(value) {
|
7305 | var candidate = value;
|
7306 | return candidate && candidate.kind === 'rename' && Is.string(candidate.oldUri) && Is.string(candidate.newUri) && (candidate.options === undefined ||
|
7307 | ((candidate.options.overwrite === undefined || Is.boolean(candidate.options.overwrite)) && (candidate.options.ignoreIfExists === undefined || Is.boolean(candidate.options.ignoreIfExists)))) && (candidate.annotationId === undefined || ChangeAnnotationIdentifier.is(candidate.annotationId));
|
7308 | }
|
7309 | RenameFile.is = is;
|
7310 | })(RenameFile || (RenameFile = {}));
|
7311 | var DeleteFile;
|
7312 | (function (DeleteFile) {
|
7313 | function create(uri, options, annotation) {
|
7314 | var result = {
|
7315 | kind: 'delete',
|
7316 | uri: uri
|
7317 | };
|
7318 | if (options !== undefined && (options.recursive !== undefined || options.ignoreIfNotExists !== undefined)) {
|
7319 | result.options = options;
|
7320 | }
|
7321 | if (annotation !== undefined) {
|
7322 | result.annotationId = annotation;
|
7323 | }
|
7324 | return result;
|
7325 | }
|
7326 | DeleteFile.create = create;
|
7327 | function is(value) {
|
7328 | var candidate = value;
|
7329 | return candidate && candidate.kind === 'delete' && Is.string(candidate.uri) && (candidate.options === undefined ||
|
7330 | ((candidate.options.recursive === undefined || Is.boolean(candidate.options.recursive)) && (candidate.options.ignoreIfNotExists === undefined || Is.boolean(candidate.options.ignoreIfNotExists)))) && (candidate.annotationId === undefined || ChangeAnnotationIdentifier.is(candidate.annotationId));
|
7331 | }
|
7332 | DeleteFile.is = is;
|
7333 | })(DeleteFile || (DeleteFile = {}));
|
7334 | var WorkspaceEdit;
|
7335 | (function (WorkspaceEdit) {
|
7336 | function is(value) {
|
7337 | var candidate = value;
|
7338 | return candidate &&
|
7339 | (candidate.changes !== undefined || candidate.documentChanges !== undefined) &&
|
7340 | (candidate.documentChanges === undefined || candidate.documentChanges.every(function (change) {
|
7341 | if (Is.string(change.kind)) {
|
7342 | return CreateFile.is(change) || RenameFile.is(change) || DeleteFile.is(change);
|
7343 | }
|
7344 | else {
|
7345 | return TextDocumentEdit.is(change);
|
7346 | }
|
7347 | }));
|
7348 | }
|
7349 | WorkspaceEdit.is = is;
|
7350 | })(WorkspaceEdit || (WorkspaceEdit = {}));
|
7351 | var TextEditChangeImpl = (function () {
|
7352 | function TextEditChangeImpl(edits, changeAnnotations) {
|
7353 | this.edits = edits;
|
7354 | this.changeAnnotations = changeAnnotations;
|
7355 | }
|
7356 | TextEditChangeImpl.prototype.insert = function (position, newText, annotation) {
|
7357 | var edit;
|
7358 | var id;
|
7359 | if (annotation === undefined) {
|
7360 | edit = TextEdit.insert(position, newText);
|
7361 | }
|
7362 | else if (ChangeAnnotationIdentifier.is(annotation)) {
|
7363 | id = annotation;
|
7364 | edit = AnnotatedTextEdit.insert(position, newText, annotation);
|
7365 | }
|
7366 | else {
|
7367 | this.assertChangeAnnotations(this.changeAnnotations);
|
7368 | id = this.changeAnnotations.manage(annotation);
|
7369 | edit = AnnotatedTextEdit.insert(position, newText, id);
|
7370 | }
|
7371 | this.edits.push(edit);
|
7372 | if (id !== undefined) {
|
7373 | return id;
|
7374 | }
|
7375 | };
|
7376 | TextEditChangeImpl.prototype.replace = function (range, newText, annotation) {
|
7377 | var edit;
|
7378 | var id;
|
7379 | if (annotation === undefined) {
|
7380 | edit = TextEdit.replace(range, newText);
|
7381 | }
|
7382 | else if (ChangeAnnotationIdentifier.is(annotation)) {
|
7383 | id = annotation;
|
7384 | edit = AnnotatedTextEdit.replace(range, newText, annotation);
|
7385 | }
|
7386 | else {
|
7387 | this.assertChangeAnnotations(this.changeAnnotations);
|
7388 | id = this.changeAnnotations.manage(annotation);
|
7389 | edit = AnnotatedTextEdit.replace(range, newText, id);
|
7390 | }
|
7391 | this.edits.push(edit);
|
7392 | if (id !== undefined) {
|
7393 | return id;
|
7394 | }
|
7395 | };
|
7396 | TextEditChangeImpl.prototype.delete = function (range, annotation) {
|
7397 | var edit;
|
7398 | var id;
|
7399 | if (annotation === undefined) {
|
7400 | edit = TextEdit.del(range);
|
7401 | }
|
7402 | else if (ChangeAnnotationIdentifier.is(annotation)) {
|
7403 | id = annotation;
|
7404 | edit = AnnotatedTextEdit.del(range, annotation);
|
7405 | }
|
7406 | else {
|
7407 | this.assertChangeAnnotations(this.changeAnnotations);
|
7408 | id = this.changeAnnotations.manage(annotation);
|
7409 | edit = AnnotatedTextEdit.del(range, id);
|
7410 | }
|
7411 | this.edits.push(edit);
|
7412 | if (id !== undefined) {
|
7413 | return id;
|
7414 | }
|
7415 | };
|
7416 | TextEditChangeImpl.prototype.add = function (edit) {
|
7417 | this.edits.push(edit);
|
7418 | };
|
7419 | TextEditChangeImpl.prototype.all = function () {
|
7420 | return this.edits;
|
7421 | };
|
7422 | TextEditChangeImpl.prototype.clear = function () {
|
7423 | this.edits.splice(0, this.edits.length);
|
7424 | };
|
7425 | TextEditChangeImpl.prototype.assertChangeAnnotations = function (value) {
|
7426 | if (value === undefined) {
|
7427 | throw new Error("Text edit change is not configured to manage change annotations.");
|
7428 | }
|
7429 | };
|
7430 | return TextEditChangeImpl;
|
7431 | }());
|
7432 |
|
7433 |
|
7434 |
|
7435 | var ChangeAnnotations = (function () {
|
7436 | function ChangeAnnotations(annotations) {
|
7437 | this._annotations = annotations === undefined ? Object.create(null) : annotations;
|
7438 | this._counter = 0;
|
7439 | this._size = 0;
|
7440 | }
|
7441 | ChangeAnnotations.prototype.all = function () {
|
7442 | return this._annotations;
|
7443 | };
|
7444 | Object.defineProperty(ChangeAnnotations.prototype, "size", {
|
7445 | get: function () {
|
7446 | return this._size;
|
7447 | },
|
7448 | enumerable: false,
|
7449 | configurable: true
|
7450 | });
|
7451 | ChangeAnnotations.prototype.manage = function (idOrAnnotation, annotation) {
|
7452 | var id;
|
7453 | if (ChangeAnnotationIdentifier.is(idOrAnnotation)) {
|
7454 | id = idOrAnnotation;
|
7455 | }
|
7456 | else {
|
7457 | id = this.nextId();
|
7458 | annotation = idOrAnnotation;
|
7459 | }
|
7460 | if (this._annotations[id] !== undefined) {
|
7461 | throw new Error("Id " + id + " is already in use.");
|
7462 | }
|
7463 | if (annotation === undefined) {
|
7464 | throw new Error("No annotation provided for id " + id);
|
7465 | }
|
7466 | this._annotations[id] = annotation;
|
7467 | this._size++;
|
7468 | return id;
|
7469 | };
|
7470 | ChangeAnnotations.prototype.nextId = function () {
|
7471 | this._counter++;
|
7472 | return this._counter.toString();
|
7473 | };
|
7474 | return ChangeAnnotations;
|
7475 | }());
|
7476 |
|
7477 |
|
7478 |
|
7479 | var WorkspaceChange = (function () {
|
7480 | function WorkspaceChange(workspaceEdit) {
|
7481 | var _this = this;
|
7482 | this._textEditChanges = Object.create(null);
|
7483 | if (workspaceEdit !== undefined) {
|
7484 | this._workspaceEdit = workspaceEdit;
|
7485 | if (workspaceEdit.documentChanges) {
|
7486 | this._changeAnnotations = new ChangeAnnotations(workspaceEdit.changeAnnotations);
|
7487 | workspaceEdit.changeAnnotations = this._changeAnnotations.all();
|
7488 | workspaceEdit.documentChanges.forEach(function (change) {
|
7489 | if (TextDocumentEdit.is(change)) {
|
7490 | var textEditChange = new TextEditChangeImpl(change.edits, _this._changeAnnotations);
|
7491 | _this._textEditChanges[change.textDocument.uri] = textEditChange;
|
7492 | }
|
7493 | });
|
7494 | }
|
7495 | else if (workspaceEdit.changes) {
|
7496 | Object.keys(workspaceEdit.changes).forEach(function (key) {
|
7497 | var textEditChange = new TextEditChangeImpl(workspaceEdit.changes[key]);
|
7498 | _this._textEditChanges[key] = textEditChange;
|
7499 | });
|
7500 | }
|
7501 | }
|
7502 | else {
|
7503 | this._workspaceEdit = {};
|
7504 | }
|
7505 | }
|
7506 | Object.defineProperty(WorkspaceChange.prototype, "edit", {
|
7507 | |
7508 |
|
7509 |
|
7510 |
|
7511 | get: function () {
|
7512 | this.initDocumentChanges();
|
7513 | if (this._changeAnnotations !== undefined) {
|
7514 | if (this._changeAnnotations.size === 0) {
|
7515 | this._workspaceEdit.changeAnnotations = undefined;
|
7516 | }
|
7517 | else {
|
7518 | this._workspaceEdit.changeAnnotations = this._changeAnnotations.all();
|
7519 | }
|
7520 | }
|
7521 | return this._workspaceEdit;
|
7522 | },
|
7523 | enumerable: false,
|
7524 | configurable: true
|
7525 | });
|
7526 | WorkspaceChange.prototype.getTextEditChange = function (key) {
|
7527 | if (OptionalVersionedTextDocumentIdentifier.is(key)) {
|
7528 | this.initDocumentChanges();
|
7529 | if (this._workspaceEdit.documentChanges === undefined) {
|
7530 | throw new Error('Workspace edit is not configured for document changes.');
|
7531 | }
|
7532 | var textDocument = { uri: key.uri, version: key.version };
|
7533 | var result = this._textEditChanges[textDocument.uri];
|
7534 | if (!result) {
|
7535 | var edits = [];
|
7536 | var textDocumentEdit = {
|
7537 | textDocument: textDocument,
|
7538 | edits: edits
|
7539 | };
|
7540 | this._workspaceEdit.documentChanges.push(textDocumentEdit);
|
7541 | result = new TextEditChangeImpl(edits, this._changeAnnotations);
|
7542 | this._textEditChanges[textDocument.uri] = result;
|
7543 | }
|
7544 | return result;
|
7545 | }
|
7546 | else {
|
7547 | this.initChanges();
|
7548 | if (this._workspaceEdit.changes === undefined) {
|
7549 | throw new Error('Workspace edit is not configured for normal text edit changes.');
|
7550 | }
|
7551 | var result = this._textEditChanges[key];
|
7552 | if (!result) {
|
7553 | var edits = [];
|
7554 | this._workspaceEdit.changes[key] = edits;
|
7555 | result = new TextEditChangeImpl(edits);
|
7556 | this._textEditChanges[key] = result;
|
7557 | }
|
7558 | return result;
|
7559 | }
|
7560 | };
|
7561 | WorkspaceChange.prototype.initDocumentChanges = function () {
|
7562 | if (this._workspaceEdit.documentChanges === undefined && this._workspaceEdit.changes === undefined) {
|
7563 | this._changeAnnotations = new ChangeAnnotations();
|
7564 | this._workspaceEdit.documentChanges = [];
|
7565 | this._workspaceEdit.changeAnnotations = this._changeAnnotations.all();
|
7566 | }
|
7567 | };
|
7568 | WorkspaceChange.prototype.initChanges = function () {
|
7569 | if (this._workspaceEdit.documentChanges === undefined && this._workspaceEdit.changes === undefined) {
|
7570 | this._workspaceEdit.changes = Object.create(null);
|
7571 | }
|
7572 | };
|
7573 | WorkspaceChange.prototype.createFile = function (uri, optionsOrAnnotation, options) {
|
7574 | this.initDocumentChanges();
|
7575 | if (this._workspaceEdit.documentChanges === undefined) {
|
7576 | throw new Error('Workspace edit is not configured for document changes.');
|
7577 | }
|
7578 | var annotation;
|
7579 | if (ChangeAnnotation.is(optionsOrAnnotation) || ChangeAnnotationIdentifier.is(optionsOrAnnotation)) {
|
7580 | annotation = optionsOrAnnotation;
|
7581 | }
|
7582 | else {
|
7583 | options = optionsOrAnnotation;
|
7584 | }
|
7585 | var operation;
|
7586 | var id;
|
7587 | if (annotation === undefined) {
|
7588 | operation = CreateFile.create(uri, options);
|
7589 | }
|
7590 | else {
|
7591 | id = ChangeAnnotationIdentifier.is(annotation) ? annotation : this._changeAnnotations.manage(annotation);
|
7592 | operation = CreateFile.create(uri, options, id);
|
7593 | }
|
7594 | this._workspaceEdit.documentChanges.push(operation);
|
7595 | if (id !== undefined) {
|
7596 | return id;
|
7597 | }
|
7598 | };
|
7599 | WorkspaceChange.prototype.renameFile = function (oldUri, newUri, optionsOrAnnotation, options) {
|
7600 | this.initDocumentChanges();
|
7601 | if (this._workspaceEdit.documentChanges === undefined) {
|
7602 | throw new Error('Workspace edit is not configured for document changes.');
|
7603 | }
|
7604 | var annotation;
|
7605 | if (ChangeAnnotation.is(optionsOrAnnotation) || ChangeAnnotationIdentifier.is(optionsOrAnnotation)) {
|
7606 | annotation = optionsOrAnnotation;
|
7607 | }
|
7608 | else {
|
7609 | options = optionsOrAnnotation;
|
7610 | }
|
7611 | var operation;
|
7612 | var id;
|
7613 | if (annotation === undefined) {
|
7614 | operation = RenameFile.create(oldUri, newUri, options);
|
7615 | }
|
7616 | else {
|
7617 | id = ChangeAnnotationIdentifier.is(annotation) ? annotation : this._changeAnnotations.manage(annotation);
|
7618 | operation = RenameFile.create(oldUri, newUri, options, id);
|
7619 | }
|
7620 | this._workspaceEdit.documentChanges.push(operation);
|
7621 | if (id !== undefined) {
|
7622 | return id;
|
7623 | }
|
7624 | };
|
7625 | WorkspaceChange.prototype.deleteFile = function (uri, optionsOrAnnotation, options) {
|
7626 | this.initDocumentChanges();
|
7627 | if (this._workspaceEdit.documentChanges === undefined) {
|
7628 | throw new Error('Workspace edit is not configured for document changes.');
|
7629 | }
|
7630 | var annotation;
|
7631 | if (ChangeAnnotation.is(optionsOrAnnotation) || ChangeAnnotationIdentifier.is(optionsOrAnnotation)) {
|
7632 | annotation = optionsOrAnnotation;
|
7633 | }
|
7634 | else {
|
7635 | options = optionsOrAnnotation;
|
7636 | }
|
7637 | var operation;
|
7638 | var id;
|
7639 | if (annotation === undefined) {
|
7640 | operation = DeleteFile.create(uri, options);
|
7641 | }
|
7642 | else {
|
7643 | id = ChangeAnnotationIdentifier.is(annotation) ? annotation : this._changeAnnotations.manage(annotation);
|
7644 | operation = DeleteFile.create(uri, options, id);
|
7645 | }
|
7646 | this._workspaceEdit.documentChanges.push(operation);
|
7647 | if (id !== undefined) {
|
7648 | return id;
|
7649 | }
|
7650 | };
|
7651 | return WorkspaceChange;
|
7652 | }());
|
7653 |
|
7654 |
|
7655 |
|
7656 |
|
7657 |
|
7658 | var TextDocumentIdentifier;
|
7659 | (function (TextDocumentIdentifier) {
|
7660 | |
7661 |
|
7662 |
|
7663 |
|
7664 | function create(uri) {
|
7665 | return { uri: uri };
|
7666 | }
|
7667 | TextDocumentIdentifier.create = create;
|
7668 | |
7669 |
|
7670 |
|
7671 | function is(value) {
|
7672 | var candidate = value;
|
7673 | return Is.defined(candidate) && Is.string(candidate.uri);
|
7674 | }
|
7675 | TextDocumentIdentifier.is = is;
|
7676 | })(TextDocumentIdentifier || (TextDocumentIdentifier = {}));
|
7677 |
|
7678 |
|
7679 |
|
7680 |
|
7681 | var VersionedTextDocumentIdentifier;
|
7682 | (function (VersionedTextDocumentIdentifier) {
|
7683 | |
7684 |
|
7685 |
|
7686 |
|
7687 |
|
7688 | function create(uri, version) {
|
7689 | return { uri: uri, version: version };
|
7690 | }
|
7691 | VersionedTextDocumentIdentifier.create = create;
|
7692 | |
7693 |
|
7694 |
|
7695 | function is(value) {
|
7696 | var candidate = value;
|
7697 | return Is.defined(candidate) && Is.string(candidate.uri) && Is.integer(candidate.version);
|
7698 | }
|
7699 | VersionedTextDocumentIdentifier.is = is;
|
7700 | })(VersionedTextDocumentIdentifier || (VersionedTextDocumentIdentifier = {}));
|
7701 |
|
7702 |
|
7703 |
|
7704 |
|
7705 | var OptionalVersionedTextDocumentIdentifier;
|
7706 | (function (OptionalVersionedTextDocumentIdentifier) {
|
7707 | |
7708 |
|
7709 |
|
7710 |
|
7711 |
|
7712 | function create(uri, version) {
|
7713 | return { uri: uri, version: version };
|
7714 | }
|
7715 | OptionalVersionedTextDocumentIdentifier.create = create;
|
7716 | |
7717 |
|
7718 |
|
7719 | function is(value) {
|
7720 | var candidate = value;
|
7721 | return Is.defined(candidate) && Is.string(candidate.uri) && (candidate.version === null || Is.integer(candidate.version));
|
7722 | }
|
7723 | OptionalVersionedTextDocumentIdentifier.is = is;
|
7724 | })(OptionalVersionedTextDocumentIdentifier || (OptionalVersionedTextDocumentIdentifier = {}));
|
7725 |
|
7726 |
|
7727 |
|
7728 |
|
7729 | var TextDocumentItem;
|
7730 | (function (TextDocumentItem) {
|
7731 | |
7732 |
|
7733 |
|
7734 |
|
7735 |
|
7736 |
|
7737 |
|
7738 | function create(uri, languageId, version, text) {
|
7739 | return { uri: uri, languageId: languageId, version: version, text: text };
|
7740 | }
|
7741 | TextDocumentItem.create = create;
|
7742 | |
7743 |
|
7744 |
|
7745 | function is(value) {
|
7746 | var candidate = value;
|
7747 | return Is.defined(candidate) && Is.string(candidate.uri) && Is.string(candidate.languageId) && Is.integer(candidate.version) && Is.string(candidate.text);
|
7748 | }
|
7749 | TextDocumentItem.is = is;
|
7750 | })(TextDocumentItem || (TextDocumentItem = {}));
|
7751 |
|
7752 |
|
7753 |
|
7754 |
|
7755 |
|
7756 |
|
7757 |
|
7758 | var MarkupKind;
|
7759 | (function (MarkupKind) {
|
7760 | |
7761 |
|
7762 |
|
7763 | MarkupKind.PlainText = 'plaintext';
|
7764 | |
7765 |
|
7766 |
|
7767 | MarkupKind.Markdown = 'markdown';
|
7768 | })(MarkupKind || (MarkupKind = {}));
|
7769 | (function (MarkupKind) {
|
7770 | |
7771 |
|
7772 |
|
7773 | function is(value) {
|
7774 | var candidate = value;
|
7775 | return candidate === MarkupKind.PlainText || candidate === MarkupKind.Markdown;
|
7776 | }
|
7777 | MarkupKind.is = is;
|
7778 | })(MarkupKind || (MarkupKind = {}));
|
7779 | var MarkupContent;
|
7780 | (function (MarkupContent) {
|
7781 | |
7782 |
|
7783 |
|
7784 | function is(value) {
|
7785 | var candidate = value;
|
7786 | return Is.objectLiteral(value) && MarkupKind.is(candidate.kind) && Is.string(candidate.value);
|
7787 | }
|
7788 | MarkupContent.is = is;
|
7789 | })(MarkupContent || (MarkupContent = {}));
|
7790 |
|
7791 |
|
7792 |
|
7793 | var CompletionItemKind;
|
7794 | (function (CompletionItemKind) {
|
7795 | CompletionItemKind.Text = 1;
|
7796 | CompletionItemKind.Method = 2;
|
7797 | CompletionItemKind.Function = 3;
|
7798 | CompletionItemKind.Constructor = 4;
|
7799 | CompletionItemKind.Field = 5;
|
7800 | CompletionItemKind.Variable = 6;
|
7801 | CompletionItemKind.Class = 7;
|
7802 | CompletionItemKind.Interface = 8;
|
7803 | CompletionItemKind.Module = 9;
|
7804 | CompletionItemKind.Property = 10;
|
7805 | CompletionItemKind.Unit = 11;
|
7806 | CompletionItemKind.Value = 12;
|
7807 | CompletionItemKind.Enum = 13;
|
7808 | CompletionItemKind.Keyword = 14;
|
7809 | CompletionItemKind.Snippet = 15;
|
7810 | CompletionItemKind.Color = 16;
|
7811 | CompletionItemKind.File = 17;
|
7812 | CompletionItemKind.Reference = 18;
|
7813 | CompletionItemKind.Folder = 19;
|
7814 | CompletionItemKind.EnumMember = 20;
|
7815 | CompletionItemKind.Constant = 21;
|
7816 | CompletionItemKind.Struct = 22;
|
7817 | CompletionItemKind.Event = 23;
|
7818 | CompletionItemKind.Operator = 24;
|
7819 | CompletionItemKind.TypeParameter = 25;
|
7820 | })(CompletionItemKind || (CompletionItemKind = {}));
|
7821 |
|
7822 |
|
7823 |
|
7824 |
|
7825 | var InsertTextFormat;
|
7826 | (function (InsertTextFormat) {
|
7827 | |
7828 |
|
7829 |
|
7830 | InsertTextFormat.PlainText = 1;
|
7831 | |
7832 |
|
7833 |
|
7834 |
|
7835 |
|
7836 |
|
7837 |
|
7838 |
|
7839 |
|
7840 |
|
7841 | InsertTextFormat.Snippet = 2;
|
7842 | })(InsertTextFormat || (InsertTextFormat = {}));
|
7843 |
|
7844 |
|
7845 |
|
7846 |
|
7847 |
|
7848 |
|
7849 | var CompletionItemTag;
|
7850 | (function (CompletionItemTag) {
|
7851 | |
7852 |
|
7853 |
|
7854 | CompletionItemTag.Deprecated = 1;
|
7855 | })(CompletionItemTag || (CompletionItemTag = {}));
|
7856 |
|
7857 |
|
7858 |
|
7859 |
|
7860 |
|
7861 | var InsertReplaceEdit;
|
7862 | (function (InsertReplaceEdit) {
|
7863 | |
7864 |
|
7865 |
|
7866 | function create(newText, insert, replace) {
|
7867 | return { newText: newText, insert: insert, replace: replace };
|
7868 | }
|
7869 | InsertReplaceEdit.create = create;
|
7870 | |
7871 |
|
7872 |
|
7873 | function is(value) {
|
7874 | var candidate = value;
|
7875 | return candidate && Is.string(candidate.newText) && Range.is(candidate.insert) && Range.is(candidate.replace);
|
7876 | }
|
7877 | InsertReplaceEdit.is = is;
|
7878 | })(InsertReplaceEdit || (InsertReplaceEdit = {}));
|
7879 |
|
7880 |
|
7881 |
|
7882 |
|
7883 |
|
7884 |
|
7885 | var InsertTextMode;
|
7886 | (function (InsertTextMode) {
|
7887 | |
7888 |
|
7889 |
|
7890 |
|
7891 |
|
7892 |
|
7893 |
|
7894 | InsertTextMode.asIs = 1;
|
7895 | |
7896 |
|
7897 |
|
7898 |
|
7899 |
|
7900 |
|
7901 |
|
7902 |
|
7903 |
|
7904 | InsertTextMode.adjustIndentation = 2;
|
7905 | })(InsertTextMode || (InsertTextMode = {}));
|
7906 |
|
7907 |
|
7908 |
|
7909 |
|
7910 | var CompletionItem;
|
7911 | (function (CompletionItem) {
|
7912 | |
7913 |
|
7914 |
|
7915 |
|
7916 | function create(label) {
|
7917 | return { label: label };
|
7918 | }
|
7919 | CompletionItem.create = create;
|
7920 | })(CompletionItem || (CompletionItem = {}));
|
7921 |
|
7922 |
|
7923 |
|
7924 |
|
7925 | var CompletionList;
|
7926 | (function (CompletionList) {
|
7927 | |
7928 |
|
7929 |
|
7930 |
|
7931 |
|
7932 |
|
7933 | function create(items, isIncomplete) {
|
7934 | return { items: items ? items : [], isIncomplete: !!isIncomplete };
|
7935 | }
|
7936 | CompletionList.create = create;
|
7937 | })(CompletionList || (CompletionList = {}));
|
7938 | var MarkedString;
|
7939 | (function (MarkedString) {
|
7940 | |
7941 |
|
7942 |
|
7943 |
|
7944 |
|
7945 | function fromPlainText(plainText) {
|
7946 | return plainText.replace(/[\\`*_{}[\]()#+\-.!]/g, '\\$&');
|
7947 | }
|
7948 | MarkedString.fromPlainText = fromPlainText;
|
7949 | |
7950 |
|
7951 |
|
7952 | function is(value) {
|
7953 | var candidate = value;
|
7954 | return Is.string(candidate) || (Is.objectLiteral(candidate) && Is.string(candidate.language) && Is.string(candidate.value));
|
7955 | }
|
7956 | MarkedString.is = is;
|
7957 | })(MarkedString || (MarkedString = {}));
|
7958 | var Hover;
|
7959 | (function (Hover) {
|
7960 | |
7961 |
|
7962 |
|
7963 | function is(value) {
|
7964 | var candidate = value;
|
7965 | return !!candidate && Is.objectLiteral(candidate) && (MarkupContent.is(candidate.contents) ||
|
7966 | MarkedString.is(candidate.contents) ||
|
7967 | Is.typedArray(candidate.contents, MarkedString.is)) && (value.range === undefined || Range.is(value.range));
|
7968 | }
|
7969 | Hover.is = is;
|
7970 | })(Hover || (Hover = {}));
|
7971 |
|
7972 |
|
7973 |
|
7974 |
|
7975 | var ParameterInformation;
|
7976 | (function (ParameterInformation) {
|
7977 | |
7978 |
|
7979 |
|
7980 |
|
7981 |
|
7982 |
|
7983 | function create(label, documentation) {
|
7984 | return documentation ? { label: label, documentation: documentation } : { label: label };
|
7985 | }
|
7986 | ParameterInformation.create = create;
|
7987 | })(ParameterInformation || (ParameterInformation = {}));
|
7988 |
|
7989 |
|
7990 |
|
7991 |
|
7992 | var SignatureInformation;
|
7993 | (function (SignatureInformation) {
|
7994 | function create(label, documentation) {
|
7995 | var parameters = [];
|
7996 | for (var _i = 2; _i < arguments.length; _i++) {
|
7997 | parameters[_i - 2] = arguments[_i];
|
7998 | }
|
7999 | var result = { label: label };
|
8000 | if (Is.defined(documentation)) {
|
8001 | result.documentation = documentation;
|
8002 | }
|
8003 | if (Is.defined(parameters)) {
|
8004 | result.parameters = parameters;
|
8005 | }
|
8006 | else {
|
8007 | result.parameters = [];
|
8008 | }
|
8009 | return result;
|
8010 | }
|
8011 | SignatureInformation.create = create;
|
8012 | })(SignatureInformation || (SignatureInformation = {}));
|
8013 |
|
8014 |
|
8015 |
|
8016 | var DocumentHighlightKind;
|
8017 | (function (DocumentHighlightKind) {
|
8018 | |
8019 |
|
8020 |
|
8021 | DocumentHighlightKind.Text = 1;
|
8022 | |
8023 |
|
8024 |
|
8025 | DocumentHighlightKind.Read = 2;
|
8026 | |
8027 |
|
8028 |
|
8029 | DocumentHighlightKind.Write = 3;
|
8030 | })(DocumentHighlightKind || (DocumentHighlightKind = {}));
|
8031 |
|
8032 |
|
8033 |
|
8034 |
|
8035 | var DocumentHighlight;
|
8036 | (function (DocumentHighlight) {
|
8037 | |
8038 |
|
8039 |
|
8040 |
|
8041 | function create(range, kind) {
|
8042 | var result = { range: range };
|
8043 | if (Is.number(kind)) {
|
8044 | result.kind = kind;
|
8045 | }
|
8046 | return result;
|
8047 | }
|
8048 | DocumentHighlight.create = create;
|
8049 | })(DocumentHighlight || (DocumentHighlight = {}));
|
8050 |
|
8051 |
|
8052 |
|
8053 | var SymbolKind;
|
8054 | (function (SymbolKind) {
|
8055 | SymbolKind.File = 1;
|
8056 | SymbolKind.Module = 2;
|
8057 | SymbolKind.Namespace = 3;
|
8058 | SymbolKind.Package = 4;
|
8059 | SymbolKind.Class = 5;
|
8060 | SymbolKind.Method = 6;
|
8061 | SymbolKind.Property = 7;
|
8062 | SymbolKind.Field = 8;
|
8063 | SymbolKind.Constructor = 9;
|
8064 | SymbolKind.Enum = 10;
|
8065 | SymbolKind.Interface = 11;
|
8066 | SymbolKind.Function = 12;
|
8067 | SymbolKind.Variable = 13;
|
8068 | SymbolKind.Constant = 14;
|
8069 | SymbolKind.String = 15;
|
8070 | SymbolKind.Number = 16;
|
8071 | SymbolKind.Boolean = 17;
|
8072 | SymbolKind.Array = 18;
|
8073 | SymbolKind.Object = 19;
|
8074 | SymbolKind.Key = 20;
|
8075 | SymbolKind.Null = 21;
|
8076 | SymbolKind.EnumMember = 22;
|
8077 | SymbolKind.Struct = 23;
|
8078 | SymbolKind.Event = 24;
|
8079 | SymbolKind.Operator = 25;
|
8080 | SymbolKind.TypeParameter = 26;
|
8081 | })(SymbolKind || (SymbolKind = {}));
|
8082 |
|
8083 |
|
8084 |
|
8085 |
|
8086 | var SymbolTag;
|
8087 | (function (SymbolTag) {
|
8088 | |
8089 |
|
8090 |
|
8091 | SymbolTag.Deprecated = 1;
|
8092 | })(SymbolTag || (SymbolTag = {}));
|
8093 | var SymbolInformation;
|
8094 | (function (SymbolInformation) {
|
8095 | |
8096 |
|
8097 |
|
8098 |
|
8099 |
|
8100 |
|
8101 |
|
8102 |
|
8103 |
|
8104 | function create(name, kind, range, uri, containerName) {
|
8105 | var result = {
|
8106 | name: name,
|
8107 | kind: kind,
|
8108 | location: { uri: uri, range: range }
|
8109 | };
|
8110 | if (containerName) {
|
8111 | result.containerName = containerName;
|
8112 | }
|
8113 | return result;
|
8114 | }
|
8115 | SymbolInformation.create = create;
|
8116 | })(SymbolInformation || (SymbolInformation = {}));
|
8117 | var DocumentSymbol;
|
8118 | (function (DocumentSymbol) {
|
8119 | |
8120 |
|
8121 |
|
8122 |
|
8123 |
|
8124 |
|
8125 |
|
8126 |
|
8127 |
|
8128 |
|
8129 | function create(name, detail, kind, range, selectionRange, children) {
|
8130 | var result = {
|
8131 | name: name,
|
8132 | detail: detail,
|
8133 | kind: kind,
|
8134 | range: range,
|
8135 | selectionRange: selectionRange
|
8136 | };
|
8137 | if (children !== undefined) {
|
8138 | result.children = children;
|
8139 | }
|
8140 | return result;
|
8141 | }
|
8142 | DocumentSymbol.create = create;
|
8143 | |
8144 |
|
8145 |
|
8146 | function is(value) {
|
8147 | var candidate = value;
|
8148 | return candidate &&
|
8149 | Is.string(candidate.name) && Is.number(candidate.kind) &&
|
8150 | Range.is(candidate.range) && Range.is(candidate.selectionRange) &&
|
8151 | (candidate.detail === undefined || Is.string(candidate.detail)) &&
|
8152 | (candidate.deprecated === undefined || Is.boolean(candidate.deprecated)) &&
|
8153 | (candidate.children === undefined || Array.isArray(candidate.children)) &&
|
8154 | (candidate.tags === undefined || Array.isArray(candidate.tags));
|
8155 | }
|
8156 | DocumentSymbol.is = is;
|
8157 | })(DocumentSymbol || (DocumentSymbol = {}));
|
8158 |
|
8159 |
|
8160 |
|
8161 | var CodeActionKind;
|
8162 | (function (CodeActionKind) {
|
8163 | |
8164 |
|
8165 |
|
8166 | CodeActionKind.Empty = '';
|
8167 | |
8168 |
|
8169 |
|
8170 | CodeActionKind.QuickFix = 'quickfix';
|
8171 | |
8172 |
|
8173 |
|
8174 | CodeActionKind.Refactor = 'refactor';
|
8175 | |
8176 |
|
8177 |
|
8178 |
|
8179 |
|
8180 |
|
8181 |
|
8182 |
|
8183 |
|
8184 |
|
8185 |
|
8186 | CodeActionKind.RefactorExtract = 'refactor.extract';
|
8187 | |
8188 |
|
8189 |
|
8190 |
|
8191 |
|
8192 |
|
8193 |
|
8194 |
|
8195 |
|
8196 |
|
8197 | CodeActionKind.RefactorInline = 'refactor.inline';
|
8198 | |
8199 |
|
8200 |
|
8201 |
|
8202 |
|
8203 |
|
8204 |
|
8205 |
|
8206 |
|
8207 |
|
8208 |
|
8209 |
|
8210 | CodeActionKind.RefactorRewrite = 'refactor.rewrite';
|
8211 | |
8212 |
|
8213 |
|
8214 |
|
8215 |
|
8216 | CodeActionKind.Source = 'source';
|
8217 | |
8218 |
|
8219 |
|
8220 | CodeActionKind.SourceOrganizeImports = 'source.organizeImports';
|
8221 | |
8222 |
|
8223 |
|
8224 |
|
8225 |
|
8226 |
|
8227 |
|
8228 |
|
8229 | CodeActionKind.SourceFixAll = 'source.fixAll';
|
8230 | })(CodeActionKind || (CodeActionKind = {}));
|
8231 |
|
8232 |
|
8233 |
|
8234 |
|
8235 | var CodeActionContext;
|
8236 | (function (CodeActionContext) {
|
8237 | |
8238 |
|
8239 |
|
8240 | function create(diagnostics, only) {
|
8241 | var result = { diagnostics: diagnostics };
|
8242 | if (only !== undefined && only !== null) {
|
8243 | result.only = only;
|
8244 | }
|
8245 | return result;
|
8246 | }
|
8247 | CodeActionContext.create = create;
|
8248 | |
8249 |
|
8250 |
|
8251 | function is(value) {
|
8252 | var candidate = value;
|
8253 | return Is.defined(candidate) && Is.typedArray(candidate.diagnostics, Diagnostic.is) && (candidate.only === undefined || Is.typedArray(candidate.only, Is.string));
|
8254 | }
|
8255 | CodeActionContext.is = is;
|
8256 | })(CodeActionContext || (CodeActionContext = {}));
|
8257 | var CodeAction;
|
8258 | (function (CodeAction) {
|
8259 | function create(title, kindOrCommandOrEdit, kind) {
|
8260 | var result = { title: title };
|
8261 | var checkKind = true;
|
8262 | if (typeof kindOrCommandOrEdit === 'string') {
|
8263 | checkKind = false;
|
8264 | result.kind = kindOrCommandOrEdit;
|
8265 | }
|
8266 | else if (Command.is(kindOrCommandOrEdit)) {
|
8267 | result.command = kindOrCommandOrEdit;
|
8268 | }
|
8269 | else {
|
8270 | result.edit = kindOrCommandOrEdit;
|
8271 | }
|
8272 | if (checkKind && kind !== undefined) {
|
8273 | result.kind = kind;
|
8274 | }
|
8275 | return result;
|
8276 | }
|
8277 | CodeAction.create = create;
|
8278 | function is(value) {
|
8279 | var candidate = value;
|
8280 | return candidate && Is.string(candidate.title) &&
|
8281 | (candidate.diagnostics === undefined || Is.typedArray(candidate.diagnostics, Diagnostic.is)) &&
|
8282 | (candidate.kind === undefined || Is.string(candidate.kind)) &&
|
8283 | (candidate.edit !== undefined || candidate.command !== undefined) &&
|
8284 | (candidate.command === undefined || Command.is(candidate.command)) &&
|
8285 | (candidate.isPreferred === undefined || Is.boolean(candidate.isPreferred)) &&
|
8286 | (candidate.edit === undefined || WorkspaceEdit.is(candidate.edit));
|
8287 | }
|
8288 | CodeAction.is = is;
|
8289 | })(CodeAction || (CodeAction = {}));
|
8290 |
|
8291 |
|
8292 |
|
8293 |
|
8294 | var CodeLens;
|
8295 | (function (CodeLens) {
|
8296 | |
8297 |
|
8298 |
|
8299 | function create(range, data) {
|
8300 | var result = { range: range };
|
8301 | if (Is.defined(data)) {
|
8302 | result.data = data;
|
8303 | }
|
8304 | return result;
|
8305 | }
|
8306 | CodeLens.create = create;
|
8307 | |
8308 |
|
8309 |
|
8310 | function is(value) {
|
8311 | var candidate = value;
|
8312 | return Is.defined(candidate) && Range.is(candidate.range) && (Is.undefined(candidate.command) || Command.is(candidate.command));
|
8313 | }
|
8314 | CodeLens.is = is;
|
8315 | })(CodeLens || (CodeLens = {}));
|
8316 |
|
8317 |
|
8318 |
|
8319 |
|
8320 | var FormattingOptions;
|
8321 | (function (FormattingOptions) {
|
8322 | |
8323 |
|
8324 |
|
8325 | function create(tabSize, insertSpaces) {
|
8326 | return { tabSize: tabSize, insertSpaces: insertSpaces };
|
8327 | }
|
8328 | FormattingOptions.create = create;
|
8329 | |
8330 |
|
8331 |
|
8332 | function is(value) {
|
8333 | var candidate = value;
|
8334 | return Is.defined(candidate) && Is.uinteger(candidate.tabSize) && Is.boolean(candidate.insertSpaces);
|
8335 | }
|
8336 | FormattingOptions.is = is;
|
8337 | })(FormattingOptions || (FormattingOptions = {}));
|
8338 |
|
8339 |
|
8340 |
|
8341 |
|
8342 | var DocumentLink;
|
8343 | (function (DocumentLink) {
|
8344 | |
8345 |
|
8346 |
|
8347 | function create(range, target, data) {
|
8348 | return { range: range, target: target, data: data };
|
8349 | }
|
8350 | DocumentLink.create = create;
|
8351 | |
8352 |
|
8353 |
|
8354 | function is(value) {
|
8355 | var candidate = value;
|
8356 | return Is.defined(candidate) && Range.is(candidate.range) && (Is.undefined(candidate.target) || Is.string(candidate.target));
|
8357 | }
|
8358 | DocumentLink.is = is;
|
8359 | })(DocumentLink || (DocumentLink = {}));
|
8360 |
|
8361 |
|
8362 |
|
8363 |
|
8364 | var SelectionRange;
|
8365 | (function (SelectionRange) {
|
8366 | |
8367 |
|
8368 |
|
8369 |
|
8370 |
|
8371 | function create(range, parent) {
|
8372 | return { range: range, parent: parent };
|
8373 | }
|
8374 | SelectionRange.create = create;
|
8375 | function is(value) {
|
8376 | var candidate = value;
|
8377 | return candidate !== undefined && Range.is(candidate.range) && (candidate.parent === undefined || SelectionRange.is(candidate.parent));
|
8378 | }
|
8379 | SelectionRange.is = is;
|
8380 | })(SelectionRange || (SelectionRange = {}));
|
8381 | var EOL = ['\n', '\r\n', '\r'];
|
8382 |
|
8383 |
|
8384 |
|
8385 | var TextDocument;
|
8386 | (function (TextDocument) {
|
8387 | |
8388 |
|
8389 |
|
8390 |
|
8391 |
|
8392 |
|
8393 | function create(uri, languageId, version, content) {
|
8394 | return new FullTextDocument(uri, languageId, version, content);
|
8395 | }
|
8396 | TextDocument.create = create;
|
8397 | |
8398 |
|
8399 |
|
8400 | function is(value) {
|
8401 | var candidate = value;
|
8402 | return Is.defined(candidate) && Is.string(candidate.uri) && (Is.undefined(candidate.languageId) || Is.string(candidate.languageId)) && Is.uinteger(candidate.lineCount)
|
8403 | && Is.func(candidate.getText) && Is.func(candidate.positionAt) && Is.func(candidate.offsetAt) ? true : false;
|
8404 | }
|
8405 | TextDocument.is = is;
|
8406 | function applyEdits(document, edits) {
|
8407 | var text = document.getText();
|
8408 | var sortedEdits = mergeSort(edits, function (a, b) {
|
8409 | var diff = a.range.start.line - b.range.start.line;
|
8410 | if (diff === 0) {
|
8411 | return a.range.start.character - b.range.start.character;
|
8412 | }
|
8413 | return diff;
|
8414 | });
|
8415 | var lastModifiedOffset = text.length;
|
8416 | for (var i = sortedEdits.length - 1; i >= 0; i--) {
|
8417 | var e = sortedEdits[i];
|
8418 | var startOffset = document.offsetAt(e.range.start);
|
8419 | var endOffset = document.offsetAt(e.range.end);
|
8420 | if (endOffset <= lastModifiedOffset) {
|
8421 | text = text.substring(0, startOffset) + e.newText + text.substring(endOffset, text.length);
|
8422 | }
|
8423 | else {
|
8424 | throw new Error('Overlapping edit');
|
8425 | }
|
8426 | lastModifiedOffset = startOffset;
|
8427 | }
|
8428 | return text;
|
8429 | }
|
8430 | TextDocument.applyEdits = applyEdits;
|
8431 | function mergeSort(data, compare) {
|
8432 | if (data.length <= 1) {
|
8433 |
|
8434 | return data;
|
8435 | }
|
8436 | var p = (data.length / 2) | 0;
|
8437 | var left = data.slice(0, p);
|
8438 | var right = data.slice(p);
|
8439 | mergeSort(left, compare);
|
8440 | mergeSort(right, compare);
|
8441 | var leftIdx = 0;
|
8442 | var rightIdx = 0;
|
8443 | var i = 0;
|
8444 | while (leftIdx < left.length && rightIdx < right.length) {
|
8445 | var ret = compare(left[leftIdx], right[rightIdx]);
|
8446 | if (ret <= 0) {
|
8447 |
|
8448 | data[i++] = left[leftIdx++];
|
8449 | }
|
8450 | else {
|
8451 |
|
8452 | data[i++] = right[rightIdx++];
|
8453 | }
|
8454 | }
|
8455 | while (leftIdx < left.length) {
|
8456 | data[i++] = left[leftIdx++];
|
8457 | }
|
8458 | while (rightIdx < right.length) {
|
8459 | data[i++] = right[rightIdx++];
|
8460 | }
|
8461 | return data;
|
8462 | }
|
8463 | })(TextDocument || (TextDocument = {}));
|
8464 |
|
8465 |
|
8466 |
|
8467 | var FullTextDocument = (function () {
|
8468 | function FullTextDocument(uri, languageId, version, content) {
|
8469 | this._uri = uri;
|
8470 | this._languageId = languageId;
|
8471 | this._version = version;
|
8472 | this._content = content;
|
8473 | this._lineOffsets = undefined;
|
8474 | }
|
8475 | Object.defineProperty(FullTextDocument.prototype, "uri", {
|
8476 | get: function () {
|
8477 | return this._uri;
|
8478 | },
|
8479 | enumerable: false,
|
8480 | configurable: true
|
8481 | });
|
8482 | Object.defineProperty(FullTextDocument.prototype, "languageId", {
|
8483 | get: function () {
|
8484 | return this._languageId;
|
8485 | },
|
8486 | enumerable: false,
|
8487 | configurable: true
|
8488 | });
|
8489 | Object.defineProperty(FullTextDocument.prototype, "version", {
|
8490 | get: function () {
|
8491 | return this._version;
|
8492 | },
|
8493 | enumerable: false,
|
8494 | configurable: true
|
8495 | });
|
8496 | FullTextDocument.prototype.getText = function (range) {
|
8497 | if (range) {
|
8498 | var start = this.offsetAt(range.start);
|
8499 | var end = this.offsetAt(range.end);
|
8500 | return this._content.substring(start, end);
|
8501 | }
|
8502 | return this._content;
|
8503 | };
|
8504 | FullTextDocument.prototype.update = function (event, version) {
|
8505 | this._content = event.text;
|
8506 | this._version = version;
|
8507 | this._lineOffsets = undefined;
|
8508 | };
|
8509 | FullTextDocument.prototype.getLineOffsets = function () {
|
8510 | if (this._lineOffsets === undefined) {
|
8511 | var lineOffsets = [];
|
8512 | var text = this._content;
|
8513 | var isLineStart = true;
|
8514 | for (var i = 0; i < text.length; i++) {
|
8515 | if (isLineStart) {
|
8516 | lineOffsets.push(i);
|
8517 | isLineStart = false;
|
8518 | }
|
8519 | var ch = text.charAt(i);
|
8520 | isLineStart = (ch === '\r' || ch === '\n');
|
8521 | if (ch === '\r' && i + 1 < text.length && text.charAt(i + 1) === '\n') {
|
8522 | i++;
|
8523 | }
|
8524 | }
|
8525 | if (isLineStart && text.length > 0) {
|
8526 | lineOffsets.push(text.length);
|
8527 | }
|
8528 | this._lineOffsets = lineOffsets;
|
8529 | }
|
8530 | return this._lineOffsets;
|
8531 | };
|
8532 | FullTextDocument.prototype.positionAt = function (offset) {
|
8533 | offset = Math.max(Math.min(offset, this._content.length), 0);
|
8534 | var lineOffsets = this.getLineOffsets();
|
8535 | var low = 0, high = lineOffsets.length;
|
8536 | if (high === 0) {
|
8537 | return Position.create(0, offset);
|
8538 | }
|
8539 | while (low < high) {
|
8540 | var mid = Math.floor((low + high) / 2);
|
8541 | if (lineOffsets[mid] > offset) {
|
8542 | high = mid;
|
8543 | }
|
8544 | else {
|
8545 | low = mid + 1;
|
8546 | }
|
8547 | }
|
8548 |
|
8549 |
|
8550 | var line = low - 1;
|
8551 | return Position.create(line, offset - lineOffsets[line]);
|
8552 | };
|
8553 | FullTextDocument.prototype.offsetAt = function (position) {
|
8554 | var lineOffsets = this.getLineOffsets();
|
8555 | if (position.line >= lineOffsets.length) {
|
8556 | return this._content.length;
|
8557 | }
|
8558 | else if (position.line < 0) {
|
8559 | return 0;
|
8560 | }
|
8561 | var lineOffset = lineOffsets[position.line];
|
8562 | var nextLineOffset = (position.line + 1 < lineOffsets.length) ? lineOffsets[position.line + 1] : this._content.length;
|
8563 | return Math.max(Math.min(lineOffset + position.character, nextLineOffset), lineOffset);
|
8564 | };
|
8565 | Object.defineProperty(FullTextDocument.prototype, "lineCount", {
|
8566 | get: function () {
|
8567 | return this.getLineOffsets().length;
|
8568 | },
|
8569 | enumerable: false,
|
8570 | configurable: true
|
8571 | });
|
8572 | return FullTextDocument;
|
8573 | }());
|
8574 | var Is;
|
8575 | (function (Is) {
|
8576 | var toString = Object.prototype.toString;
|
8577 | function defined(value) {
|
8578 | return typeof value !== 'undefined';
|
8579 | }
|
8580 | Is.defined = defined;
|
8581 | function undefined(value) {
|
8582 | return typeof value === 'undefined';
|
8583 | }
|
8584 | Is.undefined = undefined;
|
8585 | function boolean(value) {
|
8586 | return value === true || value === false;
|
8587 | }
|
8588 | Is.boolean = boolean;
|
8589 | function string(value) {
|
8590 | return toString.call(value) === '[object String]';
|
8591 | }
|
8592 | Is.string = string;
|
8593 | function number(value) {
|
8594 | return toString.call(value) === '[object Number]';
|
8595 | }
|
8596 | Is.number = number;
|
8597 | function numberRange(value, min, max) {
|
8598 | return toString.call(value) === '[object Number]' && min <= value && value <= max;
|
8599 | }
|
8600 | Is.numberRange = numberRange;
|
8601 | function integer(value) {
|
8602 | return toString.call(value) === '[object Number]' && -2147483648 <= value && value <= 2147483647;
|
8603 | }
|
8604 | Is.integer = integer;
|
8605 | function uinteger(value) {
|
8606 | return toString.call(value) === '[object Number]' && 0 <= value && value <= 2147483647;
|
8607 | }
|
8608 | Is.uinteger = uinteger;
|
8609 | function func(value) {
|
8610 | return toString.call(value) === '[object Function]';
|
8611 | }
|
8612 | Is.func = func;
|
8613 | function objectLiteral(value) {
|
8614 |
|
8615 |
|
8616 |
|
8617 | return value !== null && typeof value === 'object';
|
8618 | }
|
8619 | Is.objectLiteral = objectLiteral;
|
8620 | function typedArray(value, check) {
|
8621 | return Array.isArray(value) && value.every(check);
|
8622 | }
|
8623 | Is.typedArray = typedArray;
|
8624 | })(Is || (Is = {}));
|
8625 |
|
8626 |
|
8627 | }),
|
8628 |
|
8629 | 63:
|
8630 | (function(__unused_webpack_module, exports, __webpack_require__) {
|
8631 |
|
8632 | "use strict";
|
8633 |
|
8634 |
|
8635 |
|
8636 |
|
8637 |
|
8638 | var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
8639 | if (k2 === undefined) k2 = k;
|
8640 | Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
8641 | }) : (function(o, m, k, k2) {
|
8642 | if (k2 === undefined) k2 = k;
|
8643 | o[k2] = m[k];
|
8644 | }));
|
8645 | var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
8646 | for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
8647 | };
|
8648 | Object.defineProperty(exports, "__esModule", ({ value: true }));
|
8649 | exports.ProposedFeatures = exports.SemanticTokensBuilder = void 0;
|
8650 | const semanticTokens_1 = __webpack_require__(53);
|
8651 | Object.defineProperty(exports, "SemanticTokensBuilder", ({ enumerable: true, get: function () { return semanticTokens_1.SemanticTokensBuilder; } }));
|
8652 | __exportStar(__webpack_require__(5), exports);
|
8653 | __exportStar(__webpack_require__(4), exports);
|
8654 | var ProposedFeatures;
|
8655 | (function (ProposedFeatures) {
|
8656 | ProposedFeatures.all = {
|
8657 | __brand: 'features'
|
8658 | };
|
8659 | })(ProposedFeatures = exports.ProposedFeatures || (exports.ProposedFeatures = {}));
|
8660 |
|
8661 |
|
8662 | }),
|
8663 |
|
8664 | 52:
|
8665 | ((__unused_webpack_module, exports, __webpack_require__) => {
|
8666 |
|
8667 | "use strict";
|
8668 |
|
8669 |
|
8670 |
|
8671 |
|
8672 |
|
8673 | Object.defineProperty(exports, "__esModule", ({ value: true }));
|
8674 | exports.CallHierarchyFeature = void 0;
|
8675 | const vscode_languageserver_protocol_1 = __webpack_require__(5);
|
8676 | const CallHierarchyFeature = (Base) => {
|
8677 | return class extends Base {
|
8678 | get callHierarchy() {
|
8679 | return {
|
8680 | onPrepare: (handler) => {
|
8681 | this.connection.onRequest(vscode_languageserver_protocol_1.CallHierarchyPrepareRequest.type, (params, cancel) => {
|
8682 | return handler(params, cancel, this.attachWorkDoneProgress(params), undefined);
|
8683 | });
|
8684 | },
|
8685 | onIncomingCalls: (handler) => {
|
8686 | const type = vscode_languageserver_protocol_1.CallHierarchyIncomingCallsRequest.type;
|
8687 | this.connection.onRequest(type, (params, cancel) => {
|
8688 | return handler(params, cancel, this.attachWorkDoneProgress(params), this.attachPartialResultProgress(type, params));
|
8689 | });
|
8690 | },
|
8691 | onOutgoingCalls: (handler) => {
|
8692 | const type = vscode_languageserver_protocol_1.CallHierarchyOutgoingCallsRequest.type;
|
8693 | this.connection.onRequest(type, (params, cancel) => {
|
8694 | return handler(params, cancel, this.attachWorkDoneProgress(params), this.attachPartialResultProgress(type, params));
|
8695 | });
|
8696 | }
|
8697 | };
|
8698 | }
|
8699 | };
|
8700 | };
|
8701 | exports.CallHierarchyFeature = CallHierarchyFeature;
|
8702 |
|
8703 |
|
8704 | }),
|
8705 |
|
8706 | 50:
|
8707 | ((__unused_webpack_module, exports, __webpack_require__) => {
|
8708 |
|
8709 | "use strict";
|
8710 |
|
8711 |
|
8712 |
|
8713 |
|
8714 |
|
8715 | Object.defineProperty(exports, "__esModule", ({ value: true }));
|
8716 | exports.ConfigurationFeature = void 0;
|
8717 | const vscode_languageserver_protocol_1 = __webpack_require__(5);
|
8718 | const Is = __webpack_require__(3);
|
8719 | const ConfigurationFeature = (Base) => {
|
8720 | return class extends Base {
|
8721 | getConfiguration(arg) {
|
8722 | if (!arg) {
|
8723 | return this._getConfiguration({});
|
8724 | }
|
8725 | else if (Is.string(arg)) {
|
8726 | return this._getConfiguration({ section: arg });
|
8727 | }
|
8728 | else {
|
8729 | return this._getConfiguration(arg);
|
8730 | }
|
8731 | }
|
8732 | _getConfiguration(arg) {
|
8733 | let params = {
|
8734 | items: Array.isArray(arg) ? arg : [arg]
|
8735 | };
|
8736 | return this.connection.sendRequest(vscode_languageserver_protocol_1.ConfigurationRequest.type, params).then((result) => {
|
8737 | return Array.isArray(arg) ? result : result[0];
|
8738 | });
|
8739 | }
|
8740 | };
|
8741 | };
|
8742 | exports.ConfigurationFeature = ConfigurationFeature;
|
8743 |
|
8744 |
|
8745 | }),
|
8746 |
|
8747 | 55:
|
8748 | ((__unused_webpack_module, exports, __webpack_require__) => {
|
8749 |
|
8750 | "use strict";
|
8751 |
|
8752 |
|
8753 |
|
8754 |
|
8755 |
|
8756 | Object.defineProperty(exports, "__esModule", ({ value: true }));
|
8757 | exports.FileOperationsFeature = void 0;
|
8758 | const vscode_languageserver_protocol_1 = __webpack_require__(5);
|
8759 | const FileOperationsFeature = (Base) => {
|
8760 | return class extends Base {
|
8761 | onDidCreateFiles(handler) {
|
8762 | this.connection.onNotification(vscode_languageserver_protocol_1.DidCreateFilesNotification.type, (params) => {
|
8763 | handler(params);
|
8764 | });
|
8765 | }
|
8766 | onDidRenameFiles(handler) {
|
8767 | this.connection.onNotification(vscode_languageserver_protocol_1.DidRenameFilesNotification.type, (params) => {
|
8768 | handler(params);
|
8769 | });
|
8770 | }
|
8771 | onDidDeleteFiles(handler) {
|
8772 | this.connection.onNotification(vscode_languageserver_protocol_1.DidDeleteFilesNotification.type, (params) => {
|
8773 | handler(params);
|
8774 | });
|
8775 | }
|
8776 | onWillCreateFiles(handler) {
|
8777 | return this.connection.onRequest(vscode_languageserver_protocol_1.WillCreateFilesRequest.type, (params, cancel) => {
|
8778 | return handler(params, cancel);
|
8779 | });
|
8780 | }
|
8781 | onWillRenameFiles(handler) {
|
8782 | return this.connection.onRequest(vscode_languageserver_protocol_1.WillRenameFilesRequest.type, (params, cancel) => {
|
8783 | return handler(params, cancel);
|
8784 | });
|
8785 | }
|
8786 | onWillDeleteFiles(handler) {
|
8787 | return this.connection.onRequest(vscode_languageserver_protocol_1.WillDeleteFilesRequest.type, (params, cancel) => {
|
8788 | return handler(params, cancel);
|
8789 | });
|
8790 | }
|
8791 | };
|
8792 | };
|
8793 | exports.FileOperationsFeature = FileOperationsFeature;
|
8794 |
|
8795 |
|
8796 | }),
|
8797 |
|
8798 | 56:
|
8799 | ((__unused_webpack_module, exports, __webpack_require__) => {
|
8800 |
|
8801 | "use strict";
|
8802 |
|
8803 |
|
8804 |
|
8805 |
|
8806 |
|
8807 | Object.defineProperty(exports, "__esModule", ({ value: true }));
|
8808 | exports.LinkedEditingRangeFeature = void 0;
|
8809 | const vscode_languageserver_protocol_1 = __webpack_require__(5);
|
8810 | const LinkedEditingRangeFeature = (Base) => {
|
8811 | return class extends Base {
|
8812 | onLinkedEditingRange(handler) {
|
8813 | this.connection.onRequest(vscode_languageserver_protocol_1.LinkedEditingRangeRequest.type, (params, cancel) => {
|
8814 | return handler(params, cancel, this.attachWorkDoneProgress(params), undefined);
|
8815 | });
|
8816 | }
|
8817 | };
|
8818 | };
|
8819 | exports.LinkedEditingRangeFeature = LinkedEditingRangeFeature;
|
8820 |
|
8821 |
|
8822 | }),
|
8823 |
|
8824 | 57:
|
8825 | ((__unused_webpack_module, exports, __webpack_require__) => {
|
8826 |
|
8827 | "use strict";
|
8828 |
|
8829 |
|
8830 |
|
8831 |
|
8832 |
|
8833 | Object.defineProperty(exports, "__esModule", ({ value: true }));
|
8834 | exports.MonikerFeature = void 0;
|
8835 | const vscode_languageserver_protocol_1 = __webpack_require__(5);
|
8836 | const MonikerFeature = (Base) => {
|
8837 | return class extends Base {
|
8838 | get moniker() {
|
8839 | return {
|
8840 | on: (handler) => {
|
8841 | const type = vscode_languageserver_protocol_1.MonikerRequest.type;
|
8842 | this.connection.onRequest(type, (params, cancel) => {
|
8843 | return handler(params, cancel, this.attachWorkDoneProgress(params), this.attachPartialResultProgress(type, params));
|
8844 | });
|
8845 | },
|
8846 | };
|
8847 | }
|
8848 | };
|
8849 | };
|
8850 | exports.MonikerFeature = MonikerFeature;
|
8851 |
|
8852 |
|
8853 | }),
|
8854 |
|
8855 | 49:
|
8856 | ((__unused_webpack_module, exports, __webpack_require__) => {
|
8857 |
|
8858 | "use strict";
|
8859 |
|
8860 |
|
8861 |
|
8862 |
|
8863 |
|
8864 | Object.defineProperty(exports, "__esModule", ({ value: true }));
|
8865 | exports.attachPartialResult = exports.ProgressFeature = exports.attachWorkDone = void 0;
|
8866 | const vscode_languageserver_protocol_1 = __webpack_require__(5);
|
8867 | const uuid_1 = __webpack_require__(48);
|
8868 | class WorkDoneProgressReporterImpl {
|
8869 | constructor(_connection, _token) {
|
8870 | this._connection = _connection;
|
8871 | this._token = _token;
|
8872 | WorkDoneProgressReporterImpl.Instances.set(this._token, this);
|
8873 | }
|
8874 | begin(title, percentage, message, cancellable) {
|
8875 | let param = {
|
8876 | kind: 'begin',
|
8877 | title,
|
8878 | percentage,
|
8879 | message,
|
8880 | cancellable
|
8881 | };
|
8882 | this._connection.sendProgress(vscode_languageserver_protocol_1.WorkDoneProgress.type, this._token, param);
|
8883 | }
|
8884 | report(arg0, arg1) {
|
8885 | let param = {
|
8886 | kind: 'report'
|
8887 | };
|
8888 | if (typeof arg0 === 'number') {
|
8889 | param.percentage = arg0;
|
8890 | if (arg1 !== undefined) {
|
8891 | param.message = arg1;
|
8892 | }
|
8893 | }
|
8894 | else {
|
8895 | param.message = arg0;
|
8896 | }
|
8897 | this._connection.sendProgress(vscode_languageserver_protocol_1.WorkDoneProgress.type, this._token, param);
|
8898 | }
|
8899 | done() {
|
8900 | WorkDoneProgressReporterImpl.Instances.delete(this._token);
|
8901 | this._connection.sendProgress(vscode_languageserver_protocol_1.WorkDoneProgress.type, this._token, { kind: 'end' });
|
8902 | }
|
8903 | }
|
8904 | WorkDoneProgressReporterImpl.Instances = new Map();
|
8905 | class WorkDoneProgressServerReporterImpl extends WorkDoneProgressReporterImpl {
|
8906 | constructor(connection, token) {
|
8907 | super(connection, token);
|
8908 | this._source = new vscode_languageserver_protocol_1.CancellationTokenSource();
|
8909 | }
|
8910 | get token() {
|
8911 | return this._source.token;
|
8912 | }
|
8913 | done() {
|
8914 | this._source.dispose();
|
8915 | super.done();
|
8916 | }
|
8917 | cancel() {
|
8918 | this._source.cancel();
|
8919 | }
|
8920 | }
|
8921 | class NullProgressReporter {
|
8922 | constructor() {
|
8923 | }
|
8924 | begin() {
|
8925 | }
|
8926 | report() {
|
8927 | }
|
8928 | done() {
|
8929 | }
|
8930 | }
|
8931 | class NullProgressServerReporter extends NullProgressReporter {
|
8932 | constructor() {
|
8933 | super();
|
8934 | this._source = new vscode_languageserver_protocol_1.CancellationTokenSource();
|
8935 | }
|
8936 | get token() {
|
8937 | return this._source.token;
|
8938 | }
|
8939 | done() {
|
8940 | this._source.dispose();
|
8941 | }
|
8942 | cancel() {
|
8943 | this._source.cancel();
|
8944 | }
|
8945 | }
|
8946 | function attachWorkDone(connection, params) {
|
8947 | if (params === undefined || params.workDoneToken === undefined) {
|
8948 | return new NullProgressReporter();
|
8949 | }
|
8950 | const token = params.workDoneToken;
|
8951 | delete params.workDoneToken;
|
8952 | return new WorkDoneProgressReporterImpl(connection, token);
|
8953 | }
|
8954 | exports.attachWorkDone = attachWorkDone;
|
8955 | const ProgressFeature = (Base) => {
|
8956 | return class extends Base {
|
8957 | constructor() {
|
8958 | super();
|
8959 | this._progressSupported = false;
|
8960 | }
|
8961 | initialize(capabilities) {
|
8962 | var _a;
|
8963 | if (((_a = capabilities === null || capabilities === void 0 ? void 0 : capabilities.window) === null || _a === void 0 ? void 0 : _a.workDoneProgress) === true) {
|
8964 | this._progressSupported = true;
|
8965 | this.connection.onNotification(vscode_languageserver_protocol_1.WorkDoneProgressCancelNotification.type, (params) => {
|
8966 | let progress = WorkDoneProgressReporterImpl.Instances.get(params.token);
|
8967 | if (progress instanceof WorkDoneProgressServerReporterImpl || progress instanceof NullProgressServerReporter) {
|
8968 | progress.cancel();
|
8969 | }
|
8970 | });
|
8971 | }
|
8972 | }
|
8973 | attachWorkDoneProgress(token) {
|
8974 | if (token === undefined) {
|
8975 | return new NullProgressReporter();
|
8976 | }
|
8977 | else {
|
8978 | return new WorkDoneProgressReporterImpl(this.connection, token);
|
8979 | }
|
8980 | }
|
8981 | createWorkDoneProgress() {
|
8982 | if (this._progressSupported) {
|
8983 | const token = uuid_1.generateUuid();
|
8984 | return this.connection.sendRequest(vscode_languageserver_protocol_1.WorkDoneProgressCreateRequest.type, { token }).then(() => {
|
8985 | const result = new WorkDoneProgressServerReporterImpl(this.connection, token);
|
8986 | return result;
|
8987 | });
|
8988 | }
|
8989 | else {
|
8990 | return Promise.resolve(new NullProgressServerReporter());
|
8991 | }
|
8992 | }
|
8993 | };
|
8994 | };
|
8995 | exports.ProgressFeature = ProgressFeature;
|
8996 | var ResultProgress;
|
8997 | (function (ResultProgress) {
|
8998 | ResultProgress.type = new vscode_languageserver_protocol_1.ProgressType();
|
8999 | })(ResultProgress || (ResultProgress = {}));
|
9000 | class ResultProgressReporterImpl {
|
9001 | constructor(_connection, _token) {
|
9002 | this._connection = _connection;
|
9003 | this._token = _token;
|
9004 | }
|
9005 | report(data) {
|
9006 | this._connection.sendProgress(ResultProgress.type, this._token, data);
|
9007 | }
|
9008 | }
|
9009 | function attachPartialResult(connection, params) {
|
9010 | if (params === undefined || params.partialResultToken === undefined) {
|
9011 | return undefined;
|
9012 | }
|
9013 | const token = params.partialResultToken;
|
9014 | delete params.partialResultToken;
|
9015 | return new ResultProgressReporterImpl(connection, token);
|
9016 | }
|
9017 | exports.attachPartialResult = attachPartialResult;
|
9018 |
|
9019 |
|
9020 | }),
|
9021 |
|
9022 | 53:
|
9023 | ((__unused_webpack_module, exports, __webpack_require__) => {
|
9024 |
|
9025 | "use strict";
|
9026 |
|
9027 |
|
9028 |
|
9029 |
|
9030 |
|
9031 | Object.defineProperty(exports, "__esModule", ({ value: true }));
|
9032 | exports.SemanticTokensBuilder = exports.SemanticTokensFeature = void 0;
|
9033 | const vscode_languageserver_protocol_1 = __webpack_require__(5);
|
9034 | const SemanticTokensFeature = (Base) => {
|
9035 | return class extends Base {
|
9036 | get semanticTokens() {
|
9037 | return {
|
9038 | on: (handler) => {
|
9039 | const type = vscode_languageserver_protocol_1.SemanticTokensRequest.type;
|
9040 | this.connection.onRequest(type, (params, cancel) => {
|
9041 | return handler(params, cancel, this.attachWorkDoneProgress(params), this.attachPartialResultProgress(type, params));
|
9042 | });
|
9043 | },
|
9044 | onDelta: (handler) => {
|
9045 | const type = vscode_languageserver_protocol_1.SemanticTokensDeltaRequest.type;
|
9046 | this.connection.onRequest(type, (params, cancel) => {
|
9047 | return handler(params, cancel, this.attachWorkDoneProgress(params), this.attachPartialResultProgress(type, params));
|
9048 | });
|
9049 | },
|
9050 | onRange: (handler) => {
|
9051 | const type = vscode_languageserver_protocol_1.SemanticTokensRangeRequest.type;
|
9052 | this.connection.onRequest(type, (params, cancel) => {
|
9053 | return handler(params, cancel, this.attachWorkDoneProgress(params), this.attachPartialResultProgress(type, params));
|
9054 | });
|
9055 | }
|
9056 | };
|
9057 | }
|
9058 | };
|
9059 | };
|
9060 | exports.SemanticTokensFeature = SemanticTokensFeature;
|
9061 | class SemanticTokensBuilder {
|
9062 | constructor() {
|
9063 | this._prevData = undefined;
|
9064 | this.initialize();
|
9065 | }
|
9066 | initialize() {
|
9067 | this._id = Date.now();
|
9068 | this._prevLine = 0;
|
9069 | this._prevChar = 0;
|
9070 | this._data = [];
|
9071 | this._dataLen = 0;
|
9072 | }
|
9073 | push(line, char, length, tokenType, tokenModifiers) {
|
9074 | let pushLine = line;
|
9075 | let pushChar = char;
|
9076 | if (this._dataLen > 0) {
|
9077 | pushLine -= this._prevLine;
|
9078 | if (pushLine === 0) {
|
9079 | pushChar -= this._prevChar;
|
9080 | }
|
9081 | }
|
9082 | this._data[this._dataLen++] = pushLine;
|
9083 | this._data[this._dataLen++] = pushChar;
|
9084 | this._data[this._dataLen++] = length;
|
9085 | this._data[this._dataLen++] = tokenType;
|
9086 | this._data[this._dataLen++] = tokenModifiers;
|
9087 | this._prevLine = line;
|
9088 | this._prevChar = char;
|
9089 | }
|
9090 | get id() {
|
9091 | return this._id.toString();
|
9092 | }
|
9093 | previousResult(id) {
|
9094 | if (this.id === id) {
|
9095 | this._prevData = this._data;
|
9096 | }
|
9097 | this.initialize();
|
9098 | }
|
9099 | build() {
|
9100 | this._prevData = undefined;
|
9101 | return {
|
9102 | resultId: this.id,
|
9103 | data: this._data
|
9104 | };
|
9105 | }
|
9106 | canBuildEdits() {
|
9107 | return this._prevData !== undefined;
|
9108 | }
|
9109 | buildEdits() {
|
9110 | if (this._prevData !== undefined) {
|
9111 | const prevDataLength = this._prevData.length;
|
9112 | const dataLength = this._data.length;
|
9113 | let startIndex = 0;
|
9114 | while (startIndex < dataLength && startIndex < prevDataLength && this._prevData[startIndex] === this._data[startIndex]) {
|
9115 | startIndex++;
|
9116 | }
|
9117 | if (startIndex < dataLength && startIndex < prevDataLength) {
|
9118 |
|
9119 | let endIndex = 0;
|
9120 | while (endIndex < dataLength && endIndex < prevDataLength && this._prevData[prevDataLength - 1 - endIndex] === this._data[dataLength - 1 - endIndex]) {
|
9121 | endIndex++;
|
9122 | }
|
9123 | const newData = this._data.slice(startIndex, dataLength - endIndex);
|
9124 | const result = {
|
9125 | resultId: this.id,
|
9126 | edits: [
|
9127 | { start: startIndex, deleteCount: prevDataLength - endIndex - startIndex, data: newData }
|
9128 | ]
|
9129 | };
|
9130 | return result;
|
9131 | }
|
9132 | else if (startIndex < dataLength) {
|
9133 | return { resultId: this.id, edits: [
|
9134 | { start: startIndex, deleteCount: 0, data: this._data.slice(startIndex) }
|
9135 | ] };
|
9136 | }
|
9137 | else if (startIndex < prevDataLength) {
|
9138 | return { resultId: this.id, edits: [
|
9139 | { start: startIndex, deleteCount: prevDataLength - startIndex }
|
9140 | ] };
|
9141 | }
|
9142 | else {
|
9143 | return { resultId: this.id, edits: [] };
|
9144 | }
|
9145 | }
|
9146 | else {
|
9147 | return this.build();
|
9148 | }
|
9149 | }
|
9150 | }
|
9151 | exports.SemanticTokensBuilder = SemanticTokensBuilder;
|
9152 |
|
9153 |
|
9154 | }),
|
9155 |
|
9156 | 4:
|
9157 | ((__unused_webpack_module, exports, __webpack_require__) => {
|
9158 |
|
9159 | "use strict";
|
9160 |
|
9161 |
|
9162 |
|
9163 |
|
9164 |
|
9165 | Object.defineProperty(exports, "__esModule", ({ value: true }));
|
9166 | exports.createConnection = exports.combineFeatures = exports.combineLanguagesFeatures = exports.combineWorkspaceFeatures = exports.combineWindowFeatures = exports.combineClientFeatures = exports.combineTracerFeatures = exports.combineTelemetryFeatures = exports.combineConsoleFeatures = exports._LanguagesImpl = exports.BulkUnregistration = exports.BulkRegistration = exports.ErrorMessageTracker = exports.TextDocuments = void 0;
|
9167 | const vscode_languageserver_protocol_1 = __webpack_require__(5);
|
9168 | const Is = __webpack_require__(3);
|
9169 | const UUID = __webpack_require__(48);
|
9170 | const progress_1 = __webpack_require__(49);
|
9171 | const configuration_1 = __webpack_require__(50);
|
9172 | const workspaceFolders_1 = __webpack_require__(51);
|
9173 | const callHierarchy_1 = __webpack_require__(52);
|
9174 | const semanticTokens_1 = __webpack_require__(53);
|
9175 | const showDocument_1 = __webpack_require__(54);
|
9176 | const fileOperations_1 = __webpack_require__(55);
|
9177 | const linkedEditingRange_1 = __webpack_require__(56);
|
9178 | const moniker_1 = __webpack_require__(57);
|
9179 | function null2Undefined(value) {
|
9180 | if (value === null) {
|
9181 | return undefined;
|
9182 | }
|
9183 | return value;
|
9184 | }
|
9185 |
|
9186 |
|
9187 |
|
9188 | class TextDocuments {
|
9189 | |
9190 |
|
9191 |
|
9192 | constructor(configuration) {
|
9193 | this._documents = Object.create(null);
|
9194 | this._configuration = configuration;
|
9195 | this._onDidChangeContent = new vscode_languageserver_protocol_1.Emitter();
|
9196 | this._onDidOpen = new vscode_languageserver_protocol_1.Emitter();
|
9197 | this._onDidClose = new vscode_languageserver_protocol_1.Emitter();
|
9198 | this._onDidSave = new vscode_languageserver_protocol_1.Emitter();
|
9199 | this._onWillSave = new vscode_languageserver_protocol_1.Emitter();
|
9200 | }
|
9201 | |
9202 |
|
9203 |
|
9204 |
|
9205 | get onDidChangeContent() {
|
9206 | return this._onDidChangeContent.event;
|
9207 | }
|
9208 | |
9209 |
|
9210 |
|
9211 |
|
9212 | get onDidOpen() {
|
9213 | return this._onDidOpen.event;
|
9214 | }
|
9215 | |
9216 |
|
9217 |
|
9218 |
|
9219 | get onWillSave() {
|
9220 | return this._onWillSave.event;
|
9221 | }
|
9222 | |
9223 |
|
9224 |
|
9225 |
|
9226 | onWillSaveWaitUntil(handler) {
|
9227 | this._willSaveWaitUntil = handler;
|
9228 | }
|
9229 | |
9230 |
|
9231 |
|
9232 |
|
9233 | get onDidSave() {
|
9234 | return this._onDidSave.event;
|
9235 | }
|
9236 | |
9237 |
|
9238 |
|
9239 |
|
9240 | get onDidClose() {
|
9241 | return this._onDidClose.event;
|
9242 | }
|
9243 | |
9244 |
|
9245 |
|
9246 |
|
9247 |
|
9248 |
|
9249 |
|
9250 | get(uri) {
|
9251 | return this._documents[uri];
|
9252 | }
|
9253 | |
9254 |
|
9255 |
|
9256 |
|
9257 |
|
9258 | all() {
|
9259 | return Object.keys(this._documents).map(key => this._documents[key]);
|
9260 | }
|
9261 | |
9262 |
|
9263 |
|
9264 |
|
9265 |
|
9266 | keys() {
|
9267 | return Object.keys(this._documents);
|
9268 | }
|
9269 | |
9270 |
|
9271 |
|
9272 |
|
9273 |
|
9274 |
|
9275 |
|
9276 |
|
9277 |
|
9278 |
|
9279 |
|
9280 |
|
9281 |
|
9282 | listen(connection) {
|
9283 | connection.__textDocumentSync = vscode_languageserver_protocol_1.TextDocumentSyncKind.Full;
|
9284 | connection.onDidOpenTextDocument((event) => {
|
9285 | let td = event.textDocument;
|
9286 | let document = this._configuration.create(td.uri, td.languageId, td.version, td.text);
|
9287 | this._documents[td.uri] = document;
|
9288 | let toFire = Object.freeze({ document });
|
9289 | this._onDidOpen.fire(toFire);
|
9290 | this._onDidChangeContent.fire(toFire);
|
9291 | });
|
9292 | connection.onDidChangeTextDocument((event) => {
|
9293 | let td = event.textDocument;
|
9294 | let changes = event.contentChanges;
|
9295 | if (changes.length === 0) {
|
9296 | return;
|
9297 | }
|
9298 | let document = this._documents[td.uri];
|
9299 | const { version } = td;
|
9300 | if (version === null || version === undefined) {
|
9301 | throw new Error(`Received document change event for ${td.uri} without valid version identifier`);
|
9302 | }
|
9303 | document = this._configuration.update(document, changes, version);
|
9304 | this._documents[td.uri] = document;
|
9305 | this._onDidChangeContent.fire(Object.freeze({ document }));
|
9306 | });
|
9307 | connection.onDidCloseTextDocument((event) => {
|
9308 | let document = this._documents[event.textDocument.uri];
|
9309 | if (document) {
|
9310 | delete this._documents[event.textDocument.uri];
|
9311 | this._onDidClose.fire(Object.freeze({ document }));
|
9312 | }
|
9313 | });
|
9314 | connection.onWillSaveTextDocument((event) => {
|
9315 | let document = this._documents[event.textDocument.uri];
|
9316 | if (document) {
|
9317 | this._onWillSave.fire(Object.freeze({ document, reason: event.reason }));
|
9318 | }
|
9319 | });
|
9320 | connection.onWillSaveTextDocumentWaitUntil((event, token) => {
|
9321 | let document = this._documents[event.textDocument.uri];
|
9322 | if (document && this._willSaveWaitUntil) {
|
9323 | return this._willSaveWaitUntil(Object.freeze({ document, reason: event.reason }), token);
|
9324 | }
|
9325 | else {
|
9326 | return [];
|
9327 | }
|
9328 | });
|
9329 | connection.onDidSaveTextDocument((event) => {
|
9330 | let document = this._documents[event.textDocument.uri];
|
9331 | if (document) {
|
9332 | this._onDidSave.fire(Object.freeze({ document }));
|
9333 | }
|
9334 | });
|
9335 | }
|
9336 | }
|
9337 | exports.TextDocuments = TextDocuments;
|
9338 |
|
9339 |
|
9340 |
|
9341 |
|
9342 |
|
9343 |
|
9344 | class ErrorMessageTracker {
|
9345 | constructor() {
|
9346 | this._messages = Object.create(null);
|
9347 | }
|
9348 | |
9349 |
|
9350 |
|
9351 |
|
9352 |
|
9353 | add(message) {
|
9354 | let count = this._messages[message];
|
9355 | if (!count) {
|
9356 | count = 0;
|
9357 | }
|
9358 | count++;
|
9359 | this._messages[message] = count;
|
9360 | }
|
9361 | |
9362 |
|
9363 |
|
9364 |
|
9365 |
|
9366 | sendErrors(connection) {
|
9367 | Object.keys(this._messages).forEach(message => {
|
9368 | connection.window.showErrorMessage(message);
|
9369 | });
|
9370 | }
|
9371 | }
|
9372 | exports.ErrorMessageTracker = ErrorMessageTracker;
|
9373 | class RemoteConsoleImpl {
|
9374 | constructor() {
|
9375 | }
|
9376 | rawAttach(connection) {
|
9377 | this._rawConnection = connection;
|
9378 | }
|
9379 | attach(connection) {
|
9380 | this._connection = connection;
|
9381 | }
|
9382 | get connection() {
|
9383 | if (!this._connection) {
|
9384 | throw new Error('Remote is not attached to a connection yet.');
|
9385 | }
|
9386 | return this._connection;
|
9387 | }
|
9388 | fillServerCapabilities(_capabilities) {
|
9389 | }
|
9390 | initialize(_capabilities) {
|
9391 | }
|
9392 | error(message) {
|
9393 | this.send(vscode_languageserver_protocol_1.MessageType.Error, message);
|
9394 | }
|
9395 | warn(message) {
|
9396 | this.send(vscode_languageserver_protocol_1.MessageType.Warning, message);
|
9397 | }
|
9398 | info(message) {
|
9399 | this.send(vscode_languageserver_protocol_1.MessageType.Info, message);
|
9400 | }
|
9401 | log(message) {
|
9402 | this.send(vscode_languageserver_protocol_1.MessageType.Log, message);
|
9403 | }
|
9404 | send(type, message) {
|
9405 | if (this._rawConnection) {
|
9406 | this._rawConnection.sendNotification(vscode_languageserver_protocol_1.LogMessageNotification.type, { type, message });
|
9407 | }
|
9408 | }
|
9409 | }
|
9410 | class _RemoteWindowImpl {
|
9411 | constructor() {
|
9412 | }
|
9413 | attach(connection) {
|
9414 | this._connection = connection;
|
9415 | }
|
9416 | get connection() {
|
9417 | if (!this._connection) {
|
9418 | throw new Error('Remote is not attached to a connection yet.');
|
9419 | }
|
9420 | return this._connection;
|
9421 | }
|
9422 | initialize(_capabilities) {
|
9423 | }
|
9424 | fillServerCapabilities(_capabilities) {
|
9425 | }
|
9426 | showErrorMessage(message, ...actions) {
|
9427 | let params = { type: vscode_languageserver_protocol_1.MessageType.Error, message, actions };
|
9428 | return this.connection.sendRequest(vscode_languageserver_protocol_1.ShowMessageRequest.type, params).then(null2Undefined);
|
9429 | }
|
9430 | showWarningMessage(message, ...actions) {
|
9431 | let params = { type: vscode_languageserver_protocol_1.MessageType.Warning, message, actions };
|
9432 | return this.connection.sendRequest(vscode_languageserver_protocol_1.ShowMessageRequest.type, params).then(null2Undefined);
|
9433 | }
|
9434 | showInformationMessage(message, ...actions) {
|
9435 | let params = { type: vscode_languageserver_protocol_1.MessageType.Info, message, actions };
|
9436 | return this.connection.sendRequest(vscode_languageserver_protocol_1.ShowMessageRequest.type, params).then(null2Undefined);
|
9437 | }
|
9438 | }
|
9439 | const RemoteWindowImpl = showDocument_1.ShowDocumentFeature(progress_1.ProgressFeature(_RemoteWindowImpl));
|
9440 | var BulkRegistration;
|
9441 | (function (BulkRegistration) {
|
9442 | |
9443 |
|
9444 |
|
9445 |
|
9446 | function create() {
|
9447 | return new BulkRegistrationImpl();
|
9448 | }
|
9449 | BulkRegistration.create = create;
|
9450 | })(BulkRegistration = exports.BulkRegistration || (exports.BulkRegistration = {}));
|
9451 | class BulkRegistrationImpl {
|
9452 | constructor() {
|
9453 | this._registrations = [];
|
9454 | this._registered = new Set();
|
9455 | }
|
9456 | add(type, registerOptions) {
|
9457 | const method = Is.string(type) ? type : type.method;
|
9458 | if (this._registered.has(method)) {
|
9459 | throw new Error(`${method} is already added to this registration`);
|
9460 | }
|
9461 | const id = UUID.generateUuid();
|
9462 | this._registrations.push({
|
9463 | id: id,
|
9464 | method: method,
|
9465 | registerOptions: registerOptions || {}
|
9466 | });
|
9467 | this._registered.add(method);
|
9468 | }
|
9469 | asRegistrationParams() {
|
9470 | return {
|
9471 | registrations: this._registrations
|
9472 | };
|
9473 | }
|
9474 | }
|
9475 | var BulkUnregistration;
|
9476 | (function (BulkUnregistration) {
|
9477 | function create() {
|
9478 | return new BulkUnregistrationImpl(undefined, []);
|
9479 | }
|
9480 | BulkUnregistration.create = create;
|
9481 | })(BulkUnregistration = exports.BulkUnregistration || (exports.BulkUnregistration = {}));
|
9482 | class BulkUnregistrationImpl {
|
9483 | constructor(_connection, unregistrations) {
|
9484 | this._connection = _connection;
|
9485 | this._unregistrations = new Map();
|
9486 | unregistrations.forEach(unregistration => {
|
9487 | this._unregistrations.set(unregistration.method, unregistration);
|
9488 | });
|
9489 | }
|
9490 | get isAttached() {
|
9491 | return !!this._connection;
|
9492 | }
|
9493 | attach(connection) {
|
9494 | this._connection = connection;
|
9495 | }
|
9496 | add(unregistration) {
|
9497 | this._unregistrations.set(unregistration.method, unregistration);
|
9498 | }
|
9499 | dispose() {
|
9500 | let unregistrations = [];
|
9501 | for (let unregistration of this._unregistrations.values()) {
|
9502 | unregistrations.push(unregistration);
|
9503 | }
|
9504 | let params = {
|
9505 | unregisterations: unregistrations
|
9506 | };
|
9507 | this._connection.sendRequest(vscode_languageserver_protocol_1.UnregistrationRequest.type, params).then(undefined, (_error) => {
|
9508 | this._connection.console.info(`Bulk unregistration failed.`);
|
9509 | });
|
9510 | }
|
9511 | disposeSingle(arg) {
|
9512 | const method = Is.string(arg) ? arg : arg.method;
|
9513 | const unregistration = this._unregistrations.get(method);
|
9514 | if (!unregistration) {
|
9515 | return false;
|
9516 | }
|
9517 | let params = {
|
9518 | unregisterations: [unregistration]
|
9519 | };
|
9520 | this._connection.sendRequest(vscode_languageserver_protocol_1.UnregistrationRequest.type, params).then(() => {
|
9521 | this._unregistrations.delete(method);
|
9522 | }, (_error) => {
|
9523 | this._connection.console.info(`Un-registering request handler for ${unregistration.id} failed.`);
|
9524 | });
|
9525 | return true;
|
9526 | }
|
9527 | }
|
9528 | class RemoteClientImpl {
|
9529 | attach(connection) {
|
9530 | this._connection = connection;
|
9531 | }
|
9532 | get connection() {
|
9533 | if (!this._connection) {
|
9534 | throw new Error('Remote is not attached to a connection yet.');
|
9535 | }
|
9536 | return this._connection;
|
9537 | }
|
9538 | initialize(_capabilities) {
|
9539 | }
|
9540 | fillServerCapabilities(_capabilities) {
|
9541 | }
|
9542 | register(typeOrRegistrations, registerOptionsOrType, registerOptions) {
|
9543 | if (typeOrRegistrations instanceof BulkRegistrationImpl) {
|
9544 | return this.registerMany(typeOrRegistrations);
|
9545 | }
|
9546 | else if (typeOrRegistrations instanceof BulkUnregistrationImpl) {
|
9547 | return this.registerSingle1(typeOrRegistrations, registerOptionsOrType, registerOptions);
|
9548 | }
|
9549 | else {
|
9550 | return this.registerSingle2(typeOrRegistrations, registerOptionsOrType);
|
9551 | }
|
9552 | }
|
9553 | registerSingle1(unregistration, type, registerOptions) {
|
9554 | const method = Is.string(type) ? type : type.method;
|
9555 | const id = UUID.generateUuid();
|
9556 | let params = {
|
9557 | registrations: [{ id, method, registerOptions: registerOptions || {} }]
|
9558 | };
|
9559 | if (!unregistration.isAttached) {
|
9560 | unregistration.attach(this.connection);
|
9561 | }
|
9562 | return this.connection.sendRequest(vscode_languageserver_protocol_1.RegistrationRequest.type, params).then((_result) => {
|
9563 | unregistration.add({ id: id, method: method });
|
9564 | return unregistration;
|
9565 | }, (_error) => {
|
9566 | this.connection.console.info(`Registering request handler for ${method} failed.`);
|
9567 | return Promise.reject(_error);
|
9568 | });
|
9569 | }
|
9570 | registerSingle2(type, registerOptions) {
|
9571 | const method = Is.string(type) ? type : type.method;
|
9572 | const id = UUID.generateUuid();
|
9573 | let params = {
|
9574 | registrations: [{ id, method, registerOptions: registerOptions || {} }]
|
9575 | };
|
9576 | return this.connection.sendRequest(vscode_languageserver_protocol_1.RegistrationRequest.type, params).then((_result) => {
|
9577 | return vscode_languageserver_protocol_1.Disposable.create(() => {
|
9578 | this.unregisterSingle(id, method);
|
9579 | });
|
9580 | }, (_error) => {
|
9581 | this.connection.console.info(`Registering request handler for ${method} failed.`);
|
9582 | return Promise.reject(_error);
|
9583 | });
|
9584 | }
|
9585 | unregisterSingle(id, method) {
|
9586 | let params = {
|
9587 | unregisterations: [{ id, method }]
|
9588 | };
|
9589 | return this.connection.sendRequest(vscode_languageserver_protocol_1.UnregistrationRequest.type, params).then(undefined, (_error) => {
|
9590 | this.connection.console.info(`Un-registering request handler for ${id} failed.`);
|
9591 | });
|
9592 | }
|
9593 | registerMany(registrations) {
|
9594 | let params = registrations.asRegistrationParams();
|
9595 | return this.connection.sendRequest(vscode_languageserver_protocol_1.RegistrationRequest.type, params).then(() => {
|
9596 | return new BulkUnregistrationImpl(this._connection, params.registrations.map(registration => { return { id: registration.id, method: registration.method }; }));
|
9597 | }, (_error) => {
|
9598 | this.connection.console.info(`Bulk registration failed.`);
|
9599 | return Promise.reject(_error);
|
9600 | });
|
9601 | }
|
9602 | }
|
9603 | class _RemoteWorkspaceImpl {
|
9604 | constructor() {
|
9605 | }
|
9606 | attach(connection) {
|
9607 | this._connection = connection;
|
9608 | }
|
9609 | get connection() {
|
9610 | if (!this._connection) {
|
9611 | throw new Error('Remote is not attached to a connection yet.');
|
9612 | }
|
9613 | return this._connection;
|
9614 | }
|
9615 | initialize(_capabilities) {
|
9616 | }
|
9617 | fillServerCapabilities(_capabilities) {
|
9618 | }
|
9619 | applyEdit(paramOrEdit) {
|
9620 | function isApplyWorkspaceEditParams(value) {
|
9621 | return value && !!value.edit;
|
9622 | }
|
9623 | let params = isApplyWorkspaceEditParams(paramOrEdit) ? paramOrEdit : { edit: paramOrEdit };
|
9624 | return this.connection.sendRequest(vscode_languageserver_protocol_1.ApplyWorkspaceEditRequest.type, params);
|
9625 | }
|
9626 | }
|
9627 | const RemoteWorkspaceImpl = fileOperations_1.FileOperationsFeature(workspaceFolders_1.WorkspaceFoldersFeature(configuration_1.ConfigurationFeature(_RemoteWorkspaceImpl)));
|
9628 | class TracerImpl {
|
9629 | constructor() {
|
9630 | this._trace = vscode_languageserver_protocol_1.Trace.Off;
|
9631 | }
|
9632 | attach(connection) {
|
9633 | this._connection = connection;
|
9634 | }
|
9635 | get connection() {
|
9636 | if (!this._connection) {
|
9637 | throw new Error('Remote is not attached to a connection yet.');
|
9638 | }
|
9639 | return this._connection;
|
9640 | }
|
9641 | initialize(_capabilities) {
|
9642 | }
|
9643 | fillServerCapabilities(_capabilities) {
|
9644 | }
|
9645 | set trace(value) {
|
9646 | this._trace = value;
|
9647 | }
|
9648 | log(message, verbose) {
|
9649 | if (this._trace === vscode_languageserver_protocol_1.Trace.Off) {
|
9650 | return;
|
9651 | }
|
9652 | this.connection.sendNotification(vscode_languageserver_protocol_1.LogTraceNotification.type, {
|
9653 | message: message,
|
9654 | verbose: this._trace === vscode_languageserver_protocol_1.Trace.Verbose ? verbose : undefined
|
9655 | });
|
9656 | }
|
9657 | }
|
9658 | class TelemetryImpl {
|
9659 | constructor() {
|
9660 | }
|
9661 | attach(connection) {
|
9662 | this._connection = connection;
|
9663 | }
|
9664 | get connection() {
|
9665 | if (!this._connection) {
|
9666 | throw new Error('Remote is not attached to a connection yet.');
|
9667 | }
|
9668 | return this._connection;
|
9669 | }
|
9670 | initialize(_capabilities) {
|
9671 | }
|
9672 | fillServerCapabilities(_capabilities) {
|
9673 | }
|
9674 | logEvent(data) {
|
9675 | this.connection.sendNotification(vscode_languageserver_protocol_1.TelemetryEventNotification.type, data);
|
9676 | }
|
9677 | }
|
9678 | class _LanguagesImpl {
|
9679 | constructor() {
|
9680 | }
|
9681 | attach(connection) {
|
9682 | this._connection = connection;
|
9683 | }
|
9684 | get connection() {
|
9685 | if (!this._connection) {
|
9686 | throw new Error('Remote is not attached to a connection yet.');
|
9687 | }
|
9688 | return this._connection;
|
9689 | }
|
9690 | initialize(_capabilities) {
|
9691 | }
|
9692 | fillServerCapabilities(_capabilities) {
|
9693 | }
|
9694 | attachWorkDoneProgress(params) {
|
9695 | return progress_1.attachWorkDone(this.connection, params);
|
9696 | }
|
9697 | attachPartialResultProgress(_type, params) {
|
9698 | return progress_1.attachPartialResult(this.connection, params);
|
9699 | }
|
9700 | }
|
9701 | exports._LanguagesImpl = _LanguagesImpl;
|
9702 | const LanguagesImpl = moniker_1.MonikerFeature(linkedEditingRange_1.LinkedEditingRangeFeature(semanticTokens_1.SemanticTokensFeature(callHierarchy_1.CallHierarchyFeature(_LanguagesImpl))));
|
9703 | function combineConsoleFeatures(one, two) {
|
9704 | return function (Base) {
|
9705 | return two(one(Base));
|
9706 | };
|
9707 | }
|
9708 | exports.combineConsoleFeatures = combineConsoleFeatures;
|
9709 | function combineTelemetryFeatures(one, two) {
|
9710 | return function (Base) {
|
9711 | return two(one(Base));
|
9712 | };
|
9713 | }
|
9714 | exports.combineTelemetryFeatures = combineTelemetryFeatures;
|
9715 | function combineTracerFeatures(one, two) {
|
9716 | return function (Base) {
|
9717 | return two(one(Base));
|
9718 | };
|
9719 | }
|
9720 | exports.combineTracerFeatures = combineTracerFeatures;
|
9721 | function combineClientFeatures(one, two) {
|
9722 | return function (Base) {
|
9723 | return two(one(Base));
|
9724 | };
|
9725 | }
|
9726 | exports.combineClientFeatures = combineClientFeatures;
|
9727 | function combineWindowFeatures(one, two) {
|
9728 | return function (Base) {
|
9729 | return two(one(Base));
|
9730 | };
|
9731 | }
|
9732 | exports.combineWindowFeatures = combineWindowFeatures;
|
9733 | function combineWorkspaceFeatures(one, two) {
|
9734 | return function (Base) {
|
9735 | return two(one(Base));
|
9736 | };
|
9737 | }
|
9738 | exports.combineWorkspaceFeatures = combineWorkspaceFeatures;
|
9739 | function combineLanguagesFeatures(one, two) {
|
9740 | return function (Base) {
|
9741 | return two(one(Base));
|
9742 | };
|
9743 | }
|
9744 | exports.combineLanguagesFeatures = combineLanguagesFeatures;
|
9745 | function combineFeatures(one, two) {
|
9746 | function combine(one, two, func) {
|
9747 | if (one && two) {
|
9748 | return func(one, two);
|
9749 | }
|
9750 | else if (one) {
|
9751 | return one;
|
9752 | }
|
9753 | else {
|
9754 | return two;
|
9755 | }
|
9756 | }
|
9757 | let result = {
|
9758 | __brand: 'features',
|
9759 | console: combine(one.console, two.console, combineConsoleFeatures),
|
9760 | tracer: combine(one.tracer, two.tracer, combineTracerFeatures),
|
9761 | telemetry: combine(one.telemetry, two.telemetry, combineTelemetryFeatures),
|
9762 | client: combine(one.client, two.client, combineClientFeatures),
|
9763 | window: combine(one.window, two.window, combineWindowFeatures),
|
9764 | workspace: combine(one.workspace, two.workspace, combineWorkspaceFeatures)
|
9765 | };
|
9766 | return result;
|
9767 | }
|
9768 | exports.combineFeatures = combineFeatures;
|
9769 | function createConnection(connectionFactory, watchDog, factories) {
|
9770 | const logger = (factories && factories.console ? new (factories.console(RemoteConsoleImpl))() : new RemoteConsoleImpl());
|
9771 | const connection = connectionFactory(logger);
|
9772 | logger.rawAttach(connection);
|
9773 | const tracer = (factories && factories.tracer ? new (factories.tracer(TracerImpl))() : new TracerImpl());
|
9774 | const telemetry = (factories && factories.telemetry ? new (factories.telemetry(TelemetryImpl))() : new TelemetryImpl());
|
9775 | const client = (factories && factories.client ? new (factories.client(RemoteClientImpl))() : new RemoteClientImpl());
|
9776 | const remoteWindow = (factories && factories.window ? new (factories.window(RemoteWindowImpl))() : new RemoteWindowImpl());
|
9777 | const workspace = (factories && factories.workspace ? new (factories.workspace(RemoteWorkspaceImpl))() : new RemoteWorkspaceImpl());
|
9778 | const languages = (factories && factories.languages ? new (factories.languages(LanguagesImpl))() : new LanguagesImpl());
|
9779 | const allRemotes = [logger, tracer, telemetry, client, remoteWindow, workspace, languages];
|
9780 | function asPromise(value) {
|
9781 | if (value instanceof Promise) {
|
9782 | return value;
|
9783 | }
|
9784 | else if (Is.thenable(value)) {
|
9785 | return new Promise((resolve, reject) => {
|
9786 | value.then((resolved) => resolve(resolved), (error) => reject(error));
|
9787 | });
|
9788 | }
|
9789 | else {
|
9790 | return Promise.resolve(value);
|
9791 | }
|
9792 | }
|
9793 | let shutdownHandler = undefined;
|
9794 | let initializeHandler = undefined;
|
9795 | let exitHandler = undefined;
|
9796 | let protocolConnection = {
|
9797 | listen: () => connection.listen(),
|
9798 | sendRequest: (type, ...params) => connection.sendRequest(Is.string(type) ? type : type.method, ...params),
|
9799 | onRequest: (type, handler) => connection.onRequest(type, handler),
|
9800 | sendNotification: (type, param) => {
|
9801 | const method = Is.string(type) ? type : type.method;
|
9802 | if (arguments.length === 1) {
|
9803 | connection.sendNotification(method);
|
9804 | }
|
9805 | else {
|
9806 | connection.sendNotification(method, param);
|
9807 | }
|
9808 | },
|
9809 | onNotification: (type, handler) => connection.onNotification(type, handler),
|
9810 | onProgress: connection.onProgress,
|
9811 | sendProgress: connection.sendProgress,
|
9812 | onInitialize: (handler) => initializeHandler = handler,
|
9813 | onInitialized: (handler) => connection.onNotification(vscode_languageserver_protocol_1.InitializedNotification.type, handler),
|
9814 | onShutdown: (handler) => shutdownHandler = handler,
|
9815 | onExit: (handler) => exitHandler = handler,
|
9816 | get console() { return logger; },
|
9817 | get telemetry() { return telemetry; },
|
9818 | get tracer() { return tracer; },
|
9819 | get client() { return client; },
|
9820 | get window() { return remoteWindow; },
|
9821 | get workspace() { return workspace; },
|
9822 | get languages() { return languages; },
|
9823 | onDidChangeConfiguration: (handler) => connection.onNotification(vscode_languageserver_protocol_1.DidChangeConfigurationNotification.type, handler),
|
9824 | onDidChangeWatchedFiles: (handler) => connection.onNotification(vscode_languageserver_protocol_1.DidChangeWatchedFilesNotification.type, handler),
|
9825 | __textDocumentSync: undefined,
|
9826 | onDidOpenTextDocument: (handler) => connection.onNotification(vscode_languageserver_protocol_1.DidOpenTextDocumentNotification.type, handler),
|
9827 | onDidChangeTextDocument: (handler) => connection.onNotification(vscode_languageserver_protocol_1.DidChangeTextDocumentNotification.type, handler),
|
9828 | onDidCloseTextDocument: (handler) => connection.onNotification(vscode_languageserver_protocol_1.DidCloseTextDocumentNotification.type, handler),
|
9829 | onWillSaveTextDocument: (handler) => connection.onNotification(vscode_languageserver_protocol_1.WillSaveTextDocumentNotification.type, handler),
|
9830 | onWillSaveTextDocumentWaitUntil: (handler) => connection.onRequest(vscode_languageserver_protocol_1.WillSaveTextDocumentWaitUntilRequest.type, handler),
|
9831 | onDidSaveTextDocument: (handler) => connection.onNotification(vscode_languageserver_protocol_1.DidSaveTextDocumentNotification.type, handler),
|
9832 | sendDiagnostics: (params) => connection.sendNotification(vscode_languageserver_protocol_1.PublishDiagnosticsNotification.type, params),
|
9833 | onHover: (handler) => connection.onRequest(vscode_languageserver_protocol_1.HoverRequest.type, (params, cancel) => {
|
9834 | return handler(params, cancel, progress_1.attachWorkDone(connection, params), undefined);
|
9835 | }),
|
9836 | onCompletion: (handler) => connection.onRequest(vscode_languageserver_protocol_1.CompletionRequest.type, (params, cancel) => {
|
9837 | return handler(params, cancel, progress_1.attachWorkDone(connection, params), progress_1.attachPartialResult(connection, params));
|
9838 | }),
|
9839 | onCompletionResolve: (handler) => connection.onRequest(vscode_languageserver_protocol_1.CompletionResolveRequest.type, handler),
|
9840 | onSignatureHelp: (handler) => connection.onRequest(vscode_languageserver_protocol_1.SignatureHelpRequest.type, (params, cancel) => {
|
9841 | return handler(params, cancel, progress_1.attachWorkDone(connection, params), undefined);
|
9842 | }),
|
9843 | onDeclaration: (handler) => connection.onRequest(vscode_languageserver_protocol_1.DeclarationRequest.type, (params, cancel) => {
|
9844 | return handler(params, cancel, progress_1.attachWorkDone(connection, params), progress_1.attachPartialResult(connection, params));
|
9845 | }),
|
9846 | onDefinition: (handler) => connection.onRequest(vscode_languageserver_protocol_1.DefinitionRequest.type, (params, cancel) => {
|
9847 | return handler(params, cancel, progress_1.attachWorkDone(connection, params), progress_1.attachPartialResult(connection, params));
|
9848 | }),
|
9849 | onTypeDefinition: (handler) => connection.onRequest(vscode_languageserver_protocol_1.TypeDefinitionRequest.type, (params, cancel) => {
|
9850 | return handler(params, cancel, progress_1.attachWorkDone(connection, params), progress_1.attachPartialResult(connection, params));
|
9851 | }),
|
9852 | onImplementation: (handler) => connection.onRequest(vscode_languageserver_protocol_1.ImplementationRequest.type, (params, cancel) => {
|
9853 | return handler(params, cancel, progress_1.attachWorkDone(connection, params), progress_1.attachPartialResult(connection, params));
|
9854 | }),
|
9855 | onReferences: (handler) => connection.onRequest(vscode_languageserver_protocol_1.ReferencesRequest.type, (params, cancel) => {
|
9856 | return handler(params, cancel, progress_1.attachWorkDone(connection, params), progress_1.attachPartialResult(connection, params));
|
9857 | }),
|
9858 | onDocumentHighlight: (handler) => connection.onRequest(vscode_languageserver_protocol_1.DocumentHighlightRequest.type, (params, cancel) => {
|
9859 | return handler(params, cancel, progress_1.attachWorkDone(connection, params), progress_1.attachPartialResult(connection, params));
|
9860 | }),
|
9861 | onDocumentSymbol: (handler) => connection.onRequest(vscode_languageserver_protocol_1.DocumentSymbolRequest.type, (params, cancel) => {
|
9862 | return handler(params, cancel, progress_1.attachWorkDone(connection, params), progress_1.attachPartialResult(connection, params));
|
9863 | }),
|
9864 | onWorkspaceSymbol: (handler) => connection.onRequest(vscode_languageserver_protocol_1.WorkspaceSymbolRequest.type, (params, cancel) => {
|
9865 | return handler(params, cancel, progress_1.attachWorkDone(connection, params), progress_1.attachPartialResult(connection, params));
|
9866 | }),
|
9867 | onCodeAction: (handler) => connection.onRequest(vscode_languageserver_protocol_1.CodeActionRequest.type, (params, cancel) => {
|
9868 | return handler(params, cancel, progress_1.attachWorkDone(connection, params), progress_1.attachPartialResult(connection, params));
|
9869 | }),
|
9870 | onCodeActionResolve: (handler) => connection.onRequest(vscode_languageserver_protocol_1.CodeActionResolveRequest.type, (params, cancel) => {
|
9871 | return handler(params, cancel);
|
9872 | }),
|
9873 | onCodeLens: (handler) => connection.onRequest(vscode_languageserver_protocol_1.CodeLensRequest.type, (params, cancel) => {
|
9874 | return handler(params, cancel, progress_1.attachWorkDone(connection, params), progress_1.attachPartialResult(connection, params));
|
9875 | }),
|
9876 | onCodeLensResolve: (handler) => connection.onRequest(vscode_languageserver_protocol_1.CodeLensResolveRequest.type, (params, cancel) => {
|
9877 | return handler(params, cancel);
|
9878 | }),
|
9879 | onDocumentFormatting: (handler) => connection.onRequest(vscode_languageserver_protocol_1.DocumentFormattingRequest.type, (params, cancel) => {
|
9880 | return handler(params, cancel, progress_1.attachWorkDone(connection, params), undefined);
|
9881 | }),
|
9882 | onDocumentRangeFormatting: (handler) => connection.onRequest(vscode_languageserver_protocol_1.DocumentRangeFormattingRequest.type, (params, cancel) => {
|
9883 | return handler(params, cancel, progress_1.attachWorkDone(connection, params), undefined);
|
9884 | }),
|
9885 | onDocumentOnTypeFormatting: (handler) => connection.onRequest(vscode_languageserver_protocol_1.DocumentOnTypeFormattingRequest.type, (params, cancel) => {
|
9886 | return handler(params, cancel);
|
9887 | }),
|
9888 | onRenameRequest: (handler) => connection.onRequest(vscode_languageserver_protocol_1.RenameRequest.type, (params, cancel) => {
|
9889 | return handler(params, cancel, progress_1.attachWorkDone(connection, params), undefined);
|
9890 | }),
|
9891 | onPrepareRename: (handler) => connection.onRequest(vscode_languageserver_protocol_1.PrepareRenameRequest.type, (params, cancel) => {
|
9892 | return handler(params, cancel);
|
9893 | }),
|
9894 | onDocumentLinks: (handler) => connection.onRequest(vscode_languageserver_protocol_1.DocumentLinkRequest.type, (params, cancel) => {
|
9895 | return handler(params, cancel, progress_1.attachWorkDone(connection, params), progress_1.attachPartialResult(connection, params));
|
9896 | }),
|
9897 | onDocumentLinkResolve: (handler) => connection.onRequest(vscode_languageserver_protocol_1.DocumentLinkResolveRequest.type, (params, cancel) => {
|
9898 | return handler(params, cancel);
|
9899 | }),
|
9900 | onDocumentColor: (handler) => connection.onRequest(vscode_languageserver_protocol_1.DocumentColorRequest.type, (params, cancel) => {
|
9901 | return handler(params, cancel, progress_1.attachWorkDone(connection, params), progress_1.attachPartialResult(connection, params));
|
9902 | }),
|
9903 | onColorPresentation: (handler) => connection.onRequest(vscode_languageserver_protocol_1.ColorPresentationRequest.type, (params, cancel) => {
|
9904 | return handler(params, cancel, progress_1.attachWorkDone(connection, params), progress_1.attachPartialResult(connection, params));
|
9905 | }),
|
9906 | onFoldingRanges: (handler) => connection.onRequest(vscode_languageserver_protocol_1.FoldingRangeRequest.type, (params, cancel) => {
|
9907 | return handler(params, cancel, progress_1.attachWorkDone(connection, params), progress_1.attachPartialResult(connection, params));
|
9908 | }),
|
9909 | onSelectionRanges: (handler) => connection.onRequest(vscode_languageserver_protocol_1.SelectionRangeRequest.type, (params, cancel) => {
|
9910 | return handler(params, cancel, progress_1.attachWorkDone(connection, params), progress_1.attachPartialResult(connection, params));
|
9911 | }),
|
9912 | onExecuteCommand: (handler) => connection.onRequest(vscode_languageserver_protocol_1.ExecuteCommandRequest.type, (params, cancel) => {
|
9913 | return handler(params, cancel, progress_1.attachWorkDone(connection, params), undefined);
|
9914 | }),
|
9915 | dispose: () => connection.dispose()
|
9916 | };
|
9917 | for (let remote of allRemotes) {
|
9918 | remote.attach(protocolConnection);
|
9919 | }
|
9920 | connection.onRequest(vscode_languageserver_protocol_1.InitializeRequest.type, (params) => {
|
9921 | watchDog.initialize(params);
|
9922 | if (Is.string(params.trace)) {
|
9923 | tracer.trace = vscode_languageserver_protocol_1.Trace.fromString(params.trace);
|
9924 | }
|
9925 | for (let remote of allRemotes) {
|
9926 | remote.initialize(params.capabilities);
|
9927 | }
|
9928 | if (initializeHandler) {
|
9929 | let result = initializeHandler(params, new vscode_languageserver_protocol_1.CancellationTokenSource().token, progress_1.attachWorkDone(connection, params), undefined);
|
9930 | return asPromise(result).then((value) => {
|
9931 | if (value instanceof vscode_languageserver_protocol_1.ResponseError) {
|
9932 | return value;
|
9933 | }
|
9934 | let result = value;
|
9935 | if (!result) {
|
9936 | result = { capabilities: {} };
|
9937 | }
|
9938 | let capabilities = result.capabilities;
|
9939 | if (!capabilities) {
|
9940 | capabilities = {};
|
9941 | result.capabilities = capabilities;
|
9942 | }
|
9943 | if (capabilities.textDocumentSync === undefined || capabilities.textDocumentSync === null) {
|
9944 | capabilities.textDocumentSync = Is.number(protocolConnection.__textDocumentSync) ? protocolConnection.__textDocumentSync : vscode_languageserver_protocol_1.TextDocumentSyncKind.None;
|
9945 | }
|
9946 | else if (!Is.number(capabilities.textDocumentSync) && !Is.number(capabilities.textDocumentSync.change)) {
|
9947 | capabilities.textDocumentSync.change = Is.number(protocolConnection.__textDocumentSync) ? protocolConnection.__textDocumentSync : vscode_languageserver_protocol_1.TextDocumentSyncKind.None;
|
9948 | }
|
9949 | for (let remote of allRemotes) {
|
9950 | remote.fillServerCapabilities(capabilities);
|
9951 | }
|
9952 | return result;
|
9953 | });
|
9954 | }
|
9955 | else {
|
9956 | let result = { capabilities: { textDocumentSync: vscode_languageserver_protocol_1.TextDocumentSyncKind.None } };
|
9957 | for (let remote of allRemotes) {
|
9958 | remote.fillServerCapabilities(result.capabilities);
|
9959 | }
|
9960 | return result;
|
9961 | }
|
9962 | });
|
9963 | connection.onRequest(vscode_languageserver_protocol_1.ShutdownRequest.type, () => {
|
9964 | watchDog.shutdownReceived = true;
|
9965 | if (shutdownHandler) {
|
9966 | return shutdownHandler(new vscode_languageserver_protocol_1.CancellationTokenSource().token);
|
9967 | }
|
9968 | else {
|
9969 | return undefined;
|
9970 | }
|
9971 | });
|
9972 | connection.onNotification(vscode_languageserver_protocol_1.ExitNotification.type, () => {
|
9973 | try {
|
9974 | if (exitHandler) {
|
9975 | exitHandler();
|
9976 | }
|
9977 | }
|
9978 | finally {
|
9979 | if (watchDog.shutdownReceived) {
|
9980 | watchDog.exit(0);
|
9981 | }
|
9982 | else {
|
9983 | watchDog.exit(1);
|
9984 | }
|
9985 | }
|
9986 | });
|
9987 | connection.onNotification(vscode_languageserver_protocol_1.SetTraceNotification.type, (params) => {
|
9988 | tracer.trace = vscode_languageserver_protocol_1.Trace.fromString(params.value);
|
9989 | });
|
9990 | return protocolConnection;
|
9991 | }
|
9992 | exports.createConnection = createConnection;
|
9993 |
|
9994 |
|
9995 | }),
|
9996 |
|
9997 | 54:
|
9998 | ((__unused_webpack_module, exports, __webpack_require__) => {
|
9999 |
|
10000 | "use strict";
|
10001 |
|
10002 |
|
10003 |
|
10004 |
|
10005 |
|
10006 | Object.defineProperty(exports, "__esModule", ({ value: true }));
|
10007 | exports.ShowDocumentFeature = void 0;
|
10008 | const vscode_languageserver_protocol_1 = __webpack_require__(5);
|
10009 | const ShowDocumentFeature = (Base) => {
|
10010 | return class extends Base {
|
10011 | showDocument(params) {
|
10012 | return this.connection.sendRequest(vscode_languageserver_protocol_1.ShowDocumentRequest.type, params);
|
10013 | }
|
10014 | };
|
10015 | };
|
10016 | exports.ShowDocumentFeature = ShowDocumentFeature;
|
10017 |
|
10018 |
|
10019 | }),
|
10020 |
|
10021 | 3:
|
10022 | ((__unused_webpack_module, exports) => {
|
10023 |
|
10024 | "use strict";
|
10025 |
|
10026 |
|
10027 |
|
10028 |
|
10029 |
|
10030 | Object.defineProperty(exports, "__esModule", ({ value: true }));
|
10031 | exports.thenable = exports.typedArray = exports.stringArray = exports.array = exports.func = exports.error = exports.number = exports.string = exports.boolean = void 0;
|
10032 | function boolean(value) {
|
10033 | return value === true || value === false;
|
10034 | }
|
10035 | exports.boolean = boolean;
|
10036 | function string(value) {
|
10037 | return typeof value === 'string' || value instanceof String;
|
10038 | }
|
10039 | exports.string = string;
|
10040 | function number(value) {
|
10041 | return typeof value === 'number' || value instanceof Number;
|
10042 | }
|
10043 | exports.number = number;
|
10044 | function error(value) {
|
10045 | return value instanceof Error;
|
10046 | }
|
10047 | exports.error = error;
|
10048 | function func(value) {
|
10049 | return typeof value === 'function';
|
10050 | }
|
10051 | exports.func = func;
|
10052 | function array(value) {
|
10053 | return Array.isArray(value);
|
10054 | }
|
10055 | exports.array = array;
|
10056 | function stringArray(value) {
|
10057 | return array(value) && value.every(elem => string(elem));
|
10058 | }
|
10059 | exports.stringArray = stringArray;
|
10060 | function typedArray(value, check) {
|
10061 | return Array.isArray(value) && value.every(check);
|
10062 | }
|
10063 | exports.typedArray = typedArray;
|
10064 | function thenable(value) {
|
10065 | return value && func(value.then);
|
10066 | }
|
10067 | exports.thenable = thenable;
|
10068 |
|
10069 |
|
10070 | }),
|
10071 |
|
10072 | 48:
|
10073 | ((__unused_webpack_module, exports) => {
|
10074 |
|
10075 | "use strict";
|
10076 |
|
10077 |
|
10078 |
|
10079 |
|
10080 |
|
10081 | Object.defineProperty(exports, "__esModule", ({ value: true }));
|
10082 | exports.generateUuid = exports.parse = exports.isUUID = exports.v4 = exports.empty = void 0;
|
10083 | class ValueUUID {
|
10084 | constructor(_value) {
|
10085 | this._value = _value;
|
10086 |
|
10087 | }
|
10088 | asHex() {
|
10089 | return this._value;
|
10090 | }
|
10091 | equals(other) {
|
10092 | return this.asHex() === other.asHex();
|
10093 | }
|
10094 | }
|
10095 | class V4UUID extends ValueUUID {
|
10096 | constructor() {
|
10097 | super([
|
10098 | V4UUID._randomHex(),
|
10099 | V4UUID._randomHex(),
|
10100 | V4UUID._randomHex(),
|
10101 | V4UUID._randomHex(),
|
10102 | V4UUID._randomHex(),
|
10103 | V4UUID._randomHex(),
|
10104 | V4UUID._randomHex(),
|
10105 | V4UUID._randomHex(),
|
10106 | '-',
|
10107 | V4UUID._randomHex(),
|
10108 | V4UUID._randomHex(),
|
10109 | V4UUID._randomHex(),
|
10110 | V4UUID._randomHex(),
|
10111 | '-',
|
10112 | '4',
|
10113 | V4UUID._randomHex(),
|
10114 | V4UUID._randomHex(),
|
10115 | V4UUID._randomHex(),
|
10116 | '-',
|
10117 | V4UUID._oneOf(V4UUID._timeHighBits),
|
10118 | V4UUID._randomHex(),
|
10119 | V4UUID._randomHex(),
|
10120 | V4UUID._randomHex(),
|
10121 | '-',
|
10122 | V4UUID._randomHex(),
|
10123 | V4UUID._randomHex(),
|
10124 | V4UUID._randomHex(),
|
10125 | V4UUID._randomHex(),
|
10126 | V4UUID._randomHex(),
|
10127 | V4UUID._randomHex(),
|
10128 | V4UUID._randomHex(),
|
10129 | V4UUID._randomHex(),
|
10130 | V4UUID._randomHex(),
|
10131 | V4UUID._randomHex(),
|
10132 | V4UUID._randomHex(),
|
10133 | V4UUID._randomHex(),
|
10134 | ].join(''));
|
10135 | }
|
10136 | static _oneOf(array) {
|
10137 | return array[Math.floor(array.length * Math.random())];
|
10138 | }
|
10139 | static _randomHex() {
|
10140 | return V4UUID._oneOf(V4UUID._chars);
|
10141 | }
|
10142 | }
|
10143 | V4UUID._chars = ['0', '1', '2', '3', '4', '5', '6', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'];
|
10144 | V4UUID._timeHighBits = ['8', '9', 'a', 'b'];
|
10145 |
|
10146 |
|
10147 |
|
10148 | exports.empty = new ValueUUID('00000000-0000-0000-0000-000000000000');
|
10149 | function v4() {
|
10150 | return new V4UUID();
|
10151 | }
|
10152 | exports.v4 = v4;
|
10153 | const _UUIDPattern = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
10154 | function isUUID(value) {
|
10155 | return _UUIDPattern.test(value);
|
10156 | }
|
10157 | exports.isUUID = isUUID;
|
10158 |
|
10159 |
|
10160 |
|
10161 |
|
10162 | function parse(value) {
|
10163 | if (!isUUID(value)) {
|
10164 | throw new Error('invalid uuid');
|
10165 | }
|
10166 | return new ValueUUID(value);
|
10167 | }
|
10168 | exports.parse = parse;
|
10169 | function generateUuid() {
|
10170 | return v4().asHex();
|
10171 | }
|
10172 | exports.generateUuid = generateUuid;
|
10173 |
|
10174 |
|
10175 | }),
|
10176 |
|
10177 | 51:
|
10178 | ((__unused_webpack_module, exports, __webpack_require__) => {
|
10179 |
|
10180 | "use strict";
|
10181 |
|
10182 |
|
10183 |
|
10184 |
|
10185 |
|
10186 | Object.defineProperty(exports, "__esModule", ({ value: true }));
|
10187 | exports.WorkspaceFoldersFeature = void 0;
|
10188 | const vscode_languageserver_protocol_1 = __webpack_require__(5);
|
10189 | const WorkspaceFoldersFeature = (Base) => {
|
10190 | return class extends Base {
|
10191 | initialize(capabilities) {
|
10192 | let workspaceCapabilities = capabilities.workspace;
|
10193 | if (workspaceCapabilities && workspaceCapabilities.workspaceFolders) {
|
10194 | this._onDidChangeWorkspaceFolders = new vscode_languageserver_protocol_1.Emitter();
|
10195 | this.connection.onNotification(vscode_languageserver_protocol_1.DidChangeWorkspaceFoldersNotification.type, (params) => {
|
10196 | this._onDidChangeWorkspaceFolders.fire(params.event);
|
10197 | });
|
10198 | }
|
10199 | }
|
10200 | getWorkspaceFolders() {
|
10201 | return this.connection.sendRequest(vscode_languageserver_protocol_1.WorkspaceFoldersRequest.type);
|
10202 | }
|
10203 | get onDidChangeWorkspaceFolders() {
|
10204 | if (!this._onDidChangeWorkspaceFolders) {
|
10205 | throw new Error('Client doesn\'t support sending workspace folder change events.');
|
10206 | }
|
10207 | if (!this._unregistration) {
|
10208 | this._unregistration = this.connection.client.register(vscode_languageserver_protocol_1.DidChangeWorkspaceFoldersNotification.type);
|
10209 | }
|
10210 | return this._onDidChangeWorkspaceFolders.event;
|
10211 | }
|
10212 | };
|
10213 | };
|
10214 | exports.WorkspaceFoldersFeature = WorkspaceFoldersFeature;
|
10215 |
|
10216 |
|
10217 | }),
|
10218 |
|
10219 | 58:
|
10220 | ((__unused_webpack_module, exports, __webpack_require__) => {
|
10221 |
|
10222 | "use strict";
|
10223 |
|
10224 |
|
10225 |
|
10226 |
|
10227 |
|
10228 | Object.defineProperty(exports, "__esModule", ({ value: true }));
|
10229 | exports.resolveModulePath = exports.FileSystem = exports.resolveGlobalYarnPath = exports.resolveGlobalNodePath = exports.resolve = exports.uriToFilePath = void 0;
|
10230 | const url = __webpack_require__(59);
|
10231 | const path = __webpack_require__(23);
|
10232 | const fs = __webpack_require__(60);
|
10233 | const child_process_1 = __webpack_require__(61);
|
10234 |
|
10235 |
|
10236 |
|
10237 |
|
10238 | function uriToFilePath(uri) {
|
10239 | let parsed = url.parse(uri);
|
10240 | if (parsed.protocol !== 'file:' || !parsed.path) {
|
10241 | return undefined;
|
10242 | }
|
10243 | let segments = parsed.path.split('/');
|
10244 | for (var i = 0, len = segments.length; i < len; i++) {
|
10245 | segments[i] = decodeURIComponent(segments[i]);
|
10246 | }
|
10247 | if (process.platform === 'win32' && segments.length > 1) {
|
10248 | let first = segments[0];
|
10249 | let second = segments[1];
|
10250 |
|
10251 |
|
10252 | if (first.length === 0 && second.length > 1 && second[1] === ':') {
|
10253 |
|
10254 | segments.shift();
|
10255 | }
|
10256 | }
|
10257 | return path.normalize(segments.join('/'));
|
10258 | }
|
10259 | exports.uriToFilePath = uriToFilePath;
|
10260 | function isWindows() {
|
10261 | return process.platform === 'win32';
|
10262 | }
|
10263 | function resolve(moduleName, nodePath, cwd, tracer) {
|
10264 | const nodePathKey = 'NODE_PATH';
|
10265 | const app = [
|
10266 | 'var p = process;',
|
10267 | 'p.on(\'message\',function(m){',
|
10268 | 'if(m.c===\'e\'){',
|
10269 | 'p.exit(0);',
|
10270 | '}',
|
10271 | 'else if(m.c===\'rs\'){',
|
10272 | 'try{',
|
10273 | 'var r=require.resolve(m.a);',
|
10274 | 'p.send({c:\'r\',s:true,r:r});',
|
10275 | '}',
|
10276 | 'catch(err){',
|
10277 | 'p.send({c:\'r\',s:false});',
|
10278 | '}',
|
10279 | '}',
|
10280 | '});'
|
10281 | ].join('');
|
10282 | return new Promise((resolve, reject) => {
|
10283 | let env = process.env;
|
10284 | let newEnv = Object.create(null);
|
10285 | Object.keys(env).forEach(key => newEnv[key] = env[key]);
|
10286 | if (nodePath && fs.existsSync(nodePath) ) {
|
10287 | if (newEnv[nodePathKey]) {
|
10288 | newEnv[nodePathKey] = nodePath + path.delimiter + newEnv[nodePathKey];
|
10289 | }
|
10290 | else {
|
10291 | newEnv[nodePathKey] = nodePath;
|
10292 | }
|
10293 | if (tracer) {
|
10294 | tracer(`NODE_PATH value is: ${newEnv[nodePathKey]}`);
|
10295 | }
|
10296 | }
|
10297 | newEnv['ELECTRON_RUN_AS_NODE'] = '1';
|
10298 | try {
|
10299 | let cp = child_process_1.fork('', [], {
|
10300 | cwd: cwd,
|
10301 | env: newEnv,
|
10302 | execArgv: ['-e', app]
|
10303 | });
|
10304 | if (cp.pid === void 0) {
|
10305 | reject(new Error(`Starting process to resolve node module ${moduleName} failed`));
|
10306 | return;
|
10307 | }
|
10308 | cp.on('error', (error) => {
|
10309 | reject(error);
|
10310 | });
|
10311 | cp.on('message', (message) => {
|
10312 | if (message.c === 'r') {
|
10313 | cp.send({ c: 'e' });
|
10314 | if (message.s) {
|
10315 | resolve(message.r);
|
10316 | }
|
10317 | else {
|
10318 | reject(new Error(`Failed to resolve module: ${moduleName}`));
|
10319 | }
|
10320 | }
|
10321 | });
|
10322 | let message = {
|
10323 | c: 'rs',
|
10324 | a: moduleName
|
10325 | };
|
10326 | cp.send(message);
|
10327 | }
|
10328 | catch (error) {
|
10329 | reject(error);
|
10330 | }
|
10331 | });
|
10332 | }
|
10333 | exports.resolve = resolve;
|
10334 |
|
10335 |
|
10336 |
|
10337 |
|
10338 |
|
10339 |
|
10340 | function resolveGlobalNodePath(tracer) {
|
10341 | let npmCommand = 'npm';
|
10342 | const env = Object.create(null);
|
10343 | Object.keys(process.env).forEach(key => env[key] = process.env[key]);
|
10344 | env['NO_UPDATE_NOTIFIER'] = 'true';
|
10345 | const options = {
|
10346 | encoding: 'utf8',
|
10347 | env
|
10348 | };
|
10349 | if (isWindows()) {
|
10350 | npmCommand = 'npm.cmd';
|
10351 | options.shell = true;
|
10352 | }
|
10353 | let handler = () => { };
|
10354 | try {
|
10355 | process.on('SIGPIPE', handler);
|
10356 | let stdout = child_process_1.spawnSync(npmCommand, ['config', 'get', 'prefix'], options).stdout;
|
10357 | if (!stdout) {
|
10358 | if (tracer) {
|
10359 | tracer(`'npm config get prefix' didn't return a value.`);
|
10360 | }
|
10361 | return undefined;
|
10362 | }
|
10363 | let prefix = stdout.trim();
|
10364 | if (tracer) {
|
10365 | tracer(`'npm config get prefix' value is: ${prefix}`);
|
10366 | }
|
10367 | if (prefix.length > 0) {
|
10368 | if (isWindows()) {
|
10369 | return path.join(prefix, 'node_modules');
|
10370 | }
|
10371 | else {
|
10372 | return path.join(prefix, 'lib', 'node_modules');
|
10373 | }
|
10374 | }
|
10375 | return undefined;
|
10376 | }
|
10377 | catch (err) {
|
10378 | return undefined;
|
10379 | }
|
10380 | finally {
|
10381 | process.removeListener('SIGPIPE', handler);
|
10382 | }
|
10383 | }
|
10384 | exports.resolveGlobalNodePath = resolveGlobalNodePath;
|
10385 |
|
10386 |
|
10387 |
|
10388 |
|
10389 |
|
10390 |
|
10391 | function resolveGlobalYarnPath(tracer) {
|
10392 | let yarnCommand = 'yarn';
|
10393 | let options = {
|
10394 | encoding: 'utf8'
|
10395 | };
|
10396 | if (isWindows()) {
|
10397 | yarnCommand = 'yarn.cmd';
|
10398 | options.shell = true;
|
10399 | }
|
10400 | let handler = () => { };
|
10401 | try {
|
10402 | process.on('SIGPIPE', handler);
|
10403 | let results = child_process_1.spawnSync(yarnCommand, ['global', 'dir', '--json'], options);
|
10404 | let stdout = results.stdout;
|
10405 | if (!stdout) {
|
10406 | if (tracer) {
|
10407 | tracer(`'yarn global dir' didn't return a value.`);
|
10408 | if (results.stderr) {
|
10409 | tracer(results.stderr);
|
10410 | }
|
10411 | }
|
10412 | return undefined;
|
10413 | }
|
10414 | let lines = stdout.trim().split(/\r?\n/);
|
10415 | for (let line of lines) {
|
10416 | try {
|
10417 | let yarn = JSON.parse(line);
|
10418 | if (yarn.type === 'log') {
|
10419 | return path.join(yarn.data, 'node_modules');
|
10420 | }
|
10421 | }
|
10422 | catch (e) {
|
10423 |
|
10424 | }
|
10425 | }
|
10426 | return undefined;
|
10427 | }
|
10428 | catch (err) {
|
10429 | return undefined;
|
10430 | }
|
10431 | finally {
|
10432 | process.removeListener('SIGPIPE', handler);
|
10433 | }
|
10434 | }
|
10435 | exports.resolveGlobalYarnPath = resolveGlobalYarnPath;
|
10436 | var FileSystem;
|
10437 | (function (FileSystem) {
|
10438 | let _isCaseSensitive = undefined;
|
10439 | function isCaseSensitive() {
|
10440 | if (_isCaseSensitive !== void 0) {
|
10441 | return _isCaseSensitive;
|
10442 | }
|
10443 | if (process.platform === 'win32') {
|
10444 | _isCaseSensitive = false;
|
10445 | }
|
10446 | else {
|
10447 |
|
10448 |
|
10449 | _isCaseSensitive = !fs.existsSync(__filename.toUpperCase()) || !fs.existsSync(__filename.toLowerCase());
|
10450 | }
|
10451 | return _isCaseSensitive;
|
10452 | }
|
10453 | FileSystem.isCaseSensitive = isCaseSensitive;
|
10454 | function isParent(parent, child) {
|
10455 | if (isCaseSensitive()) {
|
10456 | return path.normalize(child).indexOf(path.normalize(parent)) === 0;
|
10457 | }
|
10458 | else {
|
10459 | return path.normalize(child).toLowerCase().indexOf(path.normalize(parent).toLowerCase()) === 0;
|
10460 | }
|
10461 | }
|
10462 | FileSystem.isParent = isParent;
|
10463 | })(FileSystem = exports.FileSystem || (exports.FileSystem = {}));
|
10464 | function resolveModulePath(workspaceRoot, moduleName, nodePath, tracer) {
|
10465 | if (nodePath) {
|
10466 | if (!path.isAbsolute(nodePath)) {
|
10467 | nodePath = path.join(workspaceRoot, nodePath);
|
10468 | }
|
10469 | return resolve(moduleName, nodePath, nodePath, tracer).then((value) => {
|
10470 | if (FileSystem.isParent(nodePath, value)) {
|
10471 | return value;
|
10472 | }
|
10473 | else {
|
10474 | return Promise.reject(new Error(`Failed to load ${moduleName} from node path location.`));
|
10475 | }
|
10476 | }).then(undefined, (_error) => {
|
10477 | return resolve(moduleName, resolveGlobalNodePath(tracer), workspaceRoot, tracer);
|
10478 | });
|
10479 | }
|
10480 | else {
|
10481 | return resolve(moduleName, resolveGlobalNodePath(tracer), workspaceRoot, tracer);
|
10482 | }
|
10483 | }
|
10484 | exports.resolveModulePath = resolveModulePath;
|
10485 |
|
10486 |
|
10487 | }),
|
10488 |
|
10489 | 2:
|
10490 | (function(__unused_webpack_module, exports, __webpack_require__) {
|
10491 |
|
10492 | "use strict";
|
10493 |
|
10494 |
|
10495 |
|
10496 |
|
10497 |
|
10498 |
|
10499 | var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
10500 | if (k2 === undefined) k2 = k;
|
10501 | Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
10502 | }) : (function(o, m, k, k2) {
|
10503 | if (k2 === undefined) k2 = k;
|
10504 | o[k2] = m[k];
|
10505 | }));
|
10506 | var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
10507 | for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
10508 | };
|
10509 | Object.defineProperty(exports, "__esModule", ({ value: true }));
|
10510 | exports.createConnection = exports.Files = void 0;
|
10511 | const Is = __webpack_require__(3);
|
10512 | const server_1 = __webpack_require__(4);
|
10513 | const fm = __webpack_require__(58);
|
10514 | const node_1 = __webpack_require__(62);
|
10515 | __exportStar(__webpack_require__(62), exports);
|
10516 | __exportStar(__webpack_require__(63), exports);
|
10517 | var Files;
|
10518 | (function (Files) {
|
10519 | Files.uriToFilePath = fm.uriToFilePath;
|
10520 | Files.resolveGlobalNodePath = fm.resolveGlobalNodePath;
|
10521 | Files.resolveGlobalYarnPath = fm.resolveGlobalYarnPath;
|
10522 | Files.resolve = fm.resolve;
|
10523 | Files.resolveModulePath = fm.resolveModulePath;
|
10524 | })(Files = exports.Files || (exports.Files = {}));
|
10525 | let _protocolConnection;
|
10526 | function endProtocolConnection() {
|
10527 | if (_protocolConnection === undefined) {
|
10528 | return;
|
10529 | }
|
10530 | try {
|
10531 | _protocolConnection.end();
|
10532 | }
|
10533 | catch (_err) {
|
10534 |
|
10535 |
|
10536 | }
|
10537 | }
|
10538 | let _shutdownReceived = false;
|
10539 | let exitTimer = undefined;
|
10540 | function setupExitTimer() {
|
10541 | const argName = '--clientProcessId';
|
10542 | function runTimer(value) {
|
10543 | try {
|
10544 | let processId = parseInt(value);
|
10545 | if (!isNaN(processId)) {
|
10546 | exitTimer = setInterval(() => {
|
10547 | try {
|
10548 | process.kill(processId, 0);
|
10549 | }
|
10550 | catch (ex) {
|
10551 |
|
10552 | endProtocolConnection();
|
10553 | process.exit(_shutdownReceived ? 0 : 1);
|
10554 | }
|
10555 | }, 3000);
|
10556 | }
|
10557 | }
|
10558 | catch (e) {
|
10559 |
|
10560 | }
|
10561 | }
|
10562 | for (let i = 2; i < process.argv.length; i++) {
|
10563 | let arg = process.argv[i];
|
10564 | if (arg === argName && i + 1 < process.argv.length) {
|
10565 | runTimer(process.argv[i + 1]);
|
10566 | return;
|
10567 | }
|
10568 | else {
|
10569 | let args = arg.split('=');
|
10570 | if (args[0] === argName) {
|
10571 | runTimer(args[1]);
|
10572 | }
|
10573 | }
|
10574 | }
|
10575 | }
|
10576 | setupExitTimer();
|
10577 | const watchDog = {
|
10578 | initialize: (params) => {
|
10579 | const processId = params.processId;
|
10580 | if (Is.number(processId) && exitTimer === undefined) {
|
10581 |
|
10582 |
|
10583 | setInterval(() => {
|
10584 | try {
|
10585 | process.kill(processId, 0);
|
10586 | }
|
10587 | catch (ex) {
|
10588 |
|
10589 | process.exit(_shutdownReceived ? 0 : 1);
|
10590 | }
|
10591 | }, 3000);
|
10592 | }
|
10593 | },
|
10594 | get shutdownReceived() {
|
10595 | return _shutdownReceived;
|
10596 | },
|
10597 | set shutdownReceived(value) {
|
10598 | _shutdownReceived = value;
|
10599 | },
|
10600 | exit: (code) => {
|
10601 | endProtocolConnection();
|
10602 | process.exit(code);
|
10603 | }
|
10604 | };
|
10605 | function createConnection(arg1, arg2, arg3, arg4) {
|
10606 | let factories;
|
10607 | let input;
|
10608 | let output;
|
10609 | let options;
|
10610 | if (arg1 !== void 0 && arg1.__brand === 'features') {
|
10611 | factories = arg1;
|
10612 | arg1 = arg2;
|
10613 | arg2 = arg3;
|
10614 | arg3 = arg4;
|
10615 | }
|
10616 | if (node_1.ConnectionStrategy.is(arg1) || node_1.ConnectionOptions.is(arg1)) {
|
10617 | options = arg1;
|
10618 | }
|
10619 | else {
|
10620 | input = arg1;
|
10621 | output = arg2;
|
10622 | options = arg3;
|
10623 | }
|
10624 | return _createConnection(input, output, options, factories);
|
10625 | }
|
10626 | exports.createConnection = createConnection;
|
10627 | function _createConnection(input, output, options, factories) {
|
10628 | if (!input && !output && process.argv.length > 2) {
|
10629 | let port = void 0;
|
10630 | let pipeName = void 0;
|
10631 | let argv = process.argv.slice(2);
|
10632 | for (let i = 0; i < argv.length; i++) {
|
10633 | let arg = argv[i];
|
10634 | if (arg === '--node-ipc') {
|
10635 | input = new node_1.IPCMessageReader(process);
|
10636 | output = new node_1.IPCMessageWriter(process);
|
10637 | break;
|
10638 | }
|
10639 | else if (arg === '--stdio') {
|
10640 | input = process.stdin;
|
10641 | output = process.stdout;
|
10642 | break;
|
10643 | }
|
10644 | else if (arg === '--socket') {
|
10645 | port = parseInt(argv[i + 1]);
|
10646 | break;
|
10647 | }
|
10648 | else if (arg === '--pipe') {
|
10649 | pipeName = argv[i + 1];
|
10650 | break;
|
10651 | }
|
10652 | else {
|
10653 | var args = arg.split('=');
|
10654 | if (args[0] === '--socket') {
|
10655 | port = parseInt(args[1]);
|
10656 | break;
|
10657 | }
|
10658 | else if (args[0] === '--pipe') {
|
10659 | pipeName = args[1];
|
10660 | break;
|
10661 | }
|
10662 | }
|
10663 | }
|
10664 | if (port) {
|
10665 | let transport = node_1.createServerSocketTransport(port);
|
10666 | input = transport[0];
|
10667 | output = transport[1];
|
10668 | }
|
10669 | else if (pipeName) {
|
10670 | let transport = node_1.createServerPipeTransport(pipeName);
|
10671 | input = transport[0];
|
10672 | output = transport[1];
|
10673 | }
|
10674 | }
|
10675 | var commandLineMessage = 'Use arguments of createConnection or set command line parameters: \'--node-ipc\', \'--stdio\' or \'--socket={number}\'';
|
10676 | if (!input) {
|
10677 | throw new Error('Connection input stream is not set. ' + commandLineMessage);
|
10678 | }
|
10679 | if (!output) {
|
10680 | throw new Error('Connection output stream is not set. ' + commandLineMessage);
|
10681 | }
|
10682 |
|
10683 | if (Is.func(input.read) && Is.func(input.on)) {
|
10684 | let inputStream = input;
|
10685 | inputStream.on('end', () => {
|
10686 | endProtocolConnection();
|
10687 | process.exit(_shutdownReceived ? 0 : 1);
|
10688 | });
|
10689 | inputStream.on('close', () => {
|
10690 | endProtocolConnection();
|
10691 | process.exit(_shutdownReceived ? 0 : 1);
|
10692 | });
|
10693 | }
|
10694 | const connectionFactory = (logger) => {
|
10695 | const result = node_1.createProtocolConnection(input, output, logger, options);
|
10696 | return result;
|
10697 | };
|
10698 | return server_1.createConnection(connectionFactory, watchDog, factories);
|
10699 | }
|
10700 |
|
10701 |
|
10702 | }),
|
10703 |
|
10704 | 71:
|
10705 | ((module, __unused_webpack_exports, __webpack_require__) => {
|
10706 |
|
10707 | module = __webpack_require__.nmd(module);
|
10708 |
|
10709 |
|
10710 |
|
10711 | var fs = __webpack_require__(60);
|
10712 | var util = __webpack_require__(10);
|
10713 |
|
10714 | function main() {
|
10715 | var neovim = false;
|
10716 | var fpath = ''
|
10717 | var args = process.argv;
|
10718 | if (args.length == 4) {
|
10719 | if (args[2] == '--neovim') {
|
10720 | neovim = true;
|
10721 | }
|
10722 | fpath = args[3];
|
10723 | } else if (args.length == 3) {
|
10724 | neovim = false;
|
10725 | fpath = args[2]
|
10726 | }
|
10727 | var r = new StringReader(viml_readfile(fpath));
|
10728 | var p = new VimLParser(neovim);
|
10729 | var c = new Compiler();
|
10730 | try {
|
10731 | var lines = c.compile(p.parse(r));
|
10732 | for (var i in lines) {
|
10733 | process.stdout.write(lines[i] + "\n");
|
10734 | }
|
10735 | } catch (e) {
|
10736 | process.stdout.write(e + '\n');
|
10737 | }
|
10738 | }
|
10739 |
|
10740 | var pat_vim2js = {
|
10741 | "[0-9a-zA-Z]" : "[0-9a-zA-Z]",
|
10742 | "[@*!=><&~#]" : "[@*!=><&~#]",
|
10743 | "\\<ARGOPT\\>" : "\\bARGOPT\\b",
|
10744 | "\\<BANG\\>" : "\\bBANG\\b",
|
10745 | "\\<EDITCMD\\>" : "\\bEDITCMD\\b",
|
10746 | "\\<NOTRLCOM\\>" : "\\bNOTRLCOM\\b",
|
10747 | "\\<TRLBAR\\>" : "\\bTRLBAR\\b",
|
10748 | "\\<USECTRLV\\>" : "\\bUSECTRLV\\b",
|
10749 | "\\<USERCMD\\>" : "\\bUSERCMD\\b",
|
10750 | "\\<\\(XFILE\\|FILES\\|FILE1\\)\\>" : "\\b(XFILE|FILES|FILE1)\\b",
|
10751 | "\\S" : "\\S",
|
10752 | "\\a" : "[A-Za-z]",
|
10753 | "\\d" : "\\d",
|
10754 | "\\h" : "[A-Za-z_]",
|
10755 | "\\s" : "\\s",
|
10756 | "\\v^d%[elete][lp]$" : "^d(elete|elet|ele|el|e)[lp]$",
|
10757 | "\\v^s%(c[^sr][^i][^p]|g|i[^mlg]|I|r[^e])" : "^s(c[^sr][^i][^p]|g|i[^mlg]|I|r[^e])",
|
10758 | "\\w" : "[0-9A-Za-z_]",
|
10759 | "\\w\\|[:#]" : "[0-9A-Za-z_]|[:#]",
|
10760 | "\\x" : "[0-9A-Fa-f]",
|
10761 | "^++" : "^\+\+",
|
10762 | "^++bad=\\(keep\\|drop\\|.\\)\\>" : "^\\+\\+bad=(keep|drop|.)\\b",
|
10763 | "^++bad=drop" : "^\\+\\+bad=drop",
|
10764 | "^++bad=keep" : "^\\+\\+bad=keep",
|
10765 | "^++bin\\>" : "^\\+\\+bin\\b",
|
10766 | "^++edit\\>" : "^\\+\\+edit\\b",
|
10767 | "^++enc=\\S" : "^\\+\\+enc=\\S",
|
10768 | "^++encoding=\\S" : "^\\+\\+encoding=\\S",
|
10769 | "^++ff=\\(dos\\|unix\\|mac\\)\\>" : "^\\+\\+ff=(dos|unix|mac)\\b",
|
10770 | "^++fileformat=\\(dos\\|unix\\|mac\\)\\>" : "^\\+\\+fileformat=(dos|unix|mac)\\b",
|
10771 | "^++nobin\\>" : "^\\+\\+nobin\\b",
|
10772 | "^[A-Z]" : "^[A-Z]",
|
10773 | "^\\$\\w\\+" : "^\\$[0-9A-Za-z_]+",
|
10774 | "^\\(!\\|global\\|vglobal\\)$" : "^(!|global|vglobal)$",
|
10775 | "^\\(WHILE\\|FOR\\)$" : "^(WHILE|FOR)$",
|
10776 | "^\\(vimgrep\\|vimgrepadd\\|lvimgrep\\|lvimgrepadd\\)$" : "^(vimgrep|vimgrepadd|lvimgrep|lvimgrepadd)$",
|
10777 | "^\\d" : "^\\d",
|
10778 | "^\\h" : "^[A-Za-z_]",
|
10779 | "^\\s" : "^\\s",
|
10780 | "^\\s*\\\\" : "^\\s*\\\\",
|
10781 | "^[ \\t]$" : "^[ \\t]$",
|
10782 | "^[A-Za-z]$" : "^[A-Za-z]$",
|
10783 | "^[0-9A-Za-z]$" : "^[0-9A-Za-z]$",
|
10784 | "^[0-9]$" : "^[0-9]$",
|
10785 | "^[0-9A-Fa-f]$" : "^[0-9A-Fa-f]$",
|
10786 | "^[0-9A-Za-z_]$" : "^[0-9A-Za-z_]$",
|
10787 | "^[A-Za-z_]$" : "^[A-Za-z_]$",
|
10788 | "^[0-9A-Za-z_:#]$" : "^[0-9A-Za-z_:#]$",
|
10789 | "^[A-Za-z_][0-9A-Za-z_]*$" : "^[A-Za-z_][0-9A-Za-z_]*$",
|
10790 | "^[A-Z]$" : "^[A-Z]$",
|
10791 | "^[a-z]$" : "^[a-z]$",
|
10792 | "^[vgslabwt]:$\\|^\\([vgslabwt]:\\)\\?[A-Za-z_][0-9A-Za-z_#]*$" : "^[vgslabwt]:$|^([vgslabwt]:)?[A-Za-z_][0-9A-Za-z_#]*$",
|
10793 | "^[0-7]$" : "^[0-7]$",
|
10794 | "^[0-9A-Fa-f][0-9A-Fa-f]$" : "^[0-9A-Fa-f][0-9A-Fa-f]$",
|
10795 | "^\\.[0-9A-Fa-f]$" : "^\\.[0-9A-Fa-f]$",
|
10796 | "^[0-9A-Fa-f][^0-9A-Fa-f]$" : "^[0-9A-Fa-f][^0-9A-Fa-f]$",
|
10797 | }
|
10798 |
|
10799 | function viml_add(lst, item) {
|
10800 | lst.push(item);
|
10801 | }
|
10802 |
|
10803 | function viml_call(func, args) {
|
10804 | return func.apply(null, args);
|
10805 | }
|
10806 |
|
10807 | function viml_char2nr(c) {
|
10808 | return c.charCodeAt(0);
|
10809 | }
|
10810 |
|
10811 | function viml_empty(obj) {
|
10812 | return obj.length == 0;
|
10813 | }
|
10814 |
|
10815 | function viml_equalci(a, b) {
|
10816 | return a.toLowerCase() == b.toLowerCase();
|
10817 | }
|
10818 |
|
10819 | function viml_eqreg(s, reg) {
|
10820 | var mx = new RegExp(pat_vim2js[reg]);
|
10821 | return mx.exec(s) != null;
|
10822 | }
|
10823 |
|
10824 | function viml_eqregh(s, reg) {
|
10825 | var mx = new RegExp(pat_vim2js[reg]);
|
10826 | return mx.exec(s) != null;
|
10827 | }
|
10828 |
|
10829 | function viml_eqregq(s, reg) {
|
10830 | var mx = new RegExp(pat_vim2js[reg], "i");
|
10831 | return mx.exec(s) != null;
|
10832 | }
|
10833 |
|
10834 | function viml_escape(s, chars) {
|
10835 | var r = '';
|
10836 | for (var i = 0; i < s.length; ++i) {
|
10837 | if (chars.indexOf(s.charAt(i)) != -1) {
|
10838 | r = r + "\\" + s.charAt(i);
|
10839 | } else {
|
10840 | r = r + s.charAt(i);
|
10841 | }
|
10842 | }
|
10843 | return r;
|
10844 | }
|
10845 |
|
10846 | function viml_extend(obj, item) {
|
10847 | obj.push.apply(obj, item);
|
10848 | }
|
10849 |
|
10850 | function viml_insert(lst, item) {
|
10851 | var idx = arguments.length >= 3 ? arguments[2] : 0;
|
10852 | lst.splice(0, 0, item);
|
10853 | }
|
10854 |
|
10855 | function viml_join(lst, sep) {
|
10856 | return lst.join(sep);
|
10857 | }
|
10858 |
|
10859 | function viml_keys(obj) {
|
10860 | return Object.keys(obj);
|
10861 | }
|
10862 |
|
10863 | function viml_len(obj) {
|
10864 | if (typeof obj === 'string') {
|
10865 | var len = 0;
|
10866 | for (var i = 0; i < obj.length; i++) {
|
10867 | var c = obj.charCodeAt(i);
|
10868 | len += c < 128 ? 1 : ((c > 127) && (c < 2048)) ? 2 : 3;
|
10869 | }
|
10870 | return len;
|
10871 | }
|
10872 | return obj.length;
|
10873 | }
|
10874 |
|
10875 | function viml_printf() {
|
10876 | var a000 = Array.prototype.slice.call(arguments, 0);
|
10877 | if (a000.length == 1) {
|
10878 | return a000[0];
|
10879 | } else {
|
10880 | return util.format.apply(null, a000);
|
10881 | }
|
10882 | }
|
10883 |
|
10884 | function viml_range(start) {
|
10885 | var end = arguments.length >= 2 ? arguments[1] : null;
|
10886 | if (end == null) {
|
10887 | var x = [];
|
10888 | for (var i = 0; i < start; ++i) {
|
10889 | x.push(i);
|
10890 | }
|
10891 | return x;
|
10892 | } else {
|
10893 | var x = []
|
10894 | for (var i = start; i <= end; ++i) {
|
10895 | x.push(i);
|
10896 | }
|
10897 | return x;
|
10898 | }
|
10899 | }
|
10900 |
|
10901 | function viml_readfile(path) {
|
10902 |
|
10903 | return fs.readFileSync(path, 'utf-8').split(/\r\n|\r|\n/);
|
10904 | }
|
10905 |
|
10906 | function viml_remove(lst, idx) {
|
10907 | lst.splice(idx, 1);
|
10908 | }
|
10909 |
|
10910 | function viml_split(s, sep) {
|
10911 | if (sep == "\\zs") {
|
10912 | return s.split("");
|
10913 | }
|
10914 | throw "NotImplemented";
|
10915 | }
|
10916 |
|
10917 | function viml_str2nr(s) {
|
10918 | var base = arguments.length >= 2 ? arguments[1] : 10;
|
10919 | return parseInt(s, base);
|
10920 | }
|
10921 |
|
10922 | function viml_string(obj) {
|
10923 | return obj.toString();
|
10924 | }
|
10925 |
|
10926 | function viml_has_key(obj, key) {
|
10927 | return obj[key] !== undefined;
|
10928 | }
|
10929 |
|
10930 | function viml_stridx(a, b) {
|
10931 | return a.indexOf(b);
|
10932 | }
|
10933 |
|
10934 | var NIL = [];
|
10935 | var TRUE = 1;
|
10936 | var FALSE = 0;
|
10937 | var NODE_TOPLEVEL = 1;
|
10938 | var NODE_COMMENT = 2;
|
10939 | var NODE_EXCMD = 3;
|
10940 | var NODE_FUNCTION = 4;
|
10941 | var NODE_ENDFUNCTION = 5;
|
10942 | var NODE_DELFUNCTION = 6;
|
10943 | var NODE_RETURN = 7;
|
10944 | var NODE_EXCALL = 8;
|
10945 | var NODE_LET = 9;
|
10946 | var NODE_UNLET = 10;
|
10947 | var NODE_LOCKVAR = 11;
|
10948 | var NODE_UNLOCKVAR = 12;
|
10949 | var NODE_IF = 13;
|
10950 | var NODE_ELSEIF = 14;
|
10951 | var NODE_ELSE = 15;
|
10952 | var NODE_ENDIF = 16;
|
10953 | var NODE_WHILE = 17;
|
10954 | var NODE_ENDWHILE = 18;
|
10955 | var NODE_FOR = 19;
|
10956 | var NODE_ENDFOR = 20;
|
10957 | var NODE_CONTINUE = 21;
|
10958 | var NODE_BREAK = 22;
|
10959 | var NODE_TRY = 23;
|
10960 | var NODE_CATCH = 24;
|
10961 | var NODE_FINALLY = 25;
|
10962 | var NODE_ENDTRY = 26;
|
10963 | var NODE_THROW = 27;
|
10964 | var NODE_ECHO = 28;
|
10965 | var NODE_ECHON = 29;
|
10966 | var NODE_ECHOHL = 30;
|
10967 | var NODE_ECHOMSG = 31;
|
10968 | var NODE_ECHOERR = 32;
|
10969 | var NODE_EXECUTE = 33;
|
10970 | var NODE_TERNARY = 34;
|
10971 | var NODE_OR = 35;
|
10972 | var NODE_AND = 36;
|
10973 | var NODE_EQUAL = 37;
|
10974 | var NODE_EQUALCI = 38;
|
10975 | var NODE_EQUALCS = 39;
|
10976 | var NODE_NEQUAL = 40;
|
10977 | var NODE_NEQUALCI = 41;
|
10978 | var NODE_NEQUALCS = 42;
|
10979 | var NODE_GREATER = 43;
|
10980 | var NODE_GREATERCI = 44;
|
10981 | var NODE_GREATERCS = 45;
|
10982 | var NODE_GEQUAL = 46;
|
10983 | var NODE_GEQUALCI = 47;
|
10984 | var NODE_GEQUALCS = 48;
|
10985 | var NODE_SMALLER = 49;
|
10986 | var NODE_SMALLERCI = 50;
|
10987 | var NODE_SMALLERCS = 51;
|
10988 | var NODE_SEQUAL = 52;
|
10989 | var NODE_SEQUALCI = 53;
|
10990 | var NODE_SEQUALCS = 54;
|
10991 | var NODE_MATCH = 55;
|
10992 | var NODE_MATCHCI = 56;
|
10993 | var NODE_MATCHCS = 57;
|
10994 | var NODE_NOMATCH = 58;
|
10995 | var NODE_NOMATCHCI = 59;
|
10996 | var NODE_NOMATCHCS = 60;
|
10997 | var NODE_IS = 61;
|
10998 | var NODE_ISCI = 62;
|
10999 | var NODE_ISCS = 63;
|
11000 | var NODE_ISNOT = 64;
|
11001 | var NODE_ISNOTCI = 65;
|
11002 | var NODE_ISNOTCS = 66;
|
11003 | var NODE_ADD = 67;
|
11004 | var NODE_SUBTRACT = 68;
|
11005 | var NODE_CONCAT = 69;
|
11006 | var NODE_MULTIPLY = 70;
|
11007 | var NODE_DIVIDE = 71;
|
11008 | var NODE_REMAINDER = 72;
|
11009 | var NODE_NOT = 73;
|
11010 | var NODE_MINUS = 74;
|
11011 | var NODE_PLUS = 75;
|
11012 | var NODE_SUBSCRIPT = 76;
|
11013 | var NODE_SLICE = 77;
|
11014 | var NODE_CALL = 78;
|
11015 | var NODE_DOT = 79;
|
11016 | var NODE_NUMBER = 80;
|
11017 | var NODE_STRING = 81;
|
11018 | var NODE_LIST = 82;
|
11019 | var NODE_DICT = 83;
|
11020 | var NODE_OPTION = 85;
|
11021 | var NODE_IDENTIFIER = 86;
|
11022 | var NODE_CURLYNAME = 87;
|
11023 | var NODE_ENV = 88;
|
11024 | var NODE_REG = 89;
|
11025 | var NODE_CURLYNAMEPART = 90;
|
11026 | var NODE_CURLYNAMEEXPR = 91;
|
11027 | var NODE_LAMBDA = 92;
|
11028 | var NODE_BLOB = 93;
|
11029 | var NODE_CONST = 94;
|
11030 | var NODE_EVAL = 95;
|
11031 | var NODE_HEREDOC = 96;
|
11032 | var NODE_METHOD = 97;
|
11033 | var TOKEN_EOF = 1;
|
11034 | var TOKEN_EOL = 2;
|
11035 | var TOKEN_SPACE = 3;
|
11036 | var TOKEN_OROR = 4;
|
11037 | var TOKEN_ANDAND = 5;
|
11038 | var TOKEN_EQEQ = 6;
|
11039 | var TOKEN_EQEQCI = 7;
|
11040 | var TOKEN_EQEQCS = 8;
|
11041 | var TOKEN_NEQ = 9;
|
11042 | var TOKEN_NEQCI = 10;
|
11043 | var TOKEN_NEQCS = 11;
|
11044 | var TOKEN_GT = 12;
|
11045 | var TOKEN_GTCI = 13;
|
11046 | var TOKEN_GTCS = 14;
|
11047 | var TOKEN_GTEQ = 15;
|
11048 | var TOKEN_GTEQCI = 16;
|
11049 | var TOKEN_GTEQCS = 17;
|
11050 | var TOKEN_LT = 18;
|
11051 | var TOKEN_LTCI = 19;
|
11052 | var TOKEN_LTCS = 20;
|
11053 | var TOKEN_LTEQ = 21;
|
11054 | var TOKEN_LTEQCI = 22;
|
11055 | var TOKEN_LTEQCS = 23;
|
11056 | var TOKEN_MATCH = 24;
|
11057 | var TOKEN_MATCHCI = 25;
|
11058 | var TOKEN_MATCHCS = 26;
|
11059 | var TOKEN_NOMATCH = 27;
|
11060 | var TOKEN_NOMATCHCI = 28;
|
11061 | var TOKEN_NOMATCHCS = 29;
|
11062 | var TOKEN_IS = 30;
|
11063 | var TOKEN_ISCI = 31;
|
11064 | var TOKEN_ISCS = 32;
|
11065 | var TOKEN_ISNOT = 33;
|
11066 | var TOKEN_ISNOTCI = 34;
|
11067 | var TOKEN_ISNOTCS = 35;
|
11068 | var TOKEN_PLUS = 36;
|
11069 | var TOKEN_MINUS = 37;
|
11070 | var TOKEN_DOT = 38;
|
11071 | var TOKEN_STAR = 39;
|
11072 | var TOKEN_SLASH = 40;
|
11073 | var TOKEN_PERCENT = 41;
|
11074 | var TOKEN_NOT = 42;
|
11075 | var TOKEN_QUESTION = 43;
|
11076 | var TOKEN_COLON = 44;
|
11077 | var TOKEN_POPEN = 45;
|
11078 | var TOKEN_PCLOSE = 46;
|
11079 | var TOKEN_SQOPEN = 47;
|
11080 | var TOKEN_SQCLOSE = 48;
|
11081 | var TOKEN_COPEN = 49;
|
11082 | var TOKEN_CCLOSE = 50;
|
11083 | var TOKEN_COMMA = 51;
|
11084 | var TOKEN_NUMBER = 52;
|
11085 | var TOKEN_SQUOTE = 53;
|
11086 | var TOKEN_DQUOTE = 54;
|
11087 | var TOKEN_OPTION = 55;
|
11088 | var TOKEN_IDENTIFIER = 56;
|
11089 | var TOKEN_ENV = 57;
|
11090 | var TOKEN_REG = 58;
|
11091 | var TOKEN_EQ = 59;
|
11092 | var TOKEN_OR = 60;
|
11093 | var TOKEN_SEMICOLON = 61;
|
11094 | var TOKEN_BACKTICK = 62;
|
11095 | var TOKEN_DOTDOTDOT = 63;
|
11096 | var TOKEN_SHARP = 64;
|
11097 | var TOKEN_ARROW = 65;
|
11098 | var TOKEN_BLOB = 66;
|
11099 | var TOKEN_LITCOPEN = 67;
|
11100 | var TOKEN_DOTDOT = 68;
|
11101 | var TOKEN_HEREDOC = 69;
|
11102 | var MAX_FUNC_ARGS = 20;
|
11103 | function isalpha(c) {
|
11104 | return viml_eqregh(c, "^[A-Za-z]$");
|
11105 | }
|
11106 |
|
11107 | function isalnum(c) {
|
11108 | return viml_eqregh(c, "^[0-9A-Za-z]$");
|
11109 | }
|
11110 |
|
11111 | function isdigit(c) {
|
11112 | return viml_eqregh(c, "^[0-9]$");
|
11113 | }
|
11114 |
|
11115 | function isodigit(c) {
|
11116 | return viml_eqregh(c, "^[0-7]$");
|
11117 | }
|
11118 |
|
11119 | function isxdigit(c) {
|
11120 | return viml_eqregh(c, "^[0-9A-Fa-f]$");
|
11121 | }
|
11122 |
|
11123 | function iswordc(c) {
|
11124 | return viml_eqregh(c, "^[0-9A-Za-z_]$");
|
11125 | }
|
11126 |
|
11127 | function iswordc1(c) {
|
11128 | return viml_eqregh(c, "^[A-Za-z_]$");
|
11129 | }
|
11130 |
|
11131 | function iswhite(c) {
|
11132 | return viml_eqregh(c, "^[ \\t]$");
|
11133 | }
|
11134 |
|
11135 | function isnamec(c) {
|
11136 | return viml_eqregh(c, "^[0-9A-Za-z_:#]$");
|
11137 | }
|
11138 |
|
11139 | function isnamec1(c) {
|
11140 | return viml_eqregh(c, "^[A-Za-z_]$");
|
11141 | }
|
11142 |
|
11143 | function isargname(s) {
|
11144 | return viml_eqregh(s, "^[A-Za-z_][0-9A-Za-z_]*$");
|
11145 | }
|
11146 |
|
11147 | function isvarname(s) {
|
11148 | return viml_eqregh(s, "^[vgslabwt]:$\\|^\\([vgslabwt]:\\)\\?[A-Za-z_][0-9A-Za-z_#]*$");
|
11149 | }
|
11150 |
|
11151 |
|
11152 | function isidc(c) {
|
11153 | return viml_eqregh(c, "^[0-9A-Za-z_]$");
|
11154 | }
|
11155 |
|
11156 | function isupper(c) {
|
11157 | return viml_eqregh(c, "^[A-Z]$");
|
11158 | }
|
11159 |
|
11160 | function islower(c) {
|
11161 | return viml_eqregh(c, "^[a-z]$");
|
11162 | }
|
11163 |
|
11164 | function ExArg() {
|
11165 | var ea = {};
|
11166 | ea.forceit = FALSE;
|
11167 | ea.addr_count = 0;
|
11168 | ea.line1 = 0;
|
11169 | ea.line2 = 0;
|
11170 | ea.flags = 0;
|
11171 | ea.do_ecmd_cmd = "";
|
11172 | ea.do_ecmd_lnum = 0;
|
11173 | ea.append = 0;
|
11174 | ea.usefilter = FALSE;
|
11175 | ea.amount = 0;
|
11176 | ea.regname = 0;
|
11177 | ea.force_bin = 0;
|
11178 | ea.read_edit = 0;
|
11179 | ea.force_ff = 0;
|
11180 | ea.force_enc = 0;
|
11181 | ea.bad_char = 0;
|
11182 | ea.linepos = {};
|
11183 | ea.cmdpos = [];
|
11184 | ea.argpos = [];
|
11185 | ea.cmd = {};
|
11186 | ea.modifiers = [];
|
11187 | ea.range = [];
|
11188 | ea.argopt = {};
|
11189 | ea.argcmd = {};
|
11190 | return ea;
|
11191 | }
|
11192 |
|
11193 |
|
11194 |
|
11195 |
|
11196 |
|
11197 |
|
11198 |
|
11199 |
|
11200 |
|
11201 |
|
11202 |
|
11203 |
|
11204 |
|
11205 |
|
11206 |
|
11207 |
|
11208 |
|
11209 |
|
11210 |
|
11211 |
|
11212 |
|
11213 |
|
11214 |
|
11215 |
|
11216 |
|
11217 |
|
11218 |
|
11219 |
|
11220 |
|
11221 |
|
11222 |
|
11223 |
|
11224 |
|
11225 |
|
11226 |
|
11227 |
|
11228 |
|
11229 |
|
11230 |
|
11231 |
|
11232 |
|
11233 |
|
11234 |
|
11235 |
|
11236 |
|
11237 |
|
11238 |
|
11239 |
|
11240 |
|
11241 |
|
11242 |
|
11243 |
|
11244 |
|
11245 |
|
11246 |
|
11247 |
|
11248 |
|
11249 |
|
11250 |
|
11251 |
|
11252 |
|
11253 |
|
11254 |
|
11255 |
|
11256 |
|
11257 |
|
11258 |
|
11259 |
|
11260 |
|
11261 |
|
11262 |
|
11263 |
|
11264 |
|
11265 |
|
11266 |
|
11267 |
|
11268 |
|
11269 |
|
11270 |
|
11271 |
|
11272 |
|
11273 |
|
11274 |
|
11275 |
|
11276 |
|
11277 |
|
11278 |
|
11279 |
|
11280 |
|
11281 |
|
11282 |
|
11283 |
|
11284 |
|
11285 |
|
11286 |
|
11287 |
|
11288 |
|
11289 |
|
11290 |
|
11291 |
|
11292 |
|
11293 |
|
11294 |
|
11295 |
|
11296 |
|
11297 |
|
11298 |
|
11299 |
|
11300 |
|
11301 |
|
11302 |
|
11303 |
|
11304 |
|
11305 |
|
11306 | function Node(type) {
|
11307 | return {"type":type};
|
11308 | }
|
11309 |
|
11310 | function Err(msg, pos) {
|
11311 | return viml_printf("vimlparser: %s: line %d col %d", msg, pos.lnum, pos.col);
|
11312 | }
|
11313 |
|
11314 | function VimLParser() { this.__init__.apply(this, arguments); }
|
11315 | VimLParser.prototype.__init__ = function() {
|
11316 | var a000 = Array.prototype.slice.call(arguments, 0);
|
11317 | if (viml_len(a000) > 0) {
|
11318 | this.neovim = a000[0];
|
11319 | }
|
11320 | else {
|
11321 | this.neovim = 0;
|
11322 | }
|
11323 | this.find_command_cache = {};
|
11324 | }
|
11325 |
|
11326 | VimLParser.prototype.push_context = function(node) {
|
11327 | viml_insert(this.context, node);
|
11328 | }
|
11329 |
|
11330 | VimLParser.prototype.pop_context = function() {
|
11331 | viml_remove(this.context, 0);
|
11332 | }
|
11333 |
|
11334 | VimLParser.prototype.find_context = function(type) {
|
11335 | var i = 0;
|
11336 | var __c3 = this.context;
|
11337 | for (var __i3 = 0; __i3 < __c3.length; ++__i3) {
|
11338 | var node = __c3[__i3];
|
11339 | if (node.type == type) {
|
11340 | return i;
|
11341 | }
|
11342 | i += 1;
|
11343 | }
|
11344 | return -1;
|
11345 | }
|
11346 |
|
11347 | VimLParser.prototype.add_node = function(node) {
|
11348 | viml_add(this.context[0].body, node);
|
11349 | }
|
11350 |
|
11351 | VimLParser.prototype.check_missing_endfunction = function(ends, pos) {
|
11352 | if (this.context[0].type == NODE_FUNCTION) {
|
11353 | throw Err(viml_printf("E126: Missing :endfunction: %s", ends), pos);
|
11354 | }
|
11355 | }
|
11356 |
|
11357 | VimLParser.prototype.check_missing_endif = function(ends, pos) {
|
11358 | if (this.context[0].type == NODE_IF || this.context[0].type == NODE_ELSEIF || this.context[0].type == NODE_ELSE) {
|
11359 | throw Err(viml_printf("E171: Missing :endif: %s", ends), pos);
|
11360 | }
|
11361 | }
|
11362 |
|
11363 | VimLParser.prototype.check_missing_endtry = function(ends, pos) {
|
11364 | if (this.context[0].type == NODE_TRY || this.context[0].type == NODE_CATCH || this.context[0].type == NODE_FINALLY) {
|
11365 | throw Err(viml_printf("E600: Missing :endtry: %s", ends), pos);
|
11366 | }
|
11367 | }
|
11368 |
|
11369 | VimLParser.prototype.check_missing_endwhile = function(ends, pos) {
|
11370 | if (this.context[0].type == NODE_WHILE) {
|
11371 | throw Err(viml_printf("E170: Missing :endwhile: %s", ends), pos);
|
11372 | }
|
11373 | }
|
11374 |
|
11375 | VimLParser.prototype.check_missing_endfor = function(ends, pos) {
|
11376 | if (this.context[0].type == NODE_FOR) {
|
11377 | throw Err(viml_printf("E170: Missing :endfor: %s", ends), pos);
|
11378 | }
|
11379 | }
|
11380 |
|
11381 | VimLParser.prototype.parse = function(reader) {
|
11382 | this.reader = reader;
|
11383 | this.context = [];
|
11384 | var toplevel = Node(NODE_TOPLEVEL);
|
11385 | toplevel.pos = this.reader.getpos();
|
11386 | toplevel.body = [];
|
11387 | this.push_context(toplevel);
|
11388 | while (this.reader.peek() != "<EOF>") {
|
11389 | this.parse_one_cmd();
|
11390 | }
|
11391 | this.check_missing_endfunction("TOPLEVEL", this.reader.getpos());
|
11392 | this.check_missing_endif("TOPLEVEL", this.reader.getpos());
|
11393 | this.check_missing_endtry("TOPLEVEL", this.reader.getpos());
|
11394 | this.check_missing_endwhile("TOPLEVEL", this.reader.getpos());
|
11395 | this.check_missing_endfor("TOPLEVEL", this.reader.getpos());
|
11396 | this.pop_context();
|
11397 | return toplevel;
|
11398 | }
|
11399 |
|
11400 | VimLParser.prototype.parse_one_cmd = function() {
|
11401 | this.ea = ExArg();
|
11402 | if (this.reader.peekn(2) == "#!") {
|
11403 | this.parse_hashbang();
|
11404 | this.reader.get();
|
11405 | return;
|
11406 | }
|
11407 | this.reader.skip_white_and_colon();
|
11408 | if (this.reader.peekn(1) == "") {
|
11409 | this.reader.get();
|
11410 | return;
|
11411 | }
|
11412 | if (this.reader.peekn(1) == "\"") {
|
11413 | this.parse_comment();
|
11414 | this.reader.get();
|
11415 | return;
|
11416 | }
|
11417 | this.ea.linepos = this.reader.getpos();
|
11418 | this.parse_command_modifiers();
|
11419 | this.parse_range();
|
11420 | this.parse_command();
|
11421 | this.parse_trail();
|
11422 | }
|
11423 |
|
11424 |
|
11425 | VimLParser.prototype.parse_command_modifiers = function() {
|
11426 | var modifiers = [];
|
11427 | while (TRUE) {
|
11428 | var pos = this.reader.tell();
|
11429 | var d = "";
|
11430 | if (isdigit(this.reader.peekn(1))) {
|
11431 | var d = this.reader.read_digit();
|
11432 | this.reader.skip_white();
|
11433 | }
|
11434 | var k = this.reader.read_alpha();
|
11435 | var c = this.reader.peekn(1);
|
11436 | this.reader.skip_white();
|
11437 | if (viml_stridx("aboveleft", k) == 0 && viml_len(k) >= 3) {
|
11438 |
|
11439 | viml_add(modifiers, {"name":"aboveleft"});
|
11440 | }
|
11441 | else if (viml_stridx("belowright", k) == 0 && viml_len(k) >= 3) {
|
11442 |
|
11443 | viml_add(modifiers, {"name":"belowright"});
|
11444 | }
|
11445 | else if (viml_stridx("browse", k) == 0 && viml_len(k) >= 3) {
|
11446 |
|
11447 | viml_add(modifiers, {"name":"browse"});
|
11448 | }
|
11449 | else if (viml_stridx("botright", k) == 0 && viml_len(k) >= 2) {
|
11450 |
|
11451 | viml_add(modifiers, {"name":"botright"});
|
11452 | }
|
11453 | else if (viml_stridx("confirm", k) == 0 && viml_len(k) >= 4) {
|
11454 |
|
11455 | viml_add(modifiers, {"name":"confirm"});
|
11456 | }
|
11457 | else if (viml_stridx("keepmarks", k) == 0 && viml_len(k) >= 3) {
|
11458 |
|
11459 | viml_add(modifiers, {"name":"keepmarks"});
|
11460 | }
|
11461 | else if (viml_stridx("keepalt", k) == 0 && viml_len(k) >= 5) {
|
11462 |
|
11463 | viml_add(modifiers, {"name":"keepalt"});
|
11464 | }
|
11465 | else if (viml_stridx("keepjumps", k) == 0 && viml_len(k) >= 5) {
|
11466 |
|
11467 | viml_add(modifiers, {"name":"keepjumps"});
|
11468 | }
|
11469 | else if (viml_stridx("keeppatterns", k) == 0 && viml_len(k) >= 5) {
|
11470 |
|
11471 | viml_add(modifiers, {"name":"keeppatterns"});
|
11472 | }
|
11473 | else if (viml_stridx("hide", k) == 0 && viml_len(k) >= 3) {
|
11474 |
|
11475 | if (this.ends_excmds(c)) {
|
11476 | break;
|
11477 | }
|
11478 | viml_add(modifiers, {"name":"hide"});
|
11479 | }
|
11480 | else if (viml_stridx("lockmarks", k) == 0 && viml_len(k) >= 3) {
|
11481 |
|
11482 | viml_add(modifiers, {"name":"lockmarks"});
|
11483 | }
|
11484 | else if (viml_stridx("leftabove", k) == 0 && viml_len(k) >= 5) {
|
11485 |
|
11486 | viml_add(modifiers, {"name":"leftabove"});
|
11487 | }
|
11488 | else if (viml_stridx("noautocmd", k) == 0 && viml_len(k) >= 3) {
|
11489 |
|
11490 | viml_add(modifiers, {"name":"noautocmd"});
|
11491 | }
|
11492 | else if (viml_stridx("noswapfile", k) == 0 && viml_len(k) >= 3) {
|
11493 |
|
11494 | viml_add(modifiers, {"name":"noswapfile"});
|
11495 | }
|
11496 | else if (viml_stridx("rightbelow", k) == 0 && viml_len(k) >= 6) {
|
11497 |
|
11498 | viml_add(modifiers, {"name":"rightbelow"});
|
11499 | }
|
11500 | else if (viml_stridx("sandbox", k) == 0 && viml_len(k) >= 3) {
|
11501 |
|
11502 | viml_add(modifiers, {"name":"sandbox"});
|
11503 | }
|
11504 | else if (viml_stridx("silent", k) == 0 && viml_len(k) >= 3) {
|
11505 |
|
11506 | if (c == "!") {
|
11507 | this.reader.get();
|
11508 | viml_add(modifiers, {"name":"silent", "bang":1});
|
11509 | }
|
11510 | else {
|
11511 | viml_add(modifiers, {"name":"silent", "bang":0});
|
11512 | }
|
11513 | }
|
11514 | else if (k == "tab") {
|
11515 |
|
11516 | if (d != "") {
|
11517 | viml_add(modifiers, {"name":"tab", "count":viml_str2nr(d, 10)});
|
11518 | }
|
11519 | else {
|
11520 | viml_add(modifiers, {"name":"tab"});
|
11521 | }
|
11522 | }
|
11523 | else if (viml_stridx("topleft", k) == 0 && viml_len(k) >= 2) {
|
11524 |
|
11525 | viml_add(modifiers, {"name":"topleft"});
|
11526 | }
|
11527 | else if (viml_stridx("unsilent", k) == 0 && viml_len(k) >= 3) {
|
11528 |
|
11529 | viml_add(modifiers, {"name":"unsilent"});
|
11530 | }
|
11531 | else if (viml_stridx("vertical", k) == 0 && viml_len(k) >= 4) {
|
11532 |
|
11533 | viml_add(modifiers, {"name":"vertical"});
|
11534 | }
|
11535 | else if (viml_stridx("verbose", k) == 0 && viml_len(k) >= 4) {
|
11536 |
|
11537 | if (d != "") {
|
11538 | viml_add(modifiers, {"name":"verbose", "count":viml_str2nr(d, 10)});
|
11539 | }
|
11540 | else {
|
11541 | viml_add(modifiers, {"name":"verbose", "count":1});
|
11542 | }
|
11543 | }
|
11544 | else {
|
11545 | this.reader.seek_set(pos);
|
11546 | break;
|
11547 | }
|
11548 | }
|
11549 | this.ea.modifiers = modifiers;
|
11550 | }
|
11551 |
|
11552 |
|
11553 | VimLParser.prototype.parse_range = function() {
|
11554 | var tokens = [];
|
11555 | while (TRUE) {
|
11556 | while (TRUE) {
|
11557 | this.reader.skip_white();
|
11558 | var c = this.reader.peekn(1);
|
11559 | if (c == "") {
|
11560 | break;
|
11561 | }
|
11562 | if (c == ".") {
|
11563 | viml_add(tokens, this.reader.getn(1));
|
11564 | }
|
11565 | else if (c == "$") {
|
11566 | viml_add(tokens, this.reader.getn(1));
|
11567 | }
|
11568 | else if (c == "'") {
|
11569 | this.reader.getn(1);
|
11570 | var m = this.reader.getn(1);
|
11571 | if (m == "") {
|
11572 | break;
|
11573 | }
|
11574 | viml_add(tokens, "'" + m);
|
11575 | }
|
11576 | else if (c == "/") {
|
11577 | this.reader.getn(1);
|
11578 | var __tmp = this.parse_pattern(c);
|
11579 | var pattern = __tmp[0];
|
11580 | var _ = __tmp[1];
|
11581 | viml_add(tokens, pattern);
|
11582 | }
|
11583 | else if (c == "?") {
|
11584 | this.reader.getn(1);
|
11585 | var __tmp = this.parse_pattern(c);
|
11586 | var pattern = __tmp[0];
|
11587 | var _ = __tmp[1];
|
11588 | viml_add(tokens, pattern);
|
11589 | }
|
11590 | else if (c == "\\") {
|
11591 | var m = this.reader.p(1);
|
11592 | if (m == "&" || m == "?" || m == "/") {
|
11593 | this.reader.seek_cur(2);
|
11594 | viml_add(tokens, "\\" + m);
|
11595 | }
|
11596 | else {
|
11597 | throw Err("E10: \\\\ should be followed by /, ? or &", this.reader.getpos());
|
11598 | }
|
11599 | }
|
11600 | else if (isdigit(c)) {
|
11601 | viml_add(tokens, this.reader.read_digit());
|
11602 | }
|
11603 | while (TRUE) {
|
11604 | this.reader.skip_white();
|
11605 | if (this.reader.peekn(1) == "") {
|
11606 | break;
|
11607 | }
|
11608 | var n = this.reader.read_integer();
|
11609 | if (n == "") {
|
11610 | break;
|
11611 | }
|
11612 | viml_add(tokens, n);
|
11613 | }
|
11614 | if (this.reader.p(0) != "/" && this.reader.p(0) != "?") {
|
11615 | break;
|
11616 | }
|
11617 | }
|
11618 | if (this.reader.peekn(1) == "%") {
|
11619 | viml_add(tokens, this.reader.getn(1));
|
11620 | }
|
11621 | else if (this.reader.peekn(1) == "*") {
|
11622 |
|
11623 | viml_add(tokens, this.reader.getn(1));
|
11624 | }
|
11625 | if (this.reader.peekn(1) == ";") {
|
11626 | viml_add(tokens, this.reader.getn(1));
|
11627 | continue;
|
11628 | }
|
11629 | else if (this.reader.peekn(1) == ",") {
|
11630 | viml_add(tokens, this.reader.getn(1));
|
11631 | continue;
|
11632 | }
|
11633 | break;
|
11634 | }
|
11635 | this.ea.range = tokens;
|
11636 | }
|
11637 |
|
11638 |
|
11639 | VimLParser.prototype.parse_pattern = function(delimiter) {
|
11640 | var pattern = "";
|
11641 | var endc = "";
|
11642 | var inbracket = 0;
|
11643 | while (TRUE) {
|
11644 | var c = this.reader.getn(1);
|
11645 | if (c == "") {
|
11646 | break;
|
11647 | }
|
11648 | if (c == delimiter && inbracket == 0) {
|
11649 | var endc = c;
|
11650 | break;
|
11651 | }
|
11652 | pattern += c;
|
11653 | if (c == "\\") {
|
11654 | var c = this.reader.peekn(1);
|
11655 | if (c == "") {
|
11656 | throw Err("E682: Invalid search pattern or delimiter", this.reader.getpos());
|
11657 | }
|
11658 | this.reader.getn(1);
|
11659 | pattern += c;
|
11660 | }
|
11661 | else if (c == "[") {
|
11662 | inbracket += 1;
|
11663 | }
|
11664 | else if (c == "]") {
|
11665 | inbracket -= 1;
|
11666 | }
|
11667 | }
|
11668 | return [pattern, endc];
|
11669 | }
|
11670 |
|
11671 | VimLParser.prototype.parse_command = function() {
|
11672 | this.reader.skip_white_and_colon();
|
11673 | this.ea.cmdpos = this.reader.getpos();
|
11674 | if (this.reader.peekn(1) == "" || this.reader.peekn(1) == "\"") {
|
11675 | if (!viml_empty(this.ea.modifiers) || !viml_empty(this.ea.range)) {
|
11676 | this.parse_cmd_modifier_range();
|
11677 | }
|
11678 | return;
|
11679 | }
|
11680 | this.ea.cmd = this.find_command();
|
11681 | if (this.ea.cmd === NIL) {
|
11682 | this.reader.setpos(this.ea.cmdpos);
|
11683 | throw Err(viml_printf("E492: Not an editor command: %s", this.reader.peekline()), this.ea.cmdpos);
|
11684 | }
|
11685 | if (this.reader.peekn(1) == "!" && this.ea.cmd.name != "substitute" && this.ea.cmd.name != "smagic" && this.ea.cmd.name != "snomagic") {
|
11686 | this.reader.getn(1);
|
11687 | this.ea.forceit = TRUE;
|
11688 | }
|
11689 | else {
|
11690 | this.ea.forceit = FALSE;
|
11691 | }
|
11692 | if (!viml_eqregh(this.ea.cmd.flags, "\\<BANG\\>") && this.ea.forceit && !viml_eqregh(this.ea.cmd.flags, "\\<USERCMD\\>")) {
|
11693 | throw Err("E477: No ! allowed", this.ea.cmdpos);
|
11694 | }
|
11695 | if (this.ea.cmd.name != "!") {
|
11696 | this.reader.skip_white();
|
11697 | }
|
11698 | this.ea.argpos = this.reader.getpos();
|
11699 | if (viml_eqregh(this.ea.cmd.flags, "\\<ARGOPT\\>")) {
|
11700 | this.parse_argopt();
|
11701 | }
|
11702 | if (this.ea.cmd.name == "write" || this.ea.cmd.name == "update") {
|
11703 | if (this.reader.p(0) == ">") {
|
11704 | if (this.reader.p(1) != ">") {
|
11705 | throw Err("E494: Use w or w>>", this.ea.cmdpos);
|
11706 | }
|
11707 | this.reader.seek_cur(2);
|
11708 | this.reader.skip_white();
|
11709 | this.ea.append = 1;
|
11710 | }
|
11711 | else if (this.reader.peekn(1) == "!" && this.ea.cmd.name == "write") {
|
11712 | this.reader.getn(1);
|
11713 | this.ea.usefilter = TRUE;
|
11714 | }
|
11715 | }
|
11716 | if (this.ea.cmd.name == "read") {
|
11717 | if (this.ea.forceit) {
|
11718 | this.ea.usefilter = TRUE;
|
11719 | this.ea.forceit = FALSE;
|
11720 | }
|
11721 | else if (this.reader.peekn(1) == "!") {
|
11722 | this.reader.getn(1);
|
11723 | this.ea.usefilter = TRUE;
|
11724 | }
|
11725 | }
|
11726 | if (this.ea.cmd.name == "<" || this.ea.cmd.name == ">") {
|
11727 | this.ea.amount = 1;
|
11728 | while (this.reader.peekn(1) == this.ea.cmd.name) {
|
11729 | this.reader.getn(1);
|
11730 | this.ea.amount += 1;
|
11731 | }
|
11732 | this.reader.skip_white();
|
11733 | }
|
11734 | if (viml_eqregh(this.ea.cmd.flags, "\\<EDITCMD\\>") && !this.ea.usefilter) {
|
11735 | this.parse_argcmd();
|
11736 | }
|
11737 | this._parse_command(this.ea.cmd.parser);
|
11738 | }
|
11739 |
|
11740 |
|
11741 | VimLParser.prototype._parse_command = function(parser) {
|
11742 | if (parser == "parse_cmd_append") {
|
11743 | this.parse_cmd_append();
|
11744 | }
|
11745 | else if (parser == "parse_cmd_break") {
|
11746 | this.parse_cmd_break();
|
11747 | }
|
11748 | else if (parser == "parse_cmd_call") {
|
11749 | this.parse_cmd_call();
|
11750 | }
|
11751 | else if (parser == "parse_cmd_catch") {
|
11752 | this.parse_cmd_catch();
|
11753 | }
|
11754 | else if (parser == "parse_cmd_common") {
|
11755 | this.parse_cmd_common();
|
11756 | }
|
11757 | else if (parser == "parse_cmd_continue") {
|
11758 | this.parse_cmd_continue();
|
11759 | }
|
11760 | else if (parser == "parse_cmd_delfunction") {
|
11761 | this.parse_cmd_delfunction();
|
11762 | }
|
11763 | else if (parser == "parse_cmd_echo") {
|
11764 | this.parse_cmd_echo();
|
11765 | }
|
11766 | else if (parser == "parse_cmd_echoerr") {
|
11767 | this.parse_cmd_echoerr();
|
11768 | }
|
11769 | else if (parser == "parse_cmd_echohl") {
|
11770 | this.parse_cmd_echohl();
|
11771 | }
|
11772 | else if (parser == "parse_cmd_echomsg") {
|
11773 | this.parse_cmd_echomsg();
|
11774 | }
|
11775 | else if (parser == "parse_cmd_echon") {
|
11776 | this.parse_cmd_echon();
|
11777 | }
|
11778 | else if (parser == "parse_cmd_else") {
|
11779 | this.parse_cmd_else();
|
11780 | }
|
11781 | else if (parser == "parse_cmd_elseif") {
|
11782 | this.parse_cmd_elseif();
|
11783 | }
|
11784 | else if (parser == "parse_cmd_endfor") {
|
11785 | this.parse_cmd_endfor();
|
11786 | }
|
11787 | else if (parser == "parse_cmd_endfunction") {
|
11788 | this.parse_cmd_endfunction();
|
11789 | }
|
11790 | else if (parser == "parse_cmd_endif") {
|
11791 | this.parse_cmd_endif();
|
11792 | }
|
11793 | else if (parser == "parse_cmd_endtry") {
|
11794 | this.parse_cmd_endtry();
|
11795 | }
|
11796 | else if (parser == "parse_cmd_endwhile") {
|
11797 | this.parse_cmd_endwhile();
|
11798 | }
|
11799 | else if (parser == "parse_cmd_execute") {
|
11800 | this.parse_cmd_execute();
|
11801 | }
|
11802 | else if (parser == "parse_cmd_finally") {
|
11803 | this.parse_cmd_finally();
|
11804 | }
|
11805 | else if (parser == "parse_cmd_finish") {
|
11806 | this.parse_cmd_finish();
|
11807 | }
|
11808 | else if (parser == "parse_cmd_for") {
|
11809 | this.parse_cmd_for();
|
11810 | }
|
11811 | else if (parser == "parse_cmd_function") {
|
11812 | this.parse_cmd_function();
|
11813 | }
|
11814 | else if (parser == "parse_cmd_if") {
|
11815 | this.parse_cmd_if();
|
11816 | }
|
11817 | else if (parser == "parse_cmd_insert") {
|
11818 | this.parse_cmd_insert();
|
11819 | }
|
11820 | else if (parser == "parse_cmd_let") {
|
11821 | this.parse_cmd_let();
|
11822 | }
|
11823 | else if (parser == "parse_cmd_const") {
|
11824 | this.parse_cmd_const();
|
11825 | }
|
11826 | else if (parser == "parse_cmd_loadkeymap") {
|
11827 | this.parse_cmd_loadkeymap();
|
11828 | }
|
11829 | else if (parser == "parse_cmd_lockvar") {
|
11830 | this.parse_cmd_lockvar();
|
11831 | }
|
11832 | else if (parser == "parse_cmd_lua") {
|
11833 | this.parse_cmd_lua();
|
11834 | }
|
11835 | else if (parser == "parse_cmd_modifier_range") {
|
11836 | this.parse_cmd_modifier_range();
|
11837 | }
|
11838 | else if (parser == "parse_cmd_mzscheme") {
|
11839 | this.parse_cmd_mzscheme();
|
11840 | }
|
11841 | else if (parser == "parse_cmd_perl") {
|
11842 | this.parse_cmd_perl();
|
11843 | }
|
11844 | else if (parser == "parse_cmd_python") {
|
11845 | this.parse_cmd_python();
|
11846 | }
|
11847 | else if (parser == "parse_cmd_python3") {
|
11848 | this.parse_cmd_python3();
|
11849 | }
|
11850 | else if (parser == "parse_cmd_return") {
|
11851 | this.parse_cmd_return();
|
11852 | }
|
11853 | else if (parser == "parse_cmd_ruby") {
|
11854 | this.parse_cmd_ruby();
|
11855 | }
|
11856 | else if (parser == "parse_cmd_tcl") {
|
11857 | this.parse_cmd_tcl();
|
11858 | }
|
11859 | else if (parser == "parse_cmd_throw") {
|
11860 | this.parse_cmd_throw();
|
11861 | }
|
11862 | else if (parser == "parse_cmd_eval") {
|
11863 | this.parse_cmd_eval();
|
11864 | }
|
11865 | else if (parser == "parse_cmd_try") {
|
11866 | this.parse_cmd_try();
|
11867 | }
|
11868 | else if (parser == "parse_cmd_unlet") {
|
11869 | this.parse_cmd_unlet();
|
11870 | }
|
11871 | else if (parser == "parse_cmd_unlockvar") {
|
11872 | this.parse_cmd_unlockvar();
|
11873 | }
|
11874 | else if (parser == "parse_cmd_usercmd") {
|
11875 | this.parse_cmd_usercmd();
|
11876 | }
|
11877 | else if (parser == "parse_cmd_while") {
|
11878 | this.parse_cmd_while();
|
11879 | }
|
11880 | else if (parser == "parse_wincmd") {
|
11881 | this.parse_wincmd();
|
11882 | }
|
11883 | else if (parser == "parse_cmd_syntax") {
|
11884 | this.parse_cmd_syntax();
|
11885 | }
|
11886 | else {
|
11887 | throw viml_printf("unknown parser: %s", viml_string(parser));
|
11888 | }
|
11889 | }
|
11890 |
|
11891 | VimLParser.prototype.find_command = function() {
|
11892 | var c = this.reader.peekn(1);
|
11893 | var name = "";
|
11894 | if (c == "k") {
|
11895 | this.reader.getn(1);
|
11896 | var name = "k";
|
11897 | }
|
11898 | else if (c == "s" && viml_eqregh(this.reader.peekn(5), "\\v^s%(c[^sr][^i][^p]|g|i[^mlg]|I|r[^e])")) {
|
11899 | this.reader.getn(1);
|
11900 | var name = "substitute";
|
11901 | }
|
11902 | else if (viml_eqregh(c, "[@*!=><&~#]")) {
|
11903 | this.reader.getn(1);
|
11904 | var name = c;
|
11905 | }
|
11906 | else if (this.reader.peekn(2) == "py") {
|
11907 | var name = this.reader.read_alnum();
|
11908 | }
|
11909 | else {
|
11910 | var pos = this.reader.tell();
|
11911 | var name = this.reader.read_alpha();
|
11912 | if (name != "del" && viml_eqregh(name, "\\v^d%[elete][lp]$")) {
|
11913 | this.reader.seek_set(pos);
|
11914 | var name = this.reader.getn(viml_len(name) - 1);
|
11915 | }
|
11916 | }
|
11917 | if (name == "") {
|
11918 | return NIL;
|
11919 | }
|
11920 | if (viml_has_key(this.find_command_cache, name)) {
|
11921 | return this.find_command_cache[name];
|
11922 | }
|
11923 | var cmd = NIL;
|
11924 | var __c4 = this.builtin_commands;
|
11925 | for (var __i4 = 0; __i4 < __c4.length; ++__i4) {
|
11926 | var x = __c4[__i4];
|
11927 | if (viml_stridx(x.name, name) == 0 && viml_len(name) >= x.minlen) {
|
11928 | delete cmd;
|
11929 | var cmd = x;
|
11930 | break;
|
11931 | }
|
11932 | }
|
11933 | if (this.neovim) {
|
11934 | var __c5 = this.neovim_additional_commands;
|
11935 | for (var __i5 = 0; __i5 < __c5.length; ++__i5) {
|
11936 | var x = __c5[__i5];
|
11937 | if (viml_stridx(x.name, name) == 0 && viml_len(name) >= x.minlen) {
|
11938 | delete cmd;
|
11939 | var cmd = x;
|
11940 | break;
|
11941 | }
|
11942 | }
|
11943 | var __c6 = this.neovim_removed_commands;
|
11944 | for (var __i6 = 0; __i6 < __c6.length; ++__i6) {
|
11945 | var x = __c6[__i6];
|
11946 | if (viml_stridx(x.name, name) == 0 && viml_len(name) >= x.minlen) {
|
11947 | delete cmd;
|
11948 | var cmd = NIL;
|
11949 | break;
|
11950 | }
|
11951 | }
|
11952 | }
|
11953 |
|
11954 | if ((cmd === NIL || cmd.name == "Print") && viml_eqregh(name, "^[A-Z]")) {
|
11955 | name += this.reader.read_alnum();
|
11956 | delete cmd;
|
11957 | var cmd = {"name":name, "flags":"USERCMD", "parser":"parse_cmd_usercmd"};
|
11958 | }
|
11959 | this.find_command_cache[name] = cmd;
|
11960 | return cmd;
|
11961 | }
|
11962 |
|
11963 |
|
11964 | VimLParser.prototype.parse_hashbang = function() {
|
11965 | this.reader.getn(-1);
|
11966 | }
|
11967 |
|
11968 |
|
11969 |
|
11970 | VimLParser.prototype.parse_argopt = function() {
|
11971 | while (this.reader.p(0) == "+" && this.reader.p(1) == "+") {
|
11972 | var s = this.reader.peekn(20);
|
11973 | if (viml_eqregh(s, "^++bin\\>")) {
|
11974 | this.reader.getn(5);
|
11975 | this.ea.force_bin = 1;
|
11976 | }
|
11977 | else if (viml_eqregh(s, "^++nobin\\>")) {
|
11978 | this.reader.getn(7);
|
11979 | this.ea.force_bin = 2;
|
11980 | }
|
11981 | else if (viml_eqregh(s, "^++edit\\>")) {
|
11982 | this.reader.getn(6);
|
11983 | this.ea.read_edit = 1;
|
11984 | }
|
11985 | else if (viml_eqregh(s, "^++ff=\\(dos\\|unix\\|mac\\)\\>")) {
|
11986 | this.reader.getn(5);
|
11987 | this.ea.force_ff = this.reader.read_alpha();
|
11988 | }
|
11989 | else if (viml_eqregh(s, "^++fileformat=\\(dos\\|unix\\|mac\\)\\>")) {
|
11990 | this.reader.getn(13);
|
11991 | this.ea.force_ff = this.reader.read_alpha();
|
11992 | }
|
11993 | else if (viml_eqregh(s, "^++enc=\\S")) {
|
11994 | this.reader.getn(6);
|
11995 | this.ea.force_enc = this.reader.read_nonwhite();
|
11996 | }
|
11997 | else if (viml_eqregh(s, "^++encoding=\\S")) {
|
11998 | this.reader.getn(11);
|
11999 | this.ea.force_enc = this.reader.read_nonwhite();
|
12000 | }
|
12001 | else if (viml_eqregh(s, "^++bad=\\(keep\\|drop\\|.\\)\\>")) {
|
12002 | this.reader.getn(6);
|
12003 | if (viml_eqregh(s, "^++bad=keep")) {
|
12004 | this.ea.bad_char = this.reader.getn(4);
|
12005 | }
|
12006 | else if (viml_eqregh(s, "^++bad=drop")) {
|
12007 | this.ea.bad_char = this.reader.getn(4);
|
12008 | }
|
12009 | else {
|
12010 | this.ea.bad_char = this.reader.getn(1);
|
12011 | }
|
12012 | }
|
12013 | else if (viml_eqregh(s, "^++")) {
|
12014 | throw Err("E474: Invalid Argument", this.reader.getpos());
|
12015 | }
|
12016 | else {
|
12017 | break;
|
12018 | }
|
12019 | this.reader.skip_white();
|
12020 | }
|
12021 | }
|
12022 |
|
12023 |
|
12024 |
|
12025 | VimLParser.prototype.parse_argcmd = function() {
|
12026 | if (this.reader.peekn(1) == "+") {
|
12027 | this.reader.getn(1);
|
12028 | if (this.reader.peekn(1) == " ") {
|
12029 | this.ea.do_ecmd_cmd = "$";
|
12030 | }
|
12031 | else {
|
12032 | this.ea.do_ecmd_cmd = this.read_cmdarg();
|
12033 | }
|
12034 | }
|
12035 | }
|
12036 |
|
12037 | VimLParser.prototype.read_cmdarg = function() {
|
12038 | var r = "";
|
12039 | while (TRUE) {
|
12040 | var c = this.reader.peekn(1);
|
12041 | if (c == "" || iswhite(c)) {
|
12042 | break;
|
12043 | }
|
12044 | this.reader.getn(1);
|
12045 | if (c == "\\") {
|
12046 | var c = this.reader.getn(1);
|
12047 | }
|
12048 | r += c;
|
12049 | }
|
12050 | return r;
|
12051 | }
|
12052 |
|
12053 | VimLParser.prototype.parse_comment = function() {
|
12054 | var npos = this.reader.getpos();
|
12055 | var c = this.reader.get();
|
12056 | if (c != "\"") {
|
12057 | throw Err(viml_printf("unexpected character: %s", c), npos);
|
12058 | }
|
12059 | var node = Node(NODE_COMMENT);
|
12060 | node.pos = npos;
|
12061 | node.str = this.reader.getn(-1);
|
12062 | this.add_node(node);
|
12063 | }
|
12064 |
|
12065 | VimLParser.prototype.parse_trail = function() {
|
12066 | this.reader.skip_white();
|
12067 | var c = this.reader.peek();
|
12068 | if (c == "<EOF>") {
|
12069 |
|
12070 | }
|
12071 | else if (c == "<EOL>") {
|
12072 | this.reader.get();
|
12073 | }
|
12074 | else if (c == "|") {
|
12075 | this.reader.get();
|
12076 | }
|
12077 | else if (c == "\"") {
|
12078 | this.parse_comment();
|
12079 | this.reader.get();
|
12080 | }
|
12081 | else {
|
12082 | throw Err(viml_printf("E488: Trailing characters: %s", c), this.reader.getpos());
|
12083 | }
|
12084 | }
|
12085 |
|
12086 |
|
12087 | VimLParser.prototype.parse_cmd_modifier_range = function() {
|
12088 | var node = Node(NODE_EXCMD);
|
12089 | node.pos = this.ea.cmdpos;
|
12090 | node.ea = this.ea;
|
12091 | node.str = this.reader.getstr(this.ea.linepos, this.reader.getpos());
|
12092 | this.add_node(node);
|
12093 | }
|
12094 |
|
12095 |
|
12096 | VimLParser.prototype.parse_cmd_common = function() {
|
12097 | var end = this.reader.getpos();
|
12098 | if (viml_eqregh(this.ea.cmd.flags, "\\<TRLBAR\\>") && !this.ea.usefilter) {
|
12099 | var end = this.separate_nextcmd();
|
12100 | }
|
12101 | else if (this.ea.cmd.name == "!" || this.ea.cmd.name == "global" || this.ea.cmd.name == "vglobal" || this.ea.usefilter) {
|
12102 | while (TRUE) {
|
12103 | var end = this.reader.getpos();
|
12104 | if (this.reader.getn(1) == "") {
|
12105 | break;
|
12106 | }
|
12107 | }
|
12108 | }
|
12109 | else {
|
12110 | while (TRUE) {
|
12111 | var end = this.reader.getpos();
|
12112 | if (this.reader.getn(1) == "") {
|
12113 | break;
|
12114 | }
|
12115 | }
|
12116 | }
|
12117 | var node = Node(NODE_EXCMD);
|
12118 | node.pos = this.ea.cmdpos;
|
12119 | node.ea = this.ea;
|
12120 | node.str = this.reader.getstr(this.ea.linepos, end);
|
12121 | this.add_node(node);
|
12122 | }
|
12123 |
|
12124 | VimLParser.prototype.separate_nextcmd = function() {
|
12125 | if (this.ea.cmd.name == "vimgrep" || this.ea.cmd.name == "vimgrepadd" || this.ea.cmd.name == "lvimgrep" || this.ea.cmd.name == "lvimgrepadd") {
|
12126 | this.skip_vimgrep_pat();
|
12127 | }
|
12128 | var pc = "";
|
12129 | var end = this.reader.getpos();
|
12130 | var nospend = end;
|
12131 | while (TRUE) {
|
12132 | var end = this.reader.getpos();
|
12133 | if (!iswhite(pc)) {
|
12134 | var nospend = end;
|
12135 | }
|
12136 | var c = this.reader.peek();
|
12137 | if (c == "<EOF>" || c == "<EOL>") {
|
12138 | break;
|
12139 | }
|
12140 | else if (c == "\x16") {
|
12141 |
|
12142 | this.reader.get();
|
12143 | var end = this.reader.getpos();
|
12144 | var nospend = this.reader.getpos();
|
12145 | var c = this.reader.peek();
|
12146 | if (c == "<EOF>" || c == "<EOL>") {
|
12147 | break;
|
12148 | }
|
12149 | this.reader.get();
|
12150 | }
|
12151 | else if (this.reader.peekn(2) == "`=" && viml_eqregh(this.ea.cmd.flags, "\\<\\(XFILE\\|FILES\\|FILE1\\)\\>")) {
|
12152 | this.reader.getn(2);
|
12153 | this.parse_expr();
|
12154 | var c = this.reader.peekn(1);
|
12155 | if (c != "`") {
|
12156 | throw Err(viml_printf("unexpected character: %s", c), this.reader.getpos());
|
12157 | }
|
12158 | this.reader.getn(1);
|
12159 | }
|
12160 | else if (c == "|" || c == "\n" || c == "\"" && !viml_eqregh(this.ea.cmd.flags, "\\<NOTRLCOM\\>") && (this.ea.cmd.name != "@" && this.ea.cmd.name != "*" || this.reader.getpos() != this.ea.argpos) && (this.ea.cmd.name != "redir" || this.reader.getpos().i != this.ea.argpos.i + 1 || pc != "@")) {
|
12161 | var has_cpo_bar = FALSE;
|
12162 |
|
12163 | if ((!has_cpo_bar || !viml_eqregh(this.ea.cmd.flags, "\\<USECTRLV\\>")) && pc == "\\") {
|
12164 | this.reader.get();
|
12165 | }
|
12166 | else {
|
12167 | break;
|
12168 | }
|
12169 | }
|
12170 | else {
|
12171 | this.reader.get();
|
12172 | }
|
12173 | var pc = c;
|
12174 | }
|
12175 | if (!viml_eqregh(this.ea.cmd.flags, "\\<NOTRLCOM\\>")) {
|
12176 | var end = nospend;
|
12177 | }
|
12178 | return end;
|
12179 | }
|
12180 |
|
12181 |
|
12182 | VimLParser.prototype.skip_vimgrep_pat = function() {
|
12183 | if (this.reader.peekn(1) == "") {
|
12184 |
|
12185 | }
|
12186 | else if (isidc(this.reader.peekn(1))) {
|
12187 |
|
12188 | this.reader.read_nonwhite();
|
12189 | }
|
12190 | else {
|
12191 |
|
12192 | var c = this.reader.getn(1);
|
12193 | var __tmp = this.parse_pattern(c);
|
12194 | var _ = __tmp[0];
|
12195 | var endc = __tmp[1];
|
12196 | if (c != endc) {
|
12197 | return;
|
12198 | }
|
12199 | while (this.reader.p(0) == "g" || this.reader.p(0) == "j") {
|
12200 | this.reader.getn(1);
|
12201 | }
|
12202 | }
|
12203 | }
|
12204 |
|
12205 | VimLParser.prototype.parse_cmd_append = function() {
|
12206 | this.reader.setpos(this.ea.linepos);
|
12207 | var cmdline = this.reader.readline();
|
12208 | var lines = [cmdline];
|
12209 | var m = ".";
|
12210 | while (TRUE) {
|
12211 | if (this.reader.peek() == "<EOF>") {
|
12212 | break;
|
12213 | }
|
12214 | var line = this.reader.getn(-1);
|
12215 | viml_add(lines, line);
|
12216 | if (line == m) {
|
12217 | break;
|
12218 | }
|
12219 | this.reader.get();
|
12220 | }
|
12221 | var node = Node(NODE_EXCMD);
|
12222 | node.pos = this.ea.cmdpos;
|
12223 | node.ea = this.ea;
|
12224 | node.str = viml_join(lines, "\n");
|
12225 | this.add_node(node);
|
12226 | }
|
12227 |
|
12228 | VimLParser.prototype.parse_cmd_insert = function() {
|
12229 | this.parse_cmd_append();
|
12230 | }
|
12231 |
|
12232 | VimLParser.prototype.parse_cmd_loadkeymap = function() {
|
12233 | this.reader.setpos(this.ea.linepos);
|
12234 | var cmdline = this.reader.readline();
|
12235 | var lines = [cmdline];
|
12236 | while (TRUE) {
|
12237 | if (this.reader.peek() == "<EOF>") {
|
12238 | break;
|
12239 | }
|
12240 | var line = this.reader.readline();
|
12241 | viml_add(lines, line);
|
12242 | }
|
12243 | var node = Node(NODE_EXCMD);
|
12244 | node.pos = this.ea.cmdpos;
|
12245 | node.ea = this.ea;
|
12246 | node.str = viml_join(lines, "\n");
|
12247 | this.add_node(node);
|
12248 | }
|
12249 |
|
12250 | VimLParser.prototype.parse_cmd_lua = function() {
|
12251 | var lines = [];
|
12252 | this.reader.skip_white();
|
12253 | if (this.reader.peekn(2) == "<<") {
|
12254 | this.reader.getn(2);
|
12255 | this.reader.skip_white();
|
12256 | var m = this.reader.readline();
|
12257 | if (m == "") {
|
12258 | var m = ".";
|
12259 | }
|
12260 | this.reader.setpos(this.ea.linepos);
|
12261 | var cmdline = this.reader.getn(-1);
|
12262 | var lines = [cmdline];
|
12263 | this.reader.get();
|
12264 | while (TRUE) {
|
12265 | if (this.reader.peek() == "<EOF>") {
|
12266 | break;
|
12267 | }
|
12268 | var line = this.reader.getn(-1);
|
12269 | viml_add(lines, line);
|
12270 | if (line == m) {
|
12271 | break;
|
12272 | }
|
12273 | this.reader.get();
|
12274 | }
|
12275 | }
|
12276 | else {
|
12277 | this.reader.setpos(this.ea.linepos);
|
12278 | var cmdline = this.reader.getn(-1);
|
12279 | var lines = [cmdline];
|
12280 | }
|
12281 | var node = Node(NODE_EXCMD);
|
12282 | node.pos = this.ea.cmdpos;
|
12283 | node.ea = this.ea;
|
12284 | node.str = viml_join(lines, "\n");
|
12285 | this.add_node(node);
|
12286 | }
|
12287 |
|
12288 | VimLParser.prototype.parse_cmd_mzscheme = function() {
|
12289 | this.parse_cmd_lua();
|
12290 | }
|
12291 |
|
12292 | VimLParser.prototype.parse_cmd_perl = function() {
|
12293 | this.parse_cmd_lua();
|
12294 | }
|
12295 |
|
12296 | VimLParser.prototype.parse_cmd_python = function() {
|
12297 | this.parse_cmd_lua();
|
12298 | }
|
12299 |
|
12300 | VimLParser.prototype.parse_cmd_python3 = function() {
|
12301 | this.parse_cmd_lua();
|
12302 | }
|
12303 |
|
12304 | VimLParser.prototype.parse_cmd_ruby = function() {
|
12305 | this.parse_cmd_lua();
|
12306 | }
|
12307 |
|
12308 | VimLParser.prototype.parse_cmd_tcl = function() {
|
12309 | this.parse_cmd_lua();
|
12310 | }
|
12311 |
|
12312 | VimLParser.prototype.parse_cmd_finish = function() {
|
12313 | this.parse_cmd_common();
|
12314 | if (this.context[0].type == NODE_TOPLEVEL) {
|
12315 | this.reader.seek_end(0);
|
12316 | }
|
12317 | }
|
12318 |
|
12319 |
|
12320 | VimLParser.prototype.parse_cmd_usercmd = function() {
|
12321 | this.parse_cmd_common();
|
12322 | }
|
12323 |
|
12324 | VimLParser.prototype.parse_cmd_function = function() {
|
12325 | var pos = this.reader.tell();
|
12326 | this.reader.skip_white();
|
12327 |
|
12328 | if (this.ends_excmds(this.reader.peek())) {
|
12329 | this.reader.seek_set(pos);
|
12330 | this.parse_cmd_common();
|
12331 | return;
|
12332 | }
|
12333 |
|
12334 | if (this.reader.peekn(1) == "/") {
|
12335 | this.reader.seek_set(pos);
|
12336 | this.parse_cmd_common();
|
12337 | return;
|
12338 | }
|
12339 | var left = this.parse_lvalue_func();
|
12340 | this.reader.skip_white();
|
12341 | if (left.type == NODE_IDENTIFIER) {
|
12342 | var s = left.value;
|
12343 | var ss = viml_split(s, "\\zs");
|
12344 | if (ss[0] != "<" && ss[0] != "_" && !isupper(ss[0]) && viml_stridx(s, ":") == -1 && viml_stridx(s, "#") == -1) {
|
12345 | throw Err(viml_printf("E128: Function name must start with a capital or contain a colon: %s", s), left.pos);
|
12346 | }
|
12347 | }
|
12348 |
|
12349 | if (this.reader.peekn(1) != "(") {
|
12350 | this.reader.seek_set(pos);
|
12351 | this.parse_cmd_common();
|
12352 | return;
|
12353 | }
|
12354 |
|
12355 | var node = Node(NODE_FUNCTION);
|
12356 | node.pos = this.ea.cmdpos;
|
12357 | node.body = [];
|
12358 | node.ea = this.ea;
|
12359 | node.left = left;
|
12360 | node.rlist = [];
|
12361 | node.default_args = [];
|
12362 | node.attr = {"range":0, "abort":0, "dict":0, "closure":0};
|
12363 | node.endfunction = NIL;
|
12364 | this.reader.getn(1);
|
12365 | var tokenizer = new ExprTokenizer(this.reader);
|
12366 | if (tokenizer.peek().type == TOKEN_PCLOSE) {
|
12367 | tokenizer.get();
|
12368 | }
|
12369 | else {
|
12370 | var named = {};
|
12371 | while (TRUE) {
|
12372 | var varnode = Node(NODE_IDENTIFIER);
|
12373 | var token = tokenizer.get();
|
12374 | if (token.type == TOKEN_IDENTIFIER) {
|
12375 | if (!isargname(token.value) || token.value == "firstline" || token.value == "lastline") {
|
12376 | throw Err(viml_printf("E125: Illegal argument: %s", token.value), token.pos);
|
12377 | }
|
12378 | else if (viml_has_key(named, token.value)) {
|
12379 | throw Err(viml_printf("E853: Duplicate argument name: %s", token.value), token.pos);
|
12380 | }
|
12381 | named[token.value] = 1;
|
12382 | varnode.pos = token.pos;
|
12383 | varnode.value = token.value;
|
12384 | viml_add(node.rlist, varnode);
|
12385 | if (tokenizer.peek().type == TOKEN_EQ) {
|
12386 | tokenizer.get();
|
12387 | viml_add(node.default_args, this.parse_expr());
|
12388 | }
|
12389 | else if (viml_len(node.default_args) > 0) {
|
12390 | throw Err("E989: Non-default argument follows default argument", varnode.pos);
|
12391 | }
|
12392 |
|
12393 | if (iswhite(this.reader.p(0)) && tokenizer.peek().type == TOKEN_COMMA) {
|
12394 | throw Err("E475: Invalid argument: White space is not allowed before comma", this.reader.getpos());
|
12395 | }
|
12396 | var token = tokenizer.get();
|
12397 | if (token.type == TOKEN_COMMA) {
|
12398 |
|
12399 | if (tokenizer.peek().type == TOKEN_PCLOSE) {
|
12400 | tokenizer.get();
|
12401 | break;
|
12402 | }
|
12403 | }
|
12404 | else if (token.type == TOKEN_PCLOSE) {
|
12405 | break;
|
12406 | }
|
12407 | else {
|
12408 | throw Err(viml_printf("unexpected token: %s", token.value), token.pos);
|
12409 | }
|
12410 | }
|
12411 | else if (token.type == TOKEN_DOTDOTDOT) {
|
12412 | varnode.pos = token.pos;
|
12413 | varnode.value = token.value;
|
12414 | viml_add(node.rlist, varnode);
|
12415 | var token = tokenizer.get();
|
12416 | if (token.type == TOKEN_PCLOSE) {
|
12417 | break;
|
12418 | }
|
12419 | else {
|
12420 | throw Err(viml_printf("unexpected token: %s", token.value), token.pos);
|
12421 | }
|
12422 | }
|
12423 | else {
|
12424 | throw Err(viml_printf("unexpected token: %s", token.value), token.pos);
|
12425 | }
|
12426 | }
|
12427 | }
|
12428 | while (TRUE) {
|
12429 | this.reader.skip_white();
|
12430 | var epos = this.reader.getpos();
|
12431 | var key = this.reader.read_alpha();
|
12432 | if (key == "") {
|
12433 | break;
|
12434 | }
|
12435 | else if (key == "range") {
|
12436 | node.attr.range = TRUE;
|
12437 | }
|
12438 | else if (key == "abort") {
|
12439 | node.attr.abort = TRUE;
|
12440 | }
|
12441 | else if (key == "dict") {
|
12442 | node.attr.dict = TRUE;
|
12443 | }
|
12444 | else if (key == "closure") {
|
12445 | node.attr.closure = TRUE;
|
12446 | }
|
12447 | else {
|
12448 | throw Err(viml_printf("unexpected token: %s", key), epos);
|
12449 | }
|
12450 | }
|
12451 | this.add_node(node);
|
12452 | this.push_context(node);
|
12453 | }
|
12454 |
|
12455 | VimLParser.prototype.parse_cmd_endfunction = function() {
|
12456 | this.check_missing_endif("ENDFUNCTION", this.ea.cmdpos);
|
12457 | this.check_missing_endtry("ENDFUNCTION", this.ea.cmdpos);
|
12458 | this.check_missing_endwhile("ENDFUNCTION", this.ea.cmdpos);
|
12459 | this.check_missing_endfor("ENDFUNCTION", this.ea.cmdpos);
|
12460 | if (this.context[0].type != NODE_FUNCTION) {
|
12461 | throw Err("E193: :endfunction not inside a function", this.ea.cmdpos);
|
12462 | }
|
12463 | this.reader.getn(-1);
|
12464 | var node = Node(NODE_ENDFUNCTION);
|
12465 | node.pos = this.ea.cmdpos;
|
12466 | node.ea = this.ea;
|
12467 | this.context[0].endfunction = node;
|
12468 | this.pop_context();
|
12469 | }
|
12470 |
|
12471 | VimLParser.prototype.parse_cmd_delfunction = function() {
|
12472 | var node = Node(NODE_DELFUNCTION);
|
12473 | node.pos = this.ea.cmdpos;
|
12474 | node.ea = this.ea;
|
12475 | node.left = this.parse_lvalue_func();
|
12476 | this.add_node(node);
|
12477 | }
|
12478 |
|
12479 | VimLParser.prototype.parse_cmd_return = function() {
|
12480 | if (this.find_context(NODE_FUNCTION) == -1) {
|
12481 | throw Err("E133: :return not inside a function", this.ea.cmdpos);
|
12482 | }
|
12483 | var node = Node(NODE_RETURN);
|
12484 | node.pos = this.ea.cmdpos;
|
12485 | node.ea = this.ea;
|
12486 | node.left = NIL;
|
12487 | this.reader.skip_white();
|
12488 | var c = this.reader.peek();
|
12489 | if (c == "\"" || !this.ends_excmds(c)) {
|
12490 | node.left = this.parse_expr();
|
12491 | }
|
12492 | this.add_node(node);
|
12493 | }
|
12494 |
|
12495 | VimLParser.prototype.parse_cmd_call = function() {
|
12496 | var node = Node(NODE_EXCALL);
|
12497 | node.pos = this.ea.cmdpos;
|
12498 | node.ea = this.ea;
|
12499 | this.reader.skip_white();
|
12500 | var c = this.reader.peek();
|
12501 | if (this.ends_excmds(c)) {
|
12502 | throw Err("E471: Argument required", this.reader.getpos());
|
12503 | }
|
12504 | node.left = this.parse_expr();
|
12505 | if (node.left.type != NODE_CALL) {
|
12506 | throw Err("Not a function call", node.left.pos);
|
12507 | }
|
12508 | this.add_node(node);
|
12509 | }
|
12510 |
|
12511 | VimLParser.prototype.parse_heredoc = function() {
|
12512 | var node = Node(NODE_HEREDOC);
|
12513 | node.pos = this.ea.cmdpos;
|
12514 | node.op = "";
|
12515 | node.rlist = [];
|
12516 | node.body = [];
|
12517 | while (TRUE) {
|
12518 | this.reader.skip_white();
|
12519 | var key = this.reader.read_word();
|
12520 | if (key == "") {
|
12521 | break;
|
12522 | }
|
12523 | if (!islower(key[0])) {
|
12524 | node.op = key;
|
12525 | break;
|
12526 | }
|
12527 | else {
|
12528 | viml_add(node.rlist, key);
|
12529 | }
|
12530 | }
|
12531 | if (node.op == "") {
|
12532 | throw Err("E172: Missing marker", this.reader.getpos());
|
12533 | }
|
12534 | this.parse_trail();
|
12535 | while (TRUE) {
|
12536 | if (this.reader.peek() == "<EOF>") {
|
12537 | break;
|
12538 | }
|
12539 | var line = this.reader.getn(-1);
|
12540 | if (line == node.op) {
|
12541 | return node;
|
12542 | }
|
12543 | viml_add(node.body, line);
|
12544 | this.reader.get();
|
12545 | }
|
12546 | throw Err(viml_printf("E990: Missing end marker '%s'", node.op), this.reader.getpos());
|
12547 | }
|
12548 |
|
12549 | VimLParser.prototype.parse_cmd_let = function() {
|
12550 | var pos = this.reader.tell();
|
12551 | this.reader.skip_white();
|
12552 |
|
12553 | if (this.ends_excmds(this.reader.peek())) {
|
12554 | this.reader.seek_set(pos);
|
12555 | this.parse_cmd_common();
|
12556 | return;
|
12557 | }
|
12558 | var lhs = this.parse_letlhs();
|
12559 | this.reader.skip_white();
|
12560 | var s1 = this.reader.peekn(1);
|
12561 | var s2 = this.reader.peekn(2);
|
12562 |
|
12563 | if (s2 == "..") {
|
12564 | var s2 = this.reader.peekn(3);
|
12565 | }
|
12566 | else if (s2 == "=<") {
|
12567 | var s2 = this.reader.peekn(3);
|
12568 | }
|
12569 |
|
12570 | if (this.ends_excmds(s1) || s2 != "+=" && s2 != "-=" && s2 != ".=" && s2 != "..=" && s2 != "*=" && s2 != "/=" && s2 != "%=" && s2 != "=<<" && s1 != "=") {
|
12571 | this.reader.seek_set(pos);
|
12572 | this.parse_cmd_common();
|
12573 | return;
|
12574 | }
|
12575 |
|
12576 | var node = Node(NODE_LET);
|
12577 | node.pos = this.ea.cmdpos;
|
12578 | node.ea = this.ea;
|
12579 | node.op = "";
|
12580 | node.left = lhs.left;
|
12581 | node.list = lhs.list;
|
12582 | node.rest = lhs.rest;
|
12583 | node.right = NIL;
|
12584 | if (s2 == "+=" || s2 == "-=" || s2 == ".=" || s2 == "..=" || s2 == "*=" || s2 == "/=" || s2 == "%=") {
|
12585 | this.reader.getn(viml_len(s2));
|
12586 | node.op = s2;
|
12587 | }
|
12588 | else if (s2 == "=<<") {
|
12589 | this.reader.getn(viml_len(s2));
|
12590 | this.reader.skip_white();
|
12591 | node.op = s2;
|
12592 | node.right = this.parse_heredoc();
|
12593 | this.add_node(node);
|
12594 | return;
|
12595 | }
|
12596 | else if (s1 == "=") {
|
12597 | this.reader.getn(1);
|
12598 | node.op = s1;
|
12599 | }
|
12600 | else {
|
12601 | throw "NOT REACHED";
|
12602 | }
|
12603 | node.right = this.parse_expr();
|
12604 | this.add_node(node);
|
12605 | }
|
12606 |
|
12607 | VimLParser.prototype.parse_cmd_const = function() {
|
12608 | var pos = this.reader.tell();
|
12609 | this.reader.skip_white();
|
12610 |
|
12611 | if (this.ends_excmds(this.reader.peek())) {
|
12612 | this.reader.seek_set(pos);
|
12613 | this.parse_cmd_common();
|
12614 | return;
|
12615 | }
|
12616 | var lhs = this.parse_constlhs();
|
12617 | this.reader.skip_white();
|
12618 | var s1 = this.reader.peekn(1);
|
12619 |
|
12620 | if (this.ends_excmds(s1) || s1 != "=") {
|
12621 | this.reader.seek_set(pos);
|
12622 | this.parse_cmd_common();
|
12623 | return;
|
12624 | }
|
12625 |
|
12626 | var node = Node(NODE_CONST);
|
12627 | node.pos = this.ea.cmdpos;
|
12628 | node.ea = this.ea;
|
12629 | this.reader.getn(1);
|
12630 | node.op = s1;
|
12631 | node.left = lhs.left;
|
12632 | node.list = lhs.list;
|
12633 | node.rest = lhs.rest;
|
12634 | node.right = this.parse_expr();
|
12635 | this.add_node(node);
|
12636 | }
|
12637 |
|
12638 | VimLParser.prototype.parse_cmd_unlet = function() {
|
12639 | var node = Node(NODE_UNLET);
|
12640 | node.pos = this.ea.cmdpos;
|
12641 | node.ea = this.ea;
|
12642 | node.list = this.parse_lvaluelist();
|
12643 | this.add_node(node);
|
12644 | }
|
12645 |
|
12646 | VimLParser.prototype.parse_cmd_lockvar = function() {
|
12647 | var node = Node(NODE_LOCKVAR);
|
12648 | node.pos = this.ea.cmdpos;
|
12649 | node.ea = this.ea;
|
12650 | node.depth = NIL;
|
12651 | node.list = [];
|
12652 | this.reader.skip_white();
|
12653 | if (isdigit(this.reader.peekn(1))) {
|
12654 | node.depth = viml_str2nr(this.reader.read_digit(), 10);
|
12655 | }
|
12656 | node.list = this.parse_lvaluelist();
|
12657 | this.add_node(node);
|
12658 | }
|
12659 |
|
12660 | VimLParser.prototype.parse_cmd_unlockvar = function() {
|
12661 | var node = Node(NODE_UNLOCKVAR);
|
12662 | node.pos = this.ea.cmdpos;
|
12663 | node.ea = this.ea;
|
12664 | node.depth = NIL;
|
12665 | node.list = [];
|
12666 | this.reader.skip_white();
|
12667 | if (isdigit(this.reader.peekn(1))) {
|
12668 | node.depth = viml_str2nr(this.reader.read_digit(), 10);
|
12669 | }
|
12670 | node.list = this.parse_lvaluelist();
|
12671 | this.add_node(node);
|
12672 | }
|
12673 |
|
12674 | VimLParser.prototype.parse_cmd_if = function() {
|
12675 | var node = Node(NODE_IF);
|
12676 | node.pos = this.ea.cmdpos;
|
12677 | node.body = [];
|
12678 | node.ea = this.ea;
|
12679 | node.cond = this.parse_expr();
|
12680 | node.elseif = [];
|
12681 | node._else = NIL;
|
12682 | node.endif = NIL;
|
12683 | this.add_node(node);
|
12684 | this.push_context(node);
|
12685 | }
|
12686 |
|
12687 | VimLParser.prototype.parse_cmd_elseif = function() {
|
12688 | if (this.context[0].type != NODE_IF && this.context[0].type != NODE_ELSEIF) {
|
12689 | throw Err("E582: :elseif without :if", this.ea.cmdpos);
|
12690 | }
|
12691 | if (this.context[0].type != NODE_IF) {
|
12692 | this.pop_context();
|
12693 | }
|
12694 | var node = Node(NODE_ELSEIF);
|
12695 | node.pos = this.ea.cmdpos;
|
12696 | node.body = [];
|
12697 | node.ea = this.ea;
|
12698 | node.cond = this.parse_expr();
|
12699 | viml_add(this.context[0].elseif, node);
|
12700 | this.push_context(node);
|
12701 | }
|
12702 |
|
12703 | VimLParser.prototype.parse_cmd_else = function() {
|
12704 | if (this.context[0].type != NODE_IF && this.context[0].type != NODE_ELSEIF) {
|
12705 | throw Err("E581: :else without :if", this.ea.cmdpos);
|
12706 | }
|
12707 | if (this.context[0].type != NODE_IF) {
|
12708 | this.pop_context();
|
12709 | }
|
12710 | var node = Node(NODE_ELSE);
|
12711 | node.pos = this.ea.cmdpos;
|
12712 | node.body = [];
|
12713 | node.ea = this.ea;
|
12714 | this.context[0]._else = node;
|
12715 | this.push_context(node);
|
12716 | }
|
12717 |
|
12718 | VimLParser.prototype.parse_cmd_endif = function() {
|
12719 | if (this.context[0].type != NODE_IF && this.context[0].type != NODE_ELSEIF && this.context[0].type != NODE_ELSE) {
|
12720 | throw Err("E580: :endif without :if", this.ea.cmdpos);
|
12721 | }
|
12722 | if (this.context[0].type != NODE_IF) {
|
12723 | this.pop_context();
|
12724 | }
|
12725 | var node = Node(NODE_ENDIF);
|
12726 | node.pos = this.ea.cmdpos;
|
12727 | node.ea = this.ea;
|
12728 | this.context[0].endif = node;
|
12729 | this.pop_context();
|
12730 | }
|
12731 |
|
12732 | VimLParser.prototype.parse_cmd_while = function() {
|
12733 | var node = Node(NODE_WHILE);
|
12734 | node.pos = this.ea.cmdpos;
|
12735 | node.body = [];
|
12736 | node.ea = this.ea;
|
12737 | node.cond = this.parse_expr();
|
12738 | node.endwhile = NIL;
|
12739 | this.add_node(node);
|
12740 | this.push_context(node);
|
12741 | }
|
12742 |
|
12743 | VimLParser.prototype.parse_cmd_endwhile = function() {
|
12744 | if (this.context[0].type != NODE_WHILE) {
|
12745 | throw Err("E588: :endwhile without :while", this.ea.cmdpos);
|
12746 | }
|
12747 | var node = Node(NODE_ENDWHILE);
|
12748 | node.pos = this.ea.cmdpos;
|
12749 | node.ea = this.ea;
|
12750 | this.context[0].endwhile = node;
|
12751 | this.pop_context();
|
12752 | }
|
12753 |
|
12754 | VimLParser.prototype.parse_cmd_for = function() {
|
12755 | var node = Node(NODE_FOR);
|
12756 | node.pos = this.ea.cmdpos;
|
12757 | node.body = [];
|
12758 | node.ea = this.ea;
|
12759 | node.left = NIL;
|
12760 | node.right = NIL;
|
12761 | node.endfor = NIL;
|
12762 | var lhs = this.parse_letlhs();
|
12763 | node.left = lhs.left;
|
12764 | node.list = lhs.list;
|
12765 | node.rest = lhs.rest;
|
12766 | this.reader.skip_white();
|
12767 | var epos = this.reader.getpos();
|
12768 | if (this.reader.read_alpha() != "in") {
|
12769 | throw Err("Missing \"in\" after :for", epos);
|
12770 | }
|
12771 | node.right = this.parse_expr();
|
12772 | this.add_node(node);
|
12773 | this.push_context(node);
|
12774 | }
|
12775 |
|
12776 | VimLParser.prototype.parse_cmd_endfor = function() {
|
12777 | if (this.context[0].type != NODE_FOR) {
|
12778 | throw Err("E588: :endfor without :for", this.ea.cmdpos);
|
12779 | }
|
12780 | var node = Node(NODE_ENDFOR);
|
12781 | node.pos = this.ea.cmdpos;
|
12782 | node.ea = this.ea;
|
12783 | this.context[0].endfor = node;
|
12784 | this.pop_context();
|
12785 | }
|
12786 |
|
12787 | VimLParser.prototype.parse_cmd_continue = function() {
|
12788 | if (this.find_context(NODE_WHILE) == -1 && this.find_context(NODE_FOR) == -1) {
|
12789 | throw Err("E586: :continue without :while or :for", this.ea.cmdpos);
|
12790 | }
|
12791 | var node = Node(NODE_CONTINUE);
|
12792 | node.pos = this.ea.cmdpos;
|
12793 | node.ea = this.ea;
|
12794 | this.add_node(node);
|
12795 | }
|
12796 |
|
12797 | VimLParser.prototype.parse_cmd_break = function() {
|
12798 | if (this.find_context(NODE_WHILE) == -1 && this.find_context(NODE_FOR) == -1) {
|
12799 | throw Err("E587: :break without :while or :for", this.ea.cmdpos);
|
12800 | }
|
12801 | var node = Node(NODE_BREAK);
|
12802 | node.pos = this.ea.cmdpos;
|
12803 | node.ea = this.ea;
|
12804 | this.add_node(node);
|
12805 | }
|
12806 |
|
12807 | VimLParser.prototype.parse_cmd_try = function() {
|
12808 | var node = Node(NODE_TRY);
|
12809 | node.pos = this.ea.cmdpos;
|
12810 | node.body = [];
|
12811 | node.ea = this.ea;
|
12812 | node.catch = [];
|
12813 | node._finally = NIL;
|
12814 | node.endtry = NIL;
|
12815 | this.add_node(node);
|
12816 | this.push_context(node);
|
12817 | }
|
12818 |
|
12819 | VimLParser.prototype.parse_cmd_catch = function() {
|
12820 | if (this.context[0].type == NODE_FINALLY) {
|
12821 | throw Err("E604: :catch after :finally", this.ea.cmdpos);
|
12822 | }
|
12823 | else if (this.context[0].type != NODE_TRY && this.context[0].type != NODE_CATCH) {
|
12824 | throw Err("E603: :catch without :try", this.ea.cmdpos);
|
12825 | }
|
12826 | if (this.context[0].type != NODE_TRY) {
|
12827 | this.pop_context();
|
12828 | }
|
12829 | var node = Node(NODE_CATCH);
|
12830 | node.pos = this.ea.cmdpos;
|
12831 | node.body = [];
|
12832 | node.ea = this.ea;
|
12833 | node.pattern = NIL;
|
12834 | this.reader.skip_white();
|
12835 | if (!this.ends_excmds(this.reader.peek())) {
|
12836 | var __tmp = this.parse_pattern(this.reader.get());
|
12837 | node.pattern = __tmp[0];
|
12838 | var _ = __tmp[1];
|
12839 | }
|
12840 | viml_add(this.context[0].catch, node);
|
12841 | this.push_context(node);
|
12842 | }
|
12843 |
|
12844 | VimLParser.prototype.parse_cmd_finally = function() {
|
12845 | if (this.context[0].type != NODE_TRY && this.context[0].type != NODE_CATCH) {
|
12846 | throw Err("E606: :finally without :try", this.ea.cmdpos);
|
12847 | }
|
12848 | if (this.context[0].type != NODE_TRY) {
|
12849 | this.pop_context();
|
12850 | }
|
12851 | var node = Node(NODE_FINALLY);
|
12852 | node.pos = this.ea.cmdpos;
|
12853 | node.body = [];
|
12854 | node.ea = this.ea;
|
12855 | this.context[0]._finally = node;
|
12856 | this.push_context(node);
|
12857 | }
|
12858 |
|
12859 | VimLParser.prototype.parse_cmd_endtry = function() {
|
12860 | if (this.context[0].type != NODE_TRY && this.context[0].type != NODE_CATCH && this.context[0].type != NODE_FINALLY) {
|
12861 | throw Err("E602: :endtry without :try", this.ea.cmdpos);
|
12862 | }
|
12863 | if (this.context[0].type != NODE_TRY) {
|
12864 | this.pop_context();
|
12865 | }
|
12866 | var node = Node(NODE_ENDTRY);
|
12867 | node.pos = this.ea.cmdpos;
|
12868 | node.ea = this.ea;
|
12869 | this.context[0].endtry = node;
|
12870 | this.pop_context();
|
12871 | }
|
12872 |
|
12873 | VimLParser.prototype.parse_cmd_throw = function() {
|
12874 | var node = Node(NODE_THROW);
|
12875 | node.pos = this.ea.cmdpos;
|
12876 | node.ea = this.ea;
|
12877 | node.left = this.parse_expr();
|
12878 | this.add_node(node);
|
12879 | }
|
12880 |
|
12881 | VimLParser.prototype.parse_cmd_eval = function() {
|
12882 | var node = Node(NODE_EVAL);
|
12883 | node.pos = this.ea.cmdpos;
|
12884 | node.ea = this.ea;
|
12885 | node.left = this.parse_expr();
|
12886 | this.add_node(node);
|
12887 | }
|
12888 |
|
12889 | VimLParser.prototype.parse_cmd_echo = function() {
|
12890 | var node = Node(NODE_ECHO);
|
12891 | node.pos = this.ea.cmdpos;
|
12892 | node.ea = this.ea;
|
12893 | node.list = this.parse_exprlist();
|
12894 | this.add_node(node);
|
12895 | }
|
12896 |
|
12897 | VimLParser.prototype.parse_cmd_echon = function() {
|
12898 | var node = Node(NODE_ECHON);
|
12899 | node.pos = this.ea.cmdpos;
|
12900 | node.ea = this.ea;
|
12901 | node.list = this.parse_exprlist();
|
12902 | this.add_node(node);
|
12903 | }
|
12904 |
|
12905 | VimLParser.prototype.parse_cmd_echohl = function() {
|
12906 | var node = Node(NODE_ECHOHL);
|
12907 | node.pos = this.ea.cmdpos;
|
12908 | node.ea = this.ea;
|
12909 | node.str = "";
|
12910 | while (!this.ends_excmds(this.reader.peek())) {
|
12911 | node.str += this.reader.get();
|
12912 | }
|
12913 | this.add_node(node);
|
12914 | }
|
12915 |
|
12916 | VimLParser.prototype.parse_cmd_echomsg = function() {
|
12917 | var node = Node(NODE_ECHOMSG);
|
12918 | node.pos = this.ea.cmdpos;
|
12919 | node.ea = this.ea;
|
12920 | node.list = this.parse_exprlist();
|
12921 | this.add_node(node);
|
12922 | }
|
12923 |
|
12924 | VimLParser.prototype.parse_cmd_echoerr = function() {
|
12925 | var node = Node(NODE_ECHOERR);
|
12926 | node.pos = this.ea.cmdpos;
|
12927 | node.ea = this.ea;
|
12928 | node.list = this.parse_exprlist();
|
12929 | this.add_node(node);
|
12930 | }
|
12931 |
|
12932 | VimLParser.prototype.parse_cmd_execute = function() {
|
12933 | var node = Node(NODE_EXECUTE);
|
12934 | node.pos = this.ea.cmdpos;
|
12935 | node.ea = this.ea;
|
12936 | node.list = this.parse_exprlist();
|
12937 | this.add_node(node);
|
12938 | }
|
12939 |
|
12940 | VimLParser.prototype.parse_expr = function() {
|
12941 | return new ExprParser(this.reader).parse();
|
12942 | }
|
12943 |
|
12944 | VimLParser.prototype.parse_exprlist = function() {
|
12945 | var list = [];
|
12946 | while (TRUE) {
|
12947 | this.reader.skip_white();
|
12948 | var c = this.reader.peek();
|
12949 | if (c != "\"" && this.ends_excmds(c)) {
|
12950 | break;
|
12951 | }
|
12952 | var node = this.parse_expr();
|
12953 | viml_add(list, node);
|
12954 | }
|
12955 | return list;
|
12956 | }
|
12957 |
|
12958 | VimLParser.prototype.parse_lvalue_func = function() {
|
12959 | var p = new LvalueParser(this.reader);
|
12960 | var node = p.parse();
|
12961 | if (node.type == NODE_IDENTIFIER || node.type == NODE_CURLYNAME || node.type == NODE_SUBSCRIPT || node.type == NODE_DOT || node.type == NODE_OPTION || node.type == NODE_ENV || node.type == NODE_REG) {
|
12962 | return node;
|
12963 | }
|
12964 | throw Err("Invalid Expression", node.pos);
|
12965 | }
|
12966 |
|
12967 |
|
12968 | VimLParser.prototype.parse_lvalue = function() {
|
12969 | var p = new LvalueParser(this.reader);
|
12970 | var node = p.parse();
|
12971 | if (node.type == NODE_IDENTIFIER) {
|
12972 | if (!isvarname(node.value)) {
|
12973 | throw Err(viml_printf("E461: Illegal variable name: %s", node.value), node.pos);
|
12974 | }
|
12975 | }
|
12976 | if (node.type == NODE_IDENTIFIER || node.type == NODE_CURLYNAME || node.type == NODE_SUBSCRIPT || node.type == NODE_SLICE || node.type == NODE_DOT || node.type == NODE_OPTION || node.type == NODE_ENV || node.type == NODE_REG) {
|
12977 | return node;
|
12978 | }
|
12979 | throw Err("Invalid Expression", node.pos);
|
12980 | }
|
12981 |
|
12982 |
|
12983 | VimLParser.prototype.parse_constlvalue = function() {
|
12984 | var p = new LvalueParser(this.reader);
|
12985 | var node = p.parse();
|
12986 | if (node.type == NODE_IDENTIFIER) {
|
12987 | if (!isvarname(node.value)) {
|
12988 | throw Err(viml_printf("E461: Illegal variable name: %s", node.value), node.pos);
|
12989 | }
|
12990 | }
|
12991 | if (node.type == NODE_IDENTIFIER || node.type == NODE_CURLYNAME) {
|
12992 | return node;
|
12993 | }
|
12994 | else if (node.type == NODE_SUBSCRIPT || node.type == NODE_SLICE || node.type == NODE_DOT) {
|
12995 | throw Err("E996: Cannot lock a list or dict", node.pos);
|
12996 | }
|
12997 | else if (node.type == NODE_OPTION) {
|
12998 | throw Err("E996: Cannot lock an option", node.pos);
|
12999 | }
|
13000 | else if (node.type == NODE_ENV) {
|
13001 | throw Err("E996: Cannot lock an environment variable", node.pos);
|
13002 | }
|
13003 | else if (node.type == NODE_REG) {
|
13004 | throw Err("E996: Cannot lock a register", node.pos);
|
13005 | }
|
13006 | throw Err("Invalid Expression", node.pos);
|
13007 | }
|
13008 |
|
13009 | VimLParser.prototype.parse_lvaluelist = function() {
|
13010 | var list = [];
|
13011 | var node = this.parse_expr();
|
13012 | viml_add(list, node);
|
13013 | while (TRUE) {
|
13014 | this.reader.skip_white();
|
13015 | if (this.ends_excmds(this.reader.peek())) {
|
13016 | break;
|
13017 | }
|
13018 | var node = this.parse_lvalue();
|
13019 | viml_add(list, node);
|
13020 | }
|
13021 | return list;
|
13022 | }
|
13023 |
|
13024 |
|
13025 | VimLParser.prototype.parse_letlhs = function() {
|
13026 | var lhs = {"left":NIL, "list":NIL, "rest":NIL};
|
13027 | var tokenizer = new ExprTokenizer(this.reader);
|
13028 | if (tokenizer.peek().type == TOKEN_SQOPEN) {
|
13029 | tokenizer.get();
|
13030 | lhs.list = [];
|
13031 | while (TRUE) {
|
13032 | var node = this.parse_lvalue();
|
13033 | viml_add(lhs.list, node);
|
13034 | var token = tokenizer.get();
|
13035 | if (token.type == TOKEN_SQCLOSE) {
|
13036 | break;
|
13037 | }
|
13038 | else if (token.type == TOKEN_COMMA) {
|
13039 | continue;
|
13040 | }
|
13041 | else if (token.type == TOKEN_SEMICOLON) {
|
13042 | var node = this.parse_lvalue();
|
13043 | lhs.rest = node;
|
13044 | var token = tokenizer.get();
|
13045 | if (token.type == TOKEN_SQCLOSE) {
|
13046 | break;
|
13047 | }
|
13048 | else {
|
13049 | throw Err(viml_printf("E475 Invalid argument: %s", token.value), token.pos);
|
13050 | }
|
13051 | }
|
13052 | else {
|
13053 | throw Err(viml_printf("E475 Invalid argument: %s", token.value), token.pos);
|
13054 | }
|
13055 | }
|
13056 | }
|
13057 | else {
|
13058 | lhs.left = this.parse_lvalue();
|
13059 | }
|
13060 | return lhs;
|
13061 | }
|
13062 |
|
13063 |
|
13064 | VimLParser.prototype.parse_constlhs = function() {
|
13065 | var lhs = {"left":NIL, "list":NIL, "rest":NIL};
|
13066 | var tokenizer = new ExprTokenizer(this.reader);
|
13067 | if (tokenizer.peek().type == TOKEN_SQOPEN) {
|
13068 | tokenizer.get();
|
13069 | lhs.list = [];
|
13070 | while (TRUE) {
|
13071 | var node = this.parse_lvalue();
|
13072 | viml_add(lhs.list, node);
|
13073 | var token = tokenizer.get();
|
13074 | if (token.type == TOKEN_SQCLOSE) {
|
13075 | break;
|
13076 | }
|
13077 | else if (token.type == TOKEN_COMMA) {
|
13078 | continue;
|
13079 | }
|
13080 | else if (token.type == TOKEN_SEMICOLON) {
|
13081 | var node = this.parse_lvalue();
|
13082 | lhs.rest = node;
|
13083 | var token = tokenizer.get();
|
13084 | if (token.type == TOKEN_SQCLOSE) {
|
13085 | break;
|
13086 | }
|
13087 | else {
|
13088 | throw Err(viml_printf("E475 Invalid argument: %s", token.value), token.pos);
|
13089 | }
|
13090 | }
|
13091 | else {
|
13092 | throw Err(viml_printf("E475 Invalid argument: %s", token.value), token.pos);
|
13093 | }
|
13094 | }
|
13095 | }
|
13096 | else {
|
13097 | lhs.left = this.parse_constlvalue();
|
13098 | }
|
13099 | return lhs;
|
13100 | }
|
13101 |
|
13102 | VimLParser.prototype.ends_excmds = function(c) {
|
13103 | return c == "" || c == "|" || c == "\"" || c == "<EOF>" || c == "<EOL>";
|
13104 | }
|
13105 |
|
13106 |
|
13107 | VimLParser.prototype.parse_wincmd = function() {
|
13108 | var c = this.reader.getn(1);
|
13109 | if (c == "") {
|
13110 | throw Err("E471: Argument required", this.reader.getpos());
|
13111 | }
|
13112 | else if (c == "g" || c == "\x07") {
|
13113 |
|
13114 | var c2 = this.reader.getn(1);
|
13115 | if (c2 == "" || iswhite(c2)) {
|
13116 | throw Err("E474: Invalid Argument", this.reader.getpos());
|
13117 | }
|
13118 | }
|
13119 | var end = this.reader.getpos();
|
13120 | this.reader.skip_white();
|
13121 | if (!this.ends_excmds(this.reader.peek())) {
|
13122 | throw Err("E474: Invalid Argument", this.reader.getpos());
|
13123 | }
|
13124 | var node = Node(NODE_EXCMD);
|
13125 | node.pos = this.ea.cmdpos;
|
13126 | node.ea = this.ea;
|
13127 | node.str = this.reader.getstr(this.ea.linepos, end);
|
13128 | this.add_node(node);
|
13129 | }
|
13130 |
|
13131 |
|
13132 | VimLParser.prototype.parse_cmd_syntax = function() {
|
13133 | var end = this.reader.getpos();
|
13134 | while (TRUE) {
|
13135 | var end = this.reader.getpos();
|
13136 | var c = this.reader.peek();
|
13137 | if (c == "/" || c == "'" || c == "\"") {
|
13138 | this.reader.getn(1);
|
13139 | this.parse_pattern(c);
|
13140 | }
|
13141 | else if (c == "=") {
|
13142 | this.reader.getn(1);
|
13143 | this.parse_pattern(" ");
|
13144 | }
|
13145 | else if (this.ends_excmds(c)) {
|
13146 | break;
|
13147 | }
|
13148 | this.reader.getn(1);
|
13149 | }
|
13150 | var node = Node(NODE_EXCMD);
|
13151 | node.pos = this.ea.cmdpos;
|
13152 | node.ea = this.ea;
|
13153 | node.str = this.reader.getstr(this.ea.linepos, end);
|
13154 | this.add_node(node);
|
13155 | }
|
13156 |
|
13157 | VimLParser.prototype.neovim_additional_commands = [{"name":"rshada", "minlen":3, "flags":"BANG|FILE1|TRLBAR|CMDWIN", "parser":"parse_cmd_common"}, {"name":"wshada", "minlen":3, "flags":"BANG|FILE1|TRLBAR|CMDWIN", "parser":"parse_cmd_common"}];
|
13158 | VimLParser.prototype.neovim_removed_commands = [{"name":"Print", "minlen":1, "flags":"RANGE|WHOLEFOLD|COUNT|EXFLAGS|TRLBAR|CMDWIN", "parser":"parse_cmd_common"}, {"name":"fixdel", "minlen":3, "flags":"TRLBAR|CMDWIN", "parser":"parse_cmd_common"}, {"name":"helpfind", "minlen":5, "flags":"EXTRA|NOTRLCOM", "parser":"parse_cmd_common"}, {"name":"open", "minlen":1, "flags":"RANGE|BANG|EXTRA", "parser":"parse_cmd_common"}, {"name":"shell", "minlen":2, "flags":"TRLBAR|CMDWIN", "parser":"parse_cmd_common"}, {"name":"tearoff", "minlen":2, "flags":"NEEDARG|EXTRA|TRLBAR|NOTRLCOM|CMDWIN", "parser":"parse_cmd_common"}, {"name":"gvim", "minlen":2, "flags":"BANG|FILES|EDITCMD|ARGOPT|TRLBAR|CMDWIN", "parser":"parse_cmd_common"}];
|
13159 |
|
13160 |
|
13161 | VimLParser.prototype.builtin_commands = [{"name":"append", "minlen":1, "flags":"BANG|RANGE|ZEROR|TRLBAR|CMDWIN|MODIFY", "parser":"parse_cmd_append"}, {"name":"abbreviate", "minlen":2, "flags":"EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN", "parser":"parse_cmd_common"}, {"name":"abclear", "minlen":3, "flags":"EXTRA|TRLBAR|CMDWIN", "parser":"parse_cmd_common"}, {"name":"aboveleft", "minlen":3, "flags":"NEEDARG|EXTRA|NOTRLCOM", "parser":"parse_cmd_common"}, {"name":"all", "minlen":2, "flags":"BANG|RANGE|NOTADR|COUNT|TRLBAR", "parser":"parse_cmd_common"}, {"name":"amenu", "minlen":2, "flags":"RANGE|NOTADR|ZEROR|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN", "parser":"parse_cmd_common"}, {"name":"anoremenu", "minlen":2, "flags":"RANGE|NOTADR|ZEROR|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN", "parser":"parse_cmd_common"}, {"name":"args", "minlen":2, "flags":"BANG|FILES|EDITCMD|ARGOPT|TRLBAR", "parser":"parse_cmd_common"}, {"name":"argadd", "minlen":4, "flags":"BANG|NEEDARG|RANGE|NOTADR|ZEROR|FILES|TRLBAR", "parser":"parse_cmd_common"}, {"name":"argdelete", "minlen":4, "flags":"BANG|RANGE|NOTADR|FILES|TRLBAR", "parser":"parse_cmd_common"}, {"name":"argedit", "minlen":4, "flags":"BANG|NEEDARG|RANGE|NOTADR|FILE1|EDITCMD|ARGOPT|TRLBAR", "parser":"parse_cmd_common"}, {"name":"argdo", "minlen":5, "flags":"BANG|NEEDARG|EXTRA|NOTRLCOM", "parser":"parse_cmd_common"}, {"name":"argglobal", "minlen":4, "flags":"BANG|FILES|EDITCMD|ARGOPT|TRLBAR", "parser":"parse_cmd_common"}, {"name":"arglocal", "minlen":4, "flags":"BANG|FILES|EDITCMD|ARGOPT|TRLBAR", "parser":"parse_cmd_common"}, {"name":"argument", "minlen":4, "flags":"BANG|RANGE|NOTADR|COUNT|EXTRA|EDITCMD|ARGOPT|TRLBAR", "parser":"parse_cmd_common"}, {"name":"ascii", "minlen":2, "flags":"TRLBAR|SBOXOK|CMDWIN", "parser":"parse_cmd_common"}, {"name":"autocmd", "minlen":2, "flags":"BANG|EXTRA|NOTRLCOM|USECTRLV|CMDWIN", "parser":"parse_cmd_common"}, {"name":"augroup", "minlen":3, "flags":"BANG|WORD1|TRLBAR|CMDWIN", "parser":"parse_cmd_common"}, {"name":"aunmenu", "minlen":3, "flags":"EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN", "parser":"parse_cmd_common"}, {"name":"buffer", "minlen":1, "flags":"BANG|RANGE|NOTADR|BUFNAME|BUFUNL|COUNT|EXTRA|TRLBAR", "parser":"parse_cmd_common"}, {"name":"bNext", "minlen":2, "flags":"BANG|RANGE|NOTADR|COUNT|TRLBAR", "parser":"parse_cmd_common"}, {"name":"ball", "minlen":2, "flags":"RANGE|NOTADR|COUNT|TRLBAR", "parser":"parse_cmd_common"}, {"name":"badd", "minlen":3, "flags":"NEEDARG|FILE1|EDITCMD|TRLBAR|CMDWIN", "parser":"parse_cmd_common"}, {"name":"bdelete", "minlen":2, "flags":"BANG|RANGE|NOTADR|BUFNAME|COUNT|EXTRA|TRLBAR", "parser":"parse_cmd_common"}, {"name":"behave", "minlen":2, "flags":"NEEDARG|WORD1|TRLBAR|CMDWIN", "parser":"parse_cmd_common"}, {"name":"belowright", "minlen":3, "flags":"NEEDARG|EXTRA|NOTRLCOM", "parser":"parse_cmd_common"}, {"name":"bfirst", "minlen":2, "flags":"BANG|RANGE|NOTADR|TRLBAR", "parser":"parse_cmd_common"}, {"name":"blast", "minlen":2, "flags":"BANG|RANGE|NOTADR|TRLBAR", "parser":"parse_cmd_common"}, {"name":"bmodified", "minlen":2, "flags":"BANG|RANGE|NOTADR|COUNT|TRLBAR", "parser":"parse_cmd_common"}, {"name":"bnext", "minlen":2, "flags":"BANG|RANGE|NOTADR|COUNT|TRLBAR", "parser":"parse_cmd_common"}, {"name":"botright", "minlen":2, "flags":"NEEDARG|EXTRA|NOTRLCOM", "parser":"parse_cmd_common"}, {"name":"bprevious", "minlen":2, "flags":"BANG|RANGE|NOTADR|COUNT|TRLBAR", "parser":"parse_cmd_common"}, {"name":"brewind", "minlen":2, "flags":"BANG|RANGE|NOTADR|TRLBAR", "parser":"parse_cmd_common"}, {"name":"break", "minlen":4, "flags":"TRLBAR|SBOXOK|CMDWIN", "parser":"parse_cmd_break"}, {"name":"breakadd", "minlen":6, "flags":"EXTRA|TRLBAR|CMDWIN", "parser":"parse_cmd_common"}, {"name":"breakdel", "minlen":6, "flags":"EXTRA|TRLBAR|CMDWIN", "parser":"parse_cmd_common"}, {"name":"breaklist", "minlen":6, "flags":"EXTRA|TRLBAR|CMDWIN", "parser":"parse_cmd_common"}, {"name":"browse", "minlen":3, "flags":"NEEDARG|EXTRA|NOTRLCOM|CMDWIN", "parser":"parse_cmd_common"}, {"name":"bufdo", "minlen":5, "flags":"BANG|NEEDARG|EXTRA|NOTRLCOM", "parser":"parse_cmd_common"}, {"name":"buffers", "minlen":7, "flags":"BANG|TRLBAR|CMDWIN", "parser":"parse_cmd_common"}, {"name":"bunload", "minlen":3, "flags":"BANG|RANGE|NOTADR|BUFNAME|COUNT|EXTRA|TRLBAR", "parser":"parse_cmd_common"}, {"name":"bwipeout", "minlen":2, "flags":"BANG|RANGE|NOTADR|BUFNAME|BUFUNL|COUNT|EXTRA|TRLBAR", "parser":"parse_cmd_common"}, {"name":"change", "minlen":1, "flags":"BANG|WHOLEFOLD|RANGE|COUNT|TRLBAR|CMDWIN|MODIFY", "parser":"parse_cmd_common"}, {"name":"cNext", "minlen":2, "flags":"RANGE|NOTADR|COUNT|TRLBAR|BANG", "parser":"parse_cmd_common"}, {"name":"cNfile", "minlen":3, "flags":"RANGE|NOTADR|COUNT|TRLBAR|BANG", "parser":"parse_cmd_common"}, {"name":"cabbrev", "minlen":2, "flags":"EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN", "parser":"parse_cmd_common"}, {"name":"cabclear", "minlen":4, "flags":"EXTRA|TRLBAR|CMDWIN", "parser":"parse_cmd_common"}, {"name":"caddbuffer", "minlen":3, "flags":"RANGE|NOTADR|WORD1|TRLBAR", "parser":"parse_cmd_common"}, {"name":"caddexpr", "minlen":5, "flags":"NEEDARG|WORD1|NOTRLCOM|TRLBAR", "parser":"parse_cmd_common"}, {"name":"caddfile", "minlen":5, "flags":"TRLBAR|FILE1", "parser":"parse_cmd_common"}, {"name":"call", "minlen":3, "flags":"RANGE|NEEDARG|EXTRA|NOTRLCOM|SBOXOK|CMDWIN", "parser":"parse_cmd_call"}, {"name":"catch", "minlen":3, "flags":"EXTRA|SBOXOK|CMDWIN", "parser":"parse_cmd_catch"}, {"name":"cbuffer", "minlen":2, "flags":"BANG|RANGE|NOTADR|WORD1|TRLBAR", "parser":"parse_cmd_common"}, {"name":"cc", "minlen":2, "flags":"RANGE|NOTADR|COUNT|TRLBAR|BANG", "parser":"parse_cmd_common"}, {"name":"cclose", "minlen":3, "flags":"RANGE|NOTADR|COUNT|TRLBAR", "parser":"parse_cmd_common"}, {"name":"cd", "minlen":2, "flags":"BANG|FILE1|TRLBAR|CMDWIN", "parser":"parse_cmd_common"}, {"name":"center", "minlen":2, "flags":"TRLBAR|RANGE|WHOLEFOLD|EXTRA|CMDWIN|MODIFY", "parser":"parse_cmd_common"}, {"name":"cexpr", "minlen":3, "flags":"NEEDARG|WORD1|NOTRLCOM|TRLBAR|BANG", "parser":"parse_cmd_common"}, {"name":"cfile", "minlen":2, "flags":"TRLBAR|FILE1|BANG", "parser":"parse_cmd_common"}, {"name":"cfirst", "minlen":4, "flags":"RANGE|NOTADR|COUNT|TRLBAR|BANG", "parser":"parse_cmd_common"}, {"name":"cgetbuffer", "minlen":5, "flags":"RANGE|NOTADR|WORD1|TRLBAR", "parser":"parse_cmd_common"}, {"name":"cgetexpr", "minlen":5, "flags":"NEEDARG|WORD1|NOTRLCOM|TRLBAR", "parser":"parse_cmd_common"}, {"name":"cgetfile", "minlen":2, "flags":"TRLBAR|FILE1", "parser":"parse_cmd_common"}, {"name":"changes", "minlen":7, "flags":"TRLBAR|CMDWIN", "parser":"parse_cmd_common"}, {"name":"chdir", "minlen":3, "flags":"BANG|FILE1|TRLBAR|CMDWIN", "parser":"parse_cmd_common"}, {"name":"checkpath", "minlen":3, "flags":"TRLBAR|BANG|CMDWIN", "parser":"parse_cmd_common"}, {"name":"checktime", "minlen":6, "flags":"RANGE|NOTADR|BUFNAME|COUNT|EXTRA|TRLBAR", "parser":"parse_cmd_common"}, {"name":"clist", "minlen":2, "flags":"BANG|EXTRA|TRLBAR|CMDWIN", "parser":"parse_cmd_common"}, {"name":"clast", "minlen":3, "flags":"RANGE|NOTADR|COUNT|TRLBAR|BANG", "parser":"parse_cmd_common"}, {"name":"close", "minlen":3, "flags":"BANG|TRLBAR|CMDWIN", "parser":"parse_cmd_common"}, {"name":"cmap", "minlen":2, "flags":"EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN", "parser":"parse_cmd_common"}, {"name":"cmapclear", "minlen":5, "flags":"EXTRA|TRLBAR|CMDWIN", "parser":"parse_cmd_common"}, {"name":"cmenu", "minlen":3, "flags":"RANGE|NOTADR|ZEROR|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN", "parser":"parse_cmd_common"}, {"name":"cnext", "minlen":2, "flags":"RANGE|NOTADR|COUNT|TRLBAR|BANG", "parser":"parse_cmd_common"}, {"name":"cnewer", "minlen":4, "flags":"RANGE|NOTADR|COUNT|TRLBAR", "parser":"parse_cmd_common"}, {"name":"cnfile", "minlen":3, "flags":"RANGE|NOTADR|COUNT|TRLBAR|BANG", "parser":"parse_cmd_common"}, {"name":"cnoremap", "minlen":3, "flags":"EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN", "parser":"parse_cmd_common"}, {"name":"cnoreabbrev", "minlen":6, "flags":"EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN", "parser":"parse_cmd_common"}, {"name":"cnoremenu", "minlen":7, "flags":"RANGE|NOTADR|ZEROR|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN", "parser":"parse_cmd_common"}, {"name":"copy", "minlen":2, "flags":"RANGE|WHOLEFOLD|EXTRA|TRLBAR|CMDWIN|MODIFY", "parser":"parse_cmd_common"}, {"name":"colder", "minlen":3, "flags":"RANGE|NOTADR|COUNT|TRLBAR", "parser":"parse_cmd_common"}, {"name":"colorscheme", "minlen":4, "flags":"WORD1|TRLBAR|CMDWIN", "parser":"parse_cmd_common"}, {"name":"command", "minlen":3, "flags":"EXTRA|BANG|NOTRLCOM|USECTRLV|CMDWIN", "parser":"parse_cmd_common"}, {"name":"comclear", "minlen":4, "flags":"TRLBAR|CMDWIN", "parser":"parse_cmd_common"}, {"name":"compiler", "minlen":4, "flags":"BANG|TRLBAR|WORD1|CMDWIN", "parser":"parse_cmd_common"}, {"name":"continue", "minlen":3, "flags":"TRLBAR|SBOXOK|CMDWIN", "parser":"parse_cmd_continue"}, {"name":"confirm", "minlen":4, "flags":"NEEDARG|EXTRA|NOTRLCOM|CMDWIN", "parser":"parse_cmd_common"}, {"name":"copen", "minlen":4, "flags":"RANGE|NOTADR|COUNT|TRLBAR", "parser":"parse_cmd_common"}, {"name":"cprevious", "minlen":2, "flags":"RANGE|NOTADR|COUNT|TRLBAR|BANG", "parser":"parse_cmd_common"}, {"name":"cpfile", "minlen":3, "flags":"RANGE|NOTADR|COUNT|TRLBAR|BANG", "parser":"parse_cmd_common"}, {"name":"cquit", "minlen":2, "flags":"TRLBAR|BANG", "parser":"parse_cmd_common"}, {"name":"crewind", "minlen":2, "flags":"RANGE|NOTADR|COUNT|TRLBAR|BANG", "parser":"parse_cmd_common"}, {"name":"cscope", "minlen":2, "flags":"EXTRA|NOTRLCOM|XFILE", "parser":"parse_cmd_common"}, {"name":"cstag", "minlen":3, "flags":"BANG|TRLBAR|WORD1", "parser":"parse_cmd_common"}, {"name":"cunmap", "minlen":2, "flags":"EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN", "parser":"parse_cmd_common"}, {"name":"cunabbrev", "minlen":4, "flags":"EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN", "parser":"parse_cmd_common"}, {"name":"cunmenu", "minlen":5, "flags":"EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN", "parser":"parse_cmd_common"}, {"name":"cwindow", "minlen":2, "flags":"RANGE|NOTADR|COUNT|TRLBAR", "parser":"parse_cmd_common"}, {"name":"delete", "minlen":1, "flags":"RANGE|WHOLEFOLD|REGSTR|COUNT|TRLBAR|CMDWIN|MODIFY", "parser":"parse_cmd_common"}, {"name":"delmarks", "minlen":4, "flags":"BANG|EXTRA|TRLBAR|CMDWIN", "parser":"parse_cmd_common"}, {"name":"debug", "minlen":3, "flags":"NEEDARG|EXTRA|NOTRLCOM|SBOXOK|CMDWIN", "parser":"parse_cmd_common"}, {"name":"debuggreedy", "minlen":6, "flags":"RANGE|NOTADR|ZEROR|TRLBAR|CMDWIN", "parser":"parse_cmd_common"}, {"name":"delcommand", "minlen":4, "flags":"NEEDARG|WORD1|TRLBAR|CMDWIN", "parser":"parse_cmd_common"}, {"name":"delfunction", "minlen":4, "flags":"BANG|NEEDARG|WORD1|CMDWIN", "parser":"parse_cmd_delfunction"}, {"name":"diffupdate", "minlen":3, "flags":"BANG|TRLBAR", "parser":"parse_cmd_common"}, {"name":"diffget", "minlen":5, "flags":"RANGE|EXTRA|TRLBAR|MODIFY", "parser":"parse_cmd_common"}, {"name":"diffoff", "minlen":5, "flags":"BANG|TRLBAR", "parser":"parse_cmd_common"}, {"name":"diffpatch", "minlen":5, "flags":"EXTRA|FILE1|TRLBAR|MODIFY", "parser":"parse_cmd_common"}, {"name":"diffput", "minlen":6, "flags":"RANGE|EXTRA|TRLBAR", "parser":"parse_cmd_common"}, {"name":"diffsplit", "minlen":5, "flags":"EXTRA|FILE1|TRLBAR", "parser":"parse_cmd_common"}, {"name":"diffthis", "minlen":5, "flags":"TRLBAR", "parser":"parse_cmd_common"}, {"name":"digraphs", "minlen":3, "flags":"EXTRA|TRLBAR|CMDWIN", "parser":"parse_cmd_common"}, {"name":"display", "minlen":2, "flags":"EXTRA|NOTRLCOM|TRLBAR|SBOXOK|CMDWIN", "parser":"parse_cmd_common"}, {"name":"djump", "minlen":2, "flags":"BANG|RANGE|DFLALL|WHOLEFOLD|EXTRA", "parser":"parse_cmd_common"}, {"name":"dlist", "minlen":2, "flags":"BANG|RANGE|DFLALL|WHOLEFOLD|EXTRA|CMDWIN", "parser":"parse_cmd_common"}, {"name":"doautocmd", "minlen":2, "flags":"EXTRA|TRLBAR|CMDWIN", "parser":"parse_cmd_common"}, {"name":"doautoall", "minlen":7, "flags":"EXTRA|TRLBAR|CMDWIN", "parser":"parse_cmd_common"}, {"name":"drop", "minlen":2, "flags":"FILES|EDITCMD|NEEDARG|ARGOPT|TRLBAR", "parser":"parse_cmd_common"}, {"name":"dsearch", "minlen":2, "flags":"BANG|RANGE|DFLALL|WHOLEFOLD|EXTRA|CMDWIN", "parser":"parse_cmd_common"}, {"name":"dsplit", "minlen":3, "flags":"BANG|RANGE|DFLALL|WHOLEFOLD|EXTRA", "parser":"parse_cmd_common"}, {"name":"edit", "minlen":1, "flags":"BANG|FILE1|EDITCMD|ARGOPT|TRLBAR", "parser":"parse_cmd_common"}, {"name":"earlier", "minlen":2, "flags":"TRLBAR|EXTRA|NOSPC|CMDWIN", "parser":"parse_cmd_common"}, {"name":"echo", "minlen":2, "flags":"EXTRA|NOTRLCOM|SBOXOK|CMDWIN", "parser":"parse_cmd_echo"}, {"name":"echoerr", "minlen":5, "flags":"EXTRA|NOTRLCOM|SBOXOK|CMDWIN", "parser":"parse_cmd_echoerr"}, {"name":"echohl", "minlen":5, "flags":"EXTRA|TRLBAR|SBOXOK|CMDWIN", "parser":"parse_cmd_echohl"}, {"name":"echomsg", "minlen":5, "flags":"EXTRA|NOTRLCOM|SBOXOK|CMDWIN", "parser":"parse_cmd_echomsg"}, {"name":"echon", "minlen":5, "flags":"EXTRA|NOTRLCOM|SBOXOK|CMDWIN", "parser":"parse_cmd_echon"}, {"name":"else", "minlen":2, "flags":"TRLBAR|SBOXOK|CMDWIN", "parser":"parse_cmd_else"}, {"name":"elseif", "minlen":5, "flags":"EXTRA|NOTRLCOM|SBOXOK|CMDWIN", "parser":"parse_cmd_elseif"}, {"name":"emenu", "minlen":2, "flags":"NEEDARG|EXTRA|TRLBAR|NOTRLCOM|RANGE|NOTADR|CMDWIN", "parser":"parse_cmd_common"}, {"name":"endif", "minlen":2, "flags":"TRLBAR|SBOXOK|CMDWIN", "parser":"parse_cmd_endif"}, {"name":"endfor", "minlen":5, "flags":"TRLBAR|SBOXOK|CMDWIN", "parser":"parse_cmd_endfor"}, {"name":"endfunction", "minlen":4, "flags":"TRLBAR|CMDWIN", "parser":"parse_cmd_endfunction"}, {"name":"endtry", "minlen":4, "flags":"TRLBAR|SBOXOK|CMDWIN", "parser":"parse_cmd_endtry"}, {"name":"endwhile", "minlen":4, "flags":"TRLBAR|SBOXOK|CMDWIN", "parser":"parse_cmd_endwhile"}, {"name":"enew", "minlen":3, "flags":"BANG|TRLBAR", "parser":"parse_cmd_common"}, {"name":"eval", "minlen":2, "flags":"EXTRA|NOTRLCOM|SBOXOK|CMDWIN", "parser":"parse_cmd_eval"}, {"name":"ex", "minlen":2, "flags":"BANG|FILE1|EDITCMD|ARGOPT|TRLBAR", "parser":"parse_cmd_common"}, {"name":"execute", "minlen":3, "flags":"EXTRA|NOTRLCOM|SBOXOK|CMDWIN", "parser":"parse_cmd_execute"}, {"name":"exit", "minlen":3, "flags":"RANGE|WHOLEFOLD|BANG|FILE1|ARGOPT|DFLALL|TRLBAR|CMDWIN", "parser":"parse_cmd_common"}, {"name":"exusage", "minlen":3, "flags":"TRLBAR", "parser":"parse_cmd_common"}, {"name":"file", "minlen":1, "flags":"RANGE|NOTADR|ZEROR|BANG|FILE1|TRLBAR", "parser":"parse_cmd_common"}, {"name":"files", "minlen":5, "flags":"BANG|TRLBAR|CMDWIN", "parser":"parse_cmd_common"}, {"name":"filetype", "minlen":5, "flags":"EXTRA|TRLBAR|CMDWIN", "parser":"parse_cmd_common"}, {"name":"find", "minlen":3, "flags":"RANGE|NOTADR|BANG|FILE1|EDITCMD|ARGOPT|TRLBAR", "parser":"parse_cmd_common"}, {"name":"finally", "minlen":4, "flags":"TRLBAR|SBOXOK|CMDWIN", "parser":"parse_cmd_finally"}, {"name":"finish", "minlen":4, "flags":"TRLBAR|SBOXOK|CMDWIN", "parser":"parse_cmd_finish"}, {"name":"first", "minlen":3, "flags":"EXTRA|BANG|EDITCMD|ARGOPT|TRLBAR", "parser":"parse_cmd_common"}, {"name":"fixdel", "minlen":3, "flags":"TRLBAR|CMDWIN", "parser":"parse_cmd_common"}, {"name":"fold", "minlen":2, "flags":"RANGE|WHOLEFOLD|TRLBAR|SBOXOK|CMDWIN", "parser":"parse_cmd_common"}, {"name":"foldclose", "minlen":5, "flags":"RANGE|BANG|WHOLEFOLD|TRLBAR|SBOXOK|CMDWIN", "parser":"parse_cmd_common"}, {"name":"folddoopen", "minlen":5, "flags":"RANGE|DFLALL|NEEDARG|EXTRA|NOTRLCOM", "parser":"parse_cmd_common"}, {"name":"folddoclosed", "minlen":7, "flags":"RANGE|DFLALL|NEEDARG|EXTRA|NOTRLCOM", "parser":"parse_cmd_common"}, {"name":"foldopen", "minlen":5, "flags":"RANGE|BANG|WHOLEFOLD|TRLBAR|SBOXOK|CMDWIN", "parser":"parse_cmd_common"}, {"name":"for", "minlen":3, "flags":"EXTRA|NOTRLCOM|SBOXOK|CMDWIN", "parser":"parse_cmd_for"}, {"name":"function", "minlen":2, "flags":"EXTRA|BANG|CMDWIN", "parser":"parse_cmd_function"}, {"name":"global", "minlen":1, "flags":"RANGE|WHOLEFOLD|BANG|EXTRA|DFLALL|SBOXOK|CMDWIN", "parser":"parse_cmd_common"}, {"name":"goto", "minlen":2, "flags":"RANGE|NOTADR|COUNT|TRLBAR|SBOXOK|CMDWIN", "parser":"parse_cmd_common"}, {"name":"grep", "minlen":2, "flags":"RANGE|NOTADR|BANG|NEEDARG|EXTRA|NOTRLCOM|TRLBAR|XFILE", "parser":"parse_cmd_common"}, {"name":"grepadd", "minlen":5, "flags":"RANGE|NOTADR|BANG|NEEDARG|EXTRA|NOTRLCOM|TRLBAR|XFILE", "parser":"parse_cmd_common"}, {"name":"gui", "minlen":2, "flags":"BANG|FILES|EDITCMD|ARGOPT|TRLBAR|CMDWIN", "parser":"parse_cmd_common"}, {"name":"gvim", "minlen":2, "flags":"BANG|FILES|EDITCMD|ARGOPT|TRLBAR|CMDWIN", "parser":"parse_cmd_common"}, {"name":"hardcopy", "minlen":2, "flags":"RANGE|COUNT|EXTRA|TRLBAR|DFLALL|BANG", "parser":"parse_cmd_common"}, {"name":"help", "minlen":1, "flags":"BANG|EXTRA|NOTRLCOM", "parser":"parse_cmd_common"}, {"name":"helpfind", "minlen":5, "flags":"EXTRA|NOTRLCOM", "parser":"parse_cmd_common"}, {"name":"helpgrep", "minlen":5, "flags":"EXTRA|NOTRLCOM|NEEDARG", "parser":"parse_cmd_common"}, {"name":"helptags", "minlen":5, "flags":"NEEDARG|FILES|TRLBAR|CMDWIN", "parser":"parse_cmd_common"}, {"name":"highlight", "minlen":2, "flags":"BANG|EXTRA|TRLBAR|SBOXOK|CMDWIN", "parser":"parse_cmd_common"}, {"name":"hide", "minlen":3, "flags":"BANG|EXTRA|NOTRLCOM", "parser":"parse_cmd_common"}, {"name":"history", "minlen":3, "flags":"EXTRA|TRLBAR|CMDWIN", "parser":"parse_cmd_common"}, {"name":"insert", "minlen":1, "flags":"BANG|RANGE|TRLBAR|CMDWIN|MODIFY", "parser":"parse_cmd_insert"}, {"name":"iabbrev", "minlen":2, "flags":"EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN", "parser":"parse_cmd_common"}, {"name":"iabclear", "minlen":4, "flags":"EXTRA|TRLBAR|CMDWIN", "parser":"parse_cmd_common"}, {"name":"if", "minlen":2, "flags":"EXTRA|NOTRLCOM|SBOXOK|CMDWIN", "parser":"parse_cmd_if"}, {"name":"ijump", "minlen":2, "flags":"BANG|RANGE|DFLALL|WHOLEFOLD|EXTRA", "parser":"parse_cmd_common"}, {"name":"ilist", "minlen":2, "flags":"BANG|RANGE|DFLALL|WHOLEFOLD|EXTRA|CMDWIN", "parser":"parse_cmd_common"}, {"name":"imap", "minlen":2, "flags":"EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN", "parser":"parse_cmd_common"}, {"name":"imapclear", "minlen":5, "flags":"EXTRA|TRLBAR|CMDWIN", "parser":"parse_cmd_common"}, {"name":"imenu", "minlen":3, "flags":"RANGE|NOTADR|ZEROR|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN", "parser":"parse_cmd_common"}, {"name":"inoremap", "minlen":3, "flags":"EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN", "parser":"parse_cmd_common"}, {"name":"inoreabbrev", "minlen":6, "flags":"EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN", "parser":"parse_cmd_common"}, {"name":"inoremenu", "minlen":7, "flags":"RANGE|NOTADR|ZEROR|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN", "parser":"parse_cmd_common"}, {"name":"intro", "minlen":3, "flags":"TRLBAR|CMDWIN", "parser":"parse_cmd_common"}, {"name":"isearch", "minlen":2, "flags":"BANG|RANGE|DFLALL|WHOLEFOLD|EXTRA|CMDWIN", "parser":"parse_cmd_common"}, {"name":"isplit", "minlen":3, "flags":"BANG|RANGE|DFLALL|WHOLEFOLD|EXTRA", "parser":"parse_cmd_common"}, {"name":"iunmap", "minlen":2, "flags":"EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN", "parser":"parse_cmd_common"}, {"name":"iunabbrev", "minlen":4, "flags":"EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN", "parser":"parse_cmd_common"}, {"name":"iunmenu", "minlen":5, "flags":"EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN", "parser":"parse_cmd_common"}, {"name":"join", "minlen":1, "flags":"BANG|RANGE|WHOLEFOLD|COUNT|EXFLAGS|TRLBAR|CMDWIN|MODIFY", "parser":"parse_cmd_common"}, {"name":"jumps", "minlen":2, "flags":"TRLBAR|CMDWIN", "parser":"parse_cmd_common"}, {"name":"k", "minlen":1, "flags":"RANGE|WORD1|TRLBAR|SBOXOK|CMDWIN", "parser":"parse_cmd_common"}, {"name":"keepalt", "minlen":5, "flags":"NEEDARG|EXTRA|NOTRLCOM", "parser":"parse_cmd_common"}, {"name":"keepmarks", "minlen":3, "flags":"NEEDARG|EXTRA|NOTRLCOM", "parser":"parse_cmd_common"}, {"name":"keepjumps", "minlen":5, "flags":"NEEDARG|EXTRA|NOTRLCOM", "parser":"parse_cmd_common"}, {"name":"keeppatterns", "minlen":5, "flags":"NEEDARG|EXTRA|NOTRLCOM", "parser":"parse_cmd_common"}, {"name":"lNext", "minlen":2, "flags":"RANGE|NOTADR|COUNT|TRLBAR|BANG", "parser":"parse_cmd_common"}, {"name":"lNfile", "minlen":3, "flags":"RANGE|NOTADR|COUNT|TRLBAR|BANG", "parser":"parse_cmd_common"}, {"name":"list", "minlen":1, "flags":"RANGE|WHOLEFOLD|COUNT|EXFLAGS|TRLBAR|CMDWIN", "parser":"parse_cmd_common"}, {"name":"laddexpr", "minlen":3, "flags":"NEEDARG|WORD1|NOTRLCOM|TRLBAR", "parser":"parse_cmd_common"}, {"name":"laddbuffer", "minlen":5, "flags":"RANGE|NOTADR|WORD1|TRLBAR", "parser":"parse_cmd_common"}, {"name":"laddfile", "minlen":5, "flags":"TRLBAR|FILE1", "parser":"parse_cmd_common"}, {"name":"last", "minlen":2, "flags":"EXTRA|BANG|EDITCMD|ARGOPT|TRLBAR", "parser":"parse_cmd_common"}, {"name":"language", "minlen":3, "flags":"EXTRA|TRLBAR|CMDWIN", "parser":"parse_cmd_common"}, {"name":"later", "minlen":3, "flags":"TRLBAR|EXTRA|NOSPC|CMDWIN", "parser":"parse_cmd_common"}, {"name":"lbuffer", "minlen":2, "flags":"BANG|RANGE|NOTADR|WORD1|TRLBAR", "parser":"parse_cmd_common"}, {"name":"lcd", "minlen":2, "flags":"BANG|FILE1|TRLBAR|CMDWIN", "parser":"parse_cmd_common"}, {"name":"lchdir", "minlen":3, "flags":"BANG|FILE1|TRLBAR|CMDWIN", "parser":"parse_cmd_common"}, {"name":"lclose", "minlen":3, "flags":"RANGE|NOTADR|COUNT|TRLBAR", "parser":"parse_cmd_common"}, {"name":"lcscope", "minlen":3, "flags":"EXTRA|NOTRLCOM|XFILE", "parser":"parse_cmd_common"}, {"name":"left", "minlen":2, "flags":"TRLBAR|RANGE|WHOLEFOLD|EXTRA|CMDWIN|MODIFY", "parser":"parse_cmd_common"}, {"name":"leftabove", "minlen":5, "flags":"NEEDARG|EXTRA|NOTRLCOM", "parser":"parse_cmd_common"}, {"name":"let", "minlen":3, "flags":"EXTRA|NOTRLCOM|SBOXOK|CMDWIN", "parser":"parse_cmd_let"}, {"name":"const", "minlen":4, "flags":"EXTRA|NOTRLCOM|SBOXOK|CMDWIN", "parser":"parse_cmd_const"}, {"name":"lexpr", "minlen":3, "flags":"NEEDARG|WORD1|NOTRLCOM|TRLBAR|BANG", "parser":"parse_cmd_common"}, {"name":"lfile", "minlen":2, "flags":"TRLBAR|FILE1|BANG", "parser":"parse_cmd_common"}, {"name":"lfirst", "minlen":4, "flags":"RANGE|NOTADR|COUNT|TRLBAR|BANG", "parser":"parse_cmd_common"}, {"name":"lgetbuffer", "minlen":5, "flags":"RANGE|NOTADR|WORD1|TRLBAR", "parser":"parse_cmd_common"}, {"name":"lgetexpr", "minlen":5, "flags":"NEEDARG|WORD1|NOTRLCOM|TRLBAR", "parser":"parse_cmd_common"}, {"name":"lgetfile", "minlen":2, "flags":"TRLBAR|FILE1", "parser":"parse_cmd_common"}, {"name":"lgrep", "minlen":3, "flags":"RANGE|NOTADR|BANG|NEEDARG|EXTRA|NOTRLCOM|TRLBAR|XFILE", "parser":"parse_cmd_common"}, {"name":"lgrepadd", "minlen":6, "flags":"RANGE|NOTADR|BANG|NEEDARG|EXTRA|NOTRLCOM|TRLBAR|XFILE", "parser":"parse_cmd_common"}, {"name":"lhelpgrep", "minlen":2, "flags":"EXTRA|NOTRLCOM|NEEDARG", "parser":"parse_cmd_common"}, {"name":"ll", "minlen":2, "flags":"RANGE|NOTADR|COUNT|TRLBAR|BANG", "parser":"parse_cmd_common"}, {"name":"llast", "minlen":3, "flags":"RANGE|NOTADR|COUNT|TRLBAR|BANG", "parser":"parse_cmd_common"}, {"name":"list", "minlen":3, "flags":"BANG|EXTRA|TRLBAR|CMDWIN", "parser":"parse_cmd_common"}, {"name":"lmake", "minlen":4, "flags":"BANG|EXTRA|NOTRLCOM|TRLBAR|XFILE", "parser":"parse_cmd_common"}, {"name":"lmap", "minlen":2, "flags":"EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN", "parser":"parse_cmd_common"}, {"name":"lmapclear", "minlen":5, "flags":"EXTRA|TRLBAR|CMDWIN", "parser":"parse_cmd_common"}, {"name":"lnext", "minlen":3, "flags":"RANGE|NOTADR|COUNT|TRLBAR|BANG", "parser":"parse_cmd_common"}, {"name":"lnewer", "minlen":4, "flags":"RANGE|NOTADR|COUNT|TRLBAR", "parser":"parse_cmd_common"}, {"name":"lnfile", "minlen":3, "flags":"RANGE|NOTADR|COUNT|TRLBAR|BANG", "parser":"parse_cmd_common"}, {"name":"lnoremap", "minlen":2, "flags":"EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN", "parser":"parse_cmd_common"}, {"name":"loadkeymap", "minlen":5, "flags":"CMDWIN", "parser":"parse_cmd_loadkeymap"}, {"name":"loadview", "minlen":2, "flags":"FILE1|TRLBAR", "parser":"parse_cmd_common"}, {"name":"lockmarks", "minlen":3, "flags":"NEEDARG|EXTRA|NOTRLCOM", "parser":"parse_cmd_common"}, {"name":"lockvar", "minlen":5, "flags":"BANG|EXTRA|NEEDARG|SBOXOK|CMDWIN", "parser":"parse_cmd_lockvar"}, {"name":"lolder", "minlen":3, "flags":"RANGE|NOTADR|COUNT|TRLBAR", "parser":"parse_cmd_common"}, {"name":"lopen", "minlen":3, "flags":"RANGE|NOTADR|COUNT|TRLBAR", "parser":"parse_cmd_common"}, {"name":"lprevious", "minlen":2, "flags":"RANGE|NOTADR|COUNT|TRLBAR|BANG", "parser":"parse_cmd_common"}, {"name":"lpfile", "minlen":3, "flags":"RANGE|NOTADR|COUNT|TRLBAR|BANG", "parser":"parse_cmd_common"}, {"name":"lrewind", "minlen":2, "flags":"RANGE|NOTADR|COUNT|TRLBAR|BANG", "parser":"parse_cmd_common"}, {"name":"ls", "minlen":2, "flags":"BANG|TRLBAR|CMDWIN", "parser":"parse_cmd_common"}, {"name":"ltag", "minlen":2, "flags":"NOTADR|TRLBAR|BANG|WORD1", "parser":"parse_cmd_common"}, {"name":"lunmap", "minlen":2, "flags":"EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN", "parser":"parse_cmd_common"}, {"name":"lua", "minlen":3, "flags":"RANGE|EXTRA|NEEDARG|CMDWIN", "parser":"parse_cmd_lua"}, {"name":"luado", "minlen":4, "flags":"RANGE|DFLALL|EXTRA|NEEDARG|CMDWIN", "parser":"parse_cmd_common"}, {"name":"luafile", "minlen":4, "flags":"RANGE|FILE1|NEEDARG|CMDWIN", "parser":"parse_cmd_common"}, {"name":"lvimgrep", "minlen":2, "flags":"RANGE|NOTADR|BANG|NEEDARG|EXTRA|NOTRLCOM|TRLBAR|XFILE", "parser":"parse_cmd_common"}, {"name":"lvimgrepadd", "minlen":9, "flags":"RANGE|NOTADR|BANG|NEEDARG|EXTRA|NOTRLCOM|TRLBAR|XFILE", "parser":"parse_cmd_common"}, {"name":"lwindow", "minlen":2, "flags":"RANGE|NOTADR|COUNT|TRLBAR", "parser":"parse_cmd_common"}, {"name":"move", "minlen":1, "flags":"RANGE|WHOLEFOLD|EXTRA|TRLBAR|CMDWIN|MODIFY", "parser":"parse_cmd_common"}, {"name":"mark", "minlen":2, "flags":"RANGE|WORD1|TRLBAR|SBOXOK|CMDWIN", "parser":"parse_cmd_common"}, {"name":"make", "minlen":3, "flags":"BANG|EXTRA|NOTRLCOM|TRLBAR|XFILE", "parser":"parse_cmd_common"}, {"name":"map", "minlen":3, "flags":"BANG|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN", "parser":"parse_cmd_common"}, {"name":"mapclear", "minlen":4, "flags":"EXTRA|BANG|TRLBAR|CMDWIN", "parser":"parse_cmd_common"}, {"name":"marks", "minlen":5, "flags":"EXTRA|TRLBAR|CMDWIN", "parser":"parse_cmd_common"}, {"name":"match", "minlen":3, "flags":"RANGE|NOTADR|EXTRA|CMDWIN", "parser":"parse_cmd_common"}, {"name":"menu", "minlen":2, "flags":"RANGE|NOTADR|ZEROR|BANG|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN", "parser":"parse_cmd_common"}, {"name":"menutranslate", "minlen":5, "flags":"EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN", "parser":"parse_cmd_common"}, {"name":"messages", "minlen":3, "flags":"TRLBAR|CMDWIN", "parser":"parse_cmd_common"}, {"name":"mkexrc", "minlen":2, "flags":"BANG|FILE1|TRLBAR|CMDWIN", "parser":"parse_cmd_common"}, {"name":"mksession", "minlen":3, "flags":"BANG|FILE1|TRLBAR", "parser":"parse_cmd_common"}, {"name":"mkspell", "minlen":4, "flags":"BANG|NEEDARG|EXTRA|NOTRLCOM|TRLBAR|XFILE", "parser":"parse_cmd_common"}, {"name":"mkvimrc", "minlen":3, "flags":"BANG|FILE1|TRLBAR|CMDWIN", "parser":"parse_cmd_common"}, {"name":"mkview", "minlen":5, "flags":"BANG|FILE1|TRLBAR", "parser":"parse_cmd_common"}, {"name":"mode", "minlen":3, "flags":"WORD1|TRLBAR|CMDWIN", "parser":"parse_cmd_common"}, {"name":"mzscheme", "minlen":2, "flags":"RANGE|EXTRA|DFLALL|NEEDARG|CMDWIN|SBOXOK", "parser":"parse_cmd_mzscheme"}, {"name":"mzfile", "minlen":3, "flags":"RANGE|FILE1|NEEDARG|CMDWIN", "parser":"parse_cmd_common"}, {"name":"nbclose", "minlen":3, "flags":"TRLBAR|CMDWIN", "parser":"parse_cmd_common"}, {"name":"nbkey", "minlen":2, "flags":"EXTRA|NOTADR|NEEDARG", "parser":"parse_cmd_common"}, {"name":"nbstart", "minlen":3, "flags":"WORD1|TRLBAR|CMDWIN", "parser":"parse_cmd_common"}, {"name":"next", "minlen":1, "flags":"RANGE|NOTADR|BANG|FILES|EDITCMD|ARGOPT|TRLBAR", "parser":"parse_cmd_common"}, {"name":"new", "minlen":3, "flags":"BANG|FILE1|RANGE|NOTADR|EDITCMD|ARGOPT|TRLBAR", "parser":"parse_cmd_common"}, {"name":"nmap", "minlen":2, "flags":"EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN", "parser":"parse_cmd_common"}, {"name":"nmapclear", "minlen":5, "flags":"EXTRA|TRLBAR|CMDWIN", "parser":"parse_cmd_common"}, {"name":"nmenu", "minlen":3, "flags":"RANGE|NOTADR|ZEROR|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN", "parser":"parse_cmd_common"}, {"name":"nnoremap", "minlen":2, "flags":"EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN", "parser":"parse_cmd_common"}, {"name":"nnoremenu", "minlen":7, "flags":"RANGE|NOTADR|ZEROR|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN", "parser":"parse_cmd_common"}, {"name":"noautocmd", "minlen":3, "flags":"NEEDARG|EXTRA|NOTRLCOM", "parser":"parse_cmd_common"}, {"name":"noremap", "minlen":2, "flags":"BANG|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN", "parser":"parse_cmd_common"}, {"name":"nohlsearch", "minlen":3, "flags":"TRLBAR|SBOXOK|CMDWIN", "parser":"parse_cmd_common"}, {"name":"noreabbrev", "minlen":5, "flags":"EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN", "parser":"parse_cmd_common"}, {"name":"noremenu", "minlen":6, "flags":"RANGE|NOTADR|ZEROR|BANG|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN", "parser":"parse_cmd_common"}, {"name":"normal", "minlen":4, "flags":"RANGE|BANG|EXTRA|NEEDARG|NOTRLCOM|USECTRLV|SBOXOK|CMDWIN", "parser":"parse_cmd_common"}, {"name":"number", "minlen":2, "flags":"RANGE|WHOLEFOLD|COUNT|EXFLAGS|TRLBAR|CMDWIN", "parser":"parse_cmd_common"}, {"name":"nunmap", "minlen":3, "flags":"EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN", "parser":"parse_cmd_common"}, {"name":"nunmenu", "minlen":5, "flags":"EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN", "parser":"parse_cmd_common"}, {"name":"oldfiles", "minlen":2, "flags":"BANG|TRLBAR|SBOXOK|CMDWIN", "parser":"parse_cmd_common"}, {"name":"open", "minlen":1, "flags":"RANGE|BANG|EXTRA", "parser":"parse_cmd_common"}, {"name":"omap", "minlen":2, "flags":"EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN", "parser":"parse_cmd_common"}, {"name":"omapclear", "minlen":5, "flags":"EXTRA|TRLBAR|CMDWIN", "parser":"parse_cmd_common"}, {"name":"omenu", "minlen":3, "flags":"RANGE|NOTADR|ZEROR|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN", "parser":"parse_cmd_common"}, {"name":"only", "minlen":2, "flags":"BANG|TRLBAR", "parser":"parse_cmd_common"}, {"name":"onoremap", "minlen":3, "flags":"EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN", "parser":"parse_cmd_common"}, {"name":"onoremenu", "minlen":7, "flags":"RANGE|NOTADR|ZEROR|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN", "parser":"parse_cmd_common"}, {"name":"options", "minlen":3, "flags":"TRLBAR", "parser":"parse_cmd_common"}, {"name":"ounmap", "minlen":2, "flags":"EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN", "parser":"parse_cmd_common"}, {"name":"ounmenu", "minlen":5, "flags":"EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN", "parser":"parse_cmd_common"}, {"name":"ownsyntax", "minlen":2, "flags":"EXTRA|NOTRLCOM|SBOXOK|CMDWIN", "parser":"parse_cmd_common"}, {"name":"pclose", "minlen":2, "flags":"BANG|TRLBAR", "parser":"parse_cmd_common"}, {"name":"pedit", "minlen":3, "flags":"BANG|FILE1|EDITCMD|ARGOPT|TRLBAR", "parser":"parse_cmd_common"}, {"name":"perl", "minlen":2, "flags":"RANGE|EXTRA|DFLALL|NEEDARG|SBOXOK|CMDWIN", "parser":"parse_cmd_perl"}, {"name":"print", "minlen":1, "flags":"RANGE|WHOLEFOLD|COUNT|EXFLAGS|TRLBAR|CMDWIN|SBOXOK", "parser":"parse_cmd_common"}, {"name":"profdel", "minlen":5, "flags":"EXTRA|TRLBAR|CMDWIN", "parser":"parse_cmd_common"}, {"name":"profile", "minlen":4, "flags":"BANG|EXTRA|TRLBAR|CMDWIN", "parser":"parse_cmd_common"}, {"name":"promptfind", "minlen":3, "flags":"EXTRA|NOTRLCOM|CMDWIN", "parser":"parse_cmd_common"}, {"name":"promptrepl", "minlen":7, "flags":"EXTRA|NOTRLCOM|CMDWIN", "parser":"parse_cmd_common"}, {"name":"perldo", "minlen":5, "flags":"RANGE|EXTRA|DFLALL|NEEDARG|CMDWIN", "parser":"parse_cmd_common"}, {"name":"pop", "minlen":2, "flags":"RANGE|NOTADR|BANG|COUNT|TRLBAR|ZEROR", "parser":"parse_cmd_common"}, {"name":"popup", "minlen":4, "flags":"NEEDARG|EXTRA|BANG|TRLBAR|NOTRLCOM|CMDWIN", "parser":"parse_cmd_common"}, {"name":"ppop", "minlen":2, "flags":"RANGE|NOTADR|BANG|COUNT|TRLBAR|ZEROR", "parser":"parse_cmd_common"}, {"name":"preserve", "minlen":3, "flags":"TRLBAR", "parser":"parse_cmd_common"}, {"name":"previous", "minlen":4, "flags":"EXTRA|RANGE|NOTADR|COUNT|BANG|EDITCMD|ARGOPT|TRLBAR", "parser":"parse_cmd_common"}, {"name":"psearch", "minlen":2, "flags":"BANG|RANGE|WHOLEFOLD|DFLALL|EXTRA", "parser":"parse_cmd_common"}, {"name":"ptag", "minlen":2, "flags":"RANGE|NOTADR|BANG|WORD1|TRLBAR|ZEROR", "parser":"parse_cmd_common"}, {"name":"ptNext", "minlen":3, "flags":"RANGE|NOTADR|BANG|TRLBAR|ZEROR", "parser":"parse_cmd_common"}, {"name":"ptfirst", "minlen":3, "flags":"RANGE|NOTADR|BANG|TRLBAR|ZEROR", "parser":"parse_cmd_common"}, {"name":"ptjump", "minlen":3, "flags":"BANG|TRLBAR|WORD1", "parser":"parse_cmd_common"}, {"name":"ptlast", "minlen":3, "flags":"BANG|TRLBAR", "parser":"parse_cmd_common"}, {"name":"ptnext", "minlen":3, "flags":"RANGE|NOTADR|BANG|TRLBAR|ZEROR", "parser":"parse_cmd_common"}, {"name":"ptprevious", "minlen":3, "flags":"RANGE|NOTADR|BANG|TRLBAR|ZEROR", "parser":"parse_cmd_common"}, {"name":"ptrewind", "minlen":3, "flags":"RANGE|NOTADR|BANG|TRLBAR|ZEROR", "parser":"parse_cmd_common"}, {"name":"ptselect", "minlen":3, "flags":"BANG|TRLBAR|WORD1", "parser":"parse_cmd_common"}, {"name":"put", "minlen":2, "flags":"RANGE|WHOLEFOLD|BANG|REGSTR|TRLBAR|ZEROR|CMDWIN|MODIFY", "parser":"parse_cmd_common"}, {"name":"pwd", "minlen":2, "flags":"TRLBAR|CMDWIN", "parser":"parse_cmd_common"}, {"name":"py3", "minlen":3, "flags":"RANGE|EXTRA|NEEDARG|CMDWIN", "parser":"parse_cmd_python3"}, {"name":"python3", "minlen":7, "flags":"RANGE|EXTRA|NEEDARG|CMDWIN", "parser":"parse_cmd_python3"}, {"name":"py3file", "minlen":4, "flags":"RANGE|FILE1|NEEDARG|CMDWIN", "parser":"parse_cmd_common"}, {"name":"python", "minlen":2, "flags":"RANGE|EXTRA|NEEDARG|CMDWIN", "parser":"parse_cmd_python"}, {"name":"pyfile", "minlen":3, "flags":"RANGE|FILE1|NEEDARG|CMDWIN", "parser":"parse_cmd_common"}, {"name":"pydo", "minlen":3, "flags":"RANGE|DFLALL|EXTRA|NEEDARG|CMDWIN", "parser":"parse_cmd_common"}, {"name":"py3do", "minlen":4, "flags":"RANGE|DFLALL|EXTRA|NEEDARG|CMDWIN", "parser":"parse_cmd_common"}, {"name":"quit", "minlen":1, "flags":"BANG|TRLBAR|CMDWIN", "parser":"parse_cmd_common"}, {"name":"quitall", "minlen":5, "flags":"BANG|TRLBAR", "parser":"parse_cmd_common"}, {"name":"qall", "minlen":2, "flags":"BANG|TRLBAR|CMDWIN", "parser":"parse_cmd_common"}, {"name":"read", "minlen":1, "flags":"BANG|RANGE|WHOLEFOLD|FILE1|ARGOPT|TRLBAR|ZEROR|CMDWIN|MODIFY", "parser":"parse_cmd_common"}, {"name":"recover", "minlen":3, "flags":"BANG|FILE1|TRLBAR", "parser":"parse_cmd_common"}, {"name":"redo", "minlen":3, "flags":"TRLBAR|CMDWIN", "parser":"parse_cmd_common"}, {"name":"redir", "minlen":4, "flags":"BANG|FILES|TRLBAR|CMDWIN", "parser":"parse_cmd_common"}, {"name":"redraw", "minlen":4, "flags":"BANG|TRLBAR|CMDWIN", "parser":"parse_cmd_common"}, {"name":"redrawstatus", "minlen":7, "flags":"BANG|TRLBAR|CMDWIN", "parser":"parse_cmd_common"}, {"name":"registers", "minlen":3, "flags":"EXTRA|NOTRLCOM|TRLBAR|CMDWIN", "parser":"parse_cmd_common"}, {"name":"resize", "minlen":3, "flags":"RANGE|NOTADR|TRLBAR|WORD1", "parser":"parse_cmd_common"}, {"name":"retab", "minlen":3, "flags":"TRLBAR|RANGE|WHOLEFOLD|DFLALL|BANG|WORD1|CMDWIN|MODIFY", "parser":"parse_cmd_common"}, {"name":"return", "minlen":4, "flags":"EXTRA|NOTRLCOM|SBOXOK|CMDWIN", "parser":"parse_cmd_return"}, {"name":"rewind", "minlen":3, "flags":"EXTRA|BANG|EDITCMD|ARGOPT|TRLBAR", "parser":"parse_cmd_common"}, {"name":"right", "minlen":2, "flags":"TRLBAR|RANGE|WHOLEFOLD|EXTRA|CMDWIN|MODIFY", "parser":"parse_cmd_common"}, {"name":"rightbelow", "minlen":6, "flags":"NEEDARG|EXTRA|NOTRLCOM", "parser":"parse_cmd_common"}, {"name":"ruby", "minlen":3, "flags":"RANGE|EXTRA|NEEDARG|CMDWIN", "parser":"parse_cmd_ruby"}, {"name":"rubydo", "minlen":5, "flags":"RANGE|DFLALL|EXTRA|NEEDARG|CMDWIN", "parser":"parse_cmd_common"}, {"name":"rubyfile", "minlen":5, "flags":"RANGE|FILE1|NEEDARG|CMDWIN", "parser":"parse_cmd_common"}, {"name":"rundo", "minlen":4, "flags":"NEEDARG|FILE1", "parser":"parse_cmd_common"}, {"name":"runtime", "minlen":2, "flags":"BANG|NEEDARG|FILES|TRLBAR|SBOXOK|CMDWIN", "parser":"parse_cmd_common"}, {"name":"rviminfo", "minlen":2, "flags":"BANG|FILE1|TRLBAR|CMDWIN", "parser":"parse_cmd_common"}, {"name":"substitute", "minlen":1, "flags":"RANGE|WHOLEFOLD|EXTRA|CMDWIN", "parser":"parse_cmd_common"}, {"name":"sNext", "minlen":2, "flags":"EXTRA|RANGE|NOTADR|COUNT|BANG|EDITCMD|ARGOPT|TRLBAR", "parser":"parse_cmd_common"}, {"name":"sandbox", "minlen":3, "flags":"NEEDARG|EXTRA|NOTRLCOM", "parser":"parse_cmd_common"}, {"name":"sargument", "minlen":2, "flags":"BANG|RANGE|NOTADR|COUNT|EXTRA|EDITCMD|ARGOPT|TRLBAR", "parser":"parse_cmd_common"}, {"name":"sall", "minlen":3, "flags":"BANG|RANGE|NOTADR|COUNT|TRLBAR", "parser":"parse_cmd_common"}, {"name":"saveas", "minlen":3, "flags":"BANG|DFLALL|FILE1|ARGOPT|CMDWIN|TRLBAR", "parser":"parse_cmd_common"}, {"name":"sbuffer", "minlen":2, "flags":"BANG|RANGE|NOTADR|BUFNAME|BUFUNL|COUNT|EXTRA|TRLBAR", "parser":"parse_cmd_common"}, {"name":"sbNext", "minlen":3, "flags":"RANGE|NOTADR|COUNT|TRLBAR", "parser":"parse_cmd_common"}, {"name":"sball", "minlen":3, "flags":"RANGE|NOTADR|COUNT|TRLBAR", "parser":"parse_cmd_common"}, {"name":"sbfirst", "minlen":3, "flags":"TRLBAR", "parser":"parse_cmd_common"}, {"name":"sblast", "minlen":3, "flags":"TRLBAR", "parser":"parse_cmd_common"}, {"name":"sbmodified", "minlen":3, "flags":"RANGE|NOTADR|COUNT|TRLBAR", "parser":"parse_cmd_common"}, {"name":"sbnext", "minlen":3, "flags":"RANGE|NOTADR|COUNT|TRLBAR", "parser":"parse_cmd_common"}, {"name":"sbprevious", "minlen":3, "flags":"RANGE|NOTADR|COUNT|TRLBAR", "parser":"parse_cmd_common"}, {"name":"sbrewind", "minlen":3, "flags":"TRLBAR", "parser":"parse_cmd_common"}, {"name":"scriptnames", "minlen":3, "flags":"TRLBAR|CMDWIN", "parser":"parse_cmd_common"}, {"name":"scriptencoding", "minlen":7, "flags":"WORD1|TRLBAR|CMDWIN", "parser":"parse_cmd_common"}, {"name":"scscope", "minlen":3, "flags":"EXTRA|NOTRLCOM", "parser":"parse_cmd_common"}, {"name":"set", "minlen":2, "flags":"TRLBAR|EXTRA|CMDWIN|SBOXOK", "parser":"parse_cmd_common"}, {"name":"setfiletype", "minlen":4, "flags":"TRLBAR|EXTRA|NEEDARG|CMDWIN", "parser":"parse_cmd_common"}, {"name":"setglobal", "minlen":4, "flags":"TRLBAR|EXTRA|CMDWIN|SBOXOK", "parser":"parse_cmd_common"}, {"name":"setlocal", "minlen":4, "flags":"TRLBAR|EXTRA|CMDWIN|SBOXOK", "parser":"parse_cmd_common"}, {"name":"sfind", "minlen":2, "flags":"BANG|FILE1|RANGE|NOTADR|EDITCMD|ARGOPT|TRLBAR", "parser":"parse_cmd_common"}, {"name":"sfirst", "minlen":4, "flags":"EXTRA|BANG|EDITCMD|ARGOPT|TRLBAR", "parser":"parse_cmd_common"}, {"name":"shell", "minlen":2, "flags":"TRLBAR|CMDWIN", "parser":"parse_cmd_common"}, {"name":"simalt", "minlen":3, "flags":"NEEDARG|WORD1|TRLBAR|CMDWIN", "parser":"parse_cmd_common"}, {"name":"sign", "minlen":3, "flags":"NEEDARG|RANGE|NOTADR|EXTRA|CMDWIN", "parser":"parse_cmd_common"}, {"name":"silent", "minlen":3, "flags":"NEEDARG|EXTRA|BANG|NOTRLCOM|SBOXOK|CMDWIN", "parser":"parse_cmd_common"}, {"name":"sleep", "minlen":2, "flags":"RANGE|NOTADR|COUNT|EXTRA|TRLBAR|CMDWIN", "parser":"parse_cmd_common"}, {"name":"slast", "minlen":3, "flags":"EXTRA|BANG|EDITCMD|ARGOPT|TRLBAR", "parser":"parse_cmd_common"}, {"name":"smagic", "minlen":2, "flags":"RANGE|WHOLEFOLD|EXTRA|CMDWIN", "parser":"parse_cmd_common"}, {"name":"smap", "minlen":4, "flags":"EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN", "parser":"parse_cmd_common"}, {"name":"smapclear", "minlen":5, "flags":"EXTRA|TRLBAR|CMDWIN", "parser":"parse_cmd_common"}, {"name":"smenu", "minlen":3, "flags":"RANGE|NOTADR|ZEROR|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN", "parser":"parse_cmd_common"}, {"name":"snext", "minlen":2, "flags":"RANGE|NOTADR|BANG|FILES|EDITCMD|ARGOPT|TRLBAR", "parser":"parse_cmd_common"}, {"name":"sniff", "minlen":3, "flags":"EXTRA|TRLBAR", "parser":"parse_cmd_common"}, {"name":"snomagic", "minlen":3, "flags":"RANGE|WHOLEFOLD|EXTRA|CMDWIN", "parser":"parse_cmd_common"}, {"name":"snoremap", "minlen":4, "flags":"EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN", "parser":"parse_cmd_common"}, {"name":"snoremenu", "minlen":7, "flags":"RANGE|NOTADR|ZEROR|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN", "parser":"parse_cmd_common"}, {"name":"sort", "minlen":3, "flags":"RANGE|DFLALL|WHOLEFOLD|BANG|EXTRA|NOTRLCOM|MODIFY", "parser":"parse_cmd_common"}, {"name":"source", "minlen":2, "flags":"BANG|FILE1|TRLBAR|SBOXOK|CMDWIN", "parser":"parse_cmd_common"}, {"name":"spelldump", "minlen":6, "flags":"BANG|TRLBAR", "parser":"parse_cmd_common"}, {"name":"spellgood", "minlen":3, "flags":"BANG|RANGE|NOTADR|NEEDARG|EXTRA|TRLBAR", "parser":"parse_cmd_common"}, {"name":"spellinfo", "minlen":6, "flags":"TRLBAR", "parser":"parse_cmd_common"}, {"name":"spellrepall", "minlen":6, "flags":"TRLBAR", "parser":"parse_cmd_common"}, {"name":"spellundo", "minlen":6, "flags":"BANG|RANGE|NOTADR|NEEDARG|EXTRA|TRLBAR", "parser":"parse_cmd_common"}, {"name":"spellwrong", "minlen":6, "flags":"BANG|RANGE|NOTADR|NEEDARG|EXTRA|TRLBAR", "parser":"parse_cmd_common"}, {"name":"split", "minlen":2, "flags":"BANG|FILE1|RANGE|NOTADR|EDITCMD|ARGOPT|TRLBAR", "parser":"parse_cmd_common"}, {"name":"sprevious", "minlen":3, "flags":"EXTRA|RANGE|NOTADR|COUNT|BANG|EDITCMD|ARGOPT|TRLBAR", "parser":"parse_cmd_common"}, {"name":"srewind", "minlen":3, "flags":"EXTRA|BANG|EDITCMD|ARGOPT|TRLBAR", "parser":"parse_cmd_common"}, {"name":"stop", "minlen":2, "flags":"TRLBAR|BANG|CMDWIN", "parser":"parse_cmd_common"}, {"name":"stag", "minlen":3, "flags":"RANGE|NOTADR|BANG|WORD1|TRLBAR|ZEROR", "parser":"parse_cmd_common"}, {"name":"startinsert", "minlen":4, "flags":"BANG|TRLBAR|CMDWIN", "parser":"parse_cmd_common"}, {"name":"startgreplace", "minlen":6, "flags":"BANG|TRLBAR|CMDWIN", "parser":"parse_cmd_common"}, {"name":"startreplace", "minlen":6, "flags":"BANG|TRLBAR|CMDWIN", "parser":"parse_cmd_common"}, {"name":"stopinsert", "minlen":5, "flags":"BANG|TRLBAR|CMDWIN", "parser":"parse_cmd_common"}, {"name":"stjump", "minlen":3, "flags":"BANG|TRLBAR|WORD1", "parser":"parse_cmd_common"}, {"name":"stselect", "minlen":3, "flags":"BANG|TRLBAR|WORD1", "parser":"parse_cmd_common"}, {"name":"sunhide", "minlen":3, "flags":"RANGE|NOTADR|COUNT|TRLBAR", "parser":"parse_cmd_common"}, {"name":"sunmap", "minlen":4, "flags":"EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN", "parser":"parse_cmd_common"}, {"name":"sunmenu", "minlen":5, "flags":"EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN", "parser":"parse_cmd_common"}, {"name":"suspend", "minlen":3, "flags":"TRLBAR|BANG|CMDWIN", "parser":"parse_cmd_common"}, {"name":"sview", "minlen":2, "flags":"BANG|FILE1|RANGE|NOTADR|EDITCMD|ARGOPT|TRLBAR", "parser":"parse_cmd_common"}, {"name":"swapname", "minlen":2, "flags":"TRLBAR|CMDWIN", "parser":"parse_cmd_common"}, {"name":"syntax", "minlen":2, "flags":"EXTRA|NOTRLCOM|CMDWIN", "parser":"parse_cmd_syntax"}, {"name":"syntime", "minlen":5, "flags":"NEEDARG|WORD1|TRLBAR|CMDWIN", "parser":"parse_cmd_common"}, {"name":"syncbind", "minlen":4, "flags":"TRLBAR", "parser":"parse_cmd_common"}, {"name":"t", "minlen":1, "flags":"RANGE|WHOLEFOLD|EXTRA|TRLBAR|CMDWIN|MODIFY", "parser":"parse_cmd_common"}, {"name":"tNext", "minlen":2, "flags":"RANGE|NOTADR|BANG|TRLBAR|ZEROR", "parser":"parse_cmd_common"}, {"name":"tabNext", "minlen":4, "flags":"RANGE|NOTADR|COUNT|TRLBAR", "parser":"parse_cmd_common"}, {"name":"tabclose", "minlen":4, "flags":"RANGE|NOTADR|COUNT|BANG|TRLBAR|CMDWIN", "parser":"parse_cmd_common"}, {"name":"tabdo", "minlen":4, "flags":"NEEDARG|EXTRA|NOTRLCOM", "parser":"parse_cmd_common"}, {"name":"tabedit", "minlen":4, "flags":"BANG|FILE1|RANGE|NOTADR|ZEROR|EDITCMD|ARGOPT|TRLBAR", "parser":"parse_cmd_common"}, {"name":"tabfind", "minlen":4, "flags":"BANG|FILE1|RANGE|NOTADR|ZEROR|EDITCMD|ARGOPT|NEEDARG|TRLBAR", "parser":"parse_cmd_common"}, {"name":"tabfirst", "minlen":6, "flags":"TRLBAR", "parser":"parse_cmd_common"}, {"name":"tablast", "minlen":4, "flags":"TRLBAR", "parser":"parse_cmd_common"}, {"name":"tabmove", "minlen":4, "flags":"RANGE|NOTADR|ZEROR|EXTRA|NOSPC|TRLBAR", "parser":"parse_cmd_common"}, {"name":"tabnew", "minlen":6, "flags":"BANG|FILE1|RANGE|NOTADR|ZEROR|EDITCMD|ARGOPT|TRLBAR", "parser":"parse_cmd_common"}, {"name":"tabnext", "minlen":4, "flags":"RANGE|NOTADR|COUNT|TRLBAR", "parser":"parse_cmd_common"}, {"name":"tabonly", "minlen":4, "flags":"BANG|TRLBAR|CMDWIN", "parser":"parse_cmd_common"}, {"name":"tabprevious", "minlen":4, "flags":"RANGE|NOTADR|COUNT|TRLBAR", "parser":"parse_cmd_common"}, {"name":"tabrewind", "minlen":4, "flags":"TRLBAR", "parser":"parse_cmd_common"}, {"name":"tabs", "minlen":4, "flags":"TRLBAR|CMDWIN", "parser":"parse_cmd_common"}, {"name":"tab", "minlen":3, "flags":"NEEDARG|EXTRA|NOTRLCOM", "parser":"parse_cmd_common"}, {"name":"tag", "minlen":2, "flags":"RANGE|NOTADR|BANG|WORD1|TRLBAR|ZEROR", "parser":"parse_cmd_common"}, {"name":"tags", "minlen":4, "flags":"TRLBAR|CMDWIN", "parser":"parse_cmd_common"}, {"name":"tcl", "minlen":2, "flags":"RANGE|EXTRA|NEEDARG|CMDWIN", "parser":"parse_cmd_tcl"}, {"name":"tcldo", "minlen":4, "flags":"RANGE|DFLALL|EXTRA|NEEDARG|CMDWIN", "parser":"parse_cmd_common"}, {"name":"tclfile", "minlen":4, "flags":"RANGE|FILE1|NEEDARG|CMDWIN", "parser":"parse_cmd_common"}, {"name":"tearoff", "minlen":2, "flags":"NEEDARG|EXTRA|TRLBAR|NOTRLCOM|CMDWIN", "parser":"parse_cmd_common"}, {"name":"tfirst", "minlen":2, "flags":"RANGE|NOTADR|BANG|TRLBAR|ZEROR", "parser":"parse_cmd_common"}, {"name":"throw", "minlen":2, "flags":"EXTRA|NEEDARG|SBOXOK|CMDWIN", "parser":"parse_cmd_throw"}, {"name":"tjump", "minlen":2, "flags":"BANG|TRLBAR|WORD1", "parser":"parse_cmd_common"}, {"name":"tlast", "minlen":2, "flags":"BANG|TRLBAR", "parser":"parse_cmd_common"}, {"name":"tmenu", "minlen":2, "flags":"RANGE|NOTADR|ZEROR|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN", "parser":"parse_cmd_common"}, {"name":"tnext", "minlen":2, "flags":"RANGE|NOTADR|BANG|TRLBAR|ZEROR", "parser":"parse_cmd_common"}, {"name":"topleft", "minlen":2, "flags":"NEEDARG|EXTRA|NOTRLCOM", "parser":"parse_cmd_common"}, {"name":"tprevious", "minlen":2, "flags":"RANGE|NOTADR|BANG|TRLBAR|ZEROR", "parser":"parse_cmd_common"}, {"name":"trewind", "minlen":2, "flags":"RANGE|NOTADR|BANG|TRLBAR|ZEROR", "parser":"parse_cmd_common"}, {"name":"try", "minlen":3, "flags":"TRLBAR|SBOXOK|CMDWIN", "parser":"parse_cmd_try"}, {"name":"tselect", "minlen":2, "flags":"BANG|TRLBAR|WORD1", "parser":"parse_cmd_common"}, {"name":"tunmenu", "minlen":2, "flags":"EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN", "parser":"parse_cmd_common"}, {"name":"undo", "minlen":1, "flags":"RANGE|NOTADR|COUNT|ZEROR|TRLBAR|CMDWIN", "parser":"parse_cmd_common"}, {"name":"undojoin", "minlen":5, "flags":"TRLBAR|CMDWIN", "parser":"parse_cmd_common"}, {"name":"undolist", "minlen":5, "flags":"TRLBAR|CMDWIN", "parser":"parse_cmd_common"}, {"name":"unabbreviate", "minlen":3, "flags":"EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN", "parser":"parse_cmd_common"}, {"name":"unhide", "minlen":3, "flags":"RANGE|NOTADR|COUNT|TRLBAR", "parser":"parse_cmd_common"}, {"name":"unlet", "minlen":3, "flags":"BANG|EXTRA|NEEDARG|SBOXOK|CMDWIN", "parser":"parse_cmd_unlet"}, {"name":"unlockvar", "minlen":4, "flags":"BANG|EXTRA|NEEDARG|SBOXOK|CMDWIN", "parser":"parse_cmd_unlockvar"}, {"name":"unmap", "minlen":3, "flags":"BANG|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN", "parser":"parse_cmd_common"}, {"name":"unmenu", "minlen":4, "flags":"BANG|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN", "parser":"parse_cmd_common"}, {"name":"unsilent", "minlen":3, "flags":"NEEDARG|EXTRA|NOTRLCOM|SBOXOK|CMDWIN", "parser":"parse_cmd_common"}, {"name":"update", "minlen":2, "flags":"RANGE|WHOLEFOLD|BANG|FILE1|ARGOPT|DFLALL|TRLBAR", "parser":"parse_cmd_common"}, {"name":"vglobal", "minlen":1, "flags":"RANGE|WHOLEFOLD|EXTRA|DFLALL|CMDWIN", "parser":"parse_cmd_common"}, {"name":"version", "minlen":2, "flags":"EXTRA|TRLBAR|CMDWIN", "parser":"parse_cmd_common"}, {"name":"verbose", "minlen":4, "flags":"NEEDARG|RANGE|NOTADR|EXTRA|NOTRLCOM|SBOXOK|CMDWIN", "parser":"parse_cmd_common"}, {"name":"vertical", "minlen":4, "flags":"NEEDARG|EXTRA|NOTRLCOM", "parser":"parse_cmd_common"}, {"name":"vimgrep", "minlen":3, "flags":"RANGE|NOTADR|BANG|NEEDARG|EXTRA|NOTRLCOM|TRLBAR|XFILE", "parser":"parse_cmd_common"}, {"name":"vimgrepadd", "minlen":8, "flags":"RANGE|NOTADR|BANG|NEEDARG|EXTRA|NOTRLCOM|TRLBAR|XFILE", "parser":"parse_cmd_common"}, {"name":"visual", "minlen":2, "flags":"BANG|FILE1|EDITCMD|ARGOPT|TRLBAR", "parser":"parse_cmd_common"}, {"name":"viusage", "minlen":3, "flags":"TRLBAR", "parser":"parse_cmd_common"}, {"name":"view", "minlen":3, "flags":"BANG|FILE1|EDITCMD|ARGOPT|TRLBAR", "parser":"parse_cmd_common"}, {"name":"vmap", "minlen":2, "flags":"EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN", "parser":"parse_cmd_common"}, {"name":"vmapclear", "minlen":5, "flags":"EXTRA|TRLBAR|CMDWIN", "parser":"parse_cmd_common"}, {"name":"vmenu", "minlen":3, "flags":"RANGE|NOTADR|ZEROR|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN", "parser":"parse_cmd_common"}, {"name":"vnew", "minlen":3, "flags":"BANG|FILE1|RANGE|NOTADR|EDITCMD|ARGOPT|TRLBAR", "parser":"parse_cmd_common"}, {"name":"vnoremap", "minlen":2, "flags":"EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN", "parser":"parse_cmd_common"}, {"name":"vnoremenu", "minlen":7, "flags":"RANGE|NOTADR|ZEROR|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN", "parser":"parse_cmd_common"}, {"name":"vsplit", "minlen":2, "flags":"BANG|FILE1|RANGE|NOTADR|EDITCMD|ARGOPT|TRLBAR", "parser":"parse_cmd_common"}, {"name":"vunmap", "minlen":2, "flags":"EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN", "parser":"parse_cmd_common"}, {"name":"vunmenu", "minlen":5, "flags":"EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN", "parser":"parse_cmd_common"}, {"name":"windo", "minlen":5, "flags":"BANG|NEEDARG|EXTRA|NOTRLCOM", "parser":"parse_cmd_common"}, {"name":"write", "minlen":1, "flags":"RANGE|WHOLEFOLD|BANG|FILE1|ARGOPT|DFLALL|TRLBAR|CMDWIN", "parser":"parse_cmd_common"}, {"name":"wNext", "minlen":2, "flags":"RANGE|WHOLEFOLD|NOTADR|BANG|FILE1|ARGOPT|TRLBAR", "parser":"parse_cmd_common"}, {"name":"wall", "minlen":2, "flags":"BANG|TRLBAR|CMDWIN", "parser":"parse_cmd_common"}, {"name":"while", "minlen":2, "flags":"EXTRA|NOTRLCOM|SBOXOK|CMDWIN", "parser":"parse_cmd_while"}, {"name":"winsize", "minlen":2, "flags":"EXTRA|NEEDARG|TRLBAR", "parser":"parse_cmd_common"}, {"name":"wincmd", "minlen":4, "flags":"NEEDARG|WORD1|RANGE|NOTADR", "parser":"parse_wincmd"}, {"name":"winpos", "minlen":4, "flags":"EXTRA|TRLBAR|CMDWIN", "parser":"parse_cmd_common"}, {"name":"wnext", "minlen":2, "flags":"RANGE|NOTADR|BANG|FILE1|ARGOPT|TRLBAR", "parser":"parse_cmd_common"}, {"name":"wprevious", "minlen":2, "flags":"RANGE|NOTADR|BANG|FILE1|ARGOPT|TRLBAR", "parser":"parse_cmd_common"}, {"name":"wq", "minlen":2, "flags":"RANGE|WHOLEFOLD|BANG|FILE1|ARGOPT|DFLALL|TRLBAR", "parser":"parse_cmd_common"}, {"name":"wqall", "minlen":3, "flags":"BANG|FILE1|ARGOPT|DFLALL|TRLBAR", "parser":"parse_cmd_common"}, {"name":"wsverb", "minlen":2, "flags":"EXTRA|NOTADR|NEEDARG", "parser":"parse_cmd_common"}, {"name":"wundo", "minlen":2, "flags":"BANG|NEEDARG|FILE1", "parser":"parse_cmd_common"}, {"name":"wviminfo", "minlen":2, "flags":"BANG|FILE1|TRLBAR|CMDWIN", "parser":"parse_cmd_common"}, {"name":"xit", "minlen":1, "flags":"RANGE|WHOLEFOLD|BANG|FILE1|ARGOPT|DFLALL|TRLBAR|CMDWIN", "parser":"parse_cmd_common"}, {"name":"xall", "minlen":2, "flags":"BANG|TRLBAR", "parser":"parse_cmd_common"}, {"name":"xmapclear", "minlen":5, "flags":"EXTRA|TRLBAR|CMDWIN", "parser":"parse_cmd_common"}, {"name":"xmap", "minlen":2, "flags":"EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN", "parser":"parse_cmd_common"}, {"name":"xmenu", "minlen":3, "flags":"RANGE|NOTADR|ZEROR|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN", "parser":"parse_cmd_common"}, {"name":"xnoremap", "minlen":2, "flags":"EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN", "parser":"parse_cmd_common"}, {"name":"xnoremenu", "minlen":7, "flags":"RANGE|NOTADR|ZEROR|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN", "parser":"parse_cmd_common"}, {"name":"xunmap", "minlen":2, "flags":"EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN", "parser":"parse_cmd_common"}, {"name":"xunmenu", "minlen":5, "flags":"EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN", "parser":"parse_cmd_common"}, {"name":"yank", "minlen":1, "flags":"RANGE|WHOLEFOLD|REGSTR|COUNT|TRLBAR|CMDWIN", "parser":"parse_cmd_common"}, {"name":"z", "minlen":1, "flags":"RANGE|WHOLEFOLD|EXTRA|EXFLAGS|TRLBAR|CMDWIN", "parser":"parse_cmd_common"}, {"name":"!", "minlen":1, "flags":"RANGE|WHOLEFOLD|BANG|FILES|CMDWIN", "parser":"parse_cmd_common"}, {"name":"#", "minlen":1, "flags":"RANGE|WHOLEFOLD|COUNT|EXFLAGS|TRLBAR|CMDWIN", "parser":"parse_cmd_common"}, {"name":"&", "minlen":1, "flags":"RANGE|WHOLEFOLD|EXTRA|CMDWIN|MODIFY", "parser":"parse_cmd_common"}, {"name":"*", "minlen":1, "flags":"RANGE|WHOLEFOLD|EXTRA|TRLBAR|CMDWIN", "parser":"parse_cmd_common"}, {"name":"<", "minlen":1, "flags":"RANGE|WHOLEFOLD|COUNT|EXFLAGS|TRLBAR|CMDWIN|MODIFY", "parser":"parse_cmd_common"}, {"name":"=", "minlen":1, "flags":"RANGE|TRLBAR|DFLALL|EXFLAGS|CMDWIN", "parser":"parse_cmd_common"}, {"name":">", "minlen":1, "flags":"RANGE|WHOLEFOLD|COUNT|EXFLAGS|TRLBAR|CMDWIN|MODIFY", "parser":"parse_cmd_common"}, {"name":"@", "minlen":1, "flags":"RANGE|WHOLEFOLD|EXTRA|TRLBAR|CMDWIN", "parser":"parse_cmd_common"}, {"name":"Next", "minlen":1, "flags":"EXTRA|RANGE|NOTADR|COUNT|BANG|EDITCMD|ARGOPT|TRLBAR", "parser":"parse_cmd_common"}, {"name":"Print", "minlen":1, "flags":"RANGE|WHOLEFOLD|COUNT|EXFLAGS|TRLBAR|CMDWIN", "parser":"parse_cmd_common"}, {"name":"X", "minlen":1, "flags":"TRLBAR", "parser":"parse_cmd_common"}, {"name":"~", "minlen":1, "flags":"RANGE|WHOLEFOLD|EXTRA|CMDWIN|MODIFY", "parser":"parse_cmd_common"}, {"flags":"TRLBAR", "minlen":3, "name":"cbottom", "parser":"parse_cmd_common"}, {"flags":"BANG|NEEDARG|EXTRA|NOTRLCOM|RANGE|NOTADR|DFLALL", "minlen":3, "name":"cdo", "parser":"parse_cmd_common"}, {"flags":"BANG|NEEDARG|EXTRA|NOTRLCOM|RANGE|NOTADR|DFLALL", "minlen":3, "name":"cfdo", "parser":"parse_cmd_common"}, {"flags":"TRLBAR", "minlen":3, "name":"chistory", "parser":"parse_cmd_common"}, {"flags":"TRLBAR|CMDWIN", "minlen":3, "name":"clearjumps", "parser":"parse_cmd_common"}, {"flags":"BANG|NEEDARG|EXTRA|NOTRLCOM", "minlen":4, "name":"filter", "parser":"parse_cmd_common"}, {"flags":"RANGE|NOTADR|COUNT|TRLBAR", "minlen":5, "name":"helpclose", "parser":"parse_cmd_common"}, {"flags":"TRLBAR", "minlen":3, "name":"lbottom", "parser":"parse_cmd_common"}, {"flags":"BANG|NEEDARG|EXTRA|NOTRLCOM|RANGE|NOTADR|DFLALL", "minlen":2, "name":"ldo", "parser":"parse_cmd_common"}, {"flags":"BANG|NEEDARG|EXTRA|NOTRLCOM|RANGE|NOTADR|DFLALL", "minlen":3, "name":"lfdo", "parser":"parse_cmd_common"}, {"flags":"TRLBAR", "minlen":3, "name":"lhistory", "parser":"parse_cmd_common"}, {"flags":"BANG|EXTRA|TRLBAR|CMDWIN", "minlen":3, "name":"llist", "parser":"parse_cmd_common"}, {"flags":"NEEDARG|EXTRA|NOTRLCOM", "minlen":3, "name":"noswapfile", "parser":"parse_cmd_common"}, {"flags":"BANG|FILE1|NEEDARG|TRLBAR|SBOXOK|CMDWIN", "minlen":2, "name":"packadd", "parser":"parse_cmd_common"}, {"flags":"BANG|TRLBAR|SBOXOK|CMDWIN", "minlen":5, "name":"packloadall", "parser":"parse_cmd_common"}, {"flags":"TRLBAR|CMDWIN|SBOXOK", "minlen":3, "name":"smile", "parser":"parse_cmd_common"}, {"flags":"RANGE|EXTRA|NEEDARG|CMDWIN", "minlen":3, "name":"pyx", "parser":"parse_cmd_common"}, {"flags":"RANGE|DFLALL|EXTRA|NEEDARG|CMDWIN", "minlen":4, "name":"pyxdo", "parser":"parse_cmd_common"}, {"flags":"RANGE|EXTRA|NEEDARG|CMDWIN", "minlen":7, "name":"pythonx", "parser":"parse_cmd_common"}, {"flags":"RANGE|FILE1|NEEDARG|CMDWIN", "minlen":4, "name":"pyxfile", "parser":"parse_cmd_common"}, {"flags":"RANGE|BANG|FILES|CMDWIN", "minlen":3, "name":"terminal", "parser":"parse_cmd_common"}, {"flags":"EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN", "minlen":3, "name":"tmap", "parser":"parse_cmd_common"}, {"flags":"EXTRA|TRLBAR|CMDWIN", "minlen":5, "name":"tmapclear", "parser":"parse_cmd_common"}, {"flags":"EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN", "minlen":3, "name":"tnoremap", "parser":"parse_cmd_common"}, {"flags":"EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN", "minlen":5, "name":"tunmap", "parser":"parse_cmd_common"}, {"flags":"RANGE|COUNT|TRLBAR", "minlen":4, "name":"cabove", "parser":"parse_cmd_common"}, {"flags":"RANGE|COUNT|TRLBAR", "minlen":3, "name":"cafter", "parser":"parse_cmd_common"}, {"flags":"RANGE|COUNT|TRLBAR", "minlen":3, "name":"cbefore", "parser":"parse_cmd_common"}, {"flags":"RANGE|COUNT|TRLBAR", "minlen":4, "name":"cbelow", "parser":"parse_cmd_common"}, {"flags":"EXTRA|NOTRLCOM|SBOXOK|CMDWIN", "minlen":4, "name":"const", "parser":"parse_cmd_common"}, {"flags":"RANGE|COUNT|TRLBAR", "minlen":3, "name":"labove", "parser":"parse_cmd_common"}, {"flags":"RANGE|COUNT|TRLBAR", "minlen":3, "name":"lafter", "parser":"parse_cmd_common"}, {"flags":"RANGE|COUNT|TRLBAR", "minlen":3, "name":"lbefore", "parser":"parse_cmd_common"}, {"flags":"RANGE|COUNT|TRLBAR", "minlen":4, "name":"lbelow", "parser":"parse_cmd_common"}, {"flags":"TRLBAR|CMDWIN", "minlen":7, "name":"redrawtabline", "parser":"parse_cmd_common"}, {"flags":"WORD1|TRLBAR|CMDWIN", "minlen":7, "name":"scriptversion", "parser":"parse_cmd_common"}, {"flags":"BANG|FILE1|TRLBAR|CMDWIN", "minlen":2, "name":"tcd", "parser":"parse_cmd_common"}, {"flags":"BANG|FILE1|TRLBAR|CMDWIN", "minlen":3, "name":"tchdir", "parser":"parse_cmd_common"}, {"flags":"RANGE|ZEROR|EXTRA|TRLBAR|NOTRLCOM|CTRLV|CMDWIN", "minlen":3, "name":"tlmenu", "parser":"parse_cmd_common"}, {"flags":"RANGE|ZEROR|EXTRA|TRLBAR|NOTRLCOM|CTRLV|CMDWIN", "minlen":3, "name":"tlnoremenu", "parser":"parse_cmd_common"}, {"flags":"RANGE|ZEROR|EXTRA|TRLBAR|NOTRLCOM|CTRLV|CMDWIN", "minlen":3, "name":"tlunmenu", "parser":"parse_cmd_common"}, {"flags":"EXTRA|TRLBAR|CMDWIN", "minlen":2, "name":"xrestore", "parser":"parse_cmd_common"}, {"flags":"EXTRA|BANG|SBOXOK|CMDWIN", "minlen":3, "name":"def", "parser":"parse_cmd_common"}, {"flags":"EXTRA|NEEDARG|TRLBAR|CMDWIN", "minlen":4, "name":"disassemble", "parser":"parse_cmd_common"}, {"flags":"TRLBAR|CMDWIN", "minlen":4, "name":"enddef", "parser":"parse_cmd_common"}, {"flags":"EXTRA|NOTRLCOM", "minlen":3, "name":"export", "parser":"parse_cmd_common"}, {"flags":"EXTRA|NOTRLCOM", "minlen":3, "name":"import", "parser":"parse_cmd_common"}, {"flags":"BANG|RANGE|NEEDARG|EXTRA|TRLBAR", "minlen":7, "name":"spellrare", "parser":"parse_cmd_common"}, {"flags":"", "minlen":4, "name":"vim9script", "parser":"parse_cmd_common"}];
|
13162 |
|
13163 |
|
13164 | VimLParser.prototype.builtin_functions = [{"name":"abs", "min_argc":1, "max_argc":1, "argtype":"FEARG_1"}, {"name":"acos", "min_argc":1, "max_argc":1, "argtype":"FEARG_1"}, {"name":"add", "min_argc":2, "max_argc":2, "argtype":"FEARG_1"}, {"name":"and", "min_argc":2, "max_argc":2, "argtype":"FEARG_1"}, {"name":"append", "min_argc":2, "max_argc":2, "argtype":"FEARG_LAST"}, {"name":"appendbufline", "min_argc":3, "max_argc":3, "argtype":"FEARG_LAST"}, {"name":"argc", "min_argc":0, "max_argc":1, "argtype":"0"}, {"name":"argidx", "min_argc":0, "max_argc":0, "argtype":"0"}, {"name":"arglistid", "min_argc":0, "max_argc":2, "argtype":"0"}, {"name":"argv", "min_argc":0, "max_argc":2, "argtype":"0"}, {"name":"asin", "min_argc":1, "max_argc":1, "argtype":"FEARG_1"}, {"name":"assert_beeps", "min_argc":1, "max_argc":2, "argtype":"FEARG_1"}, {"name":"assert_equal", "min_argc":2, "max_argc":3, "argtype":"FEARG_2"}, {"name":"assert_equalfile", "min_argc":2, "max_argc":2, "argtype":"FEARG_1"}, {"name":"assert_exception", "min_argc":1, "max_argc":2, "argtype":"0"}, {"name":"assert_fails", "min_argc":1, "max_argc":3, "argtype":"FEARG_1"}, {"name":"assert_false", "min_argc":1, "max_argc":2, "argtype":"FEARG_1"}, {"name":"assert_inrange", "min_argc":3, "max_argc":4, "argtype":"FEARG_3"}, {"name":"assert_match", "min_argc":2, "max_argc":3, "argtype":"FEARG_2"}, {"name":"assert_notequal", "min_argc":2, "max_argc":3, "argtype":"FEARG_2"}, {"name":"assert_notmatch", "min_argc":2, "max_argc":3, "argtype":"FEARG_2"}, {"name":"assert_report", "min_argc":1, "max_argc":1, "argtype":"FEARG_1"}, {"name":"assert_true", "min_argc":1, "max_argc":2, "argtype":"FEARG_1"}, {"name":"atan", "min_argc":1, "max_argc":1, "argtype":"FEARG_1"}, {"name":"atan2", "min_argc":2, "max_argc":2, "argtype":"FEARG_1"}, {"name":"balloon_gettext", "min_argc":0, "max_argc":0, "argtype":"0"}, {"name":"balloon_show", "min_argc":1, "max_argc":1, "argtype":"FEARG_1"}, {"name":"balloon_split", "min_argc":1, "max_argc":1, "argtype":"FEARG_1"}, {"name":"browse", "min_argc":4, "max_argc":4, "argtype":"0"}, {"name":"browsedir", "min_argc":2, "max_argc":2, "argtype":"0"}, {"name":"bufadd", "min_argc":1, "max_argc":1, "argtype":"FEARG_1"}, {"name":"bufexists", "min_argc":1, "max_argc":1, "argtype":"FEARG_1"}, {"name":"buffer_exists", "min_argc":1, "max_argc":1, "argtype":"FEARG_1"}, {"name":"buffer_name", "min_argc":0, "max_argc":1, "argtype":"FEARG_1"}, {"name":"buffer_number", "min_argc":0, "max_argc":1, "argtype":"FEARG_1"}, {"name":"buflisted", "min_argc":1, "max_argc":1, "argtype":"FEARG_1"}, {"name":"bufload", "min_argc":1, "max_argc":1, "argtype":"FEARG_1"}, {"name":"bufloaded", "min_argc":1, "max_argc":1, "argtype":"FEARG_1"}, {"name":"bufname", "min_argc":0, "max_argc":1, "argtype":"FEARG_1"}, {"name":"bufnr", "min_argc":0, "max_argc":2, "argtype":"FEARG_1"}, {"name":"bufwinid", "min_argc":1, "max_argc":1, "argtype":"FEARG_1"}, {"name":"bufwinnr", "min_argc":1, "max_argc":1, "argtype":"FEARG_1"}, {"name":"byte2line", "min_argc":1, "max_argc":1, "argtype":"FEARG_1"}, {"name":"byteidx", "min_argc":2, "max_argc":2, "argtype":"FEARG_1"}, {"name":"byteidxcomp", "min_argc":2, "max_argc":2, "argtype":"FEARG_1"}, {"name":"call", "min_argc":2, "max_argc":3, "argtype":"FEARG_1"}, {"name":"ceil", "min_argc":1, "max_argc":1, "argtype":"FEARG_1"}, {"name":"ch_canread", "min_argc":1, "max_argc":1, "argtype":"FEARG_1"}, {"name":"ch_close", "min_argc":1, "max_argc":1, "argtype":"FEARG_1"}, {"name":"ch_close_in", "min_argc":1, "max_argc":1, "argtype":"FEARG_1"}, {"name":"ch_evalexpr", "min_argc":2, "max_argc":3, "argtype":"FEARG_1"}, {"name":"ch_evalraw", "min_argc":2, "max_argc":3, "argtype":"FEARG_1"}, {"name":"ch_getbufnr", "min_argc":2, "max_argc":2, "argtype":"FEARG_1"}, {"name":"ch_getjob", "min_argc":1, "max_argc":1, "argtype":"FEARG_1"}, {"name":"ch_info", "min_argc":1, "max_argc":1, "argtype":"FEARG_1"}, {"name":"ch_log", "min_argc":1, "max_argc":2, "argtype":"FEARG_1"}, {"name":"ch_logfile", "min_argc":1, "max_argc":2, "argtype":"FEARG_1"}, {"name":"ch_open", "min_argc":1, "max_argc":2, "argtype":"FEARG_1"}, {"name":"ch_read", "min_argc":1, "max_argc":2, "argtype":"FEARG_1"}, {"name":"ch_readblob", "min_argc":1, "max_argc":2, "argtype":"FEARG_1"}, {"name":"ch_readraw", "min_argc":1, "max_argc":2, "argtype":"FEARG_1"}, {"name":"ch_sendexpr", "min_argc":2, "max_argc":3, "argtype":"FEARG_1"}, {"name":"ch_sendraw", "min_argc":2, "max_argc":3, "argtype":"FEARG_1"}, {"name":"ch_setoptions", "min_argc":2, "max_argc":2, "argtype":"FEARG_1"}, {"name":"ch_status", "min_argc":1, "max_argc":2, "argtype":"FEARG_1"}, {"name":"changenr", "min_argc":0, "max_argc":0, "argtype":"0"}, {"name":"char2nr", "min_argc":1, "max_argc":2, "argtype":"FEARG_1"}, {"name":"chdir", "min_argc":1, "max_argc":1, "argtype":"FEARG_1"}, {"name":"cindent", "min_argc":1, "max_argc":1, "argtype":"FEARG_1"}, {"name":"clearmatches", "min_argc":0, "max_argc":1, "argtype":"FEARG_1"}, {"name":"col", "min_argc":1, "max_argc":1, "argtype":"FEARG_1"}, {"name":"complete", "min_argc":2, "max_argc":2, "argtype":"FEARG_2"}, {"name":"complete_add", "min_argc":1, "max_argc":1, "argtype":"FEARG_1"}, {"name":"complete_check", "min_argc":0, "max_argc":0, "argtype":"0"}, {"name":"complete_info", "min_argc":0, "max_argc":1, "argtype":"FEARG_1"}, {"name":"confirm", "min_argc":1, "max_argc":4, "argtype":"FEARG_1"}, {"name":"copy", "min_argc":1, "max_argc":1, "argtype":"FEARG_1"}, {"name":"cos", "min_argc":1, "max_argc":1, "argtype":"FEARG_1"}, {"name":"cosh", "min_argc":1, "max_argc":1, "argtype":"FEARG_1"}, {"name":"count", "min_argc":2, "max_argc":4, "argtype":"FEARG_1"}, {"name":"cscope_connection", "min_argc":0, "max_argc":3, "argtype":"0"}, {"name":"cursor", "min_argc":1, "max_argc":3, "argtype":"FEARG_1"}, {"name":"debugbreak", "min_argc":1, "max_argc":1, "argtype":"FEARG_1"}, {"name":"deepcopy", "min_argc":1, "max_argc":2, "argtype":"FEARG_1"}, {"name":"delete", "min_argc":1, "max_argc":2, "argtype":"FEARG_1"}, {"name":"deletebufline", "min_argc":2, "max_argc":3, "argtype":"FEARG_1"}, {"name":"did_filetype", "min_argc":0, "max_argc":0, "argtype":"0"}, {"name":"diff_filler", "min_argc":1, "max_argc":1, "argtype":"FEARG_1"}, {"name":"diff_hlID", "min_argc":2, "max_argc":2, "argtype":"FEARG_1"}, {"name":"echoraw", "min_argc":1, "max_argc":1, "argtype":"FEARG_1"}, {"name":"empty", "min_argc":1, "max_argc":1, "argtype":"FEARG_1"}, {"name":"environ", "min_argc":0, "max_argc":0, "argtype":"0"}, {"name":"escape", "min_argc":2, "max_argc":2, "argtype":"FEARG_1"}, {"name":"eval", "min_argc":1, "max_argc":1, "argtype":"FEARG_1"}, {"name":"eventhandler", "min_argc":0, "max_argc":0, "argtype":"0"}, {"name":"executable", "min_argc":1, "max_argc":1, "argtype":"FEARG_1"}, {"name":"execute", "min_argc":1, "max_argc":2, "argtype":"FEARG_1"}, {"name":"exepath", "min_argc":1, "max_argc":1, "argtype":"FEARG_1"}, {"name":"exists", "min_argc":1, "max_argc":1, "argtype":"FEARG_1"}, {"name":"exp", "min_argc":1, "max_argc":1, "argtype":"FEARG_1"}, {"name":"expand", "min_argc":1, "max_argc":3, "argtype":"FEARG_1"}, {"name":"expandcmd", "min_argc":1, "max_argc":1, "argtype":"FEARG_1"}, {"name":"extend", "min_argc":2, "max_argc":3, "argtype":"FEARG_1"}, {"name":"feedkeys", "min_argc":1, "max_argc":2, "argtype":"FEARG_1"}, {"name":"file_readable", "min_argc":1, "max_argc":1, "argtype":"FEARG_1"}, {"name":"filereadable", "min_argc":1, "max_argc":1, "argtype":"FEARG_1"}, {"name":"filewritable", "min_argc":1, "max_argc":1, "argtype":"FEARG_1"}, {"name":"filter", "min_argc":2, "max_argc":2, "argtype":"FEARG_1"}, {"name":"finddir", "min_argc":1, "max_argc":3, "argtype":"FEARG_1"}, {"name":"findfile", "min_argc":1, "max_argc":3, "argtype":"FEARG_1"}, {"name":"float2nr", "min_argc":1, "max_argc":1, "argtype":"FEARG_1"}, {"name":"floor", "min_argc":1, "max_argc":1, "argtype":"FEARG_1"}, {"name":"fmod", "min_argc":2, "max_argc":2, "argtype":"FEARG_1"}, {"name":"fnameescape", "min_argc":1, "max_argc":1, "argtype":"FEARG_1"}, {"name":"fnamemodify", "min_argc":2, "max_argc":2, "argtype":"FEARG_1"}, {"name":"foldclosed", "min_argc":1, "max_argc":1, "argtype":"FEARG_1"}, {"name":"foldclosedend", "min_argc":1, "max_argc":1, "argtype":"FEARG_1"}, {"name":"foldlevel", "min_argc":1, "max_argc":1, "argtype":"FEARG_1"}, {"name":"foldtext", "min_argc":0, "max_argc":0, "argtype":"0"}, {"name":"foldtextresult", "min_argc":1, "max_argc":1, "argtype":"FEARG_1"}, {"name":"foreground", "min_argc":0, "max_argc":0, "argtype":"0"}, {"name":"funcref", "min_argc":1, "max_argc":3, "argtype":"FEARG_1"}, {"name":"function", "min_argc":1, "max_argc":3, "argtype":"FEARG_1"}, {"name":"garbagecollect", "min_argc":0, "max_argc":1, "argtype":"0"}, {"name":"get", "min_argc":2, "max_argc":3, "argtype":"FEARG_1"}, {"name":"getbufinfo", "min_argc":0, "max_argc":1, "argtype":"0"}, {"name":"getbufline", "min_argc":2, "max_argc":3, "argtype":"FEARG_1"}, {"name":"getbufvar", "min_argc":2, "max_argc":3, "argtype":"FEARG_1"}, {"name":"getchangelist", "min_argc":0, "max_argc":1, "argtype":"FEARG_1"}, {"name":"getchar", "min_argc":0, "max_argc":1, "argtype":"0"}, {"name":"getcharmod", "min_argc":0, "max_argc":0, "argtype":"0"}, {"name":"getcharsearch", "min_argc":0, "max_argc":0, "argtype":"0"}, {"name":"getcmdline", "min_argc":0, "max_argc":0, "argtype":"0"}, {"name":"getcmdpos", "min_argc":0, "max_argc":0, "argtype":"0"}, {"name":"getcmdtype", "min_argc":0, "max_argc":0, "argtype":"0"}, {"name":"getcmdwintype", "min_argc":0, "max_argc":0, "argtype":"0"}, {"name":"getcompletion", "min_argc":2, "max_argc":3, "argtype":"FEARG_1"}, {"name":"getcurpos", "min_argc":0, "max_argc":0, "argtype":"0"}, {"name":"getcwd", "min_argc":0, "max_argc":2, "argtype":"FEARG_1"}, {"name":"getenv", "min_argc":1, "max_argc":1, "argtype":"FEARG_1"}, {"name":"getfontname", "min_argc":0, "max_argc":1, "argtype":"0"}, {"name":"getfperm", "min_argc":1, "max_argc":1, "argtype":"FEARG_1"}, {"name":"getfsize", "min_argc":1, "max_argc":1, "argtype":"FEARG_1"}, {"name":"getftime", "min_argc":1, "max_argc":1, "argtype":"FEARG_1"}, {"name":"getftype", "min_argc":1, "max_argc":1, "argtype":"FEARG_1"}, {"name":"getimstatus", "min_argc":0, "max_argc":0, "argtype":"0"}, {"name":"getjumplist", "min_argc":0, "max_argc":2, "argtype":"FEARG_1"}, {"name":"getline", "min_argc":1, "max_argc":2, "argtype":"FEARG_1"}, {"name":"getloclist", "min_argc":1, "max_argc":2, "argtype":"0"}, {"name":"getmatches", "min_argc":0, "max_argc":1, "argtype":"0"}, {"name":"getmousepos", "min_argc":0, "max_argc":0, "argtype":"0"}, {"name":"getpid", "min_argc":0, "max_argc":0, "argtype":"0"}, {"name":"getpos", "min_argc":1, "max_argc":1, "argtype":"FEARG_1"}, {"name":"getqflist", "min_argc":0, "max_argc":1, "argtype":"0"}, {"name":"getreg", "min_argc":0, "max_argc":3, "argtype":"FEARG_1"}, {"name":"getregtype", "min_argc":0, "max_argc":1, "argtype":"FEARG_1"}, {"name":"gettabinfo", "min_argc":0, "max_argc":1, "argtype":"FEARG_1"}, {"name":"gettabvar", "min_argc":2, "max_argc":3, "argtype":"FEARG_1"}, {"name":"gettabwinvar", "min_argc":3, "max_argc":4, "argtype":"FEARG_1"}, {"name":"gettagstack", "min_argc":0, "max_argc":1, "argtype":"FEARG_1"}, {"name":"getwininfo", "min_argc":0, "max_argc":1, "argtype":"FEARG_1"}, {"name":"getwinpos", "min_argc":0, "max_argc":1, "argtype":"FEARG_1"}, {"name":"getwinposx", "min_argc":0, "max_argc":0, "argtype":"0"}, {"name":"getwinposy", "min_argc":0, "max_argc":0, "argtype":"0"}, {"name":"getwinvar", "min_argc":2, "max_argc":3, "argtype":"FEARG_1"}, {"name":"glob", "min_argc":1, "max_argc":4, "argtype":"FEARG_1"}, {"name":"glob2regpat", "min_argc":1, "max_argc":1, "argtype":"FEARG_1"}, {"name":"globpath", "min_argc":2, "max_argc":5, "argtype":"FEARG_2"}, {"name":"has", "min_argc":1, "max_argc":1, "argtype":"0"}, {"name":"has_key", "min_argc":2, "max_argc":2, "argtype":"FEARG_1"}, {"name":"haslocaldir", "min_argc":0, "max_argc":2, "argtype":"FEARG_1"}, {"name":"hasmapto", "min_argc":1, "max_argc":3, "argtype":"FEARG_1"}, {"name":"highlightID", "min_argc":1, "max_argc":1, "argtype":"FEARG_1"}, {"name":"highlight_exists", "min_argc":1, "max_argc":1, "argtype":"FEARG_1"}, {"name":"histadd", "min_argc":2, "max_argc":2, "argtype":"FEARG_2"}, {"name":"histdel", "min_argc":1, "max_argc":2, "argtype":"FEARG_1"}, {"name":"histget", "min_argc":1, "max_argc":2, "argtype":"FEARG_1"}, {"name":"histnr", "min_argc":1, "max_argc":1, "argtype":"FEARG_1"}, {"name":"hlID", "min_argc":1, "max_argc":1, "argtype":"FEARG_1"}, {"name":"hlexists", "min_argc":1, "max_argc":1, "argtype":"FEARG_1"}, {"name":"hostname", "min_argc":0, "max_argc":0, "argtype":"0"}, {"name":"iconv", "min_argc":3, "max_argc":3, "argtype":"FEARG_1"}, {"name":"indent", "min_argc":1, "max_argc":1, "argtype":"FEARG_1"}, {"name":"index", "min_argc":2, "max_argc":4, "argtype":"FEARG_1"}, {"name":"input", "min_argc":1, "max_argc":3, "argtype":"FEARG_1"}, {"name":"inputdialog", "min_argc":1, "max_argc":3, "argtype":"FEARG_1"}, {"name":"inputlist", "min_argc":1, "max_argc":1, "argtype":"FEARG_1"}, {"name":"inputrestore", "min_argc":0, "max_argc":0, "argtype":"0"}, {"name":"inputsave", "min_argc":0, "max_argc":0, "argtype":"0"}, {"name":"inputsecret", "min_argc":1, "max_argc":2, "argtype":"FEARG_1"}, {"name":"insert", "min_argc":2, "max_argc":3, "argtype":"FEARG_1"}, {"name":"interrupt", "min_argc":0, "max_argc":0, "argtype":"0"}, {"name":"invert", "min_argc":1, "max_argc":1, "argtype":"FEARG_1"}, {"name":"isdirectory", "min_argc":1, "max_argc":1, "argtype":"FEARG_1"}, {"name":"isinf", "min_argc":1, "max_argc":1, "argtype":"FEARG_1"}, {"name":"islocked", "min_argc":1, "max_argc":1, "argtype":"FEARG_1"}, {"name":"isnan", "min_argc":1, "max_argc":1, "argtype":"FEARG_1"}, {"name":"items", "min_argc":1, "max_argc":1, "argtype":"FEARG_1"}, {"name":"job_getchannel", "min_argc":1, "max_argc":1, "argtype":"FEARG_1"}, {"name":"job_info", "min_argc":0, "max_argc":1, "argtype":"FEARG_1"}, {"name":"job_setoptions", "min_argc":2, "max_argc":2, "argtype":"FEARG_1"}, {"name":"job_start", "min_argc":1, "max_argc":2, "argtype":"FEARG_1"}, {"name":"job_status", "min_argc":1, "max_argc":1, "argtype":"FEARG_1"}, {"name":"job_stop", "min_argc":1, "max_argc":2, "argtype":"FEARG_1"}, {"name":"join", "min_argc":1, "max_argc":2, "argtype":"FEARG_1"}, {"name":"js_decode", "min_argc":1, "max_argc":1, "argtype":"FEARG_1"}, {"name":"js_encode", "min_argc":1, "max_argc":1, "argtype":"FEARG_1"}, {"name":"json_decode", "min_argc":1, "max_argc":1, "argtype":"FEARG_1"}, {"name":"json_encode", "min_argc":1, "max_argc":1, "argtype":"FEARG_1"}, {"name":"keys", "min_argc":1, "max_argc":1, "argtype":"FEARG_1"}, {"name":"last_buffer_nr", "min_argc":0, "max_argc":0, "argtype":"0"}, {"name":"len", "min_argc":1, "max_argc":1, "argtype":"FEARG_1"}, {"name":"libcall", "min_argc":3, "max_argc":3, "argtype":"FEARG_3"}, {"name":"libcallnr", "min_argc":3, "max_argc":3, "argtype":"FEARG_3"}, {"name":"line", "min_argc":1, "max_argc":2, "argtype":"FEARG_1"}, {"name":"line2byte", "min_argc":1, "max_argc":1, "argtype":"FEARG_1"}, {"name":"lispindent", "min_argc":1, "max_argc":1, "argtype":"FEARG_1"}, {"name":"list2str", "min_argc":1, "max_argc":2, "argtype":"FEARG_1"}, {"name":"listener_add", "min_argc":1, "max_argc":2, "argtype":"FEARG_2"}, {"name":"listener_flush", "min_argc":0, "max_argc":1, "argtype":"FEARG_1"}, {"name":"listener_remove", "min_argc":1, "max_argc":1, "argtype":"FEARG_1"}, {"name":"localtime", "min_argc":0, "max_argc":0, "argtype":"0"}, {"name":"log", "min_argc":1, "max_argc":1, "argtype":"FEARG_1"}, {"name":"log10", "min_argc":1, "max_argc":1, "argtype":"FEARG_1"}, {"name":"luaeval", "min_argc":1, "max_argc":2, "argtype":"FEARG_1"}, {"name":"map", "min_argc":2, "max_argc":2, "argtype":"FEARG_1"}, {"name":"maparg", "min_argc":1, "max_argc":4, "argtype":"FEARG_1"}, {"name":"mapcheck", "min_argc":1, "max_argc":3, "argtype":"FEARG_1"}, {"name":"match", "min_argc":2, "max_argc":4, "argtype":"FEARG_1"}, {"name":"matchadd", "min_argc":2, "max_argc":5, "argtype":"FEARG_1"}, {"name":"matchaddpos", "min_argc":2, "max_argc":5, "argtype":"FEARG_1"}, {"name":"matcharg", "min_argc":1, "max_argc":1, "argtype":"FEARG_1"}, {"name":"matchdelete", "min_argc":1, "max_argc":2, "argtype":"FEARG_1"}, {"name":"matchend", "min_argc":2, "max_argc":4, "argtype":"FEARG_1"}, {"name":"matchlist", "min_argc":2, "max_argc":4, "argtype":"FEARG_1"}, {"name":"matchstr", "min_argc":2, "max_argc":4, "argtype":"FEARG_1"}, {"name":"matchstrpos", "min_argc":2, "max_argc":4, "argtype":"FEARG_1"}, {"name":"max", "min_argc":1, "max_argc":1, "argtype":"FEARG_1"}, {"name":"min", "min_argc":1, "max_argc":1, "argtype":"FEARG_1"}, {"name":"mkdir", "min_argc":1, "max_argc":3, "argtype":"FEARG_1"}, {"name":"mode", "min_argc":0, "max_argc":1, "argtype":"FEARG_1"}, {"name":"mzeval", "min_argc":1, "max_argc":1, "argtype":"FEARG_1"}, {"name":"nextnonblank", "min_argc":1, "max_argc":1, "argtype":"FEARG_1"}, {"name":"nr2char", "min_argc":1, "max_argc":2, "argtype":"FEARG_1"}, {"name":"or", "min_argc":2, "max_argc":2, "argtype":"FEARG_1"}, {"name":"pathshorten", "min_argc":1, "max_argc":1, "argtype":"FEARG_1"}, {"name":"perleval", "min_argc":1, "max_argc":1, "argtype":"FEARG_1"}, {"name":"popup_atcursor", "min_argc":2, "max_argc":2, "argtype":"FEARG_1"}, {"name":"popup_beval", "min_argc":2, "max_argc":2, "argtype":"FEARG_1"}, {"name":"popup_clear", "min_argc":0, "max_argc":0, "argtype":"0"}, {"name":"popup_close", "min_argc":1, "max_argc":2, "argtype":"FEARG_1"}, {"name":"popup_create", "min_argc":2, "max_argc":2, "argtype":"FEARG_1"}, {"name":"popup_dialog", "min_argc":2, "max_argc":2, "argtype":"FEARG_1"}, {"name":"popup_filter_menu", "min_argc":2, "max_argc":2, "argtype":"0"}, {"name":"popup_filter_yesno", "min_argc":2, "max_argc":2, "argtype":"0"}, {"name":"popup_findinfo", "min_argc":0, "max_argc":0, "argtype":"0"}, {"name":"popup_findpreview", "min_argc":0, "max_argc":0, "argtype":"0"}, {"name":"popup_getoptions", "min_argc":1, "max_argc":1, "argtype":"FEARG_1"}, {"name":"popup_getpos", "min_argc":1, "max_argc":1, "argtype":"FEARG_1"}, {"name":"popup_hide", "min_argc":1, "max_argc":1, "argtype":"FEARG_1"}, {"name":"popup_locate", "min_argc":2, "max_argc":2, "argtype":"0"}, {"name":"popup_menu", "min_argc":2, "max_argc":2, "argtype":"FEARG_1"}, {"name":"popup_move", "min_argc":2, "max_argc":2, "argtype":"FEARG_1"}, {"name":"popup_notification", "min_argc":2, "max_argc":2, "argtype":"FEARG_1"}, {"name":"popup_setoptions", "min_argc":2, "max_argc":2, "argtype":"FEARG_1"}, {"name":"popup_settext", "min_argc":2, "max_argc":2, "argtype":"FEARG_1"}, {"name":"popup_show", "min_argc":1, "max_argc":1, "argtype":"FEARG_1"}, {"name":"pow", "min_argc":2, "max_argc":2, "argtype":"FEARG_1"}, {"name":"prevnonblank", "min_argc":1, "max_argc":1, "argtype":"FEARG_1"}, {"name":"printf", "min_argc":1, "max_argc":19, "argtype":"FEARG_2"}, {"name":"prompt_setcallback", "min_argc":2, "max_argc":2, "argtype":"FEARG_1"}, {"name":"prompt_setinterrupt", "min_argc":2, "max_argc":2, "argtype":"FEARG_1"}, {"name":"prompt_setprompt", "min_argc":2, "max_argc":2, "argtype":"FEARG_1"}, {"name":"prop_add", "min_argc":3, "max_argc":3, "argtype":"FEARG_1"}, {"name":"prop_clear", "min_argc":1, "max_argc":3, "argtype":"FEARG_1"}, {"name":"prop_find", "min_argc":1, "max_argc":2, "argtype":"FEARG_1"}, {"name":"prop_list", "min_argc":1, "max_argc":2, "argtype":"FEARG_1"}, {"name":"prop_remove", "min_argc":1, "max_argc":3, "argtype":"FEARG_1"}, {"name":"prop_type_add", "min_argc":2, "max_argc":2, "argtype":"FEARG_1"}, {"name":"prop_type_change", "min_argc":2, "max_argc":2, "argtype":"FEARG_1"}, {"name":"prop_type_delete", "min_argc":1, "max_argc":2, "argtype":"FEARG_1"}, {"name":"prop_type_get", "min_argc":1, "max_argc":2, "argtype":"FEARG_1"}, {"name":"prop_type_list", "min_argc":0, "max_argc":1, "argtype":"FEARG_1"}, {"name":"pum_getpos", "min_argc":0, "max_argc":0, "argtype":"0"}, {"name":"pumvisible", "min_argc":0, "max_argc":0, "argtype":"0"}, {"name":"py3eval", "min_argc":1, "max_argc":1, "argtype":"FEARG_1"}, {"name":"pyeval", "min_argc":1, "max_argc":1, "argtype":"FEARG_1"}, {"name":"pyxeval", "min_argc":1, "max_argc":1, "argtype":"FEARG_1"}, {"name":"rand", "min_argc":0, "max_argc":1, "argtype":"FEARG_1"}, {"name":"range", "min_argc":1, "max_argc":3, "argtype":"FEARG_1"}, {"name":"readdir", "min_argc":1, "max_argc":2, "argtype":"FEARG_1"}, {"name":"readfile", "min_argc":1, "max_argc":3, "argtype":"FEARG_1"}, {"name":"reg_executing", "min_argc":0, "max_argc":0, "argtype":"0"}, {"name":"reg_recording", "min_argc":0, "max_argc":0, "argtype":"0"}, {"name":"reltime", "min_argc":0, "max_argc":2, "argtype":"FEARG_1"}, {"name":"reltimefloat", "min_argc":1, "max_argc":1, "argtype":"FEARG_1"}, {"name":"reltimestr", "min_argc":1, "max_argc":1, "argtype":"FEARG_1"}, {"name":"remote_expr", "min_argc":2, "max_argc":4, "argtype":"FEARG_1"}, {"name":"remote_foreground", "min_argc":1, "max_argc":1, "argtype":"FEARG_1"}, {"name":"remote_peek", "min_argc":1, "max_argc":2, "argtype":"FEARG_1"}, {"name":"remote_read", "min_argc":1, "max_argc":2, "argtype":"FEARG_1"}, {"name":"remote_send", "min_argc":2, "max_argc":3, "argtype":"FEARG_1"}, {"name":"remote_startserver", "min_argc":1, "max_argc":1, "argtype":"FEARG_1"}, {"name":"remove", "min_argc":2, "max_argc":3, "argtype":"FEARG_1"}, {"name":"rename", "min_argc":2, "max_argc":2, "argtype":"FEARG_1"}, {"name":"repeat", "min_argc":2, "max_argc":2, "argtype":"FEARG_1"}, {"name":"resolve", "min_argc":1, "max_argc":1, "argtype":"FEARG_1"}, {"name":"reverse", "min_argc":1, "max_argc":1, "argtype":"FEARG_1"}, {"name":"round", "min_argc":1, "max_argc":1, "argtype":"FEARG_1"}, {"name":"rubyeval", "min_argc":1, "max_argc":1, "argtype":"FEARG_1"}, {"name":"screenattr", "min_argc":2, "max_argc":2, "argtype":"FEARG_1"}, {"name":"screenchar", "min_argc":2, "max_argc":2, "argtype":"FEARG_1"}, {"name":"screenchars", "min_argc":2, "max_argc":2, "argtype":"FEARG_1"}, {"name":"screencol", "min_argc":0, "max_argc":0, "argtype":"0"}, {"name":"screenpos", "min_argc":3, "max_argc":3, "argtype":"FEARG_1"}, {"name":"screenrow", "min_argc":0, "max_argc":0, "argtype":"0"}, {"name":"screenstring", "min_argc":2, "max_argc":2, "argtype":"FEARG_1"}, {"name":"search", "min_argc":1, "max_argc":4, "argtype":"FEARG_1"}, {"name":"searchdecl", "min_argc":1, "max_argc":3, "argtype":"FEARG_1"}, {"name":"searchpair", "min_argc":3, "max_argc":7, "argtype":"0"}, {"name":"searchpairpos", "min_argc":3, "max_argc":7, "argtype":"0"}, {"name":"searchpos", "min_argc":1, "max_argc":4, "argtype":"FEARG_1"}, {"name":"server2client", "min_argc":2, "max_argc":2, "argtype":"FEARG_1"}, {"name":"serverlist", "min_argc":0, "max_argc":0, "argtype":"0"}, {"name":"setbufline", "min_argc":3, "max_argc":3, "argtype":"FEARG_3"}, {"name":"setbufvar", "min_argc":3, "max_argc":3, "argtype":"FEARG_3"}, {"name":"setcharsearch", "min_argc":1, "max_argc":1, "argtype":"FEARG_1"}, {"name":"setcmdpos", "min_argc":1, "max_argc":1, "argtype":"FEARG_1"}, {"name":"setenv", "min_argc":2, "max_argc":2, "argtype":"FEARG_2"}, {"name":"setfperm", "min_argc":2, "max_argc":2, "argtype":"FEARG_1"}, {"name":"setline", "min_argc":2, "max_argc":2, "argtype":"FEARG_2"}, {"name":"setloclist", "min_argc":2, "max_argc":4, "argtype":"FEARG_2"}, {"name":"setmatches", "min_argc":1, "max_argc":2, "argtype":"FEARG_1"}, {"name":"setpos", "min_argc":2, "max_argc":2, "argtype":"FEARG_2"}, {"name":"setqflist", "min_argc":1, "max_argc":3, "argtype":"FEARG_1"}, {"name":"setreg", "min_argc":2, "max_argc":3, "argtype":"FEARG_2"}, {"name":"settabvar", "min_argc":3, "max_argc":3, "argtype":"FEARG_3"}, {"name":"settabwinvar", "min_argc":4, "max_argc":4, "argtype":"FEARG_4"}, {"name":"settagstack", "min_argc":2, "max_argc":3, "argtype":"FEARG_2"}, {"name":"setwinvar", "min_argc":3, "max_argc":3, "argtype":"FEARG_3"}, {"name":"sha256", "min_argc":1, "max_argc":1, "argtype":"FEARG_1"}, {"name":"shellescape", "min_argc":1, "max_argc":2, "argtype":"FEARG_1"}, {"name":"shiftwidth", "min_argc":0, "max_argc":1, "argtype":"FEARG_1"}, {"name":"sign_define", "min_argc":1, "max_argc":2, "argtype":"FEARG_1"}, {"name":"sign_getdefined", "min_argc":0, "max_argc":1, "argtype":"FEARG_1"}, {"name":"sign_getplaced", "min_argc":0, "max_argc":2, "argtype":"FEARG_1"}, {"name":"sign_jump", "min_argc":3, "max_argc":3, "argtype":"FEARG_1"}, {"name":"sign_place", "min_argc":4, "max_argc":5, "argtype":"FEARG_1"}, {"name":"sign_placelist", "min_argc":1, "max_argc":1, "argtype":"FEARG_1"}, {"name":"sign_undefine", "min_argc":0, "max_argc":1, "argtype":"FEARG_1"}, {"name":"sign_unplace", "min_argc":1, "max_argc":2, "argtype":"FEARG_1"}, {"name":"sign_unplacelist", "min_argc":1, "max_argc":2, "argtype":"FEARG_1"}, {"name":"simplify", "min_argc":1, "max_argc":1, "argtype":"0"}, {"name":"sin", "min_argc":1, "max_argc":1, "argtype":"FEARG_1"}, {"name":"sinh", "min_argc":1, "max_argc":1, "argtype":"FEARG_1"}, {"name":"sort", "min_argc":1, "max_argc":3, "argtype":"FEARG_1"}, {"name":"sound_clear", "min_argc":0, "max_argc":0, "argtype":"0"}, {"name":"sound_playevent", "min_argc":1, "max_argc":2, "argtype":"FEARG_1"}, {"name":"sound_playfile", "min_argc":1, "max_argc":2, "argtype":"FEARG_1"}, {"name":"sound_stop", "min_argc":1, "max_argc":1, "argtype":"FEARG_1"}, {"name":"soundfold", "min_argc":1, "max_argc":1, "argtype":"FEARG_1"}, {"name":"spellbadword", "min_argc":0, "max_argc":1, "argtype":"FEARG_1"}, {"name":"spellsuggest", "min_argc":1, "max_argc":3, "argtype":"FEARG_1"}, {"name":"split", "min_argc":1, "max_argc":3, "argtype":"FEARG_1"}, {"name":"sqrt", "min_argc":1, "max_argc":1, "argtype":"FEARG_1"}, {"name":"srand", "min_argc":0, "max_argc":1, "argtype":"FEARG_1"}, {"name":"state", "min_argc":0, "max_argc":1, "argtype":"FEARG_1"}, {"name":"str2float", "min_argc":1, "max_argc":1, "argtype":"FEARG_1"}, {"name":"str2list", "min_argc":1, "max_argc":2, "argtype":"FEARG_1"}, {"name":"str2nr", "min_argc":1, "max_argc":3, "argtype":"FEARG_1"}, {"name":"strcharpart", "min_argc":2, "max_argc":3, "argtype":"FEARG_1"}, {"name":"strchars", "min_argc":1, "max_argc":2, "argtype":"FEARG_1"}, {"name":"strdisplaywidth", "min_argc":1, "max_argc":2, "argtype":"FEARG_1"}, {"name":"strftime", "min_argc":1, "max_argc":2, "argtype":"FEARG_1"}, {"name":"strgetchar", "min_argc":2, "max_argc":2, "argtype":"FEARG_1"}, {"name":"stridx", "min_argc":2, "max_argc":3, "argtype":"FEARG_1"}, {"name":"string", "min_argc":1, "max_argc":1, "argtype":"FEARG_1"}, {"name":"strlen", "min_argc":1, "max_argc":1, "argtype":"FEARG_1"}, {"name":"strpart", "min_argc":2, "max_argc":3, "argtype":"FEARG_1"}, {"name":"strptime", "min_argc":2, "max_argc":2, "argtype":"FEARG_1"}, {"name":"strridx", "min_argc":2, "max_argc":3, "argtype":"FEARG_1"}, {"name":"strtrans", "min_argc":1, "max_argc":1, "argtype":"FEARG_1"}, {"name":"strwidth", "min_argc":1, "max_argc":1, "argtype":"FEARG_1"}, {"name":"submatch", "min_argc":1, "max_argc":2, "argtype":"FEARG_1"}, {"name":"substitute", "min_argc":4, "max_argc":4, "argtype":"FEARG_1"}, {"name":"swapinfo", "min_argc":1, "max_argc":1, "argtype":"FEARG_1"}, {"name":"swapname", "min_argc":1, "max_argc":1, "argtype":"FEARG_1"}, {"name":"synID", "min_argc":3, "max_argc":3, "argtype":"0"}, {"name":"synIDattr", "min_argc":2, "max_argc":3, "argtype":"FEARG_1"}, {"name":"synIDtrans", "min_argc":1, "max_argc":1, "argtype":"FEARG_1"}, {"name":"synconcealed", "min_argc":2, "max_argc":2, "argtype":"0"}, {"name":"synstack", "min_argc":2, "max_argc":2, "argtype":"0"}, {"name":"system", "min_argc":1, "max_argc":2, "argtype":"FEARG_1"}, {"name":"systemlist", "min_argc":1, "max_argc":2, "argtype":"FEARG_1"}, {"name":"tabpagebuflist", "min_argc":0, "max_argc":1, "argtype":"FEARG_1"}, {"name":"tabpagenr", "min_argc":0, "max_argc":1, "argtype":"0"}, {"name":"tabpagewinnr", "min_argc":1, "max_argc":2, "argtype":"FEARG_1"}, {"name":"tagfiles", "min_argc":0, "max_argc":0, "argtype":"0"}, {"name":"taglist", "min_argc":1, "max_argc":2, "argtype":"FEARG_1"}, {"name":"tan", "min_argc":1, "max_argc":1, "argtype":"FEARG_1"}, {"name":"tanh", "min_argc":1, "max_argc":1, "argtype":"FEARG_1"}, {"name":"tempname", "min_argc":0, "max_argc":0, "argtype":"0"}, {"name":"term_dumpdiff", "min_argc":2, "max_argc":3, "argtype":"FEARG_1"}, {"name":"term_dumpload", "min_argc":1, "max_argc":2, "argtype":"FEARG_1"}, {"name":"term_dumpwrite", "min_argc":2, "max_argc":3, "argtype":"FEARG_2"}, {"name":"term_getaltscreen", "min_argc":1, "max_argc":1, "argtype":"FEARG_1"}, {"name":"term_getansicolors", "min_argc":1, "max_argc":1, "argtype":"FEARG_1"}, {"name":"term_getattr", "min_argc":2, "max_argc":2, "argtype":"FEARG_1"}, {"name":"term_getcursor", "min_argc":1, "max_argc":1, "argtype":"FEARG_1"}, {"name":"term_getjob", "min_argc":1, "max_argc":1, "argtype":"FEARG_1"}, {"name":"term_getline", "min_argc":2, "max_argc":2, "argtype":"FEARG_1"}, {"name":"term_getscrolled", "min_argc":1, "max_argc":1, "argtype":"FEARG_1"}, {"name":"term_getsize", "min_argc":1, "max_argc":1, "argtype":"FEARG_1"}, {"name":"term_getstatus", "min_argc":1, "max_argc":1, "argtype":"FEARG_1"}, {"name":"term_gettitle", "min_argc":1, "max_argc":1, "argtype":"FEARG_1"}, {"name":"term_gettty", "min_argc":1, "max_argc":2, "argtype":"FEARG_1"}, {"name":"term_list", "min_argc":0, "max_argc":0, "argtype":"0"}, {"name":"term_scrape", "min_argc":2, "max_argc":2, "argtype":"FEARG_1"}, {"name":"term_sendkeys", "min_argc":2, "max_argc":2, "argtype":"FEARG_1"}, {"name":"term_setansicolors", "min_argc":2, "max_argc":2, "argtype":"FEARG_1"}, {"name":"term_setapi", "min_argc":2, "max_argc":2, "argtype":"FEARG_1"}, {"name":"term_setkill", "min_argc":2, "max_argc":2, "argtype":"FEARG_1"}, {"name":"term_setrestore", "min_argc":2, "max_argc":2, "argtype":"FEARG_1"}, {"name":"term_setsize", "min_argc":3, "max_argc":3, "argtype":"FEARG_1"}, {"name":"term_start", "min_argc":1, "max_argc":2, "argtype":"FEARG_1"}, {"name":"term_wait", "min_argc":1, "max_argc":2, "argtype":"FEARG_1"}, {"name":"test_alloc_fail", "min_argc":3, "max_argc":3, "argtype":"FEARG_1"}, {"name":"test_autochdir", "min_argc":0, "max_argc":0, "argtype":"0"}, {"name":"test_feedinput", "min_argc":1, "max_argc":1, "argtype":"FEARG_1"}, {"name":"test_garbagecollect_now", "min_argc":0, "max_argc":0, "argtype":"0"}, {"name":"test_garbagecollect_soon", "min_argc":0, "max_argc":0, "argtype":"0"}, {"name":"test_getvalue", "min_argc":1, "max_argc":1, "argtype":"FEARG_1"}, {"name":"test_ignore_error", "min_argc":1, "max_argc":1, "argtype":"FEARG_1"}, {"name":"test_null_blob", "min_argc":0, "max_argc":0, "argtype":"0"}, {"name":"test_null_channel", "min_argc":0, "max_argc":0, "argtype":"0"}, {"name":"test_null_dict", "min_argc":0, "max_argc":0, "argtype":"0"}, {"name":"test_null_job", "min_argc":0, "max_argc":0, "argtype":"0"}, {"name":"test_null_list", "min_argc":0, "max_argc":0, "argtype":"0"}, {"name":"test_null_partial", "min_argc":0, "max_argc":0, "argtype":"0"}, {"name":"test_null_string", "min_argc":0, "max_argc":0, "argtype":"0"}, {"name":"test_option_not_set", "min_argc":1, "max_argc":1, "argtype":"FEARG_1"}, {"name":"test_override", "min_argc":2, "max_argc":2, "argtype":"FEARG_2"}, {"name":"test_refcount", "min_argc":1, "max_argc":1, "argtype":"FEARG_1"}, {"name":"test_scrollbar", "min_argc":3, "max_argc":3, "argtype":"FEARG_2"}, {"name":"test_setmouse", "min_argc":2, "max_argc":2, "argtype":"0"}, {"name":"test_settime", "min_argc":1, "max_argc":1, "argtype":"FEARG_1"}, {"name":"test_srand_seed", "min_argc":0, "max_argc":1, "argtype":"FEARG_1"}, {"name":"test_unknown", "min_argc":0, "max_argc":0, "argtype":"0"}, {"name":"test_void", "min_argc":0, "max_argc":0, "argtype":"0"}, {"name":"timer_info", "min_argc":0, "max_argc":1, "argtype":"FEARG_1"}, {"name":"timer_pause", "min_argc":2, "max_argc":2, "argtype":"FEARG_1"}, {"name":"timer_start", "min_argc":2, "max_argc":3, "argtype":"FEARG_1"}, {"name":"timer_stop", "min_argc":1, "max_argc":1, "argtype":"FEARG_1"}, {"name":"timer_stopall", "min_argc":0, "max_argc":0, "argtype":"0"}, {"name":"tolower", "min_argc":1, "max_argc":1, "argtype":"FEARG_1"}, {"name":"toupper", "min_argc":1, "max_argc":1, "argtype":"FEARG_1"}, {"name":"tr", "min_argc":3, "max_argc":3, "argtype":"FEARG_1"}, {"name":"trim", "min_argc":1, "max_argc":2, "argtype":"FEARG_1"}, {"name":"trunc", "min_argc":1, "max_argc":1, "argtype":"FEARG_1"}, {"name":"type", "min_argc":1, "max_argc":1, "argtype":"FEARG_1"}, {"name":"undofile", "min_argc":1, "max_argc":1, "argtype":"FEARG_1"}, {"name":"undotree", "min_argc":0, "max_argc":0, "argtype":"0"}, {"name":"uniq", "min_argc":1, "max_argc":3, "argtype":"FEARG_1"}, {"name":"values", "min_argc":1, "max_argc":1, "argtype":"FEARG_1"}, {"name":"virtcol", "min_argc":1, "max_argc":1, "argtype":"FEARG_1"}, {"name":"visualmode", "min_argc":0, "max_argc":1, "argtype":"0"}, {"name":"wildmenumode", "min_argc":0, "max_argc":0, "argtype":"0"}, {"name":"win_execute", "min_argc":2, "max_argc":3, "argtype":"FEARG_2"}, {"name":"win_findbuf", "min_argc":1, "max_argc":1, "argtype":"FEARG_1"}, {"name":"win_getid", "min_argc":0, "max_argc":2, "argtype":"FEARG_1"}, {"name":"win_gettype", "min_argc":0, "max_argc":1, "argtype":"FEARG_1"}, {"name":"win_gotoid", "min_argc":1, "max_argc":1, "argtype":"FEARG_1"}, {"name":"win_id2tabwin", "min_argc":1, "max_argc":1, "argtype":"FEARG_1"}, {"name":"win_id2win", "min_argc":1, "max_argc":1, "argtype":"FEARG_1"}, {"name":"win_screenpos", "min_argc":1, "max_argc":1, "argtype":"FEARG_1"}, {"name":"win_splitmove", "min_argc":2, "max_argc":3, "argtype":"FEARG_1"}, {"name":"winbufnr", "min_argc":1, "max_argc":1, "argtype":"FEARG_1"}, {"name":"wincol", "min_argc":0, "max_argc":0, "argtype":"0"}, {"name":"windowsversion", "min_argc":0, "max_argc":0, "argtype":"0"}, {"name":"winheight", "min_argc":1, "max_argc":1, "argtype":"FEARG_1"}, {"name":"winlayout", "min_argc":0, "max_argc":1, "argtype":"FEARG_1"}, {"name":"winline", "min_argc":0, "max_argc":0, "argtype":"0"}, {"name":"winnr", "min_argc":0, "max_argc":1, "argtype":"FEARG_1"}, {"name":"winrestcmd", "min_argc":0, "max_argc":0, "argtype":"0"}, {"name":"winrestview", "min_argc":1, "max_argc":1, "argtype":"FEARG_1"}, {"name":"winsaveview", "min_argc":0, "max_argc":0, "argtype":"0"}, {"name":"winwidth", "min_argc":1, "max_argc":1, "argtype":"FEARG_1"}, {"name":"wordcount", "min_argc":0, "max_argc":0, "argtype":"0"}, {"name":"writefile", "min_argc":2, "max_argc":3, "argtype":"FEARG_1"}, {"name":"xor", "min_argc":2, "max_argc":2, "argtype":"FEARG_1"}];
|
13165 | function ExprTokenizer() { this.__init__.apply(this, arguments); }
|
13166 | ExprTokenizer.prototype.__init__ = function(reader) {
|
13167 | this.reader = reader;
|
13168 | this.cache = {};
|
13169 | }
|
13170 |
|
13171 | ExprTokenizer.prototype.token = function(type, value, pos) {
|
13172 | return {"type":type, "value":value, "pos":pos};
|
13173 | }
|
13174 |
|
13175 | ExprTokenizer.prototype.peek = function() {
|
13176 | var pos = this.reader.tell();
|
13177 | var r = this.get();
|
13178 | this.reader.seek_set(pos);
|
13179 | return r;
|
13180 | }
|
13181 |
|
13182 | ExprTokenizer.prototype.get = function() {
|
13183 |
|
13184 | if (viml_has_key(this.cache, this.reader.tell())) {
|
13185 | var x = this.cache[this.reader.tell()];
|
13186 | this.reader.seek_set(x[0]);
|
13187 | return x[1];
|
13188 | }
|
13189 | var pos = this.reader.tell();
|
13190 | this.reader.skip_white();
|
13191 | var r = this.get2();
|
13192 | this.cache[pos] = [this.reader.tell(), r];
|
13193 | return r;
|
13194 | }
|
13195 |
|
13196 | ExprTokenizer.prototype.get2 = function() {
|
13197 | var r = this.reader;
|
13198 | var pos = r.getpos();
|
13199 | var c = r.peek();
|
13200 | if (c == "<EOF>") {
|
13201 | return this.token(TOKEN_EOF, c, pos);
|
13202 | }
|
13203 | else if (c == "<EOL>") {
|
13204 | r.seek_cur(1);
|
13205 | return this.token(TOKEN_EOL, c, pos);
|
13206 | }
|
13207 | else if (iswhite(c)) {
|
13208 | var s = r.read_white();
|
13209 | return this.token(TOKEN_SPACE, s, pos);
|
13210 | }
|
13211 | else if (c == "0" && (r.p(1) == "X" || r.p(1) == "x") && isxdigit(r.p(2))) {
|
13212 | var s = r.getn(3);
|
13213 | s += r.read_xdigit();
|
13214 | return this.token(TOKEN_NUMBER, s, pos);
|
13215 | }
|
13216 | else if (c == "0" && (r.p(1) == "B" || r.p(1) == "b") && (r.p(2) == "0" || r.p(2) == "1")) {
|
13217 | var s = r.getn(3);
|
13218 | s += r.read_bdigit();
|
13219 | return this.token(TOKEN_NUMBER, s, pos);
|
13220 | }
|
13221 | else if (c == "0" && (r.p(1) == "Z" || r.p(1) == "z") && r.p(2) != ".") {
|
13222 | var s = r.getn(2);
|
13223 | s += r.read_blob();
|
13224 | return this.token(TOKEN_BLOB, s, pos);
|
13225 | }
|
13226 | else if (isdigit(c)) {
|
13227 | var s = r.read_digit();
|
13228 | if (r.p(0) == "." && isdigit(r.p(1))) {
|
13229 | s += r.getn(1);
|
13230 | s += r.read_digit();
|
13231 | if ((r.p(0) == "E" || r.p(0) == "e") && (isdigit(r.p(1)) || (r.p(1) == "-" || r.p(1) == "+") && isdigit(r.p(2)))) {
|
13232 | s += r.getn(2);
|
13233 | s += r.read_digit();
|
13234 | }
|
13235 | }
|
13236 | return this.token(TOKEN_NUMBER, s, pos);
|
13237 | }
|
13238 | else if (c == "i" && r.p(1) == "s" && !isidc(r.p(2))) {
|
13239 | if (r.p(2) == "?") {
|
13240 | r.seek_cur(3);
|
13241 | return this.token(TOKEN_ISCI, "is?", pos);
|
13242 | }
|
13243 | else if (r.p(2) == "#") {
|
13244 | r.seek_cur(3);
|
13245 | return this.token(TOKEN_ISCS, "is#", pos);
|
13246 | }
|
13247 | else {
|
13248 | r.seek_cur(2);
|
13249 | return this.token(TOKEN_IS, "is", pos);
|
13250 | }
|
13251 | }
|
13252 | else if (c == "i" && r.p(1) == "s" && r.p(2) == "n" && r.p(3) == "o" && r.p(4) == "t" && !isidc(r.p(5))) {
|
13253 | if (r.p(5) == "?") {
|
13254 | r.seek_cur(6);
|
13255 | return this.token(TOKEN_ISNOTCI, "isnot?", pos);
|
13256 | }
|
13257 | else if (r.p(5) == "#") {
|
13258 | r.seek_cur(6);
|
13259 | return this.token(TOKEN_ISNOTCS, "isnot#", pos);
|
13260 | }
|
13261 | else {
|
13262 | r.seek_cur(5);
|
13263 | return this.token(TOKEN_ISNOT, "isnot", pos);
|
13264 | }
|
13265 | }
|
13266 | else if (isnamec1(c)) {
|
13267 | var s = r.read_name();
|
13268 | return this.token(TOKEN_IDENTIFIER, s, pos);
|
13269 | }
|
13270 | else if (c == "|" && r.p(1) == "|") {
|
13271 | r.seek_cur(2);
|
13272 | return this.token(TOKEN_OROR, "||", pos);
|
13273 | }
|
13274 | else if (c == "&" && r.p(1) == "&") {
|
13275 | r.seek_cur(2);
|
13276 | return this.token(TOKEN_ANDAND, "&&", pos);
|
13277 | }
|
13278 | else if (c == "=" && r.p(1) == "=") {
|
13279 | if (r.p(2) == "?") {
|
13280 | r.seek_cur(3);
|
13281 | return this.token(TOKEN_EQEQCI, "==?", pos);
|
13282 | }
|
13283 | else if (r.p(2) == "#") {
|
13284 | r.seek_cur(3);
|
13285 | return this.token(TOKEN_EQEQCS, "==#", pos);
|
13286 | }
|
13287 | else {
|
13288 | r.seek_cur(2);
|
13289 | return this.token(TOKEN_EQEQ, "==", pos);
|
13290 | }
|
13291 | }
|
13292 | else if (c == "!" && r.p(1) == "=") {
|
13293 | if (r.p(2) == "?") {
|
13294 | r.seek_cur(3);
|
13295 | return this.token(TOKEN_NEQCI, "!=?", pos);
|
13296 | }
|
13297 | else if (r.p(2) == "#") {
|
13298 | r.seek_cur(3);
|
13299 | return this.token(TOKEN_NEQCS, "!=#", pos);
|
13300 | }
|
13301 | else {
|
13302 | r.seek_cur(2);
|
13303 | return this.token(TOKEN_NEQ, "!=", pos);
|
13304 | }
|
13305 | }
|
13306 | else if (c == ">" && r.p(1) == "=") {
|
13307 | if (r.p(2) == "?") {
|
13308 | r.seek_cur(3);
|
13309 | return this.token(TOKEN_GTEQCI, ">=?", pos);
|
13310 | }
|
13311 | else if (r.p(2) == "#") {
|
13312 | r.seek_cur(3);
|
13313 | return this.token(TOKEN_GTEQCS, ">=#", pos);
|
13314 | }
|
13315 | else {
|
13316 | r.seek_cur(2);
|
13317 | return this.token(TOKEN_GTEQ, ">=", pos);
|
13318 | }
|
13319 | }
|
13320 | else if (c == "<" && r.p(1) == "=") {
|
13321 | if (r.p(2) == "?") {
|
13322 | r.seek_cur(3);
|
13323 | return this.token(TOKEN_LTEQCI, "<=?", pos);
|
13324 | }
|
13325 | else if (r.p(2) == "#") {
|
13326 | r.seek_cur(3);
|
13327 | return this.token(TOKEN_LTEQCS, "<=#", pos);
|
13328 | }
|
13329 | else {
|
13330 | r.seek_cur(2);
|
13331 | return this.token(TOKEN_LTEQ, "<=", pos);
|
13332 | }
|
13333 | }
|
13334 | else if (c == "=" && r.p(1) == "~") {
|
13335 | if (r.p(2) == "?") {
|
13336 | r.seek_cur(3);
|
13337 | return this.token(TOKEN_MATCHCI, "=~?", pos);
|
13338 | }
|
13339 | else if (r.p(2) == "#") {
|
13340 | r.seek_cur(3);
|
13341 | return this.token(TOKEN_MATCHCS, "=~#", pos);
|
13342 | }
|
13343 | else {
|
13344 | r.seek_cur(2);
|
13345 | return this.token(TOKEN_MATCH, "=~", pos);
|
13346 | }
|
13347 | }
|
13348 | else if (c == "!" && r.p(1) == "~") {
|
13349 | if (r.p(2) == "?") {
|
13350 | r.seek_cur(3);
|
13351 | return this.token(TOKEN_NOMATCHCI, "!~?", pos);
|
13352 | }
|
13353 | else if (r.p(2) == "#") {
|
13354 | r.seek_cur(3);
|
13355 | return this.token(TOKEN_NOMATCHCS, "!~#", pos);
|
13356 | }
|
13357 | else {
|
13358 | r.seek_cur(2);
|
13359 | return this.token(TOKEN_NOMATCH, "!~", pos);
|
13360 | }
|
13361 | }
|
13362 | else if (c == ">") {
|
13363 | if (r.p(1) == "?") {
|
13364 | r.seek_cur(2);
|
13365 | return this.token(TOKEN_GTCI, ">?", pos);
|
13366 | }
|
13367 | else if (r.p(1) == "#") {
|
13368 | r.seek_cur(2);
|
13369 | return this.token(TOKEN_GTCS, ">#", pos);
|
13370 | }
|
13371 | else {
|
13372 | r.seek_cur(1);
|
13373 | return this.token(TOKEN_GT, ">", pos);
|
13374 | }
|
13375 | }
|
13376 | else if (c == "<") {
|
13377 | if (r.p(1) == "?") {
|
13378 | r.seek_cur(2);
|
13379 | return this.token(TOKEN_LTCI, "<?", pos);
|
13380 | }
|
13381 | else if (r.p(1) == "#") {
|
13382 | r.seek_cur(2);
|
13383 | return this.token(TOKEN_LTCS, "<#", pos);
|
13384 | }
|
13385 | else {
|
13386 | r.seek_cur(1);
|
13387 | return this.token(TOKEN_LT, "<", pos);
|
13388 | }
|
13389 | }
|
13390 | else if (c == "+") {
|
13391 | r.seek_cur(1);
|
13392 | return this.token(TOKEN_PLUS, "+", pos);
|
13393 | }
|
13394 | else if (c == "-") {
|
13395 | if (r.p(1) == ">") {
|
13396 | r.seek_cur(2);
|
13397 | return this.token(TOKEN_ARROW, "->", pos);
|
13398 | }
|
13399 | else {
|
13400 | r.seek_cur(1);
|
13401 | return this.token(TOKEN_MINUS, "-", pos);
|
13402 | }
|
13403 | }
|
13404 | else if (c == ".") {
|
13405 | if (r.p(1) == "." && r.p(2) == ".") {
|
13406 | r.seek_cur(3);
|
13407 | return this.token(TOKEN_DOTDOTDOT, "...", pos);
|
13408 | }
|
13409 | else if (r.p(1) == ".") {
|
13410 | r.seek_cur(2);
|
13411 | return this.token(TOKEN_DOTDOT, "..", pos);
|
13412 |
|
13413 | }
|
13414 | else {
|
13415 | r.seek_cur(1);
|
13416 | return this.token(TOKEN_DOT, ".", pos);
|
13417 |
|
13418 | }
|
13419 | }
|
13420 | else if (c == "*") {
|
13421 | r.seek_cur(1);
|
13422 | return this.token(TOKEN_STAR, "*", pos);
|
13423 | }
|
13424 | else if (c == "/") {
|
13425 | r.seek_cur(1);
|
13426 | return this.token(TOKEN_SLASH, "/", pos);
|
13427 | }
|
13428 | else if (c == "%") {
|
13429 | r.seek_cur(1);
|
13430 | return this.token(TOKEN_PERCENT, "%", pos);
|
13431 | }
|
13432 | else if (c == "!") {
|
13433 | r.seek_cur(1);
|
13434 | return this.token(TOKEN_NOT, "!", pos);
|
13435 | }
|
13436 | else if (c == "?") {
|
13437 | r.seek_cur(1);
|
13438 | return this.token(TOKEN_QUESTION, "?", pos);
|
13439 | }
|
13440 | else if (c == ":") {
|
13441 | r.seek_cur(1);
|
13442 | return this.token(TOKEN_COLON, ":", pos);
|
13443 | }
|
13444 | else if (c == "#") {
|
13445 | if (r.p(1) == "{") {
|
13446 | r.seek_cur(2);
|
13447 | return this.token(TOKEN_LITCOPEN, "#{", pos);
|
13448 | }
|
13449 | else {
|
13450 | r.seek_cur(1);
|
13451 | return this.token(TOKEN_SHARP, "#", pos);
|
13452 | }
|
13453 | }
|
13454 | else if (c == "(") {
|
13455 | r.seek_cur(1);
|
13456 | return this.token(TOKEN_POPEN, "(", pos);
|
13457 | }
|
13458 | else if (c == ")") {
|
13459 | r.seek_cur(1);
|
13460 | return this.token(TOKEN_PCLOSE, ")", pos);
|
13461 | }
|
13462 | else if (c == "[") {
|
13463 | r.seek_cur(1);
|
13464 | return this.token(TOKEN_SQOPEN, "[", pos);
|
13465 | }
|
13466 | else if (c == "]") {
|
13467 | r.seek_cur(1);
|
13468 | return this.token(TOKEN_SQCLOSE, "]", pos);
|
13469 | }
|
13470 | else if (c == "{") {
|
13471 | r.seek_cur(1);
|
13472 | return this.token(TOKEN_COPEN, "{", pos);
|
13473 | }
|
13474 | else if (c == "}") {
|
13475 | r.seek_cur(1);
|
13476 | return this.token(TOKEN_CCLOSE, "}", pos);
|
13477 | }
|
13478 | else if (c == ",") {
|
13479 | r.seek_cur(1);
|
13480 | return this.token(TOKEN_COMMA, ",", pos);
|
13481 | }
|
13482 | else if (c == "'") {
|
13483 | r.seek_cur(1);
|
13484 | return this.token(TOKEN_SQUOTE, "'", pos);
|
13485 | }
|
13486 | else if (c == "\"") {
|
13487 | r.seek_cur(1);
|
13488 | return this.token(TOKEN_DQUOTE, "\"", pos);
|
13489 | }
|
13490 | else if (c == "$") {
|
13491 | var s = r.getn(1);
|
13492 | s += r.read_word();
|
13493 | return this.token(TOKEN_ENV, s, pos);
|
13494 | }
|
13495 | else if (c == "@") {
|
13496 |
|
13497 | return this.token(TOKEN_REG, r.getn(2), pos);
|
13498 | }
|
13499 | else if (c == "&") {
|
13500 | var s = "";
|
13501 | if ((r.p(1) == "g" || r.p(1) == "l") && r.p(2) == ":") {
|
13502 | var s = r.getn(3) + r.read_word();
|
13503 | }
|
13504 | else {
|
13505 | var s = r.getn(1) + r.read_word();
|
13506 | }
|
13507 | return this.token(TOKEN_OPTION, s, pos);
|
13508 | }
|
13509 | else if (c == "=") {
|
13510 | r.seek_cur(1);
|
13511 | return this.token(TOKEN_EQ, "=", pos);
|
13512 | }
|
13513 | else if (c == "|") {
|
13514 | r.seek_cur(1);
|
13515 | return this.token(TOKEN_OR, "|", pos);
|
13516 | }
|
13517 | else if (c == ";") {
|
13518 | r.seek_cur(1);
|
13519 | return this.token(TOKEN_SEMICOLON, ";", pos);
|
13520 | }
|
13521 | else if (c == "`") {
|
13522 | r.seek_cur(1);
|
13523 | return this.token(TOKEN_BACKTICK, "`", pos);
|
13524 | }
|
13525 | else {
|
13526 | throw Err(viml_printf("unexpected character: %s", c), this.reader.getpos());
|
13527 | }
|
13528 | }
|
13529 |
|
13530 | ExprTokenizer.prototype.get_sstring = function() {
|
13531 | this.reader.skip_white();
|
13532 | var c = this.reader.p(0);
|
13533 | if (c != "'") {
|
13534 | throw Err(viml_printf("unexpected character: %s", c), this.reader.getpos());
|
13535 | }
|
13536 | this.reader.seek_cur(1);
|
13537 | var s = "";
|
13538 | while (TRUE) {
|
13539 | var c = this.reader.p(0);
|
13540 | if (c == "<EOF>" || c == "<EOL>") {
|
13541 | throw Err("unexpected EOL", this.reader.getpos());
|
13542 | }
|
13543 | else if (c == "'") {
|
13544 | this.reader.seek_cur(1);
|
13545 | if (this.reader.p(0) == "'") {
|
13546 | this.reader.seek_cur(1);
|
13547 | s += "''";
|
13548 | }
|
13549 | else {
|
13550 | break;
|
13551 | }
|
13552 | }
|
13553 | else {
|
13554 | this.reader.seek_cur(1);
|
13555 | s += c;
|
13556 | }
|
13557 | }
|
13558 | return s;
|
13559 | }
|
13560 |
|
13561 | ExprTokenizer.prototype.get_dstring = function() {
|
13562 | this.reader.skip_white();
|
13563 | var c = this.reader.p(0);
|
13564 | if (c != "\"") {
|
13565 | throw Err(viml_printf("unexpected character: %s", c), this.reader.getpos());
|
13566 | }
|
13567 | this.reader.seek_cur(1);
|
13568 | var s = "";
|
13569 | while (TRUE) {
|
13570 | var c = this.reader.p(0);
|
13571 | if (c == "<EOF>" || c == "<EOL>") {
|
13572 | throw Err("unexpectd EOL", this.reader.getpos());
|
13573 | }
|
13574 | else if (c == "\"") {
|
13575 | this.reader.seek_cur(1);
|
13576 | break;
|
13577 | }
|
13578 | else if (c == "\\") {
|
13579 | this.reader.seek_cur(1);
|
13580 | s += c;
|
13581 | var c = this.reader.p(0);
|
13582 | if (c == "<EOF>" || c == "<EOL>") {
|
13583 | throw Err("ExprTokenizer: unexpected EOL", this.reader.getpos());
|
13584 | }
|
13585 | this.reader.seek_cur(1);
|
13586 | s += c;
|
13587 | }
|
13588 | else {
|
13589 | this.reader.seek_cur(1);
|
13590 | s += c;
|
13591 | }
|
13592 | }
|
13593 | return s;
|
13594 | }
|
13595 |
|
13596 | ExprTokenizer.prototype.parse_dict_literal_key = function() {
|
13597 | this.reader.skip_white();
|
13598 | var c = this.reader.peek();
|
13599 | if (!isalnum(c) && c != "_" && c != "-") {
|
13600 | throw Err(viml_printf("unexpected character: %s", c), this.reader.getpos());
|
13601 | }
|
13602 | var node = Node(NODE_STRING);
|
13603 | var s = c;
|
13604 | this.reader.seek_cur(1);
|
13605 | node.pos = this.reader.getpos();
|
13606 | while (TRUE) {
|
13607 | var c = this.reader.p(0);
|
13608 | if (c == "<EOF>" || c == "<EOL>") {
|
13609 | throw Err("unexpectd EOL", this.reader.getpos());
|
13610 | }
|
13611 | if (!isalnum(c) && c != "_" && c != "-") {
|
13612 | break;
|
13613 | }
|
13614 | this.reader.seek_cur(1);
|
13615 | s += c;
|
13616 | }
|
13617 | node.value = "'" + s + "'";
|
13618 | return node;
|
13619 | }
|
13620 |
|
13621 | function ExprParser() { this.__init__.apply(this, arguments); }
|
13622 | ExprParser.prototype.__init__ = function(reader) {
|
13623 | this.reader = reader;
|
13624 | this.tokenizer = new ExprTokenizer(reader);
|
13625 | }
|
13626 |
|
13627 | ExprParser.prototype.parse = function() {
|
13628 | return this.parse_expr1();
|
13629 | }
|
13630 |
|
13631 |
|
13632 | ExprParser.prototype.parse_expr1 = function() {
|
13633 | var left = this.parse_expr2();
|
13634 | var pos = this.reader.tell();
|
13635 | var token = this.tokenizer.get();
|
13636 | if (token.type == TOKEN_QUESTION) {
|
13637 | var node = Node(NODE_TERNARY);
|
13638 | node.pos = token.pos;
|
13639 | node.cond = left;
|
13640 | node.left = this.parse_expr1();
|
13641 | var token = this.tokenizer.get();
|
13642 | if (token.type != TOKEN_COLON) {
|
13643 | throw Err(viml_printf("unexpected token: %s", token.value), token.pos);
|
13644 | }
|
13645 | node.right = this.parse_expr1();
|
13646 | var left = node;
|
13647 | }
|
13648 | else {
|
13649 | this.reader.seek_set(pos);
|
13650 | }
|
13651 | return left;
|
13652 | }
|
13653 |
|
13654 |
|
13655 | ExprParser.prototype.parse_expr2 = function() {
|
13656 | var left = this.parse_expr3();
|
13657 | while (TRUE) {
|
13658 | var pos = this.reader.tell();
|
13659 | var token = this.tokenizer.get();
|
13660 | if (token.type == TOKEN_OROR) {
|
13661 | var node = Node(NODE_OR);
|
13662 | node.pos = token.pos;
|
13663 | node.left = left;
|
13664 | node.right = this.parse_expr3();
|
13665 | var left = node;
|
13666 | }
|
13667 | else {
|
13668 | this.reader.seek_set(pos);
|
13669 | break;
|
13670 | }
|
13671 | }
|
13672 | return left;
|
13673 | }
|
13674 |
|
13675 |
|
13676 | ExprParser.prototype.parse_expr3 = function() {
|
13677 | var left = this.parse_expr4();
|
13678 | while (TRUE) {
|
13679 | var pos = this.reader.tell();
|
13680 | var token = this.tokenizer.get();
|
13681 | if (token.type == TOKEN_ANDAND) {
|
13682 | var node = Node(NODE_AND);
|
13683 | node.pos = token.pos;
|
13684 | node.left = left;
|
13685 | node.right = this.parse_expr4();
|
13686 | var left = node;
|
13687 | }
|
13688 | else {
|
13689 | this.reader.seek_set(pos);
|
13690 | break;
|
13691 | }
|
13692 | }
|
13693 | return left;
|
13694 | }
|
13695 |
|
13696 |
|
13697 |
|
13698 |
|
13699 |
|
13700 |
|
13701 |
|
13702 |
|
13703 |
|
13704 |
|
13705 |
|
13706 |
|
13707 |
|
13708 |
|
13709 |
|
13710 |
|
13711 | ExprParser.prototype.parse_expr4 = function() {
|
13712 | var left = this.parse_expr5();
|
13713 | var pos = this.reader.tell();
|
13714 | var token = this.tokenizer.get();
|
13715 | if (token.type == TOKEN_EQEQ) {
|
13716 | var node = Node(NODE_EQUAL);
|
13717 | node.pos = token.pos;
|
13718 | node.left = left;
|
13719 | node.right = this.parse_expr5();
|
13720 | var left = node;
|
13721 | }
|
13722 | else if (token.type == TOKEN_EQEQCI) {
|
13723 | var node = Node(NODE_EQUALCI);
|
13724 | node.pos = token.pos;
|
13725 | node.left = left;
|
13726 | node.right = this.parse_expr5();
|
13727 | var left = node;
|
13728 | }
|
13729 | else if (token.type == TOKEN_EQEQCS) {
|
13730 | var node = Node(NODE_EQUALCS);
|
13731 | node.pos = token.pos;
|
13732 | node.left = left;
|
13733 | node.right = this.parse_expr5();
|
13734 | var left = node;
|
13735 | }
|
13736 | else if (token.type == TOKEN_NEQ) {
|
13737 | var node = Node(NODE_NEQUAL);
|
13738 | node.pos = token.pos;
|
13739 | node.left = left;
|
13740 | node.right = this.parse_expr5();
|
13741 | var left = node;
|
13742 | }
|
13743 | else if (token.type == TOKEN_NEQCI) {
|
13744 | var node = Node(NODE_NEQUALCI);
|
13745 | node.pos = token.pos;
|
13746 | node.left = left;
|
13747 | node.right = this.parse_expr5();
|
13748 | var left = node;
|
13749 | }
|
13750 | else if (token.type == TOKEN_NEQCS) {
|
13751 | var node = Node(NODE_NEQUALCS);
|
13752 | node.pos = token.pos;
|
13753 | node.left = left;
|
13754 | node.right = this.parse_expr5();
|
13755 | var left = node;
|
13756 | }
|
13757 | else if (token.type == TOKEN_GT) {
|
13758 | var node = Node(NODE_GREATER);
|
13759 | node.pos = token.pos;
|
13760 | node.left = left;
|
13761 | node.right = this.parse_expr5();
|
13762 | var left = node;
|
13763 | }
|
13764 | else if (token.type == TOKEN_GTCI) {
|
13765 | var node = Node(NODE_GREATERCI);
|
13766 | node.pos = token.pos;
|
13767 | node.left = left;
|
13768 | node.right = this.parse_expr5();
|
13769 | var left = node;
|
13770 | }
|
13771 | else if (token.type == TOKEN_GTCS) {
|
13772 | var node = Node(NODE_GREATERCS);
|
13773 | node.pos = token.pos;
|
13774 | node.left = left;
|
13775 | node.right = this.parse_expr5();
|
13776 | var left = node;
|
13777 | }
|
13778 | else if (token.type == TOKEN_GTEQ) {
|
13779 | var node = Node(NODE_GEQUAL);
|
13780 | node.pos = token.pos;
|
13781 | node.left = left;
|
13782 | node.right = this.parse_expr5();
|
13783 | var left = node;
|
13784 | }
|
13785 | else if (token.type == TOKEN_GTEQCI) {
|
13786 | var node = Node(NODE_GEQUALCI);
|
13787 | node.pos = token.pos;
|
13788 | node.left = left;
|
13789 | node.right = this.parse_expr5();
|
13790 | var left = node;
|
13791 | }
|
13792 | else if (token.type == TOKEN_GTEQCS) {
|
13793 | var node = Node(NODE_GEQUALCS);
|
13794 | node.pos = token.pos;
|
13795 | node.left = left;
|
13796 | node.right = this.parse_expr5();
|
13797 | var left = node;
|
13798 | }
|
13799 | else if (token.type == TOKEN_LT) {
|
13800 | var node = Node(NODE_SMALLER);
|
13801 | node.pos = token.pos;
|
13802 | node.left = left;
|
13803 | node.right = this.parse_expr5();
|
13804 | var left = node;
|
13805 | }
|
13806 | else if (token.type == TOKEN_LTCI) {
|
13807 | var node = Node(NODE_SMALLERCI);
|
13808 | node.pos = token.pos;
|
13809 | node.left = left;
|
13810 | node.right = this.parse_expr5();
|
13811 | var left = node;
|
13812 | }
|
13813 | else if (token.type == TOKEN_LTCS) {
|
13814 | var node = Node(NODE_SMALLERCS);
|
13815 | node.pos = token.pos;
|
13816 | node.left = left;
|
13817 | node.right = this.parse_expr5();
|
13818 | var left = node;
|
13819 | }
|
13820 | else if (token.type == TOKEN_LTEQ) {
|
13821 | var node = Node(NODE_SEQUAL);
|
13822 | node.pos = token.pos;
|
13823 | node.left = left;
|
13824 | node.right = this.parse_expr5();
|
13825 | var left = node;
|
13826 | }
|
13827 | else if (token.type == TOKEN_LTEQCI) {
|
13828 | var node = Node(NODE_SEQUALCI);
|
13829 | node.pos = token.pos;
|
13830 | node.left = left;
|
13831 | node.right = this.parse_expr5();
|
13832 | var left = node;
|
13833 | }
|
13834 | else if (token.type == TOKEN_LTEQCS) {
|
13835 | var node = Node(NODE_SEQUALCS);
|
13836 | node.pos = token.pos;
|
13837 | node.left = left;
|
13838 | node.right = this.parse_expr5();
|
13839 | var left = node;
|
13840 | }
|
13841 | else if (token.type == TOKEN_MATCH) {
|
13842 | var node = Node(NODE_MATCH);
|
13843 | node.pos = token.pos;
|
13844 | node.left = left;
|
13845 | node.right = this.parse_expr5();
|
13846 | var left = node;
|
13847 | }
|
13848 | else if (token.type == TOKEN_MATCHCI) {
|
13849 | var node = Node(NODE_MATCHCI);
|
13850 | node.pos = token.pos;
|
13851 | node.left = left;
|
13852 | node.right = this.parse_expr5();
|
13853 | var left = node;
|
13854 | }
|
13855 | else if (token.type == TOKEN_MATCHCS) {
|
13856 | var node = Node(NODE_MATCHCS);
|
13857 | node.pos = token.pos;
|
13858 | node.left = left;
|
13859 | node.right = this.parse_expr5();
|
13860 | var left = node;
|
13861 | }
|
13862 | else if (token.type == TOKEN_NOMATCH) {
|
13863 | var node = Node(NODE_NOMATCH);
|
13864 | node.pos = token.pos;
|
13865 | node.left = left;
|
13866 | node.right = this.parse_expr5();
|
13867 | var left = node;
|
13868 | }
|
13869 | else if (token.type == TOKEN_NOMATCHCI) {
|
13870 | var node = Node(NODE_NOMATCHCI);
|
13871 | node.pos = token.pos;
|
13872 | node.left = left;
|
13873 | node.right = this.parse_expr5();
|
13874 | var left = node;
|
13875 | }
|
13876 | else if (token.type == TOKEN_NOMATCHCS) {
|
13877 | var node = Node(NODE_NOMATCHCS);
|
13878 | node.pos = token.pos;
|
13879 | node.left = left;
|
13880 | node.right = this.parse_expr5();
|
13881 | var left = node;
|
13882 | }
|
13883 | else if (token.type == TOKEN_IS) {
|
13884 | var node = Node(NODE_IS);
|
13885 | node.pos = token.pos;
|
13886 | node.left = left;
|
13887 | node.right = this.parse_expr5();
|
13888 | var left = node;
|
13889 | }
|
13890 | else if (token.type == TOKEN_ISCI) {
|
13891 | var node = Node(NODE_ISCI);
|
13892 | node.pos = token.pos;
|
13893 | node.left = left;
|
13894 | node.right = this.parse_expr5();
|
13895 | var left = node;
|
13896 | }
|
13897 | else if (token.type == TOKEN_ISCS) {
|
13898 | var node = Node(NODE_ISCS);
|
13899 | node.pos = token.pos;
|
13900 | node.left = left;
|
13901 | node.right = this.parse_expr5();
|
13902 | var left = node;
|
13903 | }
|
13904 | else if (token.type == TOKEN_ISNOT) {
|
13905 | var node = Node(NODE_ISNOT);
|
13906 | node.pos = token.pos;
|
13907 | node.left = left;
|
13908 | node.right = this.parse_expr5();
|
13909 | var left = node;
|
13910 | }
|
13911 | else if (token.type == TOKEN_ISNOTCI) {
|
13912 | var node = Node(NODE_ISNOTCI);
|
13913 | node.pos = token.pos;
|
13914 | node.left = left;
|
13915 | node.right = this.parse_expr5();
|
13916 | var left = node;
|
13917 | }
|
13918 | else if (token.type == TOKEN_ISNOTCS) {
|
13919 | var node = Node(NODE_ISNOTCS);
|
13920 | node.pos = token.pos;
|
13921 | node.left = left;
|
13922 | node.right = this.parse_expr5();
|
13923 | var left = node;
|
13924 | }
|
13925 | else {
|
13926 | this.reader.seek_set(pos);
|
13927 | }
|
13928 | return left;
|
13929 | }
|
13930 |
|
13931 |
|
13932 |
|
13933 |
|
13934 |
|
13935 | ExprParser.prototype.parse_expr5 = function() {
|
13936 | var left = this.parse_expr6();
|
13937 | while (TRUE) {
|
13938 | var pos = this.reader.tell();
|
13939 | var token = this.tokenizer.get();
|
13940 | if (token.type == TOKEN_PLUS) {
|
13941 | var node = Node(NODE_ADD);
|
13942 | node.pos = token.pos;
|
13943 | node.left = left;
|
13944 | node.right = this.parse_expr6();
|
13945 | var left = node;
|
13946 | }
|
13947 | else if (token.type == TOKEN_MINUS) {
|
13948 | var node = Node(NODE_SUBTRACT);
|
13949 | node.pos = token.pos;
|
13950 | node.left = left;
|
13951 | node.right = this.parse_expr6();
|
13952 | var left = node;
|
13953 | }
|
13954 | else if (token.type == TOKEN_DOTDOT) {
|
13955 |
|
13956 | var node = Node(NODE_CONCAT);
|
13957 | node.pos = token.pos;
|
13958 | node.left = left;
|
13959 | node.right = this.parse_expr6();
|
13960 | var left = node;
|
13961 | }
|
13962 | else if (token.type == TOKEN_DOT) {
|
13963 |
|
13964 | var node = Node(NODE_CONCAT);
|
13965 | node.pos = token.pos;
|
13966 | node.left = left;
|
13967 | node.right = this.parse_expr6();
|
13968 | var left = node;
|
13969 | }
|
13970 | else {
|
13971 | this.reader.seek_set(pos);
|
13972 | break;
|
13973 | }
|
13974 | }
|
13975 | return left;
|
13976 | }
|
13977 |
|
13978 |
|
13979 |
|
13980 |
|
13981 | ExprParser.prototype.parse_expr6 = function() {
|
13982 | var left = this.parse_expr7();
|
13983 | while (TRUE) {
|
13984 | var pos = this.reader.tell();
|
13985 | var token = this.tokenizer.get();
|
13986 | if (token.type == TOKEN_STAR) {
|
13987 | var node = Node(NODE_MULTIPLY);
|
13988 | node.pos = token.pos;
|
13989 | node.left = left;
|
13990 | node.right = this.parse_expr7();
|
13991 | var left = node;
|
13992 | }
|
13993 | else if (token.type == TOKEN_SLASH) {
|
13994 | var node = Node(NODE_DIVIDE);
|
13995 | node.pos = token.pos;
|
13996 | node.left = left;
|
13997 | node.right = this.parse_expr7();
|
13998 | var left = node;
|
13999 | }
|
14000 | else if (token.type == TOKEN_PERCENT) {
|
14001 | var node = Node(NODE_REMAINDER);
|
14002 | node.pos = token.pos;
|
14003 | node.left = left;
|
14004 | node.right = this.parse_expr7();
|
14005 | var left = node;
|
14006 | }
|
14007 | else {
|
14008 | this.reader.seek_set(pos);
|
14009 | break;
|
14010 | }
|
14011 | }
|
14012 | return left;
|
14013 | }
|
14014 |
|
14015 |
|
14016 |
|
14017 |
|
14018 | ExprParser.prototype.parse_expr7 = function() {
|
14019 | var pos = this.reader.tell();
|
14020 | var token = this.tokenizer.get();
|
14021 | if (token.type == TOKEN_NOT) {
|
14022 | var node = Node(NODE_NOT);
|
14023 | node.pos = token.pos;
|
14024 | node.left = this.parse_expr7();
|
14025 | return node;
|
14026 | }
|
14027 | else if (token.type == TOKEN_MINUS) {
|
14028 | var node = Node(NODE_MINUS);
|
14029 | node.pos = token.pos;
|
14030 | node.left = this.parse_expr7();
|
14031 | return node;
|
14032 | }
|
14033 | else if (token.type == TOKEN_PLUS) {
|
14034 | var node = Node(NODE_PLUS);
|
14035 | node.pos = token.pos;
|
14036 | node.left = this.parse_expr7();
|
14037 | return node;
|
14038 | }
|
14039 | else {
|
14040 | this.reader.seek_set(pos);
|
14041 | var node = this.parse_expr8();
|
14042 | return node;
|
14043 | }
|
14044 | }
|
14045 |
|
14046 |
|
14047 |
|
14048 |
|
14049 |
|
14050 |
|
14051 |
|
14052 |
|
14053 | ExprParser.prototype.parse_expr8 = function() {
|
14054 | var left = this.parse_expr9();
|
14055 | while (TRUE) {
|
14056 | var pos = this.reader.tell();
|
14057 | var c = this.reader.peek();
|
14058 | var token = this.tokenizer.get();
|
14059 | if (!iswhite(c) && token.type == TOKEN_SQOPEN) {
|
14060 | var npos = token.pos;
|
14061 | if (this.tokenizer.peek().type == TOKEN_COLON) {
|
14062 | this.tokenizer.get();
|
14063 | var node = Node(NODE_SLICE);
|
14064 | node.pos = npos;
|
14065 | node.left = left;
|
14066 | node.rlist = [NIL, NIL];
|
14067 | var token = this.tokenizer.peek();
|
14068 | if (token.type != TOKEN_SQCLOSE) {
|
14069 | node.rlist[1] = this.parse_expr1();
|
14070 | }
|
14071 | var token = this.tokenizer.get();
|
14072 | if (token.type != TOKEN_SQCLOSE) {
|
14073 | throw Err(viml_printf("unexpected token: %s", token.value), token.pos);
|
14074 | }
|
14075 | var left = node;
|
14076 | }
|
14077 | else {
|
14078 | var right = this.parse_expr1();
|
14079 | if (this.tokenizer.peek().type == TOKEN_COLON) {
|
14080 | this.tokenizer.get();
|
14081 | var node = Node(NODE_SLICE);
|
14082 | node.pos = npos;
|
14083 | node.left = left;
|
14084 | node.rlist = [right, NIL];
|
14085 | var token = this.tokenizer.peek();
|
14086 | if (token.type != TOKEN_SQCLOSE) {
|
14087 | node.rlist[1] = this.parse_expr1();
|
14088 | }
|
14089 | var token = this.tokenizer.get();
|
14090 | if (token.type != TOKEN_SQCLOSE) {
|
14091 | throw Err(viml_printf("unexpected token: %s", token.value), token.pos);
|
14092 | }
|
14093 | var left = node;
|
14094 | }
|
14095 | else {
|
14096 | var node = Node(NODE_SUBSCRIPT);
|
14097 | node.pos = npos;
|
14098 | node.left = left;
|
14099 | node.right = right;
|
14100 | var token = this.tokenizer.get();
|
14101 | if (token.type != TOKEN_SQCLOSE) {
|
14102 | throw Err(viml_printf("unexpected token: %s", token.value), token.pos);
|
14103 | }
|
14104 | var left = node;
|
14105 | }
|
14106 | }
|
14107 | delete node;
|
14108 | }
|
14109 | else if (token.type == TOKEN_ARROW) {
|
14110 | var funcname_or_lambda = this.parse_expr9();
|
14111 | var token = this.tokenizer.get();
|
14112 | if (token.type != TOKEN_POPEN) {
|
14113 | throw Err("E107: Missing parentheses: lambda", token.pos);
|
14114 | }
|
14115 | var right = Node(NODE_CALL);
|
14116 | right.pos = token.pos;
|
14117 | right.left = funcname_or_lambda;
|
14118 | right.rlist = this.parse_rlist();
|
14119 | var node = Node(NODE_METHOD);
|
14120 | node.pos = token.pos;
|
14121 | node.left = left;
|
14122 | node.right = right;
|
14123 | var left = node;
|
14124 | delete node;
|
14125 | }
|
14126 | else if (token.type == TOKEN_POPEN) {
|
14127 | var node = Node(NODE_CALL);
|
14128 | node.pos = token.pos;
|
14129 | node.left = left;
|
14130 | node.rlist = this.parse_rlist();
|
14131 | var left = node;
|
14132 | delete node;
|
14133 | }
|
14134 | else if (!iswhite(c) && token.type == TOKEN_DOT) {
|
14135 |
|
14136 | var node = this.parse_dot(token, left);
|
14137 | if (node === NIL) {
|
14138 | this.reader.seek_set(pos);
|
14139 | break;
|
14140 | }
|
14141 | var left = node;
|
14142 | delete node;
|
14143 | }
|
14144 | else {
|
14145 | this.reader.seek_set(pos);
|
14146 | break;
|
14147 | }
|
14148 | }
|
14149 | return left;
|
14150 | }
|
14151 |
|
14152 | ExprParser.prototype.parse_rlist = function() {
|
14153 | var rlist = [];
|
14154 | var token = this.tokenizer.peek();
|
14155 | if (this.tokenizer.peek().type == TOKEN_PCLOSE) {
|
14156 | this.tokenizer.get();
|
14157 | }
|
14158 | else {
|
14159 | while (TRUE) {
|
14160 | viml_add(rlist, this.parse_expr1());
|
14161 | var token = this.tokenizer.get();
|
14162 | if (token.type == TOKEN_COMMA) {
|
14163 |
|
14164 | if (this.tokenizer.peek().type == TOKEN_PCLOSE) {
|
14165 | this.tokenizer.get();
|
14166 | break;
|
14167 | }
|
14168 | }
|
14169 | else if (token.type == TOKEN_PCLOSE) {
|
14170 | break;
|
14171 | }
|
14172 | else {
|
14173 | throw Err(viml_printf("unexpected token: %s", token.value), token.pos);
|
14174 | }
|
14175 | }
|
14176 | }
|
14177 | if (viml_len(rlist) > MAX_FUNC_ARGS) {
|
14178 |
|
14179 | throw Err("E740: Too many arguments for function", token.pos);
|
14180 | }
|
14181 | return rlist;
|
14182 | }
|
14183 |
|
14184 |
|
14185 |
|
14186 |
|
14187 |
|
14188 |
|
14189 |
|
14190 |
|
14191 |
|
14192 |
|
14193 |
|
14194 |
|
14195 |
|
14196 |
|
14197 |
|
14198 |
|
14199 | ExprParser.prototype.parse_expr9 = function() {
|
14200 | var pos = this.reader.tell();
|
14201 | var token = this.tokenizer.get();
|
14202 | var node = Node(-1);
|
14203 | if (token.type == TOKEN_NUMBER) {
|
14204 | var node = Node(NODE_NUMBER);
|
14205 | node.pos = token.pos;
|
14206 | node.value = token.value;
|
14207 | }
|
14208 | else if (token.type == TOKEN_BLOB) {
|
14209 | var node = Node(NODE_BLOB);
|
14210 | node.pos = token.pos;
|
14211 | node.value = token.value;
|
14212 | }
|
14213 | else if (token.type == TOKEN_DQUOTE) {
|
14214 | this.reader.seek_set(pos);
|
14215 | var node = Node(NODE_STRING);
|
14216 | node.pos = token.pos;
|
14217 | node.value = "\"" + this.tokenizer.get_dstring() + "\"";
|
14218 | }
|
14219 | else if (token.type == TOKEN_SQUOTE) {
|
14220 | this.reader.seek_set(pos);
|
14221 | var node = Node(NODE_STRING);
|
14222 | node.pos = token.pos;
|
14223 | node.value = "'" + this.tokenizer.get_sstring() + "'";
|
14224 | }
|
14225 | else if (token.type == TOKEN_SQOPEN) {
|
14226 | var node = Node(NODE_LIST);
|
14227 | node.pos = token.pos;
|
14228 | node.value = [];
|
14229 | var token = this.tokenizer.peek();
|
14230 | if (token.type == TOKEN_SQCLOSE) {
|
14231 | this.tokenizer.get();
|
14232 | }
|
14233 | else {
|
14234 | while (TRUE) {
|
14235 | viml_add(node.value, this.parse_expr1());
|
14236 | var token = this.tokenizer.peek();
|
14237 | if (token.type == TOKEN_COMMA) {
|
14238 | this.tokenizer.get();
|
14239 | if (this.tokenizer.peek().type == TOKEN_SQCLOSE) {
|
14240 | this.tokenizer.get();
|
14241 | break;
|
14242 | }
|
14243 | }
|
14244 | else if (token.type == TOKEN_SQCLOSE) {
|
14245 | this.tokenizer.get();
|
14246 | break;
|
14247 | }
|
14248 | else {
|
14249 | throw Err(viml_printf("unexpected token: %s", token.value), token.pos);
|
14250 | }
|
14251 | }
|
14252 | }
|
14253 | }
|
14254 | else if (token.type == TOKEN_COPEN || token.type == TOKEN_LITCOPEN) {
|
14255 | var is_litdict = token.type == TOKEN_LITCOPEN;
|
14256 | var savepos = this.reader.tell();
|
14257 | var nodepos = token.pos;
|
14258 | var token = this.tokenizer.get();
|
14259 | var lambda = token.type == TOKEN_ARROW;
|
14260 | if (!lambda && !(token.type == TOKEN_SQUOTE || token.type == TOKEN_DQUOTE)) {
|
14261 |
|
14262 |
|
14263 | var token2 = this.tokenizer.peek();
|
14264 | var lambda = token2.type == TOKEN_ARROW || token2.type == TOKEN_COMMA;
|
14265 | }
|
14266 |
|
14267 | var fallback = FALSE;
|
14268 | if (lambda) {
|
14269 |
|
14270 | var node = Node(NODE_LAMBDA);
|
14271 | node.pos = nodepos;
|
14272 | node.rlist = [];
|
14273 | var named = {};
|
14274 | while (TRUE) {
|
14275 | if (token.type == TOKEN_ARROW) {
|
14276 | break;
|
14277 | }
|
14278 | else if (token.type == TOKEN_IDENTIFIER) {
|
14279 | if (!isargname(token.value)) {
|
14280 | throw Err(viml_printf("E125: Illegal argument: %s", token.value), token.pos);
|
14281 | }
|
14282 | else if (viml_has_key(named, token.value)) {
|
14283 | throw Err(viml_printf("E853: Duplicate argument name: %s", token.value), token.pos);
|
14284 | }
|
14285 | named[token.value] = 1;
|
14286 | var varnode = Node(NODE_IDENTIFIER);
|
14287 | varnode.pos = token.pos;
|
14288 | varnode.value = token.value;
|
14289 |
|
14290 | if (iswhite(this.reader.p(0)) && this.tokenizer.peek().type == TOKEN_COMMA) {
|
14291 | throw Err("E475: Invalid argument: White space is not allowed before comma", this.reader.getpos());
|
14292 | }
|
14293 | var token = this.tokenizer.get();
|
14294 | viml_add(node.rlist, varnode);
|
14295 | if (token.type == TOKEN_COMMA) {
|
14296 |
|
14297 | var token = this.tokenizer.peek();
|
14298 | if (token.type == TOKEN_ARROW) {
|
14299 | this.tokenizer.get();
|
14300 | break;
|
14301 | }
|
14302 | }
|
14303 | else if (token.type == TOKEN_ARROW) {
|
14304 | break;
|
14305 | }
|
14306 | else {
|
14307 | throw Err(viml_printf("unexpected token: %s, type: %d", token.value, token.type), token.pos);
|
14308 | }
|
14309 | }
|
14310 | else if (token.type == TOKEN_DOTDOTDOT) {
|
14311 | var varnode = Node(NODE_IDENTIFIER);
|
14312 | varnode.pos = token.pos;
|
14313 | varnode.value = token.value;
|
14314 | viml_add(node.rlist, varnode);
|
14315 | var token = this.tokenizer.peek();
|
14316 | if (token.type == TOKEN_ARROW) {
|
14317 | this.tokenizer.get();
|
14318 | break;
|
14319 | }
|
14320 | else {
|
14321 | throw Err(viml_printf("unexpected token: %s", token.value), token.pos);
|
14322 | }
|
14323 | }
|
14324 | else {
|
14325 | var fallback = TRUE;
|
14326 | break;
|
14327 | }
|
14328 | var token = this.tokenizer.get();
|
14329 | }
|
14330 | if (!fallback) {
|
14331 | node.left = this.parse_expr1();
|
14332 | var token = this.tokenizer.get();
|
14333 | if (token.type != TOKEN_CCLOSE) {
|
14334 | throw Err(viml_printf("unexpected token: %s", token.value), token.pos);
|
14335 | }
|
14336 | return node;
|
14337 | }
|
14338 | }
|
14339 |
|
14340 | var node = Node(NODE_DICT);
|
14341 | node.pos = nodepos;
|
14342 | node.value = [];
|
14343 | this.reader.seek_set(savepos);
|
14344 | var token = this.tokenizer.peek();
|
14345 | if (token.type == TOKEN_CCLOSE) {
|
14346 | this.tokenizer.get();
|
14347 | return node;
|
14348 | }
|
14349 | while (1) {
|
14350 | var key = is_litdict ? this.tokenizer.parse_dict_literal_key() : this.parse_expr1();
|
14351 | var token = this.tokenizer.get();
|
14352 | if (token.type == TOKEN_CCLOSE) {
|
14353 | if (!viml_empty(node.value)) {
|
14354 | throw Err(viml_printf("unexpected token: %s", token.value), token.pos);
|
14355 | }
|
14356 | this.reader.seek_set(pos);
|
14357 | var node = this.parse_identifier();
|
14358 | break;
|
14359 | }
|
14360 | if (token.type != TOKEN_COLON) {
|
14361 | throw Err(viml_printf("unexpected token: %s", token.value), token.pos);
|
14362 | }
|
14363 | var val = this.parse_expr1();
|
14364 | viml_add(node.value, [key, val]);
|
14365 | var token = this.tokenizer.get();
|
14366 | if (token.type == TOKEN_COMMA) {
|
14367 | if (this.tokenizer.peek().type == TOKEN_CCLOSE) {
|
14368 | this.tokenizer.get();
|
14369 | break;
|
14370 | }
|
14371 | }
|
14372 | else if (token.type == TOKEN_CCLOSE) {
|
14373 | break;
|
14374 | }
|
14375 | else {
|
14376 | throw Err(viml_printf("unexpected token: %s", token.value), token.pos);
|
14377 | }
|
14378 | }
|
14379 | return node;
|
14380 | }
|
14381 | else if (token.type == TOKEN_POPEN) {
|
14382 | var node = this.parse_expr1();
|
14383 | var token = this.tokenizer.get();
|
14384 | if (token.type != TOKEN_PCLOSE) {
|
14385 | throw Err(viml_printf("unexpected token: %s", token.value), token.pos);
|
14386 | }
|
14387 | }
|
14388 | else if (token.type == TOKEN_OPTION) {
|
14389 | var node = Node(NODE_OPTION);
|
14390 | node.pos = token.pos;
|
14391 | node.value = token.value;
|
14392 | }
|
14393 | else if (token.type == TOKEN_IDENTIFIER) {
|
14394 | this.reader.seek_set(pos);
|
14395 | var node = this.parse_identifier();
|
14396 | }
|
14397 | else if (FALSE && (token.type == TOKEN_COLON || token.type == TOKEN_SHARP)) {
|
14398 |
|
14399 | this.reader.seek_set(pos);
|
14400 | var node = this.parse_identifier();
|
14401 | }
|
14402 | else if (token.type == TOKEN_LT && viml_equalci(this.reader.peekn(4), "SID>")) {
|
14403 | this.reader.seek_set(pos);
|
14404 | var node = this.parse_identifier();
|
14405 | }
|
14406 | else if (token.type == TOKEN_IS || token.type == TOKEN_ISCS || token.type == TOKEN_ISNOT || token.type == TOKEN_ISNOTCS) {
|
14407 | this.reader.seek_set(pos);
|
14408 | var node = this.parse_identifier();
|
14409 | }
|
14410 | else if (token.type == TOKEN_ENV) {
|
14411 | var node = Node(NODE_ENV);
|
14412 | node.pos = token.pos;
|
14413 | node.value = token.value;
|
14414 | }
|
14415 | else if (token.type == TOKEN_REG) {
|
14416 | var node = Node(NODE_REG);
|
14417 | node.pos = token.pos;
|
14418 | node.value = token.value;
|
14419 | }
|
14420 | else {
|
14421 | throw Err(viml_printf("unexpected token: %s", token.value), token.pos);
|
14422 | }
|
14423 | return node;
|
14424 | }
|
14425 |
|
14426 |
|
14427 |
|
14428 |
|
14429 | ExprParser.prototype.parse_dot = function(token, left) {
|
14430 | if (left.type != NODE_IDENTIFIER && left.type != NODE_CURLYNAME && left.type != NODE_DICT && left.type != NODE_SUBSCRIPT && left.type != NODE_CALL && left.type != NODE_DOT) {
|
14431 | return NIL;
|
14432 | }
|
14433 | if (!iswordc(this.reader.p(0))) {
|
14434 | return NIL;
|
14435 | }
|
14436 | var pos = this.reader.getpos();
|
14437 | var name = this.reader.read_word();
|
14438 | if (isnamec(this.reader.p(0))) {
|
14439 |
|
14440 |
|
14441 | return NIL;
|
14442 | }
|
14443 | var node = Node(NODE_DOT);
|
14444 | node.pos = token.pos;
|
14445 | node.left = left;
|
14446 | node.right = Node(NODE_IDENTIFIER);
|
14447 | node.right.pos = pos;
|
14448 | node.right.value = name;
|
14449 | return node;
|
14450 | }
|
14451 |
|
14452 |
|
14453 |
|
14454 | ExprParser.prototype.parse_concat = function(token, left) {
|
14455 | if (left.type != NODE_IDENTIFIER && left.type != NODE_CURLYNAME && left.type != NODE_DICT && left.type != NODE_SUBSCRIPT && left.type != NODE_CALL && left.type != NODE_DOT) {
|
14456 | return NIL;
|
14457 | }
|
14458 | if (!iswordc(this.reader.p(0))) {
|
14459 | return NIL;
|
14460 | }
|
14461 | var pos = this.reader.getpos();
|
14462 | var name = this.reader.read_word();
|
14463 | if (isnamec(this.reader.p(0))) {
|
14464 |
|
14465 |
|
14466 | return NIL;
|
14467 | }
|
14468 | var node = Node(NODE_CONCAT);
|
14469 | node.pos = token.pos;
|
14470 | node.left = left;
|
14471 | node.right = Node(NODE_IDENTIFIER);
|
14472 | node.right.pos = pos;
|
14473 | node.right.value = name;
|
14474 | return node;
|
14475 | }
|
14476 |
|
14477 | ExprParser.prototype.parse_identifier = function() {
|
14478 | this.reader.skip_white();
|
14479 | var npos = this.reader.getpos();
|
14480 | var curly_parts = this.parse_curly_parts();
|
14481 | if (viml_len(curly_parts) == 1 && curly_parts[0].type == NODE_CURLYNAMEPART) {
|
14482 | var node = Node(NODE_IDENTIFIER);
|
14483 | node.pos = npos;
|
14484 | node.value = curly_parts[0].value;
|
14485 | return node;
|
14486 | }
|
14487 | else {
|
14488 | var node = Node(NODE_CURLYNAME);
|
14489 | node.pos = npos;
|
14490 | node.value = curly_parts;
|
14491 | return node;
|
14492 | }
|
14493 | }
|
14494 |
|
14495 | ExprParser.prototype.parse_curly_parts = function() {
|
14496 | var curly_parts = [];
|
14497 | var c = this.reader.peek();
|
14498 | var pos = this.reader.getpos();
|
14499 | if (c == "<" && viml_equalci(this.reader.peekn(5), "<SID>")) {
|
14500 | var name = this.reader.getn(5);
|
14501 | var node = Node(NODE_CURLYNAMEPART);
|
14502 | node.curly = FALSE;
|
14503 |
|
14504 | node.pos = pos;
|
14505 | node.value = name;
|
14506 | viml_add(curly_parts, node);
|
14507 | }
|
14508 | while (TRUE) {
|
14509 | var c = this.reader.peek();
|
14510 | if (isnamec(c)) {
|
14511 | var pos = this.reader.getpos();
|
14512 | var name = this.reader.read_name();
|
14513 | var node = Node(NODE_CURLYNAMEPART);
|
14514 | node.curly = FALSE;
|
14515 |
|
14516 | node.pos = pos;
|
14517 | node.value = name;
|
14518 | viml_add(curly_parts, node);
|
14519 | }
|
14520 | else if (c == "{") {
|
14521 | this.reader.get();
|
14522 | var pos = this.reader.getpos();
|
14523 | var node = Node(NODE_CURLYNAMEEXPR);
|
14524 | node.curly = TRUE;
|
14525 |
|
14526 | node.pos = pos;
|
14527 | node.value = this.parse_expr1();
|
14528 | viml_add(curly_parts, node);
|
14529 | this.reader.skip_white();
|
14530 | var c = this.reader.p(0);
|
14531 | if (c != "}") {
|
14532 | throw Err(viml_printf("unexpected token: %s", c), this.reader.getpos());
|
14533 | }
|
14534 | this.reader.seek_cur(1);
|
14535 | }
|
14536 | else {
|
14537 | break;
|
14538 | }
|
14539 | }
|
14540 | return curly_parts;
|
14541 | }
|
14542 |
|
14543 | function LvalueParser() { ExprParser.apply(this, arguments); this.__init__.apply(this, arguments); }
|
14544 | LvalueParser.prototype = Object.create(ExprParser.prototype);
|
14545 | LvalueParser.prototype.parse = function() {
|
14546 | return this.parse_lv8();
|
14547 | }
|
14548 |
|
14549 |
|
14550 |
|
14551 |
|
14552 | LvalueParser.prototype.parse_lv8 = function() {
|
14553 | var left = this.parse_lv9();
|
14554 | while (TRUE) {
|
14555 | var pos = this.reader.tell();
|
14556 | var c = this.reader.peek();
|
14557 | var token = this.tokenizer.get();
|
14558 | if (!iswhite(c) && token.type == TOKEN_SQOPEN) {
|
14559 | var npos = token.pos;
|
14560 | var node = Node(-1);
|
14561 | if (this.tokenizer.peek().type == TOKEN_COLON) {
|
14562 | this.tokenizer.get();
|
14563 | var node = Node(NODE_SLICE);
|
14564 | node.pos = npos;
|
14565 | node.left = left;
|
14566 | node.rlist = [NIL, NIL];
|
14567 | var token = this.tokenizer.peek();
|
14568 | if (token.type != TOKEN_SQCLOSE) {
|
14569 | node.rlist[1] = this.parse_expr1();
|
14570 | }
|
14571 | var token = this.tokenizer.get();
|
14572 | if (token.type != TOKEN_SQCLOSE) {
|
14573 | throw Err(viml_printf("unexpected token: %s", token.value), token.pos);
|
14574 | }
|
14575 | }
|
14576 | else {
|
14577 | var right = this.parse_expr1();
|
14578 | if (this.tokenizer.peek().type == TOKEN_COLON) {
|
14579 | this.tokenizer.get();
|
14580 | var node = Node(NODE_SLICE);
|
14581 | node.pos = npos;
|
14582 | node.left = left;
|
14583 | node.rlist = [right, NIL];
|
14584 | var token = this.tokenizer.peek();
|
14585 | if (token.type != TOKEN_SQCLOSE) {
|
14586 | node.rlist[1] = this.parse_expr1();
|
14587 | }
|
14588 | var token = this.tokenizer.get();
|
14589 | if (token.type != TOKEN_SQCLOSE) {
|
14590 | throw Err(viml_printf("unexpected token: %s", token.value), token.pos);
|
14591 | }
|
14592 | }
|
14593 | else {
|
14594 | var node = Node(NODE_SUBSCRIPT);
|
14595 | node.pos = npos;
|
14596 | node.left = left;
|
14597 | node.right = right;
|
14598 | var token = this.tokenizer.get();
|
14599 | if (token.type != TOKEN_SQCLOSE) {
|
14600 | throw Err(viml_printf("unexpected token: %s", token.value), token.pos);
|
14601 | }
|
14602 | }
|
14603 | }
|
14604 | var left = node;
|
14605 | delete node;
|
14606 | }
|
14607 | else if (!iswhite(c) && token.type == TOKEN_DOT) {
|
14608 | var node = this.parse_dot(token, left);
|
14609 | if (node === NIL) {
|
14610 | this.reader.seek_set(pos);
|
14611 | break;
|
14612 | }
|
14613 | var left = node;
|
14614 | delete node;
|
14615 | }
|
14616 | else {
|
14617 | this.reader.seek_set(pos);
|
14618 | break;
|
14619 | }
|
14620 | }
|
14621 | return left;
|
14622 | }
|
14623 |
|
14624 |
|
14625 |
|
14626 |
|
14627 |
|
14628 |
|
14629 | LvalueParser.prototype.parse_lv9 = function() {
|
14630 | var pos = this.reader.tell();
|
14631 | var token = this.tokenizer.get();
|
14632 | var node = Node(-1);
|
14633 | if (token.type == TOKEN_COPEN) {
|
14634 | this.reader.seek_set(pos);
|
14635 | var node = this.parse_identifier();
|
14636 | }
|
14637 | else if (token.type == TOKEN_OPTION) {
|
14638 | var node = Node(NODE_OPTION);
|
14639 | node.pos = token.pos;
|
14640 | node.value = token.value;
|
14641 | }
|
14642 | else if (token.type == TOKEN_IDENTIFIER) {
|
14643 | this.reader.seek_set(pos);
|
14644 | var node = this.parse_identifier();
|
14645 | }
|
14646 | else if (token.type == TOKEN_LT && viml_equalci(this.reader.peekn(4), "SID>")) {
|
14647 | this.reader.seek_set(pos);
|
14648 | var node = this.parse_identifier();
|
14649 | }
|
14650 | else if (token.type == TOKEN_ENV) {
|
14651 | var node = Node(NODE_ENV);
|
14652 | node.pos = token.pos;
|
14653 | node.value = token.value;
|
14654 | }
|
14655 | else if (token.type == TOKEN_REG) {
|
14656 | var node = Node(NODE_REG);
|
14657 | node.pos = token.pos;
|
14658 | node.pos = token.pos;
|
14659 | node.value = token.value;
|
14660 | }
|
14661 | else {
|
14662 | throw Err(viml_printf("unexpected token: %s", token.value), token.pos);
|
14663 | }
|
14664 | return node;
|
14665 | }
|
14666 |
|
14667 | function StringReader() { this.__init__.apply(this, arguments); }
|
14668 | StringReader.prototype.__init__ = function(lines) {
|
14669 | this.buf = [];
|
14670 | this.pos = [];
|
14671 | var lnum = 0;
|
14672 | var offset = 0;
|
14673 | while (lnum < viml_len(lines)) {
|
14674 | var col = 0;
|
14675 | var __c7 = viml_split(lines[lnum], "\\zs");
|
14676 | for (var __i7 = 0; __i7 < __c7.length; ++__i7) {
|
14677 | var c = __c7[__i7];
|
14678 | viml_add(this.buf, c);
|
14679 | viml_add(this.pos, [lnum + 1, col + 1, offset]);
|
14680 | col += viml_len(c);
|
14681 | offset += viml_len(c);
|
14682 | }
|
14683 | while (lnum + 1 < viml_len(lines) && viml_eqregh(lines[lnum + 1], "^\\s*\\\\")) {
|
14684 | var skip = TRUE;
|
14685 | var col = 0;
|
14686 | var __c8 = viml_split(lines[lnum + 1], "\\zs");
|
14687 | for (var __i8 = 0; __i8 < __c8.length; ++__i8) {
|
14688 | var c = __c8[__i8];
|
14689 | if (skip) {
|
14690 | if (c == "\\") {
|
14691 | var skip = FALSE;
|
14692 | }
|
14693 | }
|
14694 | else {
|
14695 | viml_add(this.buf, c);
|
14696 | viml_add(this.pos, [lnum + 2, col + 1, offset]);
|
14697 | }
|
14698 | col += viml_len(c);
|
14699 | offset += viml_len(c);
|
14700 | }
|
14701 | lnum += 1;
|
14702 | offset += 1;
|
14703 | }
|
14704 | viml_add(this.buf, "<EOL>");
|
14705 | viml_add(this.pos, [lnum + 1, col + 1, offset]);
|
14706 | lnum += 1;
|
14707 | offset += 1;
|
14708 | }
|
14709 |
|
14710 | viml_add(this.pos, [lnum + 1, 0, offset]);
|
14711 | this.i = 0;
|
14712 | }
|
14713 |
|
14714 | StringReader.prototype.eof = function() {
|
14715 | return this.i >= viml_len(this.buf);
|
14716 | }
|
14717 |
|
14718 | StringReader.prototype.tell = function() {
|
14719 | return this.i;
|
14720 | }
|
14721 |
|
14722 | StringReader.prototype.seek_set = function(i) {
|
14723 | this.i = i;
|
14724 | }
|
14725 |
|
14726 | StringReader.prototype.seek_cur = function(i) {
|
14727 | this.i = this.i + i;
|
14728 | }
|
14729 |
|
14730 | StringReader.prototype.seek_end = function(i) {
|
14731 | this.i = viml_len(this.buf) + i;
|
14732 | }
|
14733 |
|
14734 | StringReader.prototype.p = function(i) {
|
14735 | if (this.i >= viml_len(this.buf)) {
|
14736 | return "<EOF>";
|
14737 | }
|
14738 | return this.buf[this.i + i];
|
14739 | }
|
14740 |
|
14741 | StringReader.prototype.peek = function() {
|
14742 | if (this.i >= viml_len(this.buf)) {
|
14743 | return "<EOF>";
|
14744 | }
|
14745 | return this.buf[this.i];
|
14746 | }
|
14747 |
|
14748 | StringReader.prototype.get = function() {
|
14749 | if (this.i >= viml_len(this.buf)) {
|
14750 | return "<EOF>";
|
14751 | }
|
14752 | this.i += 1;
|
14753 | return this.buf[this.i - 1];
|
14754 | }
|
14755 |
|
14756 | StringReader.prototype.peekn = function(n) {
|
14757 | var pos = this.tell();
|
14758 | var r = this.getn(n);
|
14759 | this.seek_set(pos);
|
14760 | return r;
|
14761 | }
|
14762 |
|
14763 | StringReader.prototype.getn = function(n) {
|
14764 | var r = "";
|
14765 | var j = 0;
|
14766 | while (this.i < viml_len(this.buf) && (n < 0 || j < n)) {
|
14767 | var c = this.buf[this.i];
|
14768 | if (c == "<EOL>") {
|
14769 | break;
|
14770 | }
|
14771 | r += c;
|
14772 | this.i += 1;
|
14773 | j += 1;
|
14774 | }
|
14775 | return r;
|
14776 | }
|
14777 |
|
14778 | StringReader.prototype.peekline = function() {
|
14779 | return this.peekn(-1);
|
14780 | }
|
14781 |
|
14782 | StringReader.prototype.readline = function() {
|
14783 | var r = this.getn(-1);
|
14784 | this.get();
|
14785 | return r;
|
14786 | }
|
14787 |
|
14788 | StringReader.prototype.getstr = function(begin, end) {
|
14789 | var r = "";
|
14790 | var __c9 = viml_range(begin.i, end.i - 1);
|
14791 | for (var __i9 = 0; __i9 < __c9.length; ++__i9) {
|
14792 | var i = __c9[__i9];
|
14793 | if (i >= viml_len(this.buf)) {
|
14794 | break;
|
14795 | }
|
14796 | var c = this.buf[i];
|
14797 | if (c == "<EOL>") {
|
14798 | var c = "\n";
|
14799 | }
|
14800 | r += c;
|
14801 | }
|
14802 | return r;
|
14803 | }
|
14804 |
|
14805 | StringReader.prototype.getpos = function() {
|
14806 | var __tmp = this.pos[this.i];
|
14807 | var lnum = __tmp[0];
|
14808 | var col = __tmp[1];
|
14809 | var offset = __tmp[2];
|
14810 | return {"i":this.i, "lnum":lnum, "col":col, "offset":offset};
|
14811 | }
|
14812 |
|
14813 | StringReader.prototype.setpos = function(pos) {
|
14814 | this.i = pos.i;
|
14815 | }
|
14816 |
|
14817 | StringReader.prototype.read_alpha = function() {
|
14818 | var r = "";
|
14819 | while (isalpha(this.peekn(1))) {
|
14820 | r += this.getn(1);
|
14821 | }
|
14822 | return r;
|
14823 | }
|
14824 |
|
14825 | StringReader.prototype.read_alnum = function() {
|
14826 | var r = "";
|
14827 | while (isalnum(this.peekn(1))) {
|
14828 | r += this.getn(1);
|
14829 | }
|
14830 | return r;
|
14831 | }
|
14832 |
|
14833 | StringReader.prototype.read_digit = function() {
|
14834 | var r = "";
|
14835 | while (isdigit(this.peekn(1))) {
|
14836 | r += this.getn(1);
|
14837 | }
|
14838 | return r;
|
14839 | }
|
14840 |
|
14841 | StringReader.prototype.read_odigit = function() {
|
14842 | var r = "";
|
14843 | while (isodigit(this.peekn(1))) {
|
14844 | r += this.getn(1);
|
14845 | }
|
14846 | return r;
|
14847 | }
|
14848 |
|
14849 | StringReader.prototype.read_blob = function() {
|
14850 | var r = "";
|
14851 | while (1) {
|
14852 | var s = this.peekn(2);
|
14853 | if (viml_eqregh(s, "^[0-9A-Fa-f][0-9A-Fa-f]$")) {
|
14854 | r += this.getn(2);
|
14855 | }
|
14856 | else if (viml_eqregh(s, "^\\.[0-9A-Fa-f]$")) {
|
14857 | r += this.getn(1);
|
14858 | }
|
14859 | else if (viml_eqregh(s, "^[0-9A-Fa-f][^0-9A-Fa-f]$")) {
|
14860 | throw Err("E973: Blob literal should have an even number of hex characters:" + s, this.getpos());
|
14861 | }
|
14862 | else {
|
14863 | break;
|
14864 | }
|
14865 | }
|
14866 | return r;
|
14867 | }
|
14868 |
|
14869 | StringReader.prototype.read_xdigit = function() {
|
14870 | var r = "";
|
14871 | while (isxdigit(this.peekn(1))) {
|
14872 | r += this.getn(1);
|
14873 | }
|
14874 | return r;
|
14875 | }
|
14876 |
|
14877 | StringReader.prototype.read_bdigit = function() {
|
14878 | var r = "";
|
14879 | while (this.peekn(1) == "0" || this.peekn(1) == "1") {
|
14880 | r += this.getn(1);
|
14881 | }
|
14882 | return r;
|
14883 | }
|
14884 |
|
14885 | StringReader.prototype.read_integer = function() {
|
14886 | var r = "";
|
14887 | var c = this.peekn(1);
|
14888 | if (c == "-" || c == "+") {
|
14889 | var r = this.getn(1);
|
14890 | }
|
14891 | return r + this.read_digit();
|
14892 | }
|
14893 |
|
14894 | StringReader.prototype.read_word = function() {
|
14895 | var r = "";
|
14896 | while (iswordc(this.peekn(1))) {
|
14897 | r += this.getn(1);
|
14898 | }
|
14899 | return r;
|
14900 | }
|
14901 |
|
14902 | StringReader.prototype.read_white = function() {
|
14903 | var r = "";
|
14904 | while (iswhite(this.peekn(1))) {
|
14905 | r += this.getn(1);
|
14906 | }
|
14907 | return r;
|
14908 | }
|
14909 |
|
14910 | StringReader.prototype.read_nonwhite = function() {
|
14911 | var r = "";
|
14912 | var ch = this.peekn(1);
|
14913 | while (!iswhite(ch) && ch != "") {
|
14914 | r += this.getn(1);
|
14915 | var ch = this.peekn(1);
|
14916 | }
|
14917 | return r;
|
14918 | }
|
14919 |
|
14920 | StringReader.prototype.read_name = function() {
|
14921 | var r = "";
|
14922 | while (isnamec(this.peekn(1))) {
|
14923 | r += this.getn(1);
|
14924 | }
|
14925 | return r;
|
14926 | }
|
14927 |
|
14928 | StringReader.prototype.skip_white = function() {
|
14929 | while (iswhite(this.peekn(1))) {
|
14930 | this.seek_cur(1);
|
14931 | }
|
14932 | }
|
14933 |
|
14934 | StringReader.prototype.skip_white_and_colon = function() {
|
14935 | while (TRUE) {
|
14936 | var c = this.peekn(1);
|
14937 | if (!iswhite(c) && c != ":") {
|
14938 | break;
|
14939 | }
|
14940 | this.seek_cur(1);
|
14941 | }
|
14942 | }
|
14943 |
|
14944 | function Compiler() { this.__init__.apply(this, arguments); }
|
14945 | Compiler.prototype.__init__ = function() {
|
14946 | this.indent = [""];
|
14947 | this.lines = [];
|
14948 | }
|
14949 |
|
14950 | Compiler.prototype.out = function() {
|
14951 | var a000 = Array.prototype.slice.call(arguments, 0);
|
14952 | if (viml_len(a000) == 1) {
|
14953 | if (a000[0][0] == ")") {
|
14954 | this.lines[this.lines.length - 1] += a000[0];
|
14955 | }
|
14956 | else {
|
14957 | viml_add(this.lines, this.indent[0] + a000[0]);
|
14958 | }
|
14959 | }
|
14960 | else {
|
14961 | viml_add(this.lines, this.indent[0] + viml_printf.apply(null, a000));
|
14962 | }
|
14963 | }
|
14964 |
|
14965 | Compiler.prototype.incindent = function(s) {
|
14966 | viml_insert(this.indent, this.indent[0] + s);
|
14967 | }
|
14968 |
|
14969 | Compiler.prototype.decindent = function() {
|
14970 | viml_remove(this.indent, 0);
|
14971 | }
|
14972 |
|
14973 | Compiler.prototype.compile = function(node) {
|
14974 | if (node.type == NODE_TOPLEVEL) {
|
14975 | return this.compile_toplevel(node);
|
14976 | }
|
14977 | else if (node.type == NODE_COMMENT) {
|
14978 | this.compile_comment(node);
|
14979 | return NIL;
|
14980 | }
|
14981 | else if (node.type == NODE_EXCMD) {
|
14982 | this.compile_excmd(node);
|
14983 | return NIL;
|
14984 | }
|
14985 | else if (node.type == NODE_FUNCTION) {
|
14986 | this.compile_function(node);
|
14987 | return NIL;
|
14988 | }
|
14989 | else if (node.type == NODE_DELFUNCTION) {
|
14990 | this.compile_delfunction(node);
|
14991 | return NIL;
|
14992 | }
|
14993 | else if (node.type == NODE_RETURN) {
|
14994 | this.compile_return(node);
|
14995 | return NIL;
|
14996 | }
|
14997 | else if (node.type == NODE_EXCALL) {
|
14998 | this.compile_excall(node);
|
14999 | return NIL;
|
15000 | }
|
15001 | else if (node.type == NODE_EVAL) {
|
15002 | this.compile_eval(node);
|
15003 | return NIL;
|
15004 | }
|
15005 | else if (node.type == NODE_LET) {
|
15006 | this.compile_let(node);
|
15007 | return NIL;
|
15008 | }
|
15009 | else if (node.type == NODE_CONST) {
|
15010 | this.compile_const(node);
|
15011 | return NIL;
|
15012 | }
|
15013 | else if (node.type == NODE_UNLET) {
|
15014 | this.compile_unlet(node);
|
15015 | return NIL;
|
15016 | }
|
15017 | else if (node.type == NODE_LOCKVAR) {
|
15018 | this.compile_lockvar(node);
|
15019 | return NIL;
|
15020 | }
|
15021 | else if (node.type == NODE_UNLOCKVAR) {
|
15022 | this.compile_unlockvar(node);
|
15023 | return NIL;
|
15024 | }
|
15025 | else if (node.type == NODE_IF) {
|
15026 | this.compile_if(node);
|
15027 | return NIL;
|
15028 | }
|
15029 | else if (node.type == NODE_WHILE) {
|
15030 | this.compile_while(node);
|
15031 | return NIL;
|
15032 | }
|
15033 | else if (node.type == NODE_FOR) {
|
15034 | this.compile_for(node);
|
15035 | return NIL;
|
15036 | }
|
15037 | else if (node.type == NODE_CONTINUE) {
|
15038 | this.compile_continue(node);
|
15039 | return NIL;
|
15040 | }
|
15041 | else if (node.type == NODE_BREAK) {
|
15042 | this.compile_break(node);
|
15043 | return NIL;
|
15044 | }
|
15045 | else if (node.type == NODE_TRY) {
|
15046 | this.compile_try(node);
|
15047 | return NIL;
|
15048 | }
|
15049 | else if (node.type == NODE_THROW) {
|
15050 | this.compile_throw(node);
|
15051 | return NIL;
|
15052 | }
|
15053 | else if (node.type == NODE_ECHO) {
|
15054 | this.compile_echo(node);
|
15055 | return NIL;
|
15056 | }
|
15057 | else if (node.type == NODE_ECHON) {
|
15058 | this.compile_echon(node);
|
15059 | return NIL;
|
15060 | }
|
15061 | else if (node.type == NODE_ECHOHL) {
|
15062 | this.compile_echohl(node);
|
15063 | return NIL;
|
15064 | }
|
15065 | else if (node.type == NODE_ECHOMSG) {
|
15066 | this.compile_echomsg(node);
|
15067 | return NIL;
|
15068 | }
|
15069 | else if (node.type == NODE_ECHOERR) {
|
15070 | this.compile_echoerr(node);
|
15071 | return NIL;
|
15072 | }
|
15073 | else if (node.type == NODE_EXECUTE) {
|
15074 | this.compile_execute(node);
|
15075 | return NIL;
|
15076 | }
|
15077 | else if (node.type == NODE_TERNARY) {
|
15078 | return this.compile_ternary(node);
|
15079 | }
|
15080 | else if (node.type == NODE_OR) {
|
15081 | return this.compile_or(node);
|
15082 | }
|
15083 | else if (node.type == NODE_AND) {
|
15084 | return this.compile_and(node);
|
15085 | }
|
15086 | else if (node.type == NODE_EQUAL) {
|
15087 | return this.compile_equal(node);
|
15088 | }
|
15089 | else if (node.type == NODE_EQUALCI) {
|
15090 | return this.compile_equalci(node);
|
15091 | }
|
15092 | else if (node.type == NODE_EQUALCS) {
|
15093 | return this.compile_equalcs(node);
|
15094 | }
|
15095 | else if (node.type == NODE_NEQUAL) {
|
15096 | return this.compile_nequal(node);
|
15097 | }
|
15098 | else if (node.type == NODE_NEQUALCI) {
|
15099 | return this.compile_nequalci(node);
|
15100 | }
|
15101 | else if (node.type == NODE_NEQUALCS) {
|
15102 | return this.compile_nequalcs(node);
|
15103 | }
|
15104 | else if (node.type == NODE_GREATER) {
|
15105 | return this.compile_greater(node);
|
15106 | }
|
15107 | else if (node.type == NODE_GREATERCI) {
|
15108 | return this.compile_greaterci(node);
|
15109 | }
|
15110 | else if (node.type == NODE_GREATERCS) {
|
15111 | return this.compile_greatercs(node);
|
15112 | }
|
15113 | else if (node.type == NODE_GEQUAL) {
|
15114 | return this.compile_gequal(node);
|
15115 | }
|
15116 | else if (node.type == NODE_GEQUALCI) {
|
15117 | return this.compile_gequalci(node);
|
15118 | }
|
15119 | else if (node.type == NODE_GEQUALCS) {
|
15120 | return this.compile_gequalcs(node);
|
15121 | }
|
15122 | else if (node.type == NODE_SMALLER) {
|
15123 | return this.compile_smaller(node);
|
15124 | }
|
15125 | else if (node.type == NODE_SMALLERCI) {
|
15126 | return this.compile_smallerci(node);
|
15127 | }
|
15128 | else if (node.type == NODE_SMALLERCS) {
|
15129 | return this.compile_smallercs(node);
|
15130 | }
|
15131 | else if (node.type == NODE_SEQUAL) {
|
15132 | return this.compile_sequal(node);
|
15133 | }
|
15134 | else if (node.type == NODE_SEQUALCI) {
|
15135 | return this.compile_sequalci(node);
|
15136 | }
|
15137 | else if (node.type == NODE_SEQUALCS) {
|
15138 | return this.compile_sequalcs(node);
|
15139 | }
|
15140 | else if (node.type == NODE_MATCH) {
|
15141 | return this.compile_match(node);
|
15142 | }
|
15143 | else if (node.type == NODE_MATCHCI) {
|
15144 | return this.compile_matchci(node);
|
15145 | }
|
15146 | else if (node.type == NODE_MATCHCS) {
|
15147 | return this.compile_matchcs(node);
|
15148 | }
|
15149 | else if (node.type == NODE_NOMATCH) {
|
15150 | return this.compile_nomatch(node);
|
15151 | }
|
15152 | else if (node.type == NODE_NOMATCHCI) {
|
15153 | return this.compile_nomatchci(node);
|
15154 | }
|
15155 | else if (node.type == NODE_NOMATCHCS) {
|
15156 | return this.compile_nomatchcs(node);
|
15157 | }
|
15158 | else if (node.type == NODE_IS) {
|
15159 | return this.compile_is(node);
|
15160 | }
|
15161 | else if (node.type == NODE_ISCI) {
|
15162 | return this.compile_isci(node);
|
15163 | }
|
15164 | else if (node.type == NODE_ISCS) {
|
15165 | return this.compile_iscs(node);
|
15166 | }
|
15167 | else if (node.type == NODE_ISNOT) {
|
15168 | return this.compile_isnot(node);
|
15169 | }
|
15170 | else if (node.type == NODE_ISNOTCI) {
|
15171 | return this.compile_isnotci(node);
|
15172 | }
|
15173 | else if (node.type == NODE_ISNOTCS) {
|
15174 | return this.compile_isnotcs(node);
|
15175 | }
|
15176 | else if (node.type == NODE_ADD) {
|
15177 | return this.compile_add(node);
|
15178 | }
|
15179 | else if (node.type == NODE_SUBTRACT) {
|
15180 | return this.compile_subtract(node);
|
15181 | }
|
15182 | else if (node.type == NODE_CONCAT) {
|
15183 | return this.compile_concat(node);
|
15184 | }
|
15185 | else if (node.type == NODE_MULTIPLY) {
|
15186 | return this.compile_multiply(node);
|
15187 | }
|
15188 | else if (node.type == NODE_DIVIDE) {
|
15189 | return this.compile_divide(node);
|
15190 | }
|
15191 | else if (node.type == NODE_REMAINDER) {
|
15192 | return this.compile_remainder(node);
|
15193 | }
|
15194 | else if (node.type == NODE_NOT) {
|
15195 | return this.compile_not(node);
|
15196 | }
|
15197 | else if (node.type == NODE_PLUS) {
|
15198 | return this.compile_plus(node);
|
15199 | }
|
15200 | else if (node.type == NODE_MINUS) {
|
15201 | return this.compile_minus(node);
|
15202 | }
|
15203 | else if (node.type == NODE_SUBSCRIPT) {
|
15204 | return this.compile_subscript(node);
|
15205 | }
|
15206 | else if (node.type == NODE_SLICE) {
|
15207 | return this.compile_slice(node);
|
15208 | }
|
15209 | else if (node.type == NODE_DOT) {
|
15210 | return this.compile_dot(node);
|
15211 | }
|
15212 | else if (node.type == NODE_METHOD) {
|
15213 | return this.compile_method(node);
|
15214 | }
|
15215 | else if (node.type == NODE_CALL) {
|
15216 | return this.compile_call(node);
|
15217 | }
|
15218 | else if (node.type == NODE_NUMBER) {
|
15219 | return this.compile_number(node);
|
15220 | }
|
15221 | else if (node.type == NODE_BLOB) {
|
15222 | return this.compile_blob(node);
|
15223 | }
|
15224 | else if (node.type == NODE_STRING) {
|
15225 | return this.compile_string(node);
|
15226 | }
|
15227 | else if (node.type == NODE_LIST) {
|
15228 | return this.compile_list(node);
|
15229 | }
|
15230 | else if (node.type == NODE_DICT) {
|
15231 | return this.compile_dict(node);
|
15232 | }
|
15233 | else if (node.type == NODE_OPTION) {
|
15234 | return this.compile_option(node);
|
15235 | }
|
15236 | else if (node.type == NODE_IDENTIFIER) {
|
15237 | return this.compile_identifier(node);
|
15238 | }
|
15239 | else if (node.type == NODE_CURLYNAME) {
|
15240 | return this.compile_curlyname(node);
|
15241 | }
|
15242 | else if (node.type == NODE_ENV) {
|
15243 | return this.compile_env(node);
|
15244 | }
|
15245 | else if (node.type == NODE_REG) {
|
15246 | return this.compile_reg(node);
|
15247 | }
|
15248 | else if (node.type == NODE_CURLYNAMEPART) {
|
15249 | return this.compile_curlynamepart(node);
|
15250 | }
|
15251 | else if (node.type == NODE_CURLYNAMEEXPR) {
|
15252 | return this.compile_curlynameexpr(node);
|
15253 | }
|
15254 | else if (node.type == NODE_LAMBDA) {
|
15255 | return this.compile_lambda(node);
|
15256 | }
|
15257 | else if (node.type == NODE_HEREDOC) {
|
15258 | return this.compile_heredoc(node);
|
15259 | }
|
15260 | else {
|
15261 | throw viml_printf("Compiler: unknown node: %s", viml_string(node));
|
15262 | }
|
15263 | return NIL;
|
15264 | }
|
15265 |
|
15266 | Compiler.prototype.compile_body = function(body) {
|
15267 | var __c10 = body;
|
15268 | for (var __i10 = 0; __i10 < __c10.length; ++__i10) {
|
15269 | var node = __c10[__i10];
|
15270 | this.compile(node);
|
15271 | }
|
15272 | }
|
15273 |
|
15274 | Compiler.prototype.compile_toplevel = function(node) {
|
15275 | this.compile_body(node.body);
|
15276 | return this.lines;
|
15277 | }
|
15278 |
|
15279 | Compiler.prototype.compile_comment = function(node) {
|
15280 | this.out(";%s", node.str);
|
15281 | }
|
15282 |
|
15283 | Compiler.prototype.compile_excmd = function(node) {
|
15284 | this.out("(excmd \"%s\")", viml_escape(node.str, "\\\""));
|
15285 | }
|
15286 |
|
15287 | Compiler.prototype.compile_function = function(node) {
|
15288 | var left = this.compile(node.left);
|
15289 | var rlist = node.rlist.map((function(vval) { return this.compile(vval); }).bind(this));
|
15290 | var default_args = node.default_args.map((function(vval) { return this.compile(vval); }).bind(this));
|
15291 | if (!viml_empty(rlist)) {
|
15292 | var remaining = FALSE;
|
15293 | if (rlist[rlist.length - 1] == "...") {
|
15294 | viml_remove(rlist, -1);
|
15295 | var remaining = TRUE;
|
15296 | }
|
15297 | var __c11 = viml_range(viml_len(rlist));
|
15298 | for (var __i11 = 0; __i11 < __c11.length; ++__i11) {
|
15299 | var i = __c11[__i11];
|
15300 | if (i < viml_len(rlist) - viml_len(default_args)) {
|
15301 | left += viml_printf(" %s", rlist[i]);
|
15302 | }
|
15303 | else {
|
15304 | left += viml_printf(" (%s %s)", rlist[i], default_args[i + viml_len(default_args) - viml_len(rlist)]);
|
15305 | }
|
15306 | }
|
15307 | if (remaining) {
|
15308 | left += " . ...";
|
15309 | }
|
15310 | }
|
15311 | this.out("(function (%s)", left);
|
15312 | this.incindent(" ");
|
15313 | this.compile_body(node.body);
|
15314 | this.out(")");
|
15315 | this.decindent();
|
15316 | }
|
15317 |
|
15318 | Compiler.prototype.compile_delfunction = function(node) {
|
15319 | this.out("(delfunction %s)", this.compile(node.left));
|
15320 | }
|
15321 |
|
15322 | Compiler.prototype.compile_return = function(node) {
|
15323 | if (node.left === NIL) {
|
15324 | this.out("(return)");
|
15325 | }
|
15326 | else {
|
15327 | this.out("(return %s)", this.compile(node.left));
|
15328 | }
|
15329 | }
|
15330 |
|
15331 | Compiler.prototype.compile_excall = function(node) {
|
15332 | this.out("(call %s)", this.compile(node.left));
|
15333 | }
|
15334 |
|
15335 | Compiler.prototype.compile_eval = function(node) {
|
15336 | this.out("(eval %s)", this.compile(node.left));
|
15337 | }
|
15338 |
|
15339 | Compiler.prototype.compile_let = function(node) {
|
15340 | var left = "";
|
15341 | if (node.left !== NIL) {
|
15342 | var left = this.compile(node.left);
|
15343 | }
|
15344 | else {
|
15345 | var left = viml_join(node.list.map((function(vval) { return this.compile(vval); }).bind(this)), " ");
|
15346 | if (node.rest !== NIL) {
|
15347 | left += " . " + this.compile(node.rest);
|
15348 | }
|
15349 | var left = "(" + left + ")";
|
15350 | }
|
15351 | var right = this.compile(node.right);
|
15352 | this.out("(let %s %s %s)", node.op, left, right);
|
15353 | }
|
15354 |
|
15355 |
|
15356 | Compiler.prototype.compile_const = function(node) {
|
15357 | var left = "";
|
15358 | if (node.left !== NIL) {
|
15359 | var left = this.compile(node.left);
|
15360 | }
|
15361 | else {
|
15362 | var left = viml_join(node.list.map((function(vval) { return this.compile(vval); }).bind(this)), " ");
|
15363 | if (node.rest !== NIL) {
|
15364 | left += " . " + this.compile(node.rest);
|
15365 | }
|
15366 | var left = "(" + left + ")";
|
15367 | }
|
15368 | var right = this.compile(node.right);
|
15369 | this.out("(const %s %s %s)", node.op, left, right);
|
15370 | }
|
15371 |
|
15372 | Compiler.prototype.compile_unlet = function(node) {
|
15373 | var list = node.list.map((function(vval) { return this.compile(vval); }).bind(this));
|
15374 | this.out("(unlet %s)", viml_join(list, " "));
|
15375 | }
|
15376 |
|
15377 | Compiler.prototype.compile_lockvar = function(node) {
|
15378 | var list = node.list.map((function(vval) { return this.compile(vval); }).bind(this));
|
15379 | if (node.depth === NIL) {
|
15380 | this.out("(lockvar %s)", viml_join(list, " "));
|
15381 | }
|
15382 | else {
|
15383 | this.out("(lockvar %s %s)", node.depth, viml_join(list, " "));
|
15384 | }
|
15385 | }
|
15386 |
|
15387 | Compiler.prototype.compile_unlockvar = function(node) {
|
15388 | var list = node.list.map((function(vval) { return this.compile(vval); }).bind(this));
|
15389 | if (node.depth === NIL) {
|
15390 | this.out("(unlockvar %s)", viml_join(list, " "));
|
15391 | }
|
15392 | else {
|
15393 | this.out("(unlockvar %s %s)", node.depth, viml_join(list, " "));
|
15394 | }
|
15395 | }
|
15396 |
|
15397 | Compiler.prototype.compile_if = function(node) {
|
15398 | this.out("(if %s", this.compile(node.cond));
|
15399 | this.incindent(" ");
|
15400 | this.compile_body(node.body);
|
15401 | this.decindent();
|
15402 | var __c12 = node.elseif;
|
15403 | for (var __i12 = 0; __i12 < __c12.length; ++__i12) {
|
15404 | var enode = __c12[__i12];
|
15405 | this.out(" elseif %s", this.compile(enode.cond));
|
15406 | this.incindent(" ");
|
15407 | this.compile_body(enode.body);
|
15408 | this.decindent();
|
15409 | }
|
15410 | if (node._else !== NIL) {
|
15411 | this.out(" else");
|
15412 | this.incindent(" ");
|
15413 | this.compile_body(node._else.body);
|
15414 | this.decindent();
|
15415 | }
|
15416 | this.incindent(" ");
|
15417 | this.out(")");
|
15418 | this.decindent();
|
15419 | }
|
15420 |
|
15421 | Compiler.prototype.compile_while = function(node) {
|
15422 | this.out("(while %s", this.compile(node.cond));
|
15423 | this.incindent(" ");
|
15424 | this.compile_body(node.body);
|
15425 | this.out(")");
|
15426 | this.decindent();
|
15427 | }
|
15428 |
|
15429 | Compiler.prototype.compile_for = function(node) {
|
15430 | var left = "";
|
15431 | if (node.left !== NIL) {
|
15432 | var left = this.compile(node.left);
|
15433 | }
|
15434 | else {
|
15435 | var left = viml_join(node.list.map((function(vval) { return this.compile(vval); }).bind(this)), " ");
|
15436 | if (node.rest !== NIL) {
|
15437 | left += " . " + this.compile(node.rest);
|
15438 | }
|
15439 | var left = "(" + left + ")";
|
15440 | }
|
15441 | var right = this.compile(node.right);
|
15442 | this.out("(for %s %s", left, right);
|
15443 | this.incindent(" ");
|
15444 | this.compile_body(node.body);
|
15445 | this.out(")");
|
15446 | this.decindent();
|
15447 | }
|
15448 |
|
15449 | Compiler.prototype.compile_continue = function(node) {
|
15450 | this.out("(continue)");
|
15451 | }
|
15452 |
|
15453 | Compiler.prototype.compile_break = function(node) {
|
15454 | this.out("(break)");
|
15455 | }
|
15456 |
|
15457 | Compiler.prototype.compile_try = function(node) {
|
15458 | this.out("(try");
|
15459 | this.incindent(" ");
|
15460 | this.compile_body(node.body);
|
15461 | var __c13 = node.catch;
|
15462 | for (var __i13 = 0; __i13 < __c13.length; ++__i13) {
|
15463 | var cnode = __c13[__i13];
|
15464 | if (cnode.pattern !== NIL) {
|
15465 | this.decindent();
|
15466 | this.out(" catch /%s/", cnode.pattern);
|
15467 | this.incindent(" ");
|
15468 | this.compile_body(cnode.body);
|
15469 | }
|
15470 | else {
|
15471 | this.decindent();
|
15472 | this.out(" catch");
|
15473 | this.incindent(" ");
|
15474 | this.compile_body(cnode.body);
|
15475 | }
|
15476 | }
|
15477 | if (node._finally !== NIL) {
|
15478 | this.decindent();
|
15479 | this.out(" finally");
|
15480 | this.incindent(" ");
|
15481 | this.compile_body(node._finally.body);
|
15482 | }
|
15483 | this.out(")");
|
15484 | this.decindent();
|
15485 | }
|
15486 |
|
15487 | Compiler.prototype.compile_throw = function(node) {
|
15488 | this.out("(throw %s)", this.compile(node.left));
|
15489 | }
|
15490 |
|
15491 | Compiler.prototype.compile_echo = function(node) {
|
15492 | var list = node.list.map((function(vval) { return this.compile(vval); }).bind(this));
|
15493 | this.out("(echo %s)", viml_join(list, " "));
|
15494 | }
|
15495 |
|
15496 | Compiler.prototype.compile_echon = function(node) {
|
15497 | var list = node.list.map((function(vval) { return this.compile(vval); }).bind(this));
|
15498 | this.out("(echon %s)", viml_join(list, " "));
|
15499 | }
|
15500 |
|
15501 | Compiler.prototype.compile_echohl = function(node) {
|
15502 | this.out("(echohl \"%s\")", viml_escape(node.str, "\\\""));
|
15503 | }
|
15504 |
|
15505 | Compiler.prototype.compile_echomsg = function(node) {
|
15506 | var list = node.list.map((function(vval) { return this.compile(vval); }).bind(this));
|
15507 | this.out("(echomsg %s)", viml_join(list, " "));
|
15508 | }
|
15509 |
|
15510 | Compiler.prototype.compile_echoerr = function(node) {
|
15511 | var list = node.list.map((function(vval) { return this.compile(vval); }).bind(this));
|
15512 | this.out("(echoerr %s)", viml_join(list, " "));
|
15513 | }
|
15514 |
|
15515 | Compiler.prototype.compile_execute = function(node) {
|
15516 | var list = node.list.map((function(vval) { return this.compile(vval); }).bind(this));
|
15517 | this.out("(execute %s)", viml_join(list, " "));
|
15518 | }
|
15519 |
|
15520 | Compiler.prototype.compile_ternary = function(node) {
|
15521 | return viml_printf("(?: %s %s %s)", this.compile(node.cond), this.compile(node.left), this.compile(node.right));
|
15522 | }
|
15523 |
|
15524 | Compiler.prototype.compile_or = function(node) {
|
15525 | return viml_printf("(|| %s %s)", this.compile(node.left), this.compile(node.right));
|
15526 | }
|
15527 |
|
15528 | Compiler.prototype.compile_and = function(node) {
|
15529 | return viml_printf("(&& %s %s)", this.compile(node.left), this.compile(node.right));
|
15530 | }
|
15531 |
|
15532 | Compiler.prototype.compile_equal = function(node) {
|
15533 | return viml_printf("(== %s %s)", this.compile(node.left), this.compile(node.right));
|
15534 | }
|
15535 |
|
15536 | Compiler.prototype.compile_equalci = function(node) {
|
15537 | return viml_printf("(==? %s %s)", this.compile(node.left), this.compile(node.right));
|
15538 | }
|
15539 |
|
15540 | Compiler.prototype.compile_equalcs = function(node) {
|
15541 | return viml_printf("(==# %s %s)", this.compile(node.left), this.compile(node.right));
|
15542 | }
|
15543 |
|
15544 | Compiler.prototype.compile_nequal = function(node) {
|
15545 | return viml_printf("(!= %s %s)", this.compile(node.left), this.compile(node.right));
|
15546 | }
|
15547 |
|
15548 | Compiler.prototype.compile_nequalci = function(node) {
|
15549 | return viml_printf("(!=? %s %s)", this.compile(node.left), this.compile(node.right));
|
15550 | }
|
15551 |
|
15552 | Compiler.prototype.compile_nequalcs = function(node) {
|
15553 | return viml_printf("(!=# %s %s)", this.compile(node.left), this.compile(node.right));
|
15554 | }
|
15555 |
|
15556 | Compiler.prototype.compile_greater = function(node) {
|
15557 | return viml_printf("(> %s %s)", this.compile(node.left), this.compile(node.right));
|
15558 | }
|
15559 |
|
15560 | Compiler.prototype.compile_greaterci = function(node) {
|
15561 | return viml_printf("(>? %s %s)", this.compile(node.left), this.compile(node.right));
|
15562 | }
|
15563 |
|
15564 | Compiler.prototype.compile_greatercs = function(node) {
|
15565 | return viml_printf("(># %s %s)", this.compile(node.left), this.compile(node.right));
|
15566 | }
|
15567 |
|
15568 | Compiler.prototype.compile_gequal = function(node) {
|
15569 | return viml_printf("(>= %s %s)", this.compile(node.left), this.compile(node.right));
|
15570 | }
|
15571 |
|
15572 | Compiler.prototype.compile_gequalci = function(node) {
|
15573 | return viml_printf("(>=? %s %s)", this.compile(node.left), this.compile(node.right));
|
15574 | }
|
15575 |
|
15576 | Compiler.prototype.compile_gequalcs = function(node) {
|
15577 | return viml_printf("(>=# %s %s)", this.compile(node.left), this.compile(node.right));
|
15578 | }
|
15579 |
|
15580 | Compiler.prototype.compile_smaller = function(node) {
|
15581 | return viml_printf("(< %s %s)", this.compile(node.left), this.compile(node.right));
|
15582 | }
|
15583 |
|
15584 | Compiler.prototype.compile_smallerci = function(node) {
|
15585 | return viml_printf("(<? %s %s)", this.compile(node.left), this.compile(node.right));
|
15586 | }
|
15587 |
|
15588 | Compiler.prototype.compile_smallercs = function(node) {
|
15589 | return viml_printf("(<# %s %s)", this.compile(node.left), this.compile(node.right));
|
15590 | }
|
15591 |
|
15592 | Compiler.prototype.compile_sequal = function(node) {
|
15593 | return viml_printf("(<= %s %s)", this.compile(node.left), this.compile(node.right));
|
15594 | }
|
15595 |
|
15596 | Compiler.prototype.compile_sequalci = function(node) {
|
15597 | return viml_printf("(<=? %s %s)", this.compile(node.left), this.compile(node.right));
|
15598 | }
|
15599 |
|
15600 | Compiler.prototype.compile_sequalcs = function(node) {
|
15601 | return viml_printf("(<=# %s %s)", this.compile(node.left), this.compile(node.right));
|
15602 | }
|
15603 |
|
15604 | Compiler.prototype.compile_match = function(node) {
|
15605 | return viml_printf("(=~ %s %s)", this.compile(node.left), this.compile(node.right));
|
15606 | }
|
15607 |
|
15608 | Compiler.prototype.compile_matchci = function(node) {
|
15609 | return viml_printf("(=~? %s %s)", this.compile(node.left), this.compile(node.right));
|
15610 | }
|
15611 |
|
15612 | Compiler.prototype.compile_matchcs = function(node) {
|
15613 | return viml_printf("(=~# %s %s)", this.compile(node.left), this.compile(node.right));
|
15614 | }
|
15615 |
|
15616 | Compiler.prototype.compile_nomatch = function(node) {
|
15617 | return viml_printf("(!~ %s %s)", this.compile(node.left), this.compile(node.right));
|
15618 | }
|
15619 |
|
15620 | Compiler.prototype.compile_nomatchci = function(node) {
|
15621 | return viml_printf("(!~? %s %s)", this.compile(node.left), this.compile(node.right));
|
15622 | }
|
15623 |
|
15624 | Compiler.prototype.compile_nomatchcs = function(node) {
|
15625 | return viml_printf("(!~# %s %s)", this.compile(node.left), this.compile(node.right));
|
15626 | }
|
15627 |
|
15628 | Compiler.prototype.compile_is = function(node) {
|
15629 | return viml_printf("(is %s %s)", this.compile(node.left), this.compile(node.right));
|
15630 | }
|
15631 |
|
15632 | Compiler.prototype.compile_isci = function(node) {
|
15633 | return viml_printf("(is? %s %s)", this.compile(node.left), this.compile(node.right));
|
15634 | }
|
15635 |
|
15636 | Compiler.prototype.compile_iscs = function(node) {
|
15637 | return viml_printf("(is# %s %s)", this.compile(node.left), this.compile(node.right));
|
15638 | }
|
15639 |
|
15640 | Compiler.prototype.compile_isnot = function(node) {
|
15641 | return viml_printf("(isnot %s %s)", this.compile(node.left), this.compile(node.right));
|
15642 | }
|
15643 |
|
15644 | Compiler.prototype.compile_isnotci = function(node) {
|
15645 | return viml_printf("(isnot? %s %s)", this.compile(node.left), this.compile(node.right));
|
15646 | }
|
15647 |
|
15648 | Compiler.prototype.compile_isnotcs = function(node) {
|
15649 | return viml_printf("(isnot# %s %s)", this.compile(node.left), this.compile(node.right));
|
15650 | }
|
15651 |
|
15652 | Compiler.prototype.compile_add = function(node) {
|
15653 | return viml_printf("(+ %s %s)", this.compile(node.left), this.compile(node.right));
|
15654 | }
|
15655 |
|
15656 | Compiler.prototype.compile_subtract = function(node) {
|
15657 | return viml_printf("(- %s %s)", this.compile(node.left), this.compile(node.right));
|
15658 | }
|
15659 |
|
15660 | Compiler.prototype.compile_concat = function(node) {
|
15661 | return viml_printf("(concat %s %s)", this.compile(node.left), this.compile(node.right));
|
15662 | }
|
15663 |
|
15664 | Compiler.prototype.compile_multiply = function(node) {
|
15665 | return viml_printf("(* %s %s)", this.compile(node.left), this.compile(node.right));
|
15666 | }
|
15667 |
|
15668 | Compiler.prototype.compile_divide = function(node) {
|
15669 | return viml_printf("(/ %s %s)", this.compile(node.left), this.compile(node.right));
|
15670 | }
|
15671 |
|
15672 | Compiler.prototype.compile_remainder = function(node) {
|
15673 | return viml_printf("(%% %s %s)", this.compile(node.left), this.compile(node.right));
|
15674 | }
|
15675 |
|
15676 | Compiler.prototype.compile_not = function(node) {
|
15677 | return viml_printf("(! %s)", this.compile(node.left));
|
15678 | }
|
15679 |
|
15680 | Compiler.prototype.compile_plus = function(node) {
|
15681 | return viml_printf("(+ %s)", this.compile(node.left));
|
15682 | }
|
15683 |
|
15684 | Compiler.prototype.compile_minus = function(node) {
|
15685 | return viml_printf("(- %s)", this.compile(node.left));
|
15686 | }
|
15687 |
|
15688 | Compiler.prototype.compile_subscript = function(node) {
|
15689 | return viml_printf("(subscript %s %s)", this.compile(node.left), this.compile(node.right));
|
15690 | }
|
15691 |
|
15692 | Compiler.prototype.compile_slice = function(node) {
|
15693 | var r0 = node.rlist[0] === NIL ? "nil" : this.compile(node.rlist[0]);
|
15694 | var r1 = node.rlist[1] === NIL ? "nil" : this.compile(node.rlist[1]);
|
15695 | return viml_printf("(slice %s %s %s)", this.compile(node.left), r0, r1);
|
15696 | }
|
15697 |
|
15698 | Compiler.prototype.compile_dot = function(node) {
|
15699 | return viml_printf("(dot %s %s)", this.compile(node.left), this.compile(node.right));
|
15700 | }
|
15701 |
|
15702 | Compiler.prototype.compile_method = function(node) {
|
15703 | return viml_printf("(method %s %s)", this.compile(node.left), this.compile(node.right));
|
15704 | }
|
15705 |
|
15706 | Compiler.prototype.compile_call = function(node) {
|
15707 | var rlist = node.rlist.map((function(vval) { return this.compile(vval); }).bind(this));
|
15708 | if (viml_empty(rlist)) {
|
15709 | return viml_printf("(%s)", this.compile(node.left));
|
15710 | }
|
15711 | else {
|
15712 | return viml_printf("(%s %s)", this.compile(node.left), viml_join(rlist, " "));
|
15713 | }
|
15714 | }
|
15715 |
|
15716 | Compiler.prototype.compile_number = function(node) {
|
15717 | return node.value;
|
15718 | }
|
15719 |
|
15720 | Compiler.prototype.compile_blob = function(node) {
|
15721 | return node.value;
|
15722 | }
|
15723 |
|
15724 | Compiler.prototype.compile_string = function(node) {
|
15725 | return node.value;
|
15726 | }
|
15727 |
|
15728 | Compiler.prototype.compile_list = function(node) {
|
15729 | var value = node.value.map((function(vval) { return this.compile(vval); }).bind(this));
|
15730 | if (viml_empty(value)) {
|
15731 | return "(list)";
|
15732 | }
|
15733 | else {
|
15734 | return viml_printf("(list %s)", viml_join(value, " "));
|
15735 | }
|
15736 | }
|
15737 |
|
15738 | Compiler.prototype.compile_dict = function(node) {
|
15739 | var value = node.value.map((function(vval) { return "(" + this.compile(vval[0]) + " " + this.compile(vval[1]) + ")"; }).bind(this));
|
15740 | if (viml_empty(value)) {
|
15741 | return "(dict)";
|
15742 | }
|
15743 | else {
|
15744 | return viml_printf("(dict %s)", viml_join(value, " "));
|
15745 | }
|
15746 | }
|
15747 |
|
15748 | Compiler.prototype.compile_option = function(node) {
|
15749 | return node.value;
|
15750 | }
|
15751 |
|
15752 | Compiler.prototype.compile_identifier = function(node) {
|
15753 | return node.value;
|
15754 | }
|
15755 |
|
15756 | Compiler.prototype.compile_curlyname = function(node) {
|
15757 | return viml_join(node.value.map((function(vval) { return this.compile(vval); }).bind(this)), "");
|
15758 | }
|
15759 |
|
15760 | Compiler.prototype.compile_env = function(node) {
|
15761 | return node.value;
|
15762 | }
|
15763 |
|
15764 | Compiler.prototype.compile_reg = function(node) {
|
15765 | return node.value;
|
15766 | }
|
15767 |
|
15768 | Compiler.prototype.compile_curlynamepart = function(node) {
|
15769 | return node.value;
|
15770 | }
|
15771 |
|
15772 | Compiler.prototype.compile_curlynameexpr = function(node) {
|
15773 | return "{" + this.compile(node.value) + "}";
|
15774 | }
|
15775 |
|
15776 | Compiler.prototype.escape_string = function(str) {
|
15777 | var m = {"\n":"\\n", "\t":"\\t", "\r":"\\r"};
|
15778 | var out = "\"";
|
15779 | var __c14 = viml_range(viml_len(str));
|
15780 | for (var __i14 = 0; __i14 < __c14.length; ++__i14) {
|
15781 | var i = __c14[__i14];
|
15782 | var c = str[i];
|
15783 | if (viml_has_key(m, c)) {
|
15784 | out += m[c];
|
15785 | }
|
15786 | else {
|
15787 | out += c;
|
15788 | }
|
15789 | }
|
15790 | out += "\"";
|
15791 | return out;
|
15792 | }
|
15793 |
|
15794 | Compiler.prototype.compile_lambda = function(node) {
|
15795 | var rlist = node.rlist.map((function(vval) { return this.compile(vval); }).bind(this));
|
15796 | return viml_printf("(lambda (%s) %s)", viml_join(rlist, " "), this.compile(node.left));
|
15797 | }
|
15798 |
|
15799 | Compiler.prototype.compile_heredoc = function(node) {
|
15800 | if (viml_empty(node.rlist)) {
|
15801 | var rlist = "(list)";
|
15802 | }
|
15803 | else {
|
15804 | var rlist = "(list " + viml_join(node.rlist.map((function(vval) { return this.escape_string(vval); }).bind(this)), " ") + ")";
|
15805 | }
|
15806 | if (viml_empty(node.body)) {
|
15807 | var body = "(list)";
|
15808 | }
|
15809 | else {
|
15810 | var body = "(list " + viml_join(node.body.map((function(vval) { return this.escape_string(vval); }).bind(this)), " ") + ")";
|
15811 | }
|
15812 | var op = this.escape_string(node.op);
|
15813 | return viml_printf("(heredoc %s %s %s)", rlist, op, body);
|
15814 | }
|
15815 |
|
15816 |
|
15817 | function RegexpParser() { this.__init__.apply(this, arguments); }
|
15818 | RegexpParser.prototype.RE_VERY_NOMAGIC = 1;
|
15819 | RegexpParser.prototype.RE_NOMAGIC = 2;
|
15820 | RegexpParser.prototype.RE_MAGIC = 3;
|
15821 | RegexpParser.prototype.RE_VERY_MAGIC = 4;
|
15822 | RegexpParser.prototype.__init__ = function(reader, cmd, delim) {
|
15823 | this.reader = reader;
|
15824 | this.cmd = cmd;
|
15825 | this.delim = delim;
|
15826 | this.reg_magic = this.RE_MAGIC;
|
15827 | }
|
15828 |
|
15829 | RegexpParser.prototype.isend = function(c) {
|
15830 | return c == "<EOF>" || c == "<EOL>" || c == this.delim;
|
15831 | }
|
15832 |
|
15833 | RegexpParser.prototype.parse_regexp = function() {
|
15834 | var prevtoken = "";
|
15835 | var ntoken = "";
|
15836 | var ret = [];
|
15837 | if (this.reader.peekn(4) == "\\%#=") {
|
15838 | var epos = this.reader.getpos();
|
15839 | var token = this.reader.getn(5);
|
15840 | if (token != "\\%#=0" && token != "\\%#=1" && token != "\\%#=2") {
|
15841 | throw Err("E864: \\%#= can only be followed by 0, 1, or 2", epos);
|
15842 | }
|
15843 | viml_add(ret, token);
|
15844 | }
|
15845 | while (!this.isend(this.reader.peek())) {
|
15846 | var prevtoken = ntoken;
|
15847 | var __tmp = this.get_token();
|
15848 | var token = __tmp[0];
|
15849 | var ntoken = __tmp[1];
|
15850 | if (ntoken == "\\m") {
|
15851 | this.reg_magic = this.RE_MAGIC;
|
15852 | }
|
15853 | else if (ntoken == "\\M") {
|
15854 | this.reg_magic = this.RE_NOMAGIC;
|
15855 | }
|
15856 | else if (ntoken == "\\v") {
|
15857 | this.reg_magic = this.RE_VERY_MAGIC;
|
15858 | }
|
15859 | else if (ntoken == "\\V") {
|
15860 | this.reg_magic = this.RE_VERY_NOMAGIC;
|
15861 | }
|
15862 | else if (ntoken == "\\*") {
|
15863 |
|
15864 | if (prevtoken == "" || prevtoken == "\\^" || prevtoken == "\\&" || prevtoken == "\\|" || prevtoken == "\\(") {
|
15865 | var ntoken = "*";
|
15866 | }
|
15867 | }
|
15868 | else if (ntoken == "\\^") {
|
15869 |
|
15870 | if (this.reg_magic != this.RE_VERY_MAGIC && prevtoken != "" && prevtoken != "\\&" && prevtoken != "\\|" && prevtoken != "\\n" && prevtoken != "\\(" && prevtoken != "\\%(") {
|
15871 | var ntoken = "^";
|
15872 | }
|
15873 | }
|
15874 | else if (ntoken == "\\$") {
|
15875 |
|
15876 | var pos = this.reader.tell();
|
15877 | if (this.reg_magic != this.RE_VERY_MAGIC) {
|
15878 | while (!this.isend(this.reader.peek())) {
|
15879 | var __tmp = this.get_token();
|
15880 | var t = __tmp[0];
|
15881 | var n = __tmp[1];
|
15882 |
|
15883 | if (n == "\\c" || n == "\\C" || n == "\\m" || n == "\\M" || n == "\\Z") {
|
15884 | continue;
|
15885 | }
|
15886 | if (n != "\\|" && n != "\\&" && n != "\\n" && n != "\\)") {
|
15887 | var ntoken = "$";
|
15888 | }
|
15889 | break;
|
15890 | }
|
15891 | }
|
15892 | this.reader.seek_set(pos);
|
15893 | }
|
15894 | else if (ntoken == "\\?") {
|
15895 |
|
15896 | if (this.cmd == "?") {
|
15897 | var ntoken = "?";
|
15898 | }
|
15899 | }
|
15900 | viml_add(ret, ntoken);
|
15901 | }
|
15902 | return ret;
|
15903 | }
|
15904 |
|
15905 |
|
15906 | RegexpParser.prototype.get_token = function() {
|
15907 | if (this.reg_magic == this.RE_VERY_MAGIC) {
|
15908 | return this.get_token_very_magic();
|
15909 | }
|
15910 | else if (this.reg_magic == this.RE_MAGIC) {
|
15911 | return this.get_token_magic();
|
15912 | }
|
15913 | else if (this.reg_magic == this.RE_NOMAGIC) {
|
15914 | return this.get_token_nomagic();
|
15915 | }
|
15916 | else if (this.reg_magic == this.RE_VERY_NOMAGIC) {
|
15917 | return this.get_token_very_nomagic();
|
15918 | }
|
15919 | }
|
15920 |
|
15921 | RegexpParser.prototype.get_token_very_magic = function() {
|
15922 | if (this.isend(this.reader.peek())) {
|
15923 | return ["<END>", "<END>"];
|
15924 | }
|
15925 | var c = this.reader.get();
|
15926 | if (c == "\\") {
|
15927 | return this.get_token_backslash_common();
|
15928 | }
|
15929 | else if (c == "*") {
|
15930 | return ["*", "\\*"];
|
15931 | }
|
15932 | else if (c == "+") {
|
15933 | return ["+", "\\+"];
|
15934 | }
|
15935 | else if (c == "=") {
|
15936 | return ["=", "\\="];
|
15937 | }
|
15938 | else if (c == "?") {
|
15939 | return ["?", "\\?"];
|
15940 | }
|
15941 | else if (c == "{") {
|
15942 | return this.get_token_brace("{");
|
15943 | }
|
15944 | else if (c == "@") {
|
15945 | return this.get_token_at("@");
|
15946 | }
|
15947 | else if (c == "^") {
|
15948 | return ["^", "\\^"];
|
15949 | }
|
15950 | else if (c == "$") {
|
15951 | return ["$", "\\$"];
|
15952 | }
|
15953 | else if (c == ".") {
|
15954 | return [".", "\\."];
|
15955 | }
|
15956 | else if (c == "<") {
|
15957 | return ["<", "\\<"];
|
15958 | }
|
15959 | else if (c == ">") {
|
15960 | return [">", "\\>"];
|
15961 | }
|
15962 | else if (c == "%") {
|
15963 | return this.get_token_percent("%");
|
15964 | }
|
15965 | else if (c == "[") {
|
15966 | return this.get_token_sq("[");
|
15967 | }
|
15968 | else if (c == "~") {
|
15969 | return ["~", "\\~"];
|
15970 | }
|
15971 | else if (c == "|") {
|
15972 | return ["|", "\\|"];
|
15973 | }
|
15974 | else if (c == "&") {
|
15975 | return ["&", "\\&"];
|
15976 | }
|
15977 | else if (c == "(") {
|
15978 | return ["(", "\\("];
|
15979 | }
|
15980 | else if (c == ")") {
|
15981 | return [")", "\\)"];
|
15982 | }
|
15983 | return [c, c];
|
15984 | }
|
15985 |
|
15986 | RegexpParser.prototype.get_token_magic = function() {
|
15987 | if (this.isend(this.reader.peek())) {
|
15988 | return ["<END>", "<END>"];
|
15989 | }
|
15990 | var c = this.reader.get();
|
15991 | if (c == "\\") {
|
15992 | var pos = this.reader.tell();
|
15993 | var c = this.reader.get();
|
15994 | if (c == "+") {
|
15995 | return ["\\+", "\\+"];
|
15996 | }
|
15997 | else if (c == "=") {
|
15998 | return ["\\=", "\\="];
|
15999 | }
|
16000 | else if (c == "?") {
|
16001 | return ["\\?", "\\?"];
|
16002 | }
|
16003 | else if (c == "{") {
|
16004 | return this.get_token_brace("\\{");
|
16005 | }
|
16006 | else if (c == "@") {
|
16007 | return this.get_token_at("\\@");
|
16008 | }
|
16009 | else if (c == "<") {
|
16010 | return ["\\<", "\\<"];
|
16011 | }
|
16012 | else if (c == ">") {
|
16013 | return ["\\>", "\\>"];
|
16014 | }
|
16015 | else if (c == "%") {
|
16016 | return this.get_token_percent("\\%");
|
16017 | }
|
16018 | else if (c == "|") {
|
16019 | return ["\\|", "\\|"];
|
16020 | }
|
16021 | else if (c == "&") {
|
16022 | return ["\\&", "\\&"];
|
16023 | }
|
16024 | else if (c == "(") {
|
16025 | return ["\\(", "\\("];
|
16026 | }
|
16027 | else if (c == ")") {
|
16028 | return ["\\)", "\\)"];
|
16029 | }
|
16030 | this.reader.seek_set(pos);
|
16031 | return this.get_token_backslash_common();
|
16032 | }
|
16033 | else if (c == "*") {
|
16034 | return ["*", "\\*"];
|
16035 | }
|
16036 | else if (c == "^") {
|
16037 | return ["^", "\\^"];
|
16038 | }
|
16039 | else if (c == "$") {
|
16040 | return ["$", "\\$"];
|
16041 | }
|
16042 | else if (c == ".") {
|
16043 | return [".", "\\."];
|
16044 | }
|
16045 | else if (c == "[") {
|
16046 | return this.get_token_sq("[");
|
16047 | }
|
16048 | else if (c == "~") {
|
16049 | return ["~", "\\~"];
|
16050 | }
|
16051 | return [c, c];
|
16052 | }
|
16053 |
|
16054 | RegexpParser.prototype.get_token_nomagic = function() {
|
16055 | if (this.isend(this.reader.peek())) {
|
16056 | return ["<END>", "<END>"];
|
16057 | }
|
16058 | var c = this.reader.get();
|
16059 | if (c == "\\") {
|
16060 | var pos = this.reader.tell();
|
16061 | var c = this.reader.get();
|
16062 | if (c == "*") {
|
16063 | return ["\\*", "\\*"];
|
16064 | }
|
16065 | else if (c == "+") {
|
16066 | return ["\\+", "\\+"];
|
16067 | }
|
16068 | else if (c == "=") {
|
16069 | return ["\\=", "\\="];
|
16070 | }
|
16071 | else if (c == "?") {
|
16072 | return ["\\?", "\\?"];
|
16073 | }
|
16074 | else if (c == "{") {
|
16075 | return this.get_token_brace("\\{");
|
16076 | }
|
16077 | else if (c == "@") {
|
16078 | return this.get_token_at("\\@");
|
16079 | }
|
16080 | else if (c == ".") {
|
16081 | return ["\\.", "\\."];
|
16082 | }
|
16083 | else if (c == "<") {
|
16084 | return ["\\<", "\\<"];
|
16085 | }
|
16086 | else if (c == ">") {
|
16087 | return ["\\>", "\\>"];
|
16088 | }
|
16089 | else if (c == "%") {
|
16090 | return this.get_token_percent("\\%");
|
16091 | }
|
16092 | else if (c == "~") {
|
16093 | return ["\\~", "\\^"];
|
16094 | }
|
16095 | else if (c == "[") {
|
16096 | return this.get_token_sq("\\[");
|
16097 | }
|
16098 | else if (c == "|") {
|
16099 | return ["\\|", "\\|"];
|
16100 | }
|
16101 | else if (c == "&") {
|
16102 | return ["\\&", "\\&"];
|
16103 | }
|
16104 | else if (c == "(") {
|
16105 | return ["\\(", "\\("];
|
16106 | }
|
16107 | else if (c == ")") {
|
16108 | return ["\\)", "\\)"];
|
16109 | }
|
16110 | this.reader.seek_set(pos);
|
16111 | return this.get_token_backslash_common();
|
16112 | }
|
16113 | else if (c == "^") {
|
16114 | return ["^", "\\^"];
|
16115 | }
|
16116 | else if (c == "$") {
|
16117 | return ["$", "\\$"];
|
16118 | }
|
16119 | return [c, c];
|
16120 | }
|
16121 |
|
16122 | RegexpParser.prototype.get_token_very_nomagic = function() {
|
16123 | if (this.isend(this.reader.peek())) {
|
16124 | return ["<END>", "<END>"];
|
16125 | }
|
16126 | var c = this.reader.get();
|
16127 | if (c == "\\") {
|
16128 | var pos = this.reader.tell();
|
16129 | var c = this.reader.get();
|
16130 | if (c == "*") {
|
16131 | return ["\\*", "\\*"];
|
16132 | }
|
16133 | else if (c == "+") {
|
16134 | return ["\\+", "\\+"];
|
16135 | }
|
16136 | else if (c == "=") {
|
16137 | return ["\\=", "\\="];
|
16138 | }
|
16139 | else if (c == "?") {
|
16140 | return ["\\?", "\\?"];
|
16141 | }
|
16142 | else if (c == "{") {
|
16143 | return this.get_token_brace("\\{");
|
16144 | }
|
16145 | else if (c == "@") {
|
16146 | return this.get_token_at("\\@");
|
16147 | }
|
16148 | else if (c == "^") {
|
16149 | return ["\\^", "\\^"];
|
16150 | }
|
16151 | else if (c == "$") {
|
16152 | return ["\\$", "\\$"];
|
16153 | }
|
16154 | else if (c == "<") {
|
16155 | return ["\\<", "\\<"];
|
16156 | }
|
16157 | else if (c == ">") {
|
16158 | return ["\\>", "\\>"];
|
16159 | }
|
16160 | else if (c == "%") {
|
16161 | return this.get_token_percent("\\%");
|
16162 | }
|
16163 | else if (c == "~") {
|
16164 | return ["\\~", "\\~"];
|
16165 | }
|
16166 | else if (c == "[") {
|
16167 | return this.get_token_sq("\\[");
|
16168 | }
|
16169 | else if (c == "|") {
|
16170 | return ["\\|", "\\|"];
|
16171 | }
|
16172 | else if (c == "&") {
|
16173 | return ["\\&", "\\&"];
|
16174 | }
|
16175 | else if (c == "(") {
|
16176 | return ["\\(", "\\("];
|
16177 | }
|
16178 | else if (c == ")") {
|
16179 | return ["\\)", "\\)"];
|
16180 | }
|
16181 | this.reader.seek_set(pos);
|
16182 | return this.get_token_backslash_common();
|
16183 | }
|
16184 | return [c, c];
|
16185 | }
|
16186 |
|
16187 | RegexpParser.prototype.get_token_backslash_common = function() {
|
16188 | var cclass = "iIkKfFpPsSdDxXoOwWhHaAlLuU";
|
16189 | var c = this.reader.get();
|
16190 | if (c == "\\") {
|
16191 | return ["\\\\", "\\\\"];
|
16192 | }
|
16193 | else if (viml_stridx(cclass, c) != -1) {
|
16194 | return ["\\" + c, "\\" + c];
|
16195 | }
|
16196 | else if (c == "_") {
|
16197 | var epos = this.reader.getpos();
|
16198 | var c = this.reader.get();
|
16199 | if (viml_stridx(cclass, c) != -1) {
|
16200 | return ["\\_" + c, "\\_ . c"];
|
16201 | }
|
16202 | else if (c == "^") {
|
16203 | return ["\\_^", "\\_^"];
|
16204 | }
|
16205 | else if (c == "$") {
|
16206 | return ["\\_$", "\\_$"];
|
16207 | }
|
16208 | else if (c == ".") {
|
16209 | return ["\\_.", "\\_."];
|
16210 | }
|
16211 | else if (c == "[") {
|
16212 | return this.get_token_sq("\\_[");
|
16213 | }
|
16214 | throw Err("E63: Invalid use of \\_", epos);
|
16215 | }
|
16216 | else if (viml_stridx("etrb", c) != -1) {
|
16217 | return ["\\" + c, "\\" + c];
|
16218 | }
|
16219 | else if (viml_stridx("123456789", c) != -1) {
|
16220 | return ["\\" + c, "\\" + c];
|
16221 | }
|
16222 | else if (c == "z") {
|
16223 | var epos = this.reader.getpos();
|
16224 | var c = this.reader.get();
|
16225 | if (viml_stridx("123456789", c) != -1) {
|
16226 | return ["\\z" + c, "\\z" + c];
|
16227 | }
|
16228 | else if (c == "s") {
|
16229 | return ["\\zs", "\\zs"];
|
16230 | }
|
16231 | else if (c == "e") {
|
16232 | return ["\\ze", "\\ze"];
|
16233 | }
|
16234 | else if (c == "(") {
|
16235 | return ["\\z(", "\\z("];
|
16236 | }
|
16237 | throw Err("E68: Invalid character after \\z", epos);
|
16238 | }
|
16239 | else if (viml_stridx("cCmMvVZ", c) != -1) {
|
16240 | return ["\\" + c, "\\" + c];
|
16241 | }
|
16242 | else if (c == "%") {
|
16243 | var epos = this.reader.getpos();
|
16244 | var c = this.reader.get();
|
16245 | if (c == "d") {
|
16246 | var r = this.getdecchrs();
|
16247 | if (r != "") {
|
16248 | return ["\\%d" + r, "\\%d" + r];
|
16249 | }
|
16250 | }
|
16251 | else if (c == "o") {
|
16252 | var r = this.getoctchrs();
|
16253 | if (r != "") {
|
16254 | return ["\\%o" + r, "\\%o" + r];
|
16255 | }
|
16256 | }
|
16257 | else if (c == "x") {
|
16258 | var r = this.gethexchrs(2);
|
16259 | if (r != "") {
|
16260 | return ["\\%x" + r, "\\%x" + r];
|
16261 | }
|
16262 | }
|
16263 | else if (c == "u") {
|
16264 | var r = this.gethexchrs(4);
|
16265 | if (r != "") {
|
16266 | return ["\\%u" + r, "\\%u" + r];
|
16267 | }
|
16268 | }
|
16269 | else if (c == "U") {
|
16270 | var r = this.gethexchrs(8);
|
16271 | if (r != "") {
|
16272 | return ["\\%U" + r, "\\%U" + r];
|
16273 | }
|
16274 | }
|
16275 | throw Err("E678: Invalid character after \\%[dxouU]", epos);
|
16276 | }
|
16277 | return ["\\" + c, c];
|
16278 | }
|
16279 |
|
16280 |
|
16281 | RegexpParser.prototype.get_token_brace = function(pre) {
|
16282 | var r = "";
|
16283 | var minus = "";
|
16284 | var comma = "";
|
16285 | var n = "";
|
16286 | var m = "";
|
16287 | if (this.reader.p(0) == "-") {
|
16288 | var minus = this.reader.get();
|
16289 | r += minus;
|
16290 | }
|
16291 | if (isdigit(this.reader.p(0))) {
|
16292 | var n = this.reader.read_digit();
|
16293 | r += n;
|
16294 | }
|
16295 | if (this.reader.p(0) == ",") {
|
16296 | var comma = this.rader.get();
|
16297 | r += comma;
|
16298 | }
|
16299 | if (isdigit(this.reader.p(0))) {
|
16300 | var m = this.reader.read_digit();
|
16301 | r += m;
|
16302 | }
|
16303 | if (this.reader.p(0) == "\\") {
|
16304 | r += this.reader.get();
|
16305 | }
|
16306 | if (this.reader.p(0) != "}") {
|
16307 | throw Err("E554: Syntax error in \\{...}", this.reader.getpos());
|
16308 | }
|
16309 | this.reader.get();
|
16310 | return [pre + r, "\\{" + minus + n + comma + m + "}"];
|
16311 | }
|
16312 |
|
16313 |
|
16314 | RegexpParser.prototype.get_token_sq = function(pre) {
|
16315 | var start = this.reader.tell();
|
16316 | var r = "";
|
16317 |
|
16318 | if (this.reader.p(0) == "^") {
|
16319 | r += this.reader.get();
|
16320 | }
|
16321 |
|
16322 | if (this.reader.p(0) == "]" || this.reader.p(0) == "-") {
|
16323 | r += this.reader.get();
|
16324 | }
|
16325 | while (TRUE) {
|
16326 | var startc = 0;
|
16327 | var c = this.reader.p(0);
|
16328 | if (this.isend(c)) {
|
16329 |
|
16330 | this.reader.seek_set(start);
|
16331 | return [pre, "["];
|
16332 | }
|
16333 | else if (c == "]") {
|
16334 | this.reader.seek_cur(1);
|
16335 | return [pre + r + "]", "\\[" + r + "]"];
|
16336 | }
|
16337 | else if (c == "[") {
|
16338 | var e = this.get_token_sq_char_class();
|
16339 | if (e == "") {
|
16340 | var e = this.get_token_sq_equi_class();
|
16341 | if (e == "") {
|
16342 | var e = this.get_token_sq_coll_element();
|
16343 | if (e == "") {
|
16344 | var __tmp = this.get_token_sq_c();
|
16345 | var e = __tmp[0];
|
16346 | var startc = __tmp[1];
|
16347 | }
|
16348 | }
|
16349 | }
|
16350 | r += e;
|
16351 | }
|
16352 | else {
|
16353 | var __tmp = this.get_token_sq_c();
|
16354 | var e = __tmp[0];
|
16355 | var startc = __tmp[1];
|
16356 | r += e;
|
16357 | }
|
16358 | if (startc != 0 && this.reader.p(0) == "-" && !this.isend(this.reader.p(1)) && !(this.reader.p(1) == "\\" && this.reader.p(2) == "n")) {
|
16359 | this.reader.seek_cur(1);
|
16360 | r += "-";
|
16361 | var c = this.reader.p(0);
|
16362 | if (c == "[") {
|
16363 | var e = this.get_token_sq_coll_element();
|
16364 | if (e != "") {
|
16365 | var endc = viml_char2nr(e[2]);
|
16366 | }
|
16367 | else {
|
16368 | var __tmp = this.get_token_sq_c();
|
16369 | var e = __tmp[0];
|
16370 | var endc = __tmp[1];
|
16371 | }
|
16372 | r += e;
|
16373 | }
|
16374 | else {
|
16375 | var __tmp = this.get_token_sq_c();
|
16376 | var e = __tmp[0];
|
16377 | var endc = __tmp[1];
|
16378 | r += e;
|
16379 | }
|
16380 | if (startc > endc || endc > startc + 256) {
|
16381 | throw Err("E16: Invalid range", this.reader.getpos());
|
16382 | }
|
16383 | }
|
16384 | }
|
16385 | }
|
16386 |
|
16387 |
|
16388 | RegexpParser.prototype.get_token_sq_c = function() {
|
16389 | var c = this.reader.p(0);
|
16390 | if (c == "\\") {
|
16391 | this.reader.seek_cur(1);
|
16392 | var c = this.reader.p(0);
|
16393 | if (c == "n") {
|
16394 | this.reader.seek_cur(1);
|
16395 | return ["\\n", 0];
|
16396 | }
|
16397 | else if (c == "r") {
|
16398 | this.reader.seek_cur(1);
|
16399 | return ["\\r", 13];
|
16400 | }
|
16401 | else if (c == "t") {
|
16402 | this.reader.seek_cur(1);
|
16403 | return ["\\t", 9];
|
16404 | }
|
16405 | else if (c == "e") {
|
16406 | this.reader.seek_cur(1);
|
16407 | return ["\\e", 27];
|
16408 | }
|
16409 | else if (c == "b") {
|
16410 | this.reader.seek_cur(1);
|
16411 | return ["\\b", 8];
|
16412 | }
|
16413 | else if (viml_stridx("]^-\\", c) != -1) {
|
16414 | this.reader.seek_cur(1);
|
16415 | return ["\\" + c, viml_char2nr(c)];
|
16416 | }
|
16417 | else if (viml_stridx("doxuU", c) != -1) {
|
16418 | var __tmp = this.get_token_sq_coll_char();
|
16419 | var c = __tmp[0];
|
16420 | var n = __tmp[1];
|
16421 | return [c, n];
|
16422 | }
|
16423 | else {
|
16424 | return ["\\", viml_char2nr("\\")];
|
16425 | }
|
16426 | }
|
16427 | else if (c == "-") {
|
16428 | this.reader.seek_cur(1);
|
16429 | return ["-", viml_char2nr("-")];
|
16430 | }
|
16431 | else {
|
16432 | this.reader.seek_cur(1);
|
16433 | return [c, viml_char2nr(c)];
|
16434 | }
|
16435 | }
|
16436 |
|
16437 |
|
16438 | RegexpParser.prototype.get_token_sq_coll_char = function() {
|
16439 | var pos = this.reader.tell();
|
16440 | var c = this.reader.get();
|
16441 | if (c == "d") {
|
16442 | var r = this.getdecchrs();
|
16443 | var n = viml_str2nr(r, 10);
|
16444 | }
|
16445 | else if (c == "o") {
|
16446 | var r = this.getoctchrs();
|
16447 | var n = viml_str2nr(r, 8);
|
16448 | }
|
16449 | else if (c == "x") {
|
16450 | var r = this.gethexchrs(2);
|
16451 | var n = viml_str2nr(r, 16);
|
16452 | }
|
16453 | else if (c == "u") {
|
16454 | var r = this.gethexchrs(4);
|
16455 | var n = viml_str2nr(r, 16);
|
16456 | }
|
16457 | else if (c == "U") {
|
16458 | var r = this.gethexchrs(8);
|
16459 | var n = viml_str2nr(r, 16);
|
16460 | }
|
16461 | else {
|
16462 | var r = "";
|
16463 | }
|
16464 | if (r == "") {
|
16465 | this.reader.seek_set(pos);
|
16466 | return "\\";
|
16467 | }
|
16468 | return ["\\" + c + r, n];
|
16469 | }
|
16470 |
|
16471 |
|
16472 | RegexpParser.prototype.get_token_sq_coll_element = function() {
|
16473 | if (this.reader.p(0) == "[" && this.reader.p(1) == "." && !this.isend(this.reader.p(2)) && this.reader.p(3) == "." && this.reader.p(4) == "]") {
|
16474 | return this.reader.getn(5);
|
16475 | }
|
16476 | return "";
|
16477 | }
|
16478 |
|
16479 |
|
16480 | RegexpParser.prototype.get_token_sq_equi_class = function() {
|
16481 | if (this.reader.p(0) == "[" && this.reader.p(1) == "=" && !this.isend(this.reader.p(2)) && this.reader.p(3) == "=" && this.reader.p(4) == "]") {
|
16482 | return this.reader.getn(5);
|
16483 | }
|
16484 | return "";
|
16485 | }
|
16486 |
|
16487 |
|
16488 | RegexpParser.prototype.get_token_sq_char_class = function() {
|
16489 | var class_names = ["alnum", "alpha", "blank", "cntrl", "digit", "graph", "lower", "print", "punct", "space", "upper", "xdigit", "tab", "return", "backspace", "escape"];
|
16490 | var pos = this.reader.tell();
|
16491 | if (this.reader.p(0) == "[" && this.reader.p(1) == ":") {
|
16492 | this.reader.seek_cur(2);
|
16493 | var r = this.reader.read_alpha();
|
16494 | if (this.reader.p(0) == ":" && this.reader.p(1) == "]") {
|
16495 | this.reader.seek_cur(2);
|
16496 | var __c15 = class_names;
|
16497 | for (var __i15 = 0; __i15 < __c15.length; ++__i15) {
|
16498 | var name = __c15[__i15];
|
16499 | if (r == name) {
|
16500 | return "[:" + name + ":]";
|
16501 | }
|
16502 | }
|
16503 | }
|
16504 | }
|
16505 | this.reader.seek_set(pos);
|
16506 | return "";
|
16507 | }
|
16508 |
|
16509 |
|
16510 | RegexpParser.prototype.get_token_at = function(pre) {
|
16511 | var epos = this.reader.getpos();
|
16512 | var c = this.reader.get();
|
16513 | if (c == ">") {
|
16514 | return [pre + ">", "\\@>"];
|
16515 | }
|
16516 | else if (c == "=") {
|
16517 | return [pre + "=", "\\@="];
|
16518 | }
|
16519 | else if (c == "!") {
|
16520 | return [pre + "!", "\\@!"];
|
16521 | }
|
16522 | else if (c == "<") {
|
16523 | var c = this.reader.get();
|
16524 | if (c == "=") {
|
16525 | return [pre + "<=", "\\@<="];
|
16526 | }
|
16527 | else if (c == "!") {
|
16528 | return [pre + "<!", "\\@<!"];
|
16529 | }
|
16530 | }
|
16531 | throw Err("E64: @ follows nothing", epos);
|
16532 | }
|
16533 |
|
16534 |
|
16535 | RegexpParser.prototype.get_token_percent = function(pre) {
|
16536 | var c = this.reader.get();
|
16537 | if (c == "^") {
|
16538 | return [pre + "^", "\\%^"];
|
16539 | }
|
16540 | else if (c == "$") {
|
16541 | return [pre + "$", "\\%$"];
|
16542 | }
|
16543 | else if (c == "V") {
|
16544 | return [pre + "V", "\\%V"];
|
16545 | }
|
16546 | else if (c == "#") {
|
16547 | return [pre + "#", "\\%#"];
|
16548 | }
|
16549 | else if (c == "[") {
|
16550 | return this.get_token_percent_sq(pre + "[");
|
16551 | }
|
16552 | else if (c == "(") {
|
16553 | return [pre + "(", "\\%("];
|
16554 | }
|
16555 | else {
|
16556 | return this.get_token_mlcv(pre);
|
16557 | }
|
16558 | }
|
16559 |
|
16560 |
|
16561 | RegexpParser.prototype.get_token_percent_sq = function(pre) {
|
16562 | var r = "";
|
16563 | while (TRUE) {
|
16564 | var c = this.reader.peek();
|
16565 | if (this.isend(c)) {
|
16566 | throw Err("E69: Missing ] after \\%[", this.reader.getpos());
|
16567 | }
|
16568 | else if (c == "]") {
|
16569 | if (r == "") {
|
16570 | throw Err("E70: Empty \\%[", this.reader.getpos());
|
16571 | }
|
16572 | this.reader.seek_cur(1);
|
16573 | break;
|
16574 | }
|
16575 | this.reader.seek_cur(1);
|
16576 | r += c;
|
16577 | }
|
16578 | return [pre + r + "]", "\\%[" + r + "]"];
|
16579 | }
|
16580 |
|
16581 |
|
16582 | RegexpParser.prototype.get_token_mlvc = function(pre) {
|
16583 | var r = "";
|
16584 | var cmp = "";
|
16585 | if (this.reader.p(0) == "<" || this.reader.p(0) == ">") {
|
16586 | var cmp = this.reader.get();
|
16587 | r += cmp;
|
16588 | }
|
16589 | if (this.reader.p(0) == "'") {
|
16590 | r += this.reader.get();
|
16591 | var c = this.reader.p(0);
|
16592 | if (this.isend(c)) {
|
16593 |
|
16594 | var c = "";
|
16595 | }
|
16596 | else {
|
16597 | var c = this.reader.get();
|
16598 | }
|
16599 | return [pre + r + c, "\\%" + cmp + "'" + c];
|
16600 | }
|
16601 | else if (isdigit(this.reader.p(0))) {
|
16602 | var d = this.reader.read_digit();
|
16603 | r += d;
|
16604 | var c = this.reader.p(0);
|
16605 | if (c == "l") {
|
16606 | this.reader.get();
|
16607 | return [pre + r + "l", "\\%" + cmp + d + "l"];
|
16608 | }
|
16609 | else if (c == "c") {
|
16610 | this.reader.get();
|
16611 | return [pre + r + "c", "\\%" + cmp + d + "c"];
|
16612 | }
|
16613 | else if (c == "v") {
|
16614 | this.reader.get();
|
16615 | return [pre + r + "v", "\\%" + cmp + d + "v"];
|
16616 | }
|
16617 | }
|
16618 | throw Err("E71: Invalid character after %", this.reader.getpos());
|
16619 | }
|
16620 |
|
16621 | RegexpParser.prototype.getdecchrs = function() {
|
16622 | return this.reader.read_digit();
|
16623 | }
|
16624 |
|
16625 | RegexpParser.prototype.getoctchrs = function() {
|
16626 | return this.reader.read_odigit();
|
16627 | }
|
16628 |
|
16629 | RegexpParser.prototype.gethexchrs = function(n) {
|
16630 | var r = "";
|
16631 | var __c16 = viml_range(n);
|
16632 | for (var __i16 = 0; __i16 < __c16.length; ++__i16) {
|
16633 | var i = __c16[__i16];
|
16634 | var c = this.reader.peek();
|
16635 | if (!isxdigit(c)) {
|
16636 | break;
|
16637 | }
|
16638 | r += this.reader.get();
|
16639 | }
|
16640 | return r;
|
16641 | }
|
16642 |
|
16643 | if (__webpack_require__.c[__webpack_require__.s] === module) {
|
16644 | main();
|
16645 | }
|
16646 | else {
|
16647 | module.exports = {
|
16648 | VimLParser: VimLParser,
|
16649 | StringReader: StringReader,
|
16650 | Compiler: Compiler
|
16651 | };
|
16652 | }
|
16653 |
|
16654 |
|
16655 | }),
|
16656 |
|
16657 | 61:
|
16658 | ((module) => {
|
16659 |
|
16660 | "use strict";
|
16661 | module.exports = require("child_process");;
|
16662 |
|
16663 | }),
|
16664 |
|
16665 | 25:
|
16666 | ((module) => {
|
16667 |
|
16668 | "use strict";
|
16669 | module.exports = require("crypto");;
|
16670 |
|
16671 | }),
|
16672 |
|
16673 | 70:
|
16674 | ((module) => {
|
16675 |
|
16676 | "use strict";
|
16677 | module.exports = require("events");;
|
16678 |
|
16679 | }),
|
16680 |
|
16681 | 60:
|
16682 | ((module) => {
|
16683 |
|
16684 | "use strict";
|
16685 | module.exports = require("fs");;
|
16686 |
|
16687 | }),
|
16688 |
|
16689 | 26:
|
16690 | ((module) => {
|
16691 |
|
16692 | "use strict";
|
16693 | module.exports = require("net");;
|
16694 |
|
16695 | }),
|
16696 |
|
16697 | 24:
|
16698 | ((module) => {
|
16699 |
|
16700 | "use strict";
|
16701 | module.exports = require("os");;
|
16702 |
|
16703 | }),
|
16704 |
|
16705 | 23:
|
16706 | ((module) => {
|
16707 |
|
16708 | "use strict";
|
16709 | module.exports = require("path");;
|
16710 |
|
16711 | }),
|
16712 |
|
16713 | 59:
|
16714 | ((module) => {
|
16715 |
|
16716 | "use strict";
|
16717 | module.exports = require("url");;
|
16718 |
|
16719 | }),
|
16720 |
|
16721 | 10:
|
16722 | ((module) => {
|
16723 |
|
16724 | "use strict";
|
16725 | module.exports = require("util");;
|
16726 |
|
16727 | })
|
16728 |
|
16729 | });
|
16730 |
|
16731 |
|
16732 | var __webpack_module_cache__ = {};
|
16733 |
|
16734 |
|
16735 | function __webpack_require__(moduleId) {
|
16736 |
|
16737 | var cachedModule = __webpack_module_cache__[moduleId];
|
16738 | if (cachedModule !== undefined) {
|
16739 | return cachedModule.exports;
|
16740 | }
|
16741 |
|
16742 | var module = __webpack_module_cache__[moduleId] = {
|
16743 | id: moduleId,
|
16744 | loaded: false,
|
16745 | exports: {}
|
16746 | };
|
16747 |
|
16748 |
|
16749 | __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
16750 |
|
16751 |
|
16752 | module.loaded = true;
|
16753 |
|
16754 |
|
16755 | return module.exports;
|
16756 | }
|
16757 |
|
16758 |
|
16759 | __webpack_require__.c = __webpack_module_cache__;
|
16760 |
|
16761 |
|
16762 |
|
16763 | (() => {
|
16764 |
|
16765 | __webpack_require__.d = (exports, definition) => {
|
16766 | for(var key in definition) {
|
16767 | if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
|
16768 | Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
|
16769 | }
|
16770 | }
|
16771 | };
|
16772 | })();
|
16773 |
|
16774 |
|
16775 | (() => {
|
16776 | __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
|
16777 | })();
|
16778 |
|
16779 |
|
16780 | (() => {
|
16781 |
|
16782 | __webpack_require__.r = (exports) => {
|
16783 | if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
16784 | Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
16785 | }
|
16786 | Object.defineProperty(exports, '__esModule', { value: true });
|
16787 | };
|
16788 | })();
|
16789 |
|
16790 |
|
16791 | (() => {
|
16792 | __webpack_require__.nmd = (module) => {
|
16793 | module.paths = [];
|
16794 | if (!module.children) module.children = [];
|
16795 | return module;
|
16796 | };
|
16797 | })();
|
16798 |
|
16799 |
|
16800 |
|
16801 |
|
16802 |
|
16803 |
|
16804 | var __webpack_exports__ = __webpack_require__(__webpack_require__.s = 391);
|
16805 | var __webpack_export_target__ = exports;
|
16806 | for(var i in __webpack_exports__) __webpack_export_target__[i] = __webpack_exports__[i];
|
16807 | if(__webpack_exports__.__esModule) Object.defineProperty(__webpack_export_target__, "__esModule", { value: true });
|
16808 |
|
16809 | })()
|
16810 | ; |
\ | No newline at end of file |