[6a3a178] | 1 | /**
|
---|
| 2 | * @license
|
---|
| 3 | * Copyright Google LLC All Rights Reserved.
|
---|
| 4 | *
|
---|
| 5 | * Use of this source code is governed by an MIT-style license that can be
|
---|
| 6 | * found in the LICENSE file at https://angular.io/license
|
---|
| 7 | */
|
---|
| 8 | (function (factory) {
|
---|
| 9 | if (typeof module === "object" && typeof module.exports === "object") {
|
---|
| 10 | var v = factory(require, exports);
|
---|
| 11 | if (v !== undefined) module.exports = v;
|
---|
| 12 | }
|
---|
| 13 | else if (typeof define === "function" && define.amd) {
|
---|
| 14 | define("@angular/compiler/src/ml_parser/parser", ["require", "exports", "tslib", "@angular/compiler/src/parse_util", "@angular/compiler/src/ml_parser/ast", "@angular/compiler/src/ml_parser/entities", "@angular/compiler/src/ml_parser/lexer", "@angular/compiler/src/ml_parser/tags"], factory);
|
---|
| 15 | }
|
---|
| 16 | })(function (require, exports) {
|
---|
| 17 | "use strict";
|
---|
| 18 | Object.defineProperty(exports, "__esModule", { value: true });
|
---|
| 19 | exports.Parser = exports.ParseTreeResult = exports.TreeError = void 0;
|
---|
| 20 | var tslib_1 = require("tslib");
|
---|
| 21 | var parse_util_1 = require("@angular/compiler/src/parse_util");
|
---|
| 22 | var html = require("@angular/compiler/src/ml_parser/ast");
|
---|
| 23 | var entities_1 = require("@angular/compiler/src/ml_parser/entities");
|
---|
| 24 | var lexer_1 = require("@angular/compiler/src/ml_parser/lexer");
|
---|
| 25 | var tags_1 = require("@angular/compiler/src/ml_parser/tags");
|
---|
| 26 | var TreeError = /** @class */ (function (_super) {
|
---|
| 27 | tslib_1.__extends(TreeError, _super);
|
---|
| 28 | function TreeError(elementName, span, msg) {
|
---|
| 29 | var _this = _super.call(this, span, msg) || this;
|
---|
| 30 | _this.elementName = elementName;
|
---|
| 31 | return _this;
|
---|
| 32 | }
|
---|
| 33 | TreeError.create = function (elementName, span, msg) {
|
---|
| 34 | return new TreeError(elementName, span, msg);
|
---|
| 35 | };
|
---|
| 36 | return TreeError;
|
---|
| 37 | }(parse_util_1.ParseError));
|
---|
| 38 | exports.TreeError = TreeError;
|
---|
| 39 | var ParseTreeResult = /** @class */ (function () {
|
---|
| 40 | function ParseTreeResult(rootNodes, errors) {
|
---|
| 41 | this.rootNodes = rootNodes;
|
---|
| 42 | this.errors = errors;
|
---|
| 43 | }
|
---|
| 44 | return ParseTreeResult;
|
---|
| 45 | }());
|
---|
| 46 | exports.ParseTreeResult = ParseTreeResult;
|
---|
| 47 | var Parser = /** @class */ (function () {
|
---|
| 48 | function Parser(getTagDefinition) {
|
---|
| 49 | this.getTagDefinition = getTagDefinition;
|
---|
| 50 | }
|
---|
| 51 | Parser.prototype.parse = function (source, url, options) {
|
---|
| 52 | var tokenizeResult = lexer_1.tokenize(source, url, this.getTagDefinition, options);
|
---|
| 53 | var parser = new _TreeBuilder(tokenizeResult.tokens, this.getTagDefinition);
|
---|
| 54 | parser.build();
|
---|
| 55 | return new ParseTreeResult(parser.rootNodes, tokenizeResult.errors.concat(parser.errors));
|
---|
| 56 | };
|
---|
| 57 | return Parser;
|
---|
| 58 | }());
|
---|
| 59 | exports.Parser = Parser;
|
---|
| 60 | var _TreeBuilder = /** @class */ (function () {
|
---|
| 61 | function _TreeBuilder(tokens, getTagDefinition) {
|
---|
| 62 | this.tokens = tokens;
|
---|
| 63 | this.getTagDefinition = getTagDefinition;
|
---|
| 64 | this._index = -1;
|
---|
| 65 | this._elementStack = [];
|
---|
| 66 | this.rootNodes = [];
|
---|
| 67 | this.errors = [];
|
---|
| 68 | this._advance();
|
---|
| 69 | }
|
---|
| 70 | _TreeBuilder.prototype.build = function () {
|
---|
| 71 | while (this._peek.type !== 24 /* EOF */) {
|
---|
| 72 | if (this._peek.type === 0 /* TAG_OPEN_START */ ||
|
---|
| 73 | this._peek.type === 4 /* INCOMPLETE_TAG_OPEN */) {
|
---|
| 74 | this._consumeStartTag(this._advance());
|
---|
| 75 | }
|
---|
| 76 | else if (this._peek.type === 3 /* TAG_CLOSE */) {
|
---|
| 77 | this._consumeEndTag(this._advance());
|
---|
| 78 | }
|
---|
| 79 | else if (this._peek.type === 12 /* CDATA_START */) {
|
---|
| 80 | this._closeVoidElement();
|
---|
| 81 | this._consumeCdata(this._advance());
|
---|
| 82 | }
|
---|
| 83 | else if (this._peek.type === 10 /* COMMENT_START */) {
|
---|
| 84 | this._closeVoidElement();
|
---|
| 85 | this._consumeComment(this._advance());
|
---|
| 86 | }
|
---|
| 87 | else if (this._peek.type === 5 /* TEXT */ || this._peek.type === 7 /* RAW_TEXT */ ||
|
---|
| 88 | this._peek.type === 6 /* ESCAPABLE_RAW_TEXT */) {
|
---|
| 89 | this._closeVoidElement();
|
---|
| 90 | this._consumeText(this._advance());
|
---|
| 91 | }
|
---|
| 92 | else if (this._peek.type === 19 /* EXPANSION_FORM_START */) {
|
---|
| 93 | this._consumeExpansion(this._advance());
|
---|
| 94 | }
|
---|
| 95 | else {
|
---|
| 96 | // Skip all other tokens...
|
---|
| 97 | this._advance();
|
---|
| 98 | }
|
---|
| 99 | }
|
---|
| 100 | };
|
---|
| 101 | _TreeBuilder.prototype._advance = function () {
|
---|
| 102 | var prev = this._peek;
|
---|
| 103 | if (this._index < this.tokens.length - 1) {
|
---|
| 104 | // Note: there is always an EOF token at the end
|
---|
| 105 | this._index++;
|
---|
| 106 | }
|
---|
| 107 | this._peek = this.tokens[this._index];
|
---|
| 108 | return prev;
|
---|
| 109 | };
|
---|
| 110 | _TreeBuilder.prototype._advanceIf = function (type) {
|
---|
| 111 | if (this._peek.type === type) {
|
---|
| 112 | return this._advance();
|
---|
| 113 | }
|
---|
| 114 | return null;
|
---|
| 115 | };
|
---|
| 116 | _TreeBuilder.prototype._consumeCdata = function (_startToken) {
|
---|
| 117 | this._consumeText(this._advance());
|
---|
| 118 | this._advanceIf(13 /* CDATA_END */);
|
---|
| 119 | };
|
---|
| 120 | _TreeBuilder.prototype._consumeComment = function (token) {
|
---|
| 121 | var text = this._advanceIf(7 /* RAW_TEXT */);
|
---|
| 122 | this._advanceIf(11 /* COMMENT_END */);
|
---|
| 123 | var value = text != null ? text.parts[0].trim() : null;
|
---|
| 124 | this._addToParent(new html.Comment(value, token.sourceSpan));
|
---|
| 125 | };
|
---|
| 126 | _TreeBuilder.prototype._consumeExpansion = function (token) {
|
---|
| 127 | var switchValue = this._advance();
|
---|
| 128 | var type = this._advance();
|
---|
| 129 | var cases = [];
|
---|
| 130 | // read =
|
---|
| 131 | while (this._peek.type === 20 /* EXPANSION_CASE_VALUE */) {
|
---|
| 132 | var expCase = this._parseExpansionCase();
|
---|
| 133 | if (!expCase)
|
---|
| 134 | return; // error
|
---|
| 135 | cases.push(expCase);
|
---|
| 136 | }
|
---|
| 137 | // read the final }
|
---|
| 138 | if (this._peek.type !== 23 /* EXPANSION_FORM_END */) {
|
---|
| 139 | this.errors.push(TreeError.create(null, this._peek.sourceSpan, "Invalid ICU message. Missing '}'."));
|
---|
| 140 | return;
|
---|
| 141 | }
|
---|
| 142 | var sourceSpan = new parse_util_1.ParseSourceSpan(token.sourceSpan.start, this._peek.sourceSpan.end, token.sourceSpan.fullStart);
|
---|
| 143 | this._addToParent(new html.Expansion(switchValue.parts[0], type.parts[0], cases, sourceSpan, switchValue.sourceSpan));
|
---|
| 144 | this._advance();
|
---|
| 145 | };
|
---|
| 146 | _TreeBuilder.prototype._parseExpansionCase = function () {
|
---|
| 147 | var value = this._advance();
|
---|
| 148 | // read {
|
---|
| 149 | if (this._peek.type !== 21 /* EXPANSION_CASE_EXP_START */) {
|
---|
| 150 | this.errors.push(TreeError.create(null, this._peek.sourceSpan, "Invalid ICU message. Missing '{'."));
|
---|
| 151 | return null;
|
---|
| 152 | }
|
---|
| 153 | // read until }
|
---|
| 154 | var start = this._advance();
|
---|
| 155 | var exp = this._collectExpansionExpTokens(start);
|
---|
| 156 | if (!exp)
|
---|
| 157 | return null;
|
---|
| 158 | var end = this._advance();
|
---|
| 159 | exp.push({ type: 24 /* EOF */, parts: [], sourceSpan: end.sourceSpan });
|
---|
| 160 | // parse everything in between { and }
|
---|
| 161 | var expansionCaseParser = new _TreeBuilder(exp, this.getTagDefinition);
|
---|
| 162 | expansionCaseParser.build();
|
---|
| 163 | if (expansionCaseParser.errors.length > 0) {
|
---|
| 164 | this.errors = this.errors.concat(expansionCaseParser.errors);
|
---|
| 165 | return null;
|
---|
| 166 | }
|
---|
| 167 | var sourceSpan = new parse_util_1.ParseSourceSpan(value.sourceSpan.start, end.sourceSpan.end, value.sourceSpan.fullStart);
|
---|
| 168 | var expSourceSpan = new parse_util_1.ParseSourceSpan(start.sourceSpan.start, end.sourceSpan.end, start.sourceSpan.fullStart);
|
---|
| 169 | return new html.ExpansionCase(value.parts[0], expansionCaseParser.rootNodes, sourceSpan, value.sourceSpan, expSourceSpan);
|
---|
| 170 | };
|
---|
| 171 | _TreeBuilder.prototype._collectExpansionExpTokens = function (start) {
|
---|
| 172 | var exp = [];
|
---|
| 173 | var expansionFormStack = [21 /* EXPANSION_CASE_EXP_START */];
|
---|
| 174 | while (true) {
|
---|
| 175 | if (this._peek.type === 19 /* EXPANSION_FORM_START */ ||
|
---|
| 176 | this._peek.type === 21 /* EXPANSION_CASE_EXP_START */) {
|
---|
| 177 | expansionFormStack.push(this._peek.type);
|
---|
| 178 | }
|
---|
| 179 | if (this._peek.type === 22 /* EXPANSION_CASE_EXP_END */) {
|
---|
| 180 | if (lastOnStack(expansionFormStack, 21 /* EXPANSION_CASE_EXP_START */)) {
|
---|
| 181 | expansionFormStack.pop();
|
---|
| 182 | if (expansionFormStack.length === 0)
|
---|
| 183 | return exp;
|
---|
| 184 | }
|
---|
| 185 | else {
|
---|
| 186 | this.errors.push(TreeError.create(null, start.sourceSpan, "Invalid ICU message. Missing '}'."));
|
---|
| 187 | return null;
|
---|
| 188 | }
|
---|
| 189 | }
|
---|
| 190 | if (this._peek.type === 23 /* EXPANSION_FORM_END */) {
|
---|
| 191 | if (lastOnStack(expansionFormStack, 19 /* EXPANSION_FORM_START */)) {
|
---|
| 192 | expansionFormStack.pop();
|
---|
| 193 | }
|
---|
| 194 | else {
|
---|
| 195 | this.errors.push(TreeError.create(null, start.sourceSpan, "Invalid ICU message. Missing '}'."));
|
---|
| 196 | return null;
|
---|
| 197 | }
|
---|
| 198 | }
|
---|
| 199 | if (this._peek.type === 24 /* EOF */) {
|
---|
| 200 | this.errors.push(TreeError.create(null, start.sourceSpan, "Invalid ICU message. Missing '}'."));
|
---|
| 201 | return null;
|
---|
| 202 | }
|
---|
| 203 | exp.push(this._advance());
|
---|
| 204 | }
|
---|
| 205 | };
|
---|
| 206 | _TreeBuilder.prototype._consumeText = function (token) {
|
---|
| 207 | var tokens = [token];
|
---|
| 208 | var startSpan = token.sourceSpan;
|
---|
| 209 | var text = token.parts[0];
|
---|
| 210 | if (text.length > 0 && text[0] === '\n') {
|
---|
| 211 | var parent_1 = this._getParentElement();
|
---|
| 212 | if (parent_1 != null && parent_1.children.length === 0 &&
|
---|
| 213 | this.getTagDefinition(parent_1.name).ignoreFirstLf) {
|
---|
| 214 | text = text.substring(1);
|
---|
| 215 | tokens[0] = { type: token.type, sourceSpan: token.sourceSpan, parts: [text] };
|
---|
| 216 | }
|
---|
| 217 | }
|
---|
| 218 | while (this._peek.type === 8 /* INTERPOLATION */ || this._peek.type === 5 /* TEXT */ ||
|
---|
| 219 | this._peek.type === 9 /* ENCODED_ENTITY */) {
|
---|
| 220 | token = this._advance();
|
---|
| 221 | tokens.push(token);
|
---|
| 222 | if (token.type === 8 /* INTERPOLATION */) {
|
---|
| 223 | // For backward compatibility we decode HTML entities that appear in interpolation
|
---|
| 224 | // expressions. This is arguably a bug, but it could be a considerable breaking change to
|
---|
| 225 | // fix it. It should be addressed in a larger project to refactor the entire parser/lexer
|
---|
| 226 | // chain after View Engine has been removed.
|
---|
| 227 | text += token.parts.join('').replace(/&([^;]+);/g, decodeEntity);
|
---|
| 228 | }
|
---|
| 229 | else if (token.type === 9 /* ENCODED_ENTITY */) {
|
---|
| 230 | text += token.parts[0];
|
---|
| 231 | }
|
---|
| 232 | else {
|
---|
| 233 | text += token.parts.join('');
|
---|
| 234 | }
|
---|
| 235 | }
|
---|
| 236 | if (text.length > 0) {
|
---|
| 237 | var endSpan = token.sourceSpan;
|
---|
| 238 | this._addToParent(new html.Text(text, new parse_util_1.ParseSourceSpan(startSpan.start, endSpan.end, startSpan.fullStart, startSpan.details), tokens));
|
---|
| 239 | }
|
---|
| 240 | };
|
---|
| 241 | _TreeBuilder.prototype._closeVoidElement = function () {
|
---|
| 242 | var el = this._getParentElement();
|
---|
| 243 | if (el && this.getTagDefinition(el.name).isVoid) {
|
---|
| 244 | this._elementStack.pop();
|
---|
| 245 | }
|
---|
| 246 | };
|
---|
| 247 | _TreeBuilder.prototype._consumeStartTag = function (startTagToken) {
|
---|
| 248 | var _a = tslib_1.__read(startTagToken.parts, 2), prefix = _a[0], name = _a[1];
|
---|
| 249 | var attrs = [];
|
---|
| 250 | while (this._peek.type === 14 /* ATTR_NAME */) {
|
---|
| 251 | attrs.push(this._consumeAttr(this._advance()));
|
---|
| 252 | }
|
---|
| 253 | var fullName = this._getElementFullName(prefix, name, this._getParentElement());
|
---|
| 254 | var selfClosing = false;
|
---|
| 255 | // Note: There could have been a tokenizer error
|
---|
| 256 | // so that we don't get a token for the end tag...
|
---|
| 257 | if (this._peek.type === 2 /* TAG_OPEN_END_VOID */) {
|
---|
| 258 | this._advance();
|
---|
| 259 | selfClosing = true;
|
---|
| 260 | var tagDef = this.getTagDefinition(fullName);
|
---|
| 261 | if (!(tagDef.canSelfClose || tags_1.getNsPrefix(fullName) !== null || tagDef.isVoid)) {
|
---|
| 262 | this.errors.push(TreeError.create(fullName, startTagToken.sourceSpan, "Only void and foreign elements can be self closed \"" + startTagToken.parts[1] + "\""));
|
---|
| 263 | }
|
---|
| 264 | }
|
---|
| 265 | else if (this._peek.type === 1 /* TAG_OPEN_END */) {
|
---|
| 266 | this._advance();
|
---|
| 267 | selfClosing = false;
|
---|
| 268 | }
|
---|
| 269 | var end = this._peek.sourceSpan.fullStart;
|
---|
| 270 | var span = new parse_util_1.ParseSourceSpan(startTagToken.sourceSpan.start, end, startTagToken.sourceSpan.fullStart);
|
---|
| 271 | // Create a separate `startSpan` because `span` will be modified when there is an `end` span.
|
---|
| 272 | var startSpan = new parse_util_1.ParseSourceSpan(startTagToken.sourceSpan.start, end, startTagToken.sourceSpan.fullStart);
|
---|
| 273 | var el = new html.Element(fullName, attrs, [], span, startSpan, undefined);
|
---|
| 274 | this._pushElement(el);
|
---|
| 275 | if (selfClosing) {
|
---|
| 276 | // Elements that are self-closed have their `endSourceSpan` set to the full span, as the
|
---|
| 277 | // element start tag also represents the end tag.
|
---|
| 278 | this._popElement(fullName, span);
|
---|
| 279 | }
|
---|
| 280 | else if (startTagToken.type === 4 /* INCOMPLETE_TAG_OPEN */) {
|
---|
| 281 | // We already know the opening tag is not complete, so it is unlikely it has a corresponding
|
---|
| 282 | // close tag. Let's optimistically parse it as a full element and emit an error.
|
---|
| 283 | this._popElement(fullName, null);
|
---|
| 284 | this.errors.push(TreeError.create(fullName, span, "Opening tag \"" + fullName + "\" not terminated."));
|
---|
| 285 | }
|
---|
| 286 | };
|
---|
| 287 | _TreeBuilder.prototype._pushElement = function (el) {
|
---|
| 288 | var parentEl = this._getParentElement();
|
---|
| 289 | if (parentEl && this.getTagDefinition(parentEl.name).isClosedByChild(el.name)) {
|
---|
| 290 | this._elementStack.pop();
|
---|
| 291 | }
|
---|
| 292 | this._addToParent(el);
|
---|
| 293 | this._elementStack.push(el);
|
---|
| 294 | };
|
---|
| 295 | _TreeBuilder.prototype._consumeEndTag = function (endTagToken) {
|
---|
| 296 | var fullName = this._getElementFullName(endTagToken.parts[0], endTagToken.parts[1], this._getParentElement());
|
---|
| 297 | if (this.getTagDefinition(fullName).isVoid) {
|
---|
| 298 | this.errors.push(TreeError.create(fullName, endTagToken.sourceSpan, "Void elements do not have end tags \"" + endTagToken.parts[1] + "\""));
|
---|
| 299 | }
|
---|
| 300 | else if (!this._popElement(fullName, endTagToken.sourceSpan)) {
|
---|
| 301 | var errMsg = "Unexpected closing tag \"" + fullName + "\". It may happen when the tag has already been closed by another tag. For more info see https://www.w3.org/TR/html5/syntax.html#closing-elements-that-have-implied-end-tags";
|
---|
| 302 | this.errors.push(TreeError.create(fullName, endTagToken.sourceSpan, errMsg));
|
---|
| 303 | }
|
---|
| 304 | };
|
---|
| 305 | /**
|
---|
| 306 | * Closes the nearest element with the tag name `fullName` in the parse tree.
|
---|
| 307 | * `endSourceSpan` is the span of the closing tag, or null if the element does
|
---|
| 308 | * not have a closing tag (for example, this happens when an incomplete
|
---|
| 309 | * opening tag is recovered).
|
---|
| 310 | */
|
---|
| 311 | _TreeBuilder.prototype._popElement = function (fullName, endSourceSpan) {
|
---|
| 312 | var unexpectedCloseTagDetected = false;
|
---|
| 313 | for (var stackIndex = this._elementStack.length - 1; stackIndex >= 0; stackIndex--) {
|
---|
| 314 | var el = this._elementStack[stackIndex];
|
---|
| 315 | if (el.name === fullName) {
|
---|
| 316 | // Record the parse span with the element that is being closed. Any elements that are
|
---|
| 317 | // removed from the element stack at this point are closed implicitly, so they won't get
|
---|
| 318 | // an end source span (as there is no explicit closing element).
|
---|
| 319 | el.endSourceSpan = endSourceSpan;
|
---|
| 320 | el.sourceSpan.end = endSourceSpan !== null ? endSourceSpan.end : el.sourceSpan.end;
|
---|
| 321 | this._elementStack.splice(stackIndex, this._elementStack.length - stackIndex);
|
---|
| 322 | return !unexpectedCloseTagDetected;
|
---|
| 323 | }
|
---|
| 324 | if (!this.getTagDefinition(el.name).closedByParent) {
|
---|
| 325 | // Note that we encountered an unexpected close tag but continue processing the element
|
---|
| 326 | // stack so we can assign an `endSourceSpan` if there is a corresponding start tag for this
|
---|
| 327 | // end tag in the stack.
|
---|
| 328 | unexpectedCloseTagDetected = true;
|
---|
| 329 | }
|
---|
| 330 | }
|
---|
| 331 | return false;
|
---|
| 332 | };
|
---|
| 333 | _TreeBuilder.prototype._consumeAttr = function (attrName) {
|
---|
| 334 | var fullName = tags_1.mergeNsAndName(attrName.parts[0], attrName.parts[1]);
|
---|
| 335 | var attrEnd = attrName.sourceSpan.end;
|
---|
| 336 | // Consume any quote
|
---|
| 337 | if (this._peek.type === 15 /* ATTR_QUOTE */) {
|
---|
| 338 | this._advance();
|
---|
| 339 | }
|
---|
| 340 | // Consume the attribute value
|
---|
| 341 | var value = '';
|
---|
| 342 | var valueTokens = [];
|
---|
| 343 | var valueStartSpan = undefined;
|
---|
| 344 | var valueEnd = undefined;
|
---|
| 345 | // NOTE: We need to use a new variable `nextTokenType` here to hide the actual type of
|
---|
| 346 | // `_peek.type` from TS. Otherwise TS will narrow the type of `_peek.type` preventing it from
|
---|
| 347 | // being able to consider `ATTR_VALUE_INTERPOLATION` as an option. This is because TS is not
|
---|
| 348 | // able to see that `_advance()` will actually mutate `_peek`.
|
---|
| 349 | var nextTokenType = this._peek.type;
|
---|
| 350 | if (nextTokenType === 16 /* ATTR_VALUE_TEXT */) {
|
---|
| 351 | valueStartSpan = this._peek.sourceSpan;
|
---|
| 352 | valueEnd = this._peek.sourceSpan.end;
|
---|
| 353 | while (this._peek.type === 16 /* ATTR_VALUE_TEXT */ ||
|
---|
| 354 | this._peek.type === 17 /* ATTR_VALUE_INTERPOLATION */ ||
|
---|
| 355 | this._peek.type === 9 /* ENCODED_ENTITY */) {
|
---|
| 356 | var valueToken = this._advance();
|
---|
| 357 | valueTokens.push(valueToken);
|
---|
| 358 | if (valueToken.type === 17 /* ATTR_VALUE_INTERPOLATION */) {
|
---|
| 359 | // For backward compatibility we decode HTML entities that appear in interpolation
|
---|
| 360 | // expressions. This is arguably a bug, but it could be a considerable breaking change to
|
---|
| 361 | // fix it. It should be addressed in a larger project to refactor the entire parser/lexer
|
---|
| 362 | // chain after View Engine has been removed.
|
---|
| 363 | value += valueToken.parts.join('').replace(/&([^;]+);/g, decodeEntity);
|
---|
| 364 | }
|
---|
| 365 | else if (valueToken.type === 9 /* ENCODED_ENTITY */) {
|
---|
| 366 | value += valueToken.parts[0];
|
---|
| 367 | }
|
---|
| 368 | else {
|
---|
| 369 | value += valueToken.parts.join('');
|
---|
| 370 | }
|
---|
| 371 | valueEnd = attrEnd = valueToken.sourceSpan.end;
|
---|
| 372 | }
|
---|
| 373 | }
|
---|
| 374 | // Consume any quote
|
---|
| 375 | if (this._peek.type === 15 /* ATTR_QUOTE */) {
|
---|
| 376 | var quoteToken = this._advance();
|
---|
| 377 | attrEnd = quoteToken.sourceSpan.end;
|
---|
| 378 | }
|
---|
| 379 | var valueSpan = valueStartSpan && valueEnd &&
|
---|
| 380 | new parse_util_1.ParseSourceSpan(valueStartSpan.start, valueEnd, valueStartSpan.fullStart);
|
---|
| 381 | return new html.Attribute(fullName, value, new parse_util_1.ParseSourceSpan(attrName.sourceSpan.start, attrEnd, attrName.sourceSpan.fullStart), attrName.sourceSpan, valueSpan, valueTokens.length > 0 ? valueTokens : undefined, undefined);
|
---|
| 382 | };
|
---|
| 383 | _TreeBuilder.prototype._getParentElement = function () {
|
---|
| 384 | return this._elementStack.length > 0 ? this._elementStack[this._elementStack.length - 1] : null;
|
---|
| 385 | };
|
---|
| 386 | _TreeBuilder.prototype._addToParent = function (node) {
|
---|
| 387 | var parent = this._getParentElement();
|
---|
| 388 | if (parent != null) {
|
---|
| 389 | parent.children.push(node);
|
---|
| 390 | }
|
---|
| 391 | else {
|
---|
| 392 | this.rootNodes.push(node);
|
---|
| 393 | }
|
---|
| 394 | };
|
---|
| 395 | _TreeBuilder.prototype._getElementFullName = function (prefix, localName, parentElement) {
|
---|
| 396 | if (prefix === '') {
|
---|
| 397 | prefix = this.getTagDefinition(localName).implicitNamespacePrefix || '';
|
---|
| 398 | if (prefix === '' && parentElement != null) {
|
---|
| 399 | var parentTagName = tags_1.splitNsName(parentElement.name)[1];
|
---|
| 400 | var parentTagDefinition = this.getTagDefinition(parentTagName);
|
---|
| 401 | if (!parentTagDefinition.preventNamespaceInheritance) {
|
---|
| 402 | prefix = tags_1.getNsPrefix(parentElement.name);
|
---|
| 403 | }
|
---|
| 404 | }
|
---|
| 405 | }
|
---|
| 406 | return tags_1.mergeNsAndName(prefix, localName);
|
---|
| 407 | };
|
---|
| 408 | return _TreeBuilder;
|
---|
| 409 | }());
|
---|
| 410 | function lastOnStack(stack, element) {
|
---|
| 411 | return stack.length > 0 && stack[stack.length - 1] === element;
|
---|
| 412 | }
|
---|
| 413 | /**
|
---|
| 414 | * Decode the `entity` string, which we believe is the contents of an HTML entity.
|
---|
| 415 | *
|
---|
| 416 | * If the string is not actually a valid/known entity then just return the original `match` string.
|
---|
| 417 | */
|
---|
| 418 | function decodeEntity(match, entity) {
|
---|
| 419 | if (entities_1.NAMED_ENTITIES[entity] !== undefined) {
|
---|
| 420 | return entities_1.NAMED_ENTITIES[entity] || match;
|
---|
| 421 | }
|
---|
| 422 | if (/^#x[a-f0-9]+$/i.test(entity)) {
|
---|
| 423 | return String.fromCodePoint(parseInt(entity.slice(2), 16));
|
---|
| 424 | }
|
---|
| 425 | if (/^#\d+$/.test(entity)) {
|
---|
| 426 | return String.fromCodePoint(parseInt(entity.slice(1), 10));
|
---|
| 427 | }
|
---|
| 428 | return match;
|
---|
| 429 | }
|
---|
| 430 | });
|
---|
| 431 | //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicGFyc2VyLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vLi4vLi4vcGFja2FnZXMvY29tcGlsZXIvc3JjL21sX3BhcnNlci9wYXJzZXIudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7Ozs7OztHQU1HOzs7Ozs7Ozs7Ozs7OztJQUVILCtEQUF5RTtJQUV6RSwwREFBOEI7SUFDOUIscUVBQTBDO0lBQzFDLCtEQUFrRDtJQUNsRCw2REFBK0U7SUFHL0U7UUFBK0IscUNBQVU7UUFLdkMsbUJBQW1CLFdBQXdCLEVBQUUsSUFBcUIsRUFBRSxHQU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