All files / source/CaffeineMc CaffeineMcParser.js

100% Statements 9/9
100% Branches 9/9
100% Functions 6/6
100% Lines 9/9

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68  7x 7x 7x                 7x     7x             61x               61x               61x           7x                                              
"use strict";
let Caf = require("caffeine-script-runtime");
Caf.defMod(module, () => {
  return Caf.importInvoke(
    ["CaffeineEight"],
    [
      global,
      require("art-standard-lib"),
      { CaffeineEight: require("caffeine-eight") },
    ],
    (CaffeineEight) => {
      let CaffeineMcParser;
      return (CaffeineMcParser = Caf.defClass(
        class CaffeineMcParser extends CaffeineEight.Parser {},
        function (CaffeineMcParser, classSuper, instanceSuper) {
          this.rule({
            root: [
              "!oneLinerWithoutColon meta? toEof",
              {
                getter: {
                  compilerName: function () {
                    let base, base1;
                    return (
                      Caf.exists((base = this.meta)) &&
                      Caf.exists((base1 = base.compilerName)) &&
                      base1.text
                    );
                  },
                  metaCode: function () {
                    let base, base1;
                    return (
                      Caf.exists((base = this.meta)) &&
                      Caf.exists((base1 = base.metaCode)) &&
                      base1.text
                    );
                  },
                  code: function () {
                    let base;
                    return (Caf.exists((base = this.toEof)) && base.text) || "";
                  },
                },
              },
            ],
          });
          this.rule({
            meta: [
              "'|' compilerName /: */ metaCode:toEol end",
              "'|' / +/ metaCode:toEol end",
              "'|' compilerName /: */? metaCode:block end",
              "'|' metaCode:block end",
              "'|' compilerName end",
              "'|'",
            ],
            oneLinerWithoutColon: "'|' compilerName / *[^:\n]/",
            compilerName: /[^:\s]+/i,
            toEof: /(.|\n)*$/,
            toEol: /\S[^\n]*/,
            end: /\n|$/,
            block: CaffeineEight.Extensions.IndentBlocks.getPropsToSubparseBlock(
              { rule: "toEof" }
            ),
          });
        }
      ));
    }
  );
});