Software zum Installieren eines Smart-Mirror Frameworks , zum Nutzen von hochschulrelevanten Informationen, auf einem Raspberry-Pi.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

base.js 2.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.File = File;
  6. exports.Program = Program;
  7. exports.BlockStatement = BlockStatement;
  8. exports.Directive = Directive;
  9. exports.DirectiveLiteral = DirectiveLiteral;
  10. exports.InterpreterDirective = InterpreterDirective;
  11. exports.Placeholder = Placeholder;
  12. var t = require("@babel/types");
  13. function File(node) {
  14. if (node.program) {
  15. this.print(node.program.interpreter, node);
  16. }
  17. this.print(node.program, node);
  18. }
  19. function Program(node) {
  20. this.printInnerComments(node, false);
  21. this.printSequence(node.directives, node);
  22. if (node.directives && node.directives.length) this.newline();
  23. this.printSequence(node.body, node);
  24. }
  25. function BlockStatement(node) {
  26. var _node$directives;
  27. this.token("{");
  28. this.printInnerComments(node);
  29. const hasDirectives = (_node$directives = node.directives) == null ? void 0 : _node$directives.length;
  30. if (node.body.length || hasDirectives) {
  31. this.newline();
  32. this.printSequence(node.directives, node, {
  33. indent: true
  34. });
  35. if (hasDirectives) this.newline();
  36. this.printSequence(node.body, node, {
  37. indent: true
  38. });
  39. this.removeTrailingNewline();
  40. this.source("end", node.loc);
  41. if (!this.endsWith("\n")) this.newline();
  42. this.rightBrace();
  43. } else {
  44. this.source("end", node.loc);
  45. this.token("}");
  46. }
  47. }
  48. function Directive(node) {
  49. this.print(node.value, node);
  50. this.semicolon();
  51. }
  52. const unescapedSingleQuoteRE = /(?:^|[^\\])(?:\\\\)*'/;
  53. const unescapedDoubleQuoteRE = /(?:^|[^\\])(?:\\\\)*"/;
  54. function DirectiveLiteral(node) {
  55. const raw = this.getPossibleRaw(node);
  56. if (raw != null) {
  57. this.token(raw);
  58. return;
  59. }
  60. const {
  61. value
  62. } = node;
  63. if (!unescapedDoubleQuoteRE.test(value)) {
  64. this.token(`"${value}"`);
  65. } else if (!unescapedSingleQuoteRE.test(value)) {
  66. this.token(`'${value}'`);
  67. } else {
  68. throw new Error("Malformed AST: it is not possible to print a directive containing" + " both unescaped single and double quotes.");
  69. }
  70. }
  71. function InterpreterDirective(node) {
  72. this.token(`#!${node.value}\n`);
  73. }
  74. function Placeholder(node) {
  75. this.token("%%");
  76. this.print(node.name);
  77. this.token("%%");
  78. if (node.expectedNode === "Statement") {
  79. this.semicolon();
  80. }
  81. }