source: imaps-frontend/node_modules/@babel/generator/lib/generators/base.js

main
Last change on this file was 79a0317, checked in by stefan toskovski <stefantoska84@…>, 5 months ago

F4 Finalna Verzija

  • Property mode set to 100644
File size: 2.6 KB
Line 
1"use strict";
2
3Object.defineProperty(exports, "__esModule", {
4 value: true
5});
6exports.BlockStatement = BlockStatement;
7exports.Directive = Directive;
8exports.DirectiveLiteral = DirectiveLiteral;
9exports.File = File;
10exports.InterpreterDirective = InterpreterDirective;
11exports.Placeholder = Placeholder;
12exports.Program = Program;
13function File(node) {
14 if (node.program) {
15 this.print(node.program.interpreter);
16 }
17 this.print(node.program);
18}
19function Program(node) {
20 var _node$directives;
21 this.noIndentInnerCommentsHere();
22 this.printInnerComments();
23 const directivesLen = (_node$directives = node.directives) == null ? void 0 : _node$directives.length;
24 if (directivesLen) {
25 var _node$directives$trai;
26 const newline = node.body.length ? 2 : 1;
27 this.printSequence(node.directives, undefined, newline);
28 if (!((_node$directives$trai = node.directives[directivesLen - 1].trailingComments) != null && _node$directives$trai.length)) {
29 this.newline(newline);
30 }
31 }
32 this.printSequence(node.body);
33}
34function BlockStatement(node) {
35 var _node$directives2;
36 this.tokenChar(123);
37 const exit = this.enterDelimited();
38 const directivesLen = (_node$directives2 = node.directives) == null ? void 0 : _node$directives2.length;
39 if (directivesLen) {
40 var _node$directives$trai2;
41 const newline = node.body.length ? 2 : 1;
42 this.printSequence(node.directives, true, newline);
43 if (!((_node$directives$trai2 = node.directives[directivesLen - 1].trailingComments) != null && _node$directives$trai2.length)) {
44 this.newline(newline);
45 }
46 }
47 this.printSequence(node.body, true);
48 exit();
49 this.rightBrace(node);
50}
51function Directive(node) {
52 this.print(node.value);
53 this.semicolon();
54}
55const unescapedSingleQuoteRE = /(?:^|[^\\])(?:\\\\)*'/;
56const unescapedDoubleQuoteRE = /(?:^|[^\\])(?:\\\\)*"/;
57function DirectiveLiteral(node) {
58 const raw = this.getPossibleRaw(node);
59 if (!this.format.minified && raw !== undefined) {
60 this.token(raw);
61 return;
62 }
63 const {
64 value
65 } = node;
66 if (!unescapedDoubleQuoteRE.test(value)) {
67 this.token(`"${value}"`);
68 } else if (!unescapedSingleQuoteRE.test(value)) {
69 this.token(`'${value}'`);
70 } else {
71 throw new Error("Malformed AST: it is not possible to print a directive containing" + " both unescaped single and double quotes.");
72 }
73}
74function InterpreterDirective(node) {
75 this.token(`#!${node.value}`);
76 this.newline(1, true);
77}
78function Placeholder(node) {
79 this.token("%%");
80 this.print(node.name);
81 this.token("%%");
82 if (node.expectedNode === "Statement") {
83 this.semicolon();
84 }
85}
86
87//# sourceMappingURL=base.js.map
Note: See TracBrowser for help on using the repository browser.