source: trip-planner-front/node_modules/@angular/compiler/src/ml_parser/ast.js

Last change on this file was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 22.8 KB
Line 
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/ast", ["require", "exports", "tslib", "@angular/compiler/src/ast_path"], factory);
15 }
16})(function (require, exports) {
17 "use strict";
18 Object.defineProperty(exports, "__esModule", { value: true });
19 exports.findNode = exports.RecursiveVisitor = exports.visitAll = exports.Comment = exports.Element = exports.Attribute = exports.ExpansionCase = exports.Expansion = exports.Text = exports.NodeWithI18n = void 0;
20 var tslib_1 = require("tslib");
21 var ast_path_1 = require("@angular/compiler/src/ast_path");
22 var NodeWithI18n = /** @class */ (function () {
23 function NodeWithI18n(sourceSpan, i18n) {
24 this.sourceSpan = sourceSpan;
25 this.i18n = i18n;
26 }
27 return NodeWithI18n;
28 }());
29 exports.NodeWithI18n = NodeWithI18n;
30 var Text = /** @class */ (function (_super) {
31 tslib_1.__extends(Text, _super);
32 function Text(value, sourceSpan, tokens, i18n) {
33 var _this = _super.call(this, sourceSpan, i18n) || this;
34 _this.value = value;
35 _this.tokens = tokens;
36 return _this;
37 }
38 Text.prototype.visit = function (visitor, context) {
39 return visitor.visitText(this, context);
40 };
41 return Text;
42 }(NodeWithI18n));
43 exports.Text = Text;
44 var Expansion = /** @class */ (function (_super) {
45 tslib_1.__extends(Expansion, _super);
46 function Expansion(switchValue, type, cases, sourceSpan, switchValueSourceSpan, i18n) {
47 var _this = _super.call(this, sourceSpan, i18n) || this;
48 _this.switchValue = switchValue;
49 _this.type = type;
50 _this.cases = cases;
51 _this.switchValueSourceSpan = switchValueSourceSpan;
52 return _this;
53 }
54 Expansion.prototype.visit = function (visitor, context) {
55 return visitor.visitExpansion(this, context);
56 };
57 return Expansion;
58 }(NodeWithI18n));
59 exports.Expansion = Expansion;
60 var ExpansionCase = /** @class */ (function () {
61 function ExpansionCase(value, expression, sourceSpan, valueSourceSpan, expSourceSpan) {
62 this.value = value;
63 this.expression = expression;
64 this.sourceSpan = sourceSpan;
65 this.valueSourceSpan = valueSourceSpan;
66 this.expSourceSpan = expSourceSpan;
67 }
68 ExpansionCase.prototype.visit = function (visitor, context) {
69 return visitor.visitExpansionCase(this, context);
70 };
71 return ExpansionCase;
72 }());
73 exports.ExpansionCase = ExpansionCase;
74 var Attribute = /** @class */ (function (_super) {
75 tslib_1.__extends(Attribute, _super);
76 function Attribute(name, value, sourceSpan, keySpan, valueSpan, valueTokens, i18n) {
77 var _this = _super.call(this, sourceSpan, i18n) || this;
78 _this.name = name;
79 _this.value = value;
80 _this.keySpan = keySpan;
81 _this.valueSpan = valueSpan;
82 _this.valueTokens = valueTokens;
83 return _this;
84 }
85 Attribute.prototype.visit = function (visitor, context) {
86 return visitor.visitAttribute(this, context);
87 };
88 return Attribute;
89 }(NodeWithI18n));
90 exports.Attribute = Attribute;
91 var Element = /** @class */ (function (_super) {
92 tslib_1.__extends(Element, _super);
93 function Element(name, attrs, children, sourceSpan, startSourceSpan, endSourceSpan, i18n) {
94 if (endSourceSpan === void 0) { endSourceSpan = null; }
95 var _this = _super.call(this, sourceSpan, i18n) || this;
96 _this.name = name;
97 _this.attrs = attrs;
98 _this.children = children;
99 _this.startSourceSpan = startSourceSpan;
100 _this.endSourceSpan = endSourceSpan;
101 return _this;
102 }
103 Element.prototype.visit = function (visitor, context) {
104 return visitor.visitElement(this, context);
105 };
106 return Element;
107 }(NodeWithI18n));
108 exports.Element = Element;
109 var Comment = /** @class */ (function () {
110 function Comment(value, sourceSpan) {
111 this.value = value;
112 this.sourceSpan = sourceSpan;
113 }
114 Comment.prototype.visit = function (visitor, context) {
115 return visitor.visitComment(this, context);
116 };
117 return Comment;
118 }());
119 exports.Comment = Comment;
120 function visitAll(visitor, nodes, context) {
121 if (context === void 0) { context = null; }
122 var result = [];
123 var visit = visitor.visit ?
124 function (ast) { return visitor.visit(ast, context) || ast.visit(visitor, context); } :
125 function (ast) { return ast.visit(visitor, context); };
126 nodes.forEach(function (ast) {
127 var astResult = visit(ast);
128 if (astResult) {
129 result.push(astResult);
130 }
131 });
132 return result;
133 }
134 exports.visitAll = visitAll;
135 var RecursiveVisitor = /** @class */ (function () {
136 function RecursiveVisitor() {
137 }
138 RecursiveVisitor.prototype.visitElement = function (ast, context) {
139 this.visitChildren(context, function (visit) {
140 visit(ast.attrs);
141 visit(ast.children);
142 });
143 };
144 RecursiveVisitor.prototype.visitAttribute = function (ast, context) { };
145 RecursiveVisitor.prototype.visitText = function (ast, context) { };
146 RecursiveVisitor.prototype.visitComment = function (ast, context) { };
147 RecursiveVisitor.prototype.visitExpansion = function (ast, context) {
148 return this.visitChildren(context, function (visit) {
149 visit(ast.cases);
150 });
151 };
152 RecursiveVisitor.prototype.visitExpansionCase = function (ast, context) { };
153 RecursiveVisitor.prototype.visitChildren = function (context, cb) {
154 var results = [];
155 var t = this;
156 function visit(children) {
157 if (children)
158 results.push(visitAll(t, children, context));
159 }
160 cb(visit);
161 return Array.prototype.concat.apply([], results);
162 };
163 return RecursiveVisitor;
164 }());
165 exports.RecursiveVisitor = RecursiveVisitor;
166 function spanOf(ast) {
167 var start = ast.sourceSpan.start.offset;
168 var end = ast.sourceSpan.end.offset;
169 if (ast instanceof Element) {
170 if (ast.endSourceSpan) {
171 end = ast.endSourceSpan.end.offset;
172 }
173 else if (ast.children && ast.children.length) {
174 end = spanOf(ast.children[ast.children.length - 1]).end;
175 }
176 }
177 return { start: start, end: end };
178 }
179 function findNode(nodes, position) {
180 var path = [];
181 var visitor = new /** @class */ (function (_super) {
182 tslib_1.__extends(class_1, _super);
183 function class_1() {
184 return _super !== null && _super.apply(this, arguments) || this;
185 }
186 class_1.prototype.visit = function (ast, context) {
187 var span = spanOf(ast);
188 if (span.start <= position && position < span.end) {
189 path.push(ast);
190 }
191 else {
192 // Returning a value here will result in the children being skipped.
193 return true;
194 }
195 };
196 return class_1;
197 }(RecursiveVisitor));
198 visitAll(visitor, nodes);
199 return new ast_path_1.AstPath(path, position);
200 }
201 exports.findNode = findNode;
202});
203//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYXN0LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vLi4vLi4vcGFja2FnZXMvY29tcGlsZXIvc3JjL21sX3BhcnNlci9hc3QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7Ozs7OztHQU1HOzs7Ozs7Ozs7Ozs7OztJQUVILDJEQUFvQztJQVlwQztRQUNFLHNCQUFtQixVQUEyQixFQUFTLElBQWU7WUFBbkQsZUFBVSxHQUFWLFVBQVUsQ0FBaUI7WUFBUyxTQUFJLEdBQUosSUFBSSxDQUFXO1FBQUcsQ0FBQztRQUU1RSxtQkFBQztJQUFELENBQUMsQUFIRCxJQUdDO0lBSHFCLG9DQUFZO0lBS2xDO1FBQTBCLGdDQUFZO1FBQ3BDLGNBQ1csS0FBYSxFQUFFLFVBQTJCLEVBQVMsTUFBK0IsRUFDekYsSUFBZTtZQUZuQixZQUdFLGtCQUFNLFVBQVUsRUFBRSxJQUFJLENBQUMsU0FDeEI7WUFIVSxXQUFLLEdBQUwsS0FBSyxDQUFRO1lBQXNDLFlBQU0sR0FBTixNQUFNLENBQXlCOztRQUc3RixDQUFDO1FBQ1Esb0JBQUssR0FBZCxVQUFlLE9BQWdCLEVBQUUsT0FBWTtZQUMzQyxPQUFPLE9BQU8sQ0FBQyxTQUFTLENBQUMsSUFBSSxFQUFFLE9BQU8sQ0FBQyxDQUFDO1FBQzFDLENBQUM7UUFDSCxXQUFDO0lBQUQsQ0F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XN0KTtcbiAgICAgIGlmIChzcGFuLnN0YXJ0IDw9IHBvc2l0aW9uICYmIHBvc2l0aW9uIDwgc3Bhbi5lbmQpIHtcbiAgICAgICAgcGF0aC5wdXNoKGFzdCk7XG4gICAgICB9IGVsc2Uge1xuICAgICAgICAvLyBSZXR1cm5pbmcgYSB2YWx1ZSBoZXJlIHdpbGwgcmVzdWx0IGluIHRoZSBjaGlsZHJlbiBiZWluZyBza2lwcGVkLlxuICAgICAgICByZXR1cm4gdHJ1ZTtcbiAgICAgIH1cbiAgICB9XG4gIH07XG5cbiAgdmlzaXRBbGwodmlzaXRvciwgbm9kZXMpO1xuXG4gIHJldHVybiBuZXcgQXN0UGF0aDxOb2RlPihwYXRoLCBwb3NpdGlvbik7XG59XG4iXX0=
Note: See TracBrowser for help on using the repository browser.