source: trip-planner-front/node_modules/@angular/compiler/esm2015/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: 18.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 */
8import { AstPath } from '../ast_path';
9export class NodeWithI18n {
10 constructor(sourceSpan, i18n) {
11 this.sourceSpan = sourceSpan;
12 this.i18n = i18n;
13 }
14}
15export class Text extends NodeWithI18n {
16 constructor(value, sourceSpan, tokens, i18n) {
17 super(sourceSpan, i18n);
18 this.value = value;
19 this.tokens = tokens;
20 }
21 visit(visitor, context) {
22 return visitor.visitText(this, context);
23 }
24}
25export class Expansion extends NodeWithI18n {
26 constructor(switchValue, type, cases, sourceSpan, switchValueSourceSpan, i18n) {
27 super(sourceSpan, i18n);
28 this.switchValue = switchValue;
29 this.type = type;
30 this.cases = cases;
31 this.switchValueSourceSpan = switchValueSourceSpan;
32 }
33 visit(visitor, context) {
34 return visitor.visitExpansion(this, context);
35 }
36}
37export class ExpansionCase {
38 constructor(value, expression, sourceSpan, valueSourceSpan, expSourceSpan) {
39 this.value = value;
40 this.expression = expression;
41 this.sourceSpan = sourceSpan;
42 this.valueSourceSpan = valueSourceSpan;
43 this.expSourceSpan = expSourceSpan;
44 }
45 visit(visitor, context) {
46 return visitor.visitExpansionCase(this, context);
47 }
48}
49export class Attribute extends NodeWithI18n {
50 constructor(name, value, sourceSpan, keySpan, valueSpan, valueTokens, i18n) {
51 super(sourceSpan, i18n);
52 this.name = name;
53 this.value = value;
54 this.keySpan = keySpan;
55 this.valueSpan = valueSpan;
56 this.valueTokens = valueTokens;
57 }
58 visit(visitor, context) {
59 return visitor.visitAttribute(this, context);
60 }
61}
62export class Element extends NodeWithI18n {
63 constructor(name, attrs, children, sourceSpan, startSourceSpan, endSourceSpan = null, i18n) {
64 super(sourceSpan, i18n);
65 this.name = name;
66 this.attrs = attrs;
67 this.children = children;
68 this.startSourceSpan = startSourceSpan;
69 this.endSourceSpan = endSourceSpan;
70 }
71 visit(visitor, context) {
72 return visitor.visitElement(this, context);
73 }
74}
75export class Comment {
76 constructor(value, sourceSpan) {
77 this.value = value;
78 this.sourceSpan = sourceSpan;
79 }
80 visit(visitor, context) {
81 return visitor.visitComment(this, context);
82 }
83}
84export function visitAll(visitor, nodes, context = null) {
85 const result = [];
86 const visit = visitor.visit ?
87 (ast) => visitor.visit(ast, context) || ast.visit(visitor, context) :
88 (ast) => ast.visit(visitor, context);
89 nodes.forEach(ast => {
90 const astResult = visit(ast);
91 if (astResult) {
92 result.push(astResult);
93 }
94 });
95 return result;
96}
97export class RecursiveVisitor {
98 constructor() { }
99 visitElement(ast, context) {
100 this.visitChildren(context, visit => {
101 visit(ast.attrs);
102 visit(ast.children);
103 });
104 }
105 visitAttribute(ast, context) { }
106 visitText(ast, context) { }
107 visitComment(ast, context) { }
108 visitExpansion(ast, context) {
109 return this.visitChildren(context, visit => {
110 visit(ast.cases);
111 });
112 }
113 visitExpansionCase(ast, context) { }
114 visitChildren(context, cb) {
115 let results = [];
116 let t = this;
117 function visit(children) {
118 if (children)
119 results.push(visitAll(t, children, context));
120 }
121 cb(visit);
122 return Array.prototype.concat.apply([], results);
123 }
124}
125function spanOf(ast) {
126 const start = ast.sourceSpan.start.offset;
127 let end = ast.sourceSpan.end.offset;
128 if (ast instanceof Element) {
129 if (ast.endSourceSpan) {
130 end = ast.endSourceSpan.end.offset;
131 }
132 else if (ast.children && ast.children.length) {
133 end = spanOf(ast.children[ast.children.length - 1]).end;
134 }
135 }
136 return { start, end };
137}
138export function findNode(nodes, position) {
139 const path = [];
140 const visitor = new class extends RecursiveVisitor {
141 visit(ast, context) {
142 const span = spanOf(ast);
143 if (span.start <= position && position < span.end) {
144 path.push(ast);
145 }
146 else {
147 // Returning a value here will result in the children being skipped.
148 return true;
149 }
150 }
151 };
152 visitAll(visitor, n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gge1xuICBjb25zdCBwYXRoOiBOb2RlW10gPSBbXTtcblxuICBjb25zdCB2aXNpdG9yID0gbmV3IGNsYXNzIGV4dGVuZHMgUmVjdXJzaXZlVmlzaXRvciB7XG4gICAgdmlzaXQoYXN0OiBOb2RlLCBjb250ZXh0OiBhbnkpOiBhbnkge1xuICAgICAgY29uc3Qgc3BhbiA9IHNwYW5PZihhc3QpO1xuICAgICAgaWYgKHNwYW4uc3RhcnQgPD0gcG9zaXRpb24gJiYgcG9zaXRpb24gPCBzcGFuLmVuZCkge1xuICAgICAgICBwYXRoLnB1c2goYXN0KTtcbiAgICAgIH0gZWxzZSB7XG4gICAgICAgIC8vIFJldHVybmluZyBhIHZhbHVlIGhlcmUgd2lsbCByZXN1bHQgaW4gdGhlIGNoaWxkcmVuIGJlaW5nIHNraXBwZWQuXG4gICAgICAgIHJldHVybiB0cnVlO1xuICAgICAgfVxuICAgIH1cbiAgfTtcblxuICB2aXNpdEFsbCh2aXNpdG9yLCBub2Rlcyk7XG5cbiAgcmV0dXJuIG5ldyBBc3RQYXRoPE5vZGU+KHBhdGgsIHBvc2l0aW9uKTtcbn1cbiJdfQ==
Note: See TracBrowser for help on using the repository browser.