/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ define('vscode-nls/vscode-nls',["require", "exports"], function (require, exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); function format(message, args) { var result; if (args.length === 0) { result = message; } else { result = message.replace(/\{(\d+)\}/g, function (match, rest) { var index = rest[0]; return typeof args[index] !== 'undefined' ? args[index] : match; }); } return result; } function localize(key, message) { var args = []; for (var _i = 2; _i < arguments.length; _i++) { args[_i - 2] = arguments[_i]; } return format(message, args); } function loadMessageBundle(file) { return localize; } exports.loadMessageBundle = loadMessageBundle; function config(opt) { return loadMessageBundle; } exports.config = config; }); define('vscode-nls', ['vscode-nls/vscode-nls'], function (main) { return main; }); /*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ (function (factory) { if (typeof module === "object" && typeof module.exports === "object") { var v = factory(require, exports); if (v !== undefined) module.exports = v; } else if (typeof define === "function" && define.amd) { define('vscode-html-languageservice/htmlLanguageTypes',["require", "exports"], factory); } })(function (require, exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); // #region Proposed types, remove once added to vscode-languageserver-types /** * Enum of known selection range kinds */ var SelectionRangeKind; (function (SelectionRangeKind) { /** * Empty Kind. */ SelectionRangeKind["Empty"] = ""; /** * The statment kind, its value is `statement`, possible extensions can be * `statement.if` etc */ SelectionRangeKind["Statement"] = "statement"; /** * The declaration kind, its value is `declaration`, possible extensions can be * `declaration.function`, `declaration.class` etc. */ SelectionRangeKind["Declaration"] = "declaration"; })(SelectionRangeKind = exports.SelectionRangeKind || (exports.SelectionRangeKind = {})); var TokenType; (function (TokenType) { TokenType[TokenType["StartCommentTag"] = 0] = "StartCommentTag"; TokenType[TokenType["Comment"] = 1] = "Comment"; TokenType[TokenType["EndCommentTag"] = 2] = "EndCommentTag"; TokenType[TokenType["StartTagOpen"] = 3] = "StartTagOpen"; TokenType[TokenType["StartTagClose"] = 4] = "StartTagClose"; TokenType[TokenType["StartTagSelfClose"] = 5] = "StartTagSelfClose"; TokenType[TokenType["StartTag"] = 6] = "StartTag"; TokenType[TokenType["EndTagOpen"] = 7] = "EndTagOpen"; TokenType[TokenType["EndTagClose"] = 8] = "EndTagClose"; TokenType[TokenType["EndTag"] = 9] = "EndTag"; TokenType[TokenType["DelimiterAssign"] = 10] = "DelimiterAssign"; TokenType[TokenType["AttributeName"] = 11] = "AttributeName"; TokenType[TokenType["AttributeValue"] = 12] = "AttributeValue"; TokenType[TokenType["StartDoctypeTag"] = 13] = "StartDoctypeTag"; TokenType[TokenType["Doctype"] = 14] = "Doctype"; TokenType[TokenType["EndDoctypeTag"] = 15] = "EndDoctypeTag"; TokenType[TokenType["Content"] = 16] = "Content"; TokenType[TokenType["Whitespace"] = 17] = "Whitespace"; TokenType[TokenType["Unknown"] = 18] = "Unknown"; TokenType[TokenType["Script"] = 19] = "Script"; TokenType[TokenType["Styles"] = 20] = "Styles"; TokenType[TokenType["EOS"] = 21] = "EOS"; })(TokenType = exports.TokenType || (exports.TokenType = {})); var ScannerState; (function (ScannerState) { ScannerState[ScannerState["WithinContent"] = 0] = "WithinContent"; ScannerState[ScannerState["AfterOpeningStartTag"] = 1] = "AfterOpeningStartTag"; ScannerState[ScannerState["AfterOpeningEndTag"] = 2] = "AfterOpeningEndTag"; ScannerState[ScannerState["WithinDoctype"] = 3] = "WithinDoctype"; ScannerState[ScannerState["WithinTag"] = 4] = "WithinTag"; ScannerState[ScannerState["WithinEndTag"] = 5] = "WithinEndTag"; ScannerState[ScannerState["WithinComment"] = 6] = "WithinComment"; ScannerState[ScannerState["WithinScriptContent"] = 7] = "WithinScriptContent"; ScannerState[ScannerState["WithinStyleContent"] = 8] = "WithinStyleContent"; ScannerState[ScannerState["AfterAttributeName"] = 9] = "AfterAttributeName"; ScannerState[ScannerState["BeforeAttributeValue"] = 10] = "BeforeAttributeValue"; })(ScannerState = exports.ScannerState || (exports.ScannerState = {})); }); //# sourceMappingURL=htmlLanguageTypes.js.map; /*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ (function (factory) { if (typeof module === "object" && typeof module.exports === "object") { var v = factory(require, exports); if (v !== undefined) module.exports = v; } else if (typeof define === "function" && define.amd) { define('vscode-html-languageservice/parser/htmlScanner',["require", "exports", "vscode-nls", "../htmlLanguageTypes"], factory); } })(function (require, exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var nls = require("vscode-nls"); var htmlLanguageTypes_1 = require("../htmlLanguageTypes"); var localize = nls.loadMessageBundle(); var MultiLineStream = /** @class */ (function () { function MultiLineStream(source, position) { this.source = source; this.len = source.length; this.position = position; } MultiLineStream.prototype.eos = function () { return this.len <= this.position; }; MultiLineStream.prototype.getSource = function () { return this.source; }; MultiLineStream.prototype.pos = function () { return this.position; }; MultiLineStream.prototype.goBackTo = function (pos) { this.position = pos; }; MultiLineStream.prototype.goBack = function (n) { this.position -= n; }; MultiLineStream.prototype.advance = function (n) { this.position += n; }; MultiLineStream.prototype.goToEnd = function () { this.position = this.source.length; }; MultiLineStream.prototype.nextChar = function () { return this.source.charCodeAt(this.position++) || 0; }; MultiLineStream.prototype.peekChar = function (n) { if (n === void 0) { n = 0; } return this.source.charCodeAt(this.position + n) || 0; }; MultiLineStream.prototype.advanceIfChar = function (ch) { if (ch === this.source.charCodeAt(this.position)) { this.position++; return true; } return false; }; MultiLineStream.prototype.advanceIfChars = function (ch) { var i; if (this.position + ch.length > this.source.length) { return false; } for (i = 0; i < ch.length; i++) { if (this.source.charCodeAt(this.position + i) !== ch[i]) { return false; } } this.advance(i); return true; }; MultiLineStream.prototype.advanceIfRegExp = function (regex) { var str = this.source.substr(this.position); var match = str.match(regex); if (match) { this.position = this.position + match.index + match[0].length; return match[0]; } return ''; }; MultiLineStream.prototype.advanceUntilRegExp = function (regex) { var str = this.source.substr(this.position); var match = str.match(regex); if (match) { this.position = this.position + match.index; return match[0]; } else { this.goToEnd(); } return ''; }; MultiLineStream.prototype.advanceUntilChar = function (ch) { while (this.position < this.source.length) { if (this.source.charCodeAt(this.position) === ch) { return true; } this.advance(1); } return false; }; MultiLineStream.prototype.advanceUntilChars = function (ch) { while (this.position + ch.length <= this.source.length) { var i = 0; for (; i < ch.length && this.source.charCodeAt(this.position + i) === ch[i]; i++) { } if (i === ch.length) { return true; } this.advance(1); } this.goToEnd(); return false; }; MultiLineStream.prototype.skipWhitespace = function () { var n = this.advanceWhileChar(function (ch) { return ch === _WSP || ch === _TAB || ch === _NWL || ch === _LFD || ch === _CAR; }); return n > 0; }; MultiLineStream.prototype.advanceWhileChar = function (condition) { var posNow = this.position; while (this.position < this.len && condition(this.source.charCodeAt(this.position))) { this.position++; } return this.position - posNow; }; return MultiLineStream; }()); var _BNG = '!'.charCodeAt(0); var _MIN = '-'.charCodeAt(0); var _LAN = '<'.charCodeAt(0); var _RAN = '>'.charCodeAt(0); var _FSL = '/'.charCodeAt(0); var _EQS = '='.charCodeAt(0); var _DQO = '"'.charCodeAt(0); var _SQO = '\''.charCodeAt(0); var _NWL = '\n'.charCodeAt(0); var _CAR = '\r'.charCodeAt(0); var _LFD = '\f'.charCodeAt(0); var _WSP = ' '.charCodeAt(0); var _TAB = '\t'.charCodeAt(0); var htmlScriptContents = { 'text/x-handlebars-template': true }; function createScanner(input, initialOffset, initialState) { if (initialOffset === void 0) { initialOffset = 0; } if (initialState === void 0) { initialState = htmlLanguageTypes_1.ScannerState.WithinContent; } var stream = new MultiLineStream(input, initialOffset); var state = initialState; var tokenOffset = 0; var tokenType = htmlLanguageTypes_1.TokenType.Unknown; var tokenError; var hasSpaceAfterTag; var lastTag; var lastAttributeName; var lastTypeValue; function nextElementName() { return stream.advanceIfRegExp(/^[_:\w][_:\w-.\d]*/).toLowerCase(); } function nextAttributeName() { return stream.advanceIfRegExp(/^[^\s"'>/=\x00-\x0F\x7F\x80-\x9F]*/).toLowerCase(); } function finishToken(offset, type, errorMessage) { tokenType = type; tokenOffset = offset; tokenError = errorMessage; return type; } function scan() { var offset = stream.pos(); var oldState = state; var token = internalScan(); if (token !== htmlLanguageTypes_1.TokenType.EOS && offset === stream.pos()) { console.log('Scanner.scan has not advanced at offset ' + offset + ', state before: ' + oldState + ' after: ' + state); stream.advance(1); return finishToken(offset, htmlLanguageTypes_1.TokenType.Unknown); } return token; } function internalScan() { var offset = stream.pos(); if (stream.eos()) { return finishToken(offset, htmlLanguageTypes_1.TokenType.EOS); } var errorMessage; switch (state) { case htmlLanguageTypes_1.ScannerState.WithinComment: if (stream.advanceIfChars([_MIN, _MIN, _RAN])) { // --> state = htmlLanguageTypes_1.ScannerState.WithinContent; return finishToken(offset, htmlLanguageTypes_1.TokenType.EndCommentTag); } stream.advanceUntilChars([_MIN, _MIN, _RAN]); // --> return finishToken(offset, htmlLanguageTypes_1.TokenType.Comment); case htmlLanguageTypes_1.ScannerState.WithinDoctype: if (stream.advanceIfChar(_RAN)) { state = htmlLanguageTypes_1.ScannerState.WithinContent; return finishToken(offset, htmlLanguageTypes_1.TokenType.EndDoctypeTag); } stream.advanceUntilChar(_RAN); // > return finishToken(offset, htmlLanguageTypes_1.TokenType.Doctype); case htmlLanguageTypes_1.ScannerState.WithinContent: if (stream.advanceIfChar(_LAN)) { // < if (!stream.eos() && stream.peekChar() === _BNG) { // ! if (stream.advanceIfChars([_BNG, _MIN, _MIN])) { // |<\/?script\s*\/?>?/i); if (match.length === 0) { stream.goToEnd(); return finishToken(offset, htmlLanguageTypes_1.TokenType.Script); } else if (match === '') { sciptState = 1; } else if (match[1] !== '/') { //