// @generated by Peggy 4.0.2.
//
// https://peggyjs.org/



  import * as t from './parser-import.js';

function peg$subclass(child, parent) {
  function C() { this.constructor = child; }
  C.prototype = parent.prototype;
  child.prototype = new C();
}

function peg$SyntaxError(message, expected, found, location) {
  var self = Error.call(this, message);
  // istanbul ignore next Check is a necessary evil to support older environments
  if (Object.setPrototypeOf) {
    Object.setPrototypeOf(self, peg$SyntaxError.prototype);
  }
  self.expected = expected;
  self.found = found;
  self.location = location;
  self.name = "SyntaxError";
  return self;
}

peg$subclass(peg$SyntaxError, Error);

function peg$padEnd(str, targetLength, padString) {
  padString = padString || " ";
  if (str.length > targetLength) { return str; }
  targetLength -= str.length;
  padString += padString.repeat(targetLength);
  return str + padString.slice(0, targetLength);
}

peg$SyntaxError.prototype.format = function(sources) {
  var str = "Error: " + this.message;
  if (this.location) {
    var src = null;
    var k;
    for (k = 0; k < sources.length; k++) {
      if (sources[k].source === this.location.source) {
        src = sources[k].text.split(/\r\n|\n|\r/g);
        break;
      }
    }
    var s = this.location.start;
    var offset_s = (this.location.source && (typeof this.location.source.offset === "function"))
      ? this.location.source.offset(s)
      : s;
    var loc = this.location.source + ":" + offset_s.line + ":" + offset_s.column;
    if (src) {
      var e = this.location.end;
      var filler = peg$padEnd("", offset_s.line.toString().length, ' ');
      var line = src[s.line - 1];
      var last = s.line === e.line ? e.column : line.length + 1;
      var hatLen = (last - s.column) || 1;
      str += "\n --> " + loc + "\n"
          + filler + " |\n"
          + offset_s.line + " | " + line + "\n"
          + filler + " | " + peg$padEnd("", s.column - 1, ' ')
          + peg$padEnd("", hatLen, "^");
    } else {
      str += "\n at " + loc;
    }
  }
  return str;
};

peg$SyntaxError.buildMessage = function(expected, found) {
  var DESCRIBE_EXPECTATION_FNS = {
    literal: function(expectation) {
      return "\"" + literalEscape(expectation.text) + "\"";
    },

    class: function(expectation) {
      var escapedParts = expectation.parts.map(function(part) {
        return Array.isArray(part)
          ? classEscape(part[0]) + "-" + classEscape(part[1])
          : classEscape(part);
      });

      return "[" + (expectation.inverted ? "^" : "") + escapedParts.join("") + "]";
    },

    any: function() {
      return "any character";
    },

    end: function() {
      return "end of input";
    },

    other: function(expectation) {
      return expectation.description;
    }
  };

  function hex(ch) {
    return ch.charCodeAt(0).toString(16).toUpperCase();
  }

  function literalEscape(s) {
    return s
      .replace(/\\/g, "\\\\")
      .replace(/"/g,  "\\\"")
      .replace(/\0/g, "\\0")
      .replace(/\t/g, "\\t")
      .replace(/\n/g, "\\n")
      .replace(/\r/g, "\\r")
      .replace(/[\x00-\x0F]/g,          function(ch) { return "\\x0" + hex(ch); })
      .replace(/[\x10-\x1F\x7F-\x9F]/g, function(ch) { return "\\x"  + hex(ch); });
  }

  function classEscape(s) {
    return s
      .replace(/\\/g, "\\\\")
      .replace(/\]/g, "\\]")
      .replace(/\^/g, "\\^")
      .replace(/-/g,  "\\-")
      .replace(/\0/g, "\\0")
      .replace(/\t/g, "\\t")
      .replace(/\n/g, "\\n")
      .replace(/\r/g, "\\r")
      .replace(/[\x00-\x0F]/g,          function(ch) { return "\\x0" + hex(ch); })
      .replace(/[\x10-\x1F\x7F-\x9F]/g, function(ch) { return "\\x"  + hex(ch); });
  }

  function describeExpectation(expectation) {
    return DESCRIBE_EXPECTATION_FNS[expectation.type](expectation);
  }

  function describeExpected(expected) {
    var descriptions = expected.map(describeExpectation);
    var i, j;

    descriptions.sort();

    if (descriptions.length > 0) {
      for (i = 1, j = 1; i < descriptions.length; i++) {
        if (descriptions[i - 1] !== descriptions[i]) {
          descriptions[j] = descriptions[i];
          j++;
        }
      }
      descriptions.length = j;
    }

    switch (descriptions.length) {
      case 1:
        return descriptions[0];

      case 2:
        return descriptions[0] + " or " + descriptions[1];

      default:
        return descriptions.slice(0, -1).join(", ")
          + ", or "
          + descriptions[descriptions.length - 1];
    }
  }

  function describeFound(found) {
    return found ? "\"" + literalEscape(found) + "\"" : "end of input";
  }

  return "Expected " + describeExpected(expected) + " but " + describeFound(found) + " found.";
};

function peg$parse(input, options) {
  options = options !== undefined ? options : {};

  var peg$FAILED = {};
  var peg$source = options.grammarSource;

  var peg$startRuleFunctions = { start: peg$parsestart };
  var peg$startRuleFunction = peg$parsestart;

  var peg$c0 = "\uFEFF";
  var peg$c1 = "include";
  var peg$c2 = "cpp_include";
  var peg$c3 = "namespace";
  var peg$c4 = "*";
  var peg$c5 = "const";
  var peg$c6 = "=";
  var peg$c7 = "typedef";
  var peg$c8 = "enum";
  var peg$c9 = "{";
  var peg$c10 = "}";
  var peg$c11 = "struct";
  var peg$c12 = "union";
  var peg$c13 = "exception";
  var peg$c14 = "service";
  var peg$c15 = "extends";
  var peg$c16 = ":";
  var peg$c17 = "required";
  var peg$c18 = "optional";
  var peg$c19 = "oneway";
  var peg$c20 = "(";
  var peg$c21 = ")";
  var peg$c22 = "void";
  var peg$c23 = "throws";
  var peg$c24 = "bool";
  var peg$c25 = "byte";
  var peg$c26 = "i8";
  var peg$c27 = "i16";
  var peg$c28 = "i32";
  var peg$c29 = "i64";
  var peg$c30 = "double";
  var peg$c31 = "string";
  var peg$c32 = "binary";
  var peg$c33 = "map";
  var peg$c34 = "<";
  var peg$c35 = ",";
  var peg$c36 = ">";
  var peg$c37 = "set";
  var peg$c38 = "list";
  var peg$c39 = "cpp_type";
  var peg$c40 = ".";
  var peg$c41 = "0x";
  var peg$c42 = "[";
  var peg$c43 = "]";
  var peg$c44 = "\\";
  var peg$c45 = "b";
  var peg$c46 = "f";
  var peg$c47 = "n";
  var peg$c48 = "r";
  var peg$c49 = "t";
  var peg$c50 = "u";
  var peg$c51 = "\"";
  var peg$c52 = "'";
  var peg$c53 = "//";
  var peg$c54 = "#";
  var peg$c55 = "/*";
  var peg$c56 = "/";
  var peg$c57 = "/**";

  var peg$r0 = /^[+\-]/;
  var peg$r1 = /^[0-9]/;
  var peg$r2 = /^[Ee]/;
  var peg$r3 = /^[0-9a-fA-F]/;
  var peg$r4 = /^["'\\]/;
  var peg$r5 = /^[^"]/;
  var peg$r6 = /^[^']/;
  var peg$r7 = /^[a-zA-Z_]/;
  var peg$r8 = /^[a-zA-Z0-9._]/;
  var peg$r9 = /^[,;]/;
  var peg$r10 = /^[ \t\r\n]/;
  var peg$r11 = /^[^\r\n]/;
  var peg$r12 = /^[^*]/;
  var peg$r13 = /^[^\/]/;

  var peg$e0 = peg$literalExpectation("\uFEFF", false);
  var peg$e1 = peg$literalExpectation("include", false);
  var peg$e2 = peg$literalExpectation("cpp_include", false);
  var peg$e3 = peg$literalExpectation("namespace", false);
  var peg$e4 = peg$literalExpectation("*", false);
  var peg$e5 = peg$literalExpectation("const", false);
  var peg$e6 = peg$literalExpectation("=", false);
  var peg$e7 = peg$literalExpectation("typedef", false);
  var peg$e8 = peg$literalExpectation("enum", false);
  var peg$e9 = peg$literalExpectation("{", false);
  var peg$e10 = peg$literalExpectation("}", false);
  var peg$e11 = peg$literalExpectation("struct", false);
  var peg$e12 = peg$literalExpectation("union", false);
  var peg$e13 = peg$literalExpectation("exception", false);
  var peg$e14 = peg$literalExpectation("service", false);
  var peg$e15 = peg$literalExpectation("extends", false);
  var peg$e16 = peg$literalExpectation(":", false);
  var peg$e17 = peg$literalExpectation("required", false);
  var peg$e18 = peg$literalExpectation("optional", false);
  var peg$e19 = peg$literalExpectation("oneway", false);
  var peg$e20 = peg$literalExpectation("(", false);
  var peg$e21 = peg$literalExpectation(")", false);
  var peg$e22 = peg$literalExpectation("void", false);
  var peg$e23 = peg$literalExpectation("throws", false);
  var peg$e24 = peg$literalExpectation("bool", false);
  var peg$e25 = peg$literalExpectation("byte", false);
  var peg$e26 = peg$literalExpectation("i8", false);
  var peg$e27 = peg$literalExpectation("i16", false);
  var peg$e28 = peg$literalExpectation("i32", false);
  var peg$e29 = peg$literalExpectation("i64", false);
  var peg$e30 = peg$literalExpectation("double", false);
  var peg$e31 = peg$literalExpectation("string", false);
  var peg$e32 = peg$literalExpectation("binary", false);
  var peg$e33 = peg$literalExpectation("map", false);
  var peg$e34 = peg$literalExpectation("<", false);
  var peg$e35 = peg$literalExpectation(",", false);
  var peg$e36 = peg$literalExpectation(">", false);
  var peg$e37 = peg$literalExpectation("set", false);
  var peg$e38 = peg$literalExpectation("list", false);
  var peg$e39 = peg$literalExpectation("cpp_type", false);
  var peg$e40 = peg$otherExpectation("number");
  var peg$e41 = peg$classExpectation(["+", "-"], false, false);
  var peg$e42 = peg$classExpectation([["0", "9"]], false, false);
  var peg$e43 = peg$literalExpectation(".", false);
  var peg$e44 = peg$classExpectation(["E", "e"], false, false);
  var peg$e45 = peg$otherExpectation("hex integer");
  var peg$e46 = peg$literalExpectation("0x", false);
  var peg$e47 = peg$classExpectation([["0", "9"], ["a", "f"], ["A", "F"]], false, false);
  var peg$e48 = peg$otherExpectation("integer");
  var peg$e49 = peg$literalExpectation("[", false);
  var peg$e50 = peg$literalExpectation("]", false);
  var peg$e51 = peg$literalExpectation("\\", false);
  var peg$e52 = peg$classExpectation(["\"", "'", "\\"], false, false);
  var peg$e53 = peg$literalExpectation("b", false);
  var peg$e54 = peg$literalExpectation("f", false);
  var peg$e55 = peg$literalExpectation("n", false);
  var peg$e56 = peg$literalExpectation("r", false);
  var peg$e57 = peg$literalExpectation("t", false);
  var peg$e58 = peg$literalExpectation("u", false);
  var peg$e59 = peg$otherExpectation("Literal");
  var peg$e60 = peg$literalExpectation("\"", false);
  var peg$e61 = peg$classExpectation(["\""], true, false);
  var peg$e62 = peg$literalExpectation("'", false);
  var peg$e63 = peg$classExpectation(["'"], true, false);
  var peg$e64 = peg$otherExpectation("Identifier");
  var peg$e65 = peg$classExpectation([["a", "z"], ["A", "Z"], "_"], false, false);
  var peg$e66 = peg$classExpectation([["a", "z"], ["A", "Z"], ["0", "9"], ".", "_"], false, false);
  var peg$e67 = peg$otherExpectation("separator");
  var peg$e68 = peg$classExpectation([",", ";"], false, false);
  var peg$e69 = peg$otherExpectation("whitespace");
  var peg$e70 = peg$classExpectation([" ", "\t", "\r", "\n"], false, false);
  var peg$e71 = peg$literalExpectation("//", false);
  var peg$e72 = peg$literalExpectation("#", false);
  var peg$e73 = peg$classExpectation(["\r", "\n"], true, false);
  var peg$e74 = peg$literalExpectation("/*", false);
  var peg$e75 = peg$classExpectation(["*"], true, false);
  var peg$e76 = peg$classExpectation(["/"], true, false);
  var peg$e77 = peg$literalExpectation("/", false);
  var peg$e78 = peg$literalExpectation("/**", false);

  var peg$f0 = function(headers, definitions) { return new t.Document(headers, definitions); };
  var peg$f1 = function(file) {
      doc("include_end");
      return new t.Include(location(), file);
    };
  var peg$f2 = function(file) {
      doc("cpp_include_end");
      return new t.CppInclude(location(), file);
    };
  var peg$f3 = function(scope, namespace) {
      doc("namespace_end");
      return new t.Namespace(location(), scope, namespace);
    };
  var peg$f4 = function() { return text(); };
  var peg$f5 = function() {
        sdoc = doc("const");
        return true;
      };
  var peg$f6 = function(type, id, value) {
        doc("const_end");
        return true;
      };
  var peg$f7 = function(type, id, value) {
      return new t.Const(location(), type, id, value, sdoc);
    };
  var peg$f8 = function() {
        sdoc = doc("typedef");
        return true;
      };
  var peg$f9 = function(type, id) {
        doc("typedef_end");
        return true;
      };
  var peg$f10 = function(type, id) {
      return new t.Typedef(location(), id, type, sdoc);
    };
  var peg$f11 = function() {
        sdoc = doc("enum");
        return true;
      };
  var peg$f12 = function(id, e, value) {
          return new t.EnumValue(location(), e, value, doc("enum_value_end"));
        };
  var peg$f13 = function(id, values) {
      doc("enum_end");
      return new t.Enum(location(), id, values, sdoc);
    };
  var peg$f14 = function() {
        sdoc = doc("struct");
        debug(1,sdoc);
        return true;
      };
  var peg$f15 = function(id, fields) {
      doc("struct_end");
      return new t.Struct(location(), id, fields, sdoc);
    };
  var peg$f16 = function() {
        sdoc = doc("union");
        return true;
      };
  var peg$f17 = function(id, fields) {
      doc("union_end");
      return new t.Union(location(), id, fields, sdoc);
    };
  var peg$f18 = function() {
        sdoc = doc("exception");
        return true;
      };
  var peg$f19 = function(id, fields) {
      doc("exception_end");
      return new t.Exception(location(), id, fields, sdoc);
    };
  var peg$f20 = function() {
        sdoc = doc("service");
        return true;
      };
  var peg$f21 = function(id, base, methods) {
      doc("service_end");
      return new t.Service(location(), id, base, methods, sdoc);
    };
  var peg$f22 = function(id, required, type, name) {
        fdoc = doc("field");
        return true;
      };
  var peg$f23 = function(id, required, type, name, def) { return new t.Field(location(), id, required, type, name, def, fdoc); };
  var peg$f24 = function() { return true; };
  var peg$f25 = function() { return false; };
  var peg$f26 = function(oneway, result, id) {
        mdoc = doc("function");
        return true;
      };
  var peg$f27 = function(oneway, result, id, params, throws) { return new t.Method(location(), result, id, params, throws, oneway != null, mdoc); };
  var peg$f28 = function() { return new t.BaseType(location(), 'void'); };
  var peg$f29 = function(id) {
    if (t.BaseTypeName.includes(id.name)) {
      return new t.BaseType(id.location, id.name);
    }
    return id;
  };
  var peg$f30 = function() {
      return new t.BaseType(location(), text());
    };
  var peg$f31 = function(k, v) {
      return new t.ContainerType(location(), 'map', [k, v]);
    };
  var peg$f32 = function(k) { return new t.ContainerType(location(), 'set', [k]); };
  var peg$f33 = function(i) { return new t.ContainerType(location(), 'list', [i]); };
  var peg$f34 = function(v) {
      return new t.ConstValue(location(), v);
    };
  var peg$f35 = function() { return parseFloat(text()); };
  var peg$f36 = function() { return BigInt(text()); };
  var peg$f37 = function() { return BigInt(text()); };
  var peg$f38 = function(k, v) { return [k, v]; };
  var peg$f39 = function(i) {
      return new Map(i || []);
    };
  var peg$f40 = function() { return "\b"; };
  var peg$f41 = function() { return "\f"; };
  var peg$f42 = function() { return "\n"; };
  var peg$f43 = function() { return "\r"; };
  var peg$f44 = function() { return "\t"; };
  var peg$f45 = function(digits) {
          return String.fromCharCode(parseInt(digits, 16));
        };
  var peg$f46 = function(chars) { return new t.Literal(location(), chars.join('')); };
  var peg$f47 = function() { return new t.Identifier(location(), text()); };
  var peg$f48 = function() { 
  _doc = t.trimDoc(text());
  debug('push', _doc)
};
  var peg$currPos = options.peg$currPos | 0;
  var peg$savedPos = peg$currPos;
  var peg$posDetailsCache = [{ line: 1, column: 1 }];
  var peg$maxFailPos = peg$currPos;
  var peg$maxFailExpected = options.peg$maxFailExpected || [];
  var peg$silentFails = options.peg$silentFails | 0;

  var peg$result;

  if (options.startRule) {
    if (!(options.startRule in peg$startRuleFunctions)) {
      throw new Error("Can't start parsing from rule \"" + options.startRule + "\".");
    }

    peg$startRuleFunction = peg$startRuleFunctions[options.startRule];
  }

  function text() {
    return input.substring(peg$savedPos, peg$currPos);
  }

  function offset() {
    return peg$savedPos;
  }

  function range() {
    return {
      source: peg$source,
      start: peg$savedPos,
      end: peg$currPos
    };
  }

  function location() {
    return peg$computeLocation(peg$savedPos, peg$currPos);
  }

  function expected(description, location) {
    location = location !== undefined
      ? location
      : peg$computeLocation(peg$savedPos, peg$currPos);

    throw peg$buildStructuredError(
      [peg$otherExpectation(description)],
      input.substring(peg$savedPos, peg$currPos),
      location
    );
  }

  function error(message, location) {
    location = location !== undefined
      ? location
      : peg$computeLocation(peg$savedPos, peg$currPos);

    throw peg$buildSimpleError(message, location);
  }

  function peg$literalExpectation(text, ignoreCase) {
    return { type: "literal", text: text, ignoreCase: ignoreCase };
  }

  function peg$classExpectation(parts, inverted, ignoreCase) {
    return { type: "class", parts: parts, inverted: inverted, ignoreCase: ignoreCase };
  }

  function peg$anyExpectation() {
    return { type: "any" };
  }

  function peg$endExpectation() {
    return { type: "end" };
  }

  function peg$otherExpectation(description) {
    return { type: "other", description: description };
  }

  function peg$computePosDetails(pos) {
    var details = peg$posDetailsCache[pos];
    var p;

    if (details) {
      return details;
    } else {
      if (pos >= peg$posDetailsCache.length) {
        p = peg$posDetailsCache.length - 1;
      } else {
        p = pos;
        while (!peg$posDetailsCache[--p]) {}
      }

      details = peg$posDetailsCache[p];
      details = {
        line: details.line,
        column: details.column
      };

      while (p < pos) {
        if (input.charCodeAt(p) === 10) {
          details.line++;
          details.column = 1;
        } else {
          details.column++;
        }

        p++;
      }

      peg$posDetailsCache[pos] = details;

      return details;
    }
  }

  function peg$computeLocation(startPos, endPos, offset) {
    var startPosDetails = peg$computePosDetails(startPos);
    var endPosDetails = peg$computePosDetails(endPos);

    var res = {
      source: peg$source,
      start: {
        offset: startPos,
        line: startPosDetails.line,
        column: startPosDetails.column
      },
      end: {
        offset: endPos,
        line: endPosDetails.line,
        column: endPosDetails.column
      }
    };
    if (offset && peg$source && (typeof peg$source.offset === "function")) {
      res.start = peg$source.offset(res.start);
      res.end = peg$source.offset(res.end);
    }
    return res;
  }

  function peg$fail(expected) {
    if (peg$currPos < peg$maxFailPos) { return; }

    if (peg$currPos > peg$maxFailPos) {
      peg$maxFailPos = peg$currPos;
      peg$maxFailExpected = [];
    }

    peg$maxFailExpected.push(expected);
  }

  function peg$buildSimpleError(message, location) {
    return new peg$SyntaxError(message, null, null, location);
  }

  function peg$buildStructuredError(expected, found, location) {
    return new peg$SyntaxError(
      peg$SyntaxError.buildMessage(expected, found),
      expected,
      found,
      location
    );
  }

  function peg$parsestart() {
    var s0, s1, s2;

    s0 = peg$currPos;
    if (input.charCodeAt(peg$currPos) === 65279) {
      s1 = peg$c0;
      peg$currPos++;
    } else {
      s1 = peg$FAILED;
      if (peg$silentFails === 0) { peg$fail(peg$e0); }
    }
    if (s1 === peg$FAILED) {
      s1 = null;
    }
    s2 = peg$parseDocument();
    s0 = s2;

    return s0;
  }

  function peg$parseDocument() {
    var s0, s1, s2, s3, s4;

    s0 = peg$currPos;
    s1 = peg$parse__();
    s2 = [];
    s3 = peg$parseHeader();
    while (s3 !== peg$FAILED) {
      s2.push(s3);
      s3 = peg$parseHeader();
    }
    s3 = [];
    s4 = peg$parseDefinition();
    while (s4 !== peg$FAILED) {
      s3.push(s4);
      s4 = peg$parseDefinition();
    }
    s4 = peg$parse__();
    peg$savedPos = s0;
    s0 = peg$f0(s2, s3);

    return s0;
  }

  function peg$parseHeader() {
    var s0, s1, s2;

    s0 = peg$currPos;
    s1 = peg$parseInclude();
    if (s1 === peg$FAILED) {
      s1 = peg$parseCppInclude();
      if (s1 === peg$FAILED) {
        s1 = peg$parseNamespace();
      }
    }
    if (s1 !== peg$FAILED) {
      s2 = peg$parse__();
      s0 = s1;
    } else {
      peg$currPos = s0;
      s0 = peg$FAILED;
    }

    return s0;
  }

  function peg$parseInclude() {
    var s0, s1, s2, s3;

    s0 = peg$currPos;
    if (input.substr(peg$currPos, 7) === peg$c1) {
      s1 = peg$c1;
      peg$currPos += 7;
    } else {
      s1 = peg$FAILED;
      if (peg$silentFails === 0) { peg$fail(peg$e1); }
    }
    if (s1 !== peg$FAILED) {
      s2 = peg$parse_();
      if (s2 !== peg$FAILED) {
        s3 = peg$parseLiteral();
        if (s3 !== peg$FAILED) {
          peg$savedPos = s0;
          s0 = peg$f1(s3);
        } else {
          peg$currPos = s0;
          s0 = peg$FAILED;
        }
      } else {
        peg$currPos = s0;
        s0 = peg$FAILED;
      }
    } else {
      peg$currPos = s0;
      s0 = peg$FAILED;
    }

    return s0;
  }

  function peg$parseCppInclude() {
    var s0, s1, s2, s3;

    s0 = peg$currPos;
    if (input.substr(peg$currPos, 11) === peg$c2) {
      s1 = peg$c2;
      peg$currPos += 11;
    } else {
      s1 = peg$FAILED;
      if (peg$silentFails === 0) { peg$fail(peg$e2); }
    }
    if (s1 !== peg$FAILED) {
      s2 = peg$parse_();
      if (s2 !== peg$FAILED) {
        s3 = peg$parseLiteral();
        if (s3 !== peg$FAILED) {
          peg$savedPos = s0;
          s0 = peg$f2(s3);
        } else {
          peg$currPos = s0;
          s0 = peg$FAILED;
        }
      } else {
        peg$currPos = s0;
        s0 = peg$FAILED;
      }
    } else {
      peg$currPos = s0;
      s0 = peg$FAILED;
    }

    return s0;
  }

  function peg$parseNamespace() {
    var s0, s1, s2, s3, s4, s5;

    s0 = peg$currPos;
    if (input.substr(peg$currPos, 9) === peg$c3) {
      s1 = peg$c3;
      peg$currPos += 9;
    } else {
      s1 = peg$FAILED;
      if (peg$silentFails === 0) { peg$fail(peg$e3); }
    }
    if (s1 !== peg$FAILED) {
      s2 = peg$parse_();
      if (s2 !== peg$FAILED) {
        s3 = peg$parseNamespaceScope();
        if (s3 !== peg$FAILED) {
          s4 = peg$parse_();
          if (s4 !== peg$FAILED) {
            s5 = peg$parseIdentifier();
            if (s5 !== peg$FAILED) {
              peg$savedPos = s0;
              s0 = peg$f3(s3, s5);
            } else {
              peg$currPos = s0;
              s0 = peg$FAILED;
            }
          } else {
            peg$currPos = s0;
            s0 = peg$FAILED;
          }
        } else {
          peg$currPos = s0;
          s0 = peg$FAILED;
        }
      } else {
        peg$currPos = s0;
        s0 = peg$FAILED;
      }
    } else {
      peg$currPos = s0;
      s0 = peg$FAILED;
    }

    return s0;
  }

  function peg$parseNamespaceScope() {
    var s0, s1;

    if (input.charCodeAt(peg$currPos) === 42) {
      s0 = peg$c4;
      peg$currPos++;
    } else {
      s0 = peg$FAILED;
      if (peg$silentFails === 0) { peg$fail(peg$e4); }
    }
    if (s0 === peg$FAILED) {
      s0 = peg$currPos;
      s1 = peg$parseIdentifier();
      if (s1 !== peg$FAILED) {
        peg$savedPos = s0;
        s1 = peg$f4();
      }
      s0 = s1;
    }

    return s0;
  }

  function peg$parseDefinition() {
    var s0, s1, s2;

    s0 = peg$currPos;
    s1 = peg$parseConst();
    if (s1 === peg$FAILED) {
      s1 = peg$parseTypedef();
      if (s1 === peg$FAILED) {
        s1 = peg$parseEnum();
        if (s1 === peg$FAILED) {
          s1 = peg$parseStruct();
          if (s1 === peg$FAILED) {
            s1 = peg$parseUnion();
            if (s1 === peg$FAILED) {
              s1 = peg$parseException();
              if (s1 === peg$FAILED) {
                s1 = peg$parseService();
              }
            }
          }
        }
      }
    }
    if (s1 !== peg$FAILED) {
      s2 = peg$parse__();
      s0 = s1;
    } else {
      peg$currPos = s0;
      s0 = peg$FAILED;
    }

    return s0;
  }

  function peg$parseConst() {
    var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13;

    s0 = peg$currPos;
    if (input.substr(peg$currPos, 5) === peg$c5) {
      s1 = peg$c5;
      peg$currPos += 5;
    } else {
      s1 = peg$FAILED;
      if (peg$silentFails === 0) { peg$fail(peg$e5); }
    }
    if (s1 !== peg$FAILED) {
      s2 = peg$parse_();
      if (s2 !== peg$FAILED) {
        peg$savedPos = peg$currPos;
        s3 = peg$f5();
        if (s3) {
          s3 = undefined;
        } else {
          s3 = peg$FAILED;
        }
        if (s3 !== peg$FAILED) {
          s4 = peg$parseFieldType();
          if (s4 !== peg$FAILED) {
            s5 = peg$parse_();
            if (s5 !== peg$FAILED) {
              s6 = peg$parseIdentifier();
              if (s6 !== peg$FAILED) {
                s7 = peg$parse__();
                if (input.charCodeAt(peg$currPos) === 61) {
                  s8 = peg$c6;
                  peg$currPos++;
                } else {
                  s8 = peg$FAILED;
                  if (peg$silentFails === 0) { peg$fail(peg$e6); }
                }
                if (s8 !== peg$FAILED) {
                  s9 = peg$parse__();
                  s10 = peg$parseConstValue();
                  if (s10 !== peg$FAILED) {
                    peg$savedPos = peg$currPos;
                    s11 = peg$f6(s4, s6, s10);
                    if (s11) {
                      s11 = undefined;
                    } else {
                      s11 = peg$FAILED;
                    }
                    if (s11 !== peg$FAILED) {
                      s12 = peg$parse__();
                      s13 = peg$parseListSeparator();
                      if (s13 === peg$FAILED) {
                        s13 = null;
                      }
                      peg$savedPos = s0;
                      s0 = peg$f7(s4, s6, s10);
                    } else {
                      peg$currPos = s0;
                      s0 = peg$FAILED;
                    }
                  } else {
                    peg$currPos = s0;
                    s0 = peg$FAILED;
                  }
                } else {
                  peg$currPos = s0;
                  s0 = peg$FAILED;
                }
              } else {
                peg$currPos = s0;
                s0 = peg$FAILED;
              }
            } else {
              peg$currPos = s0;
              s0 = peg$FAILED;
            }
          } else {
            peg$currPos = s0;
            s0 = peg$FAILED;
          }
        } else {
          peg$currPos = s0;
          s0 = peg$FAILED;
        }
      } else {
        peg$currPos = s0;
        s0 = peg$FAILED;
      }
    } else {
      peg$currPos = s0;
      s0 = peg$FAILED;
    }

    return s0;
  }

  function peg$parseTypedef() {
    var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9;

    s0 = peg$currPos;
    if (input.substr(peg$currPos, 7) === peg$c7) {
      s1 = peg$c7;
      peg$currPos += 7;
    } else {
      s1 = peg$FAILED;
      if (peg$silentFails === 0) { peg$fail(peg$e7); }
    }
    if (s1 !== peg$FAILED) {
      s2 = peg$parse_();
      if (s2 !== peg$FAILED) {
        peg$savedPos = peg$currPos;
        s3 = peg$f8();
        if (s3) {
          s3 = undefined;
        } else {
          s3 = peg$FAILED;
        }
        if (s3 !== peg$FAILED) {
          s4 = peg$parseFieldType();
          if (s4 !== peg$FAILED) {
            s5 = peg$parse_();
            if (s5 !== peg$FAILED) {
              s6 = peg$parseIdentifier();
              if (s6 !== peg$FAILED) {
                peg$savedPos = peg$currPos;
                s7 = peg$f9(s4, s6);
                if (s7) {
                  s7 = undefined;
                } else {
                  s7 = peg$FAILED;
                }
                if (s7 !== peg$FAILED) {
                  s8 = peg$parse__();
                  s9 = peg$parseListSeparator();
                  if (s9 === peg$FAILED) {
                    s9 = null;
                  }
                  peg$savedPos = s0;
                  s0 = peg$f10(s4, s6);
                } else {
                  peg$currPos = s0;
                  s0 = peg$FAILED;
                }
              } else {
                peg$currPos = s0;
                s0 = peg$FAILED;
              }
            } else {
              peg$currPos = s0;
              s0 = peg$FAILED;
            }
          } else {
            peg$currPos = s0;
            s0 = peg$FAILED;
          }
        } else {
          peg$currPos = s0;
          s0 = peg$FAILED;
        }
      } else {
        peg$currPos = s0;
        s0 = peg$FAILED;
      }
    } else {
      peg$currPos = s0;
      s0 = peg$FAILED;
    }

    return s0;
  }

  function peg$parseEnum() {
    var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13, s14, s15;

    s0 = peg$currPos;
    if (input.substr(peg$currPos, 4) === peg$c8) {
      s1 = peg$c8;
      peg$currPos += 4;
    } else {
      s1 = peg$FAILED;
      if (peg$silentFails === 0) { peg$fail(peg$e8); }
    }
    if (s1 !== peg$FAILED) {
      s2 = peg$parse_();
      if (s2 !== peg$FAILED) {
        peg$savedPos = peg$currPos;
        s3 = peg$f11();
        if (s3) {
          s3 = undefined;
        } else {
          s3 = peg$FAILED;
        }
        if (s3 !== peg$FAILED) {
          s4 = peg$parseIdentifier();
          if (s4 !== peg$FAILED) {
            s5 = peg$parse__();
            if (input.charCodeAt(peg$currPos) === 123) {
              s6 = peg$c9;
              peg$currPos++;
            } else {
              s6 = peg$FAILED;
              if (peg$silentFails === 0) { peg$fail(peg$e9); }
            }
            if (s6 !== peg$FAILED) {
              s7 = peg$parse__();
              s8 = [];
              s9 = peg$currPos;
              s10 = peg$parseIdentifier();
              if (s10 !== peg$FAILED) {
                s11 = peg$currPos;
                s12 = peg$parse__();
                if (input.charCodeAt(peg$currPos) === 61) {
                  s13 = peg$c6;
                  peg$currPos++;
                } else {
                  s13 = peg$FAILED;
                  if (peg$silentFails === 0) { peg$fail(peg$e6); }
                }
                if (s13 !== peg$FAILED) {
                  s14 = peg$parse__();
                  s15 = peg$parseIntConstant();
                  if (s15 !== peg$FAILED) {
                    s11 = s15;
                  } else {
                    peg$currPos = s11;
                    s11 = peg$FAILED;
                  }
                } else {
                  peg$currPos = s11;
                  s11 = peg$FAILED;
                }
                if (s11 === peg$FAILED) {
                  s11 = null;
                }
                s12 = peg$parse__();
                s13 = peg$parseListSeparator();
                if (s13 === peg$FAILED) {
                  s13 = null;
                }
                s14 = peg$parse__();
                peg$savedPos = s9;
                s9 = peg$f12(s4, s10, s11);
              } else {
                peg$currPos = s9;
                s9 = peg$FAILED;
              }
              while (s9 !== peg$FAILED) {
                s8.push(s9);
                s9 = peg$currPos;
                s10 = peg$parseIdentifier();
                if (s10 !== peg$FAILED) {
                  s11 = peg$currPos;
                  s12 = peg$parse__();
                  if (input.charCodeAt(peg$currPos) === 61) {
                    s13 = peg$c6;
                    peg$currPos++;
                  } else {
                    s13 = peg$FAILED;
                    if (peg$silentFails === 0) { peg$fail(peg$e6); }
                  }
                  if (s13 !== peg$FAILED) {
                    s14 = peg$parse__();
                    s15 = peg$parseIntConstant();
                    if (s15 !== peg$FAILED) {
                      s11 = s15;
                    } else {
                      peg$currPos = s11;
                      s11 = peg$FAILED;
                    }
                  } else {
                    peg$currPos = s11;
                    s11 = peg$FAILED;
                  }
                  if (s11 === peg$FAILED) {
                    s11 = null;
                  }
                  s12 = peg$parse__();
                  s13 = peg$parseListSeparator();
                  if (s13 === peg$FAILED) {
                    s13 = null;
                  }
                  s14 = peg$parse__();
                  peg$savedPos = s9;
                  s9 = peg$f12(s4, s10, s11);
                } else {
                  peg$currPos = s9;
                  s9 = peg$FAILED;
                }
              }
              s9 = peg$parse__();
              if (input.charCodeAt(peg$currPos) === 125) {
                s10 = peg$c10;
                peg$currPos++;
              } else {
                s10 = peg$FAILED;
                if (peg$silentFails === 0) { peg$fail(peg$e10); }
              }
              if (s10 !== peg$FAILED) {
                peg$savedPos = s0;
                s0 = peg$f13(s4, s8);
              } else {
                peg$currPos = s0;
                s0 = peg$FAILED;
              }
            } else {
              peg$currPos = s0;
              s0 = peg$FAILED;
            }
          } else {
            peg$currPos = s0;
            s0 = peg$FAILED;
          }
        } else {
          peg$currPos = s0;
          s0 = peg$FAILED;
        }
      } else {
        peg$currPos = s0;
        s0 = peg$FAILED;
      }
    } else {
      peg$currPos = s0;
      s0 = peg$FAILED;
    }

    return s0;
  }

  function peg$parseStruct() {
    var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10;

    s0 = peg$currPos;
    if (input.substr(peg$currPos, 6) === peg$c11) {
      s1 = peg$c11;
      peg$currPos += 6;
    } else {
      s1 = peg$FAILED;
      if (peg$silentFails === 0) { peg$fail(peg$e11); }
    }
    if (s1 !== peg$FAILED) {
      s2 = peg$parse_();
      if (s2 !== peg$FAILED) {
        peg$savedPos = peg$currPos;
        s3 = peg$f14();
        if (s3) {
          s3 = undefined;
        } else {
          s3 = peg$FAILED;
        }
        if (s3 !== peg$FAILED) {
          s4 = peg$parseIdentifier();
          if (s4 !== peg$FAILED) {
            s5 = peg$parse__();
            if (input.charCodeAt(peg$currPos) === 123) {
              s6 = peg$c9;
              peg$currPos++;
            } else {
              s6 = peg$FAILED;
              if (peg$silentFails === 0) { peg$fail(peg$e9); }
            }
            if (s6 !== peg$FAILED) {
              s7 = peg$parse__();
              s8 = [];
              s9 = peg$parseField();
              while (s9 !== peg$FAILED) {
                s8.push(s9);
                s9 = peg$parseField();
              }
              s9 = peg$parse__();
              if (input.charCodeAt(peg$currPos) === 125) {
                s10 = peg$c10;
                peg$currPos++;
              } else {
                s10 = peg$FAILED;
                if (peg$silentFails === 0) { peg$fail(peg$e10); }
              }
              if (s10 !== peg$FAILED) {
                peg$savedPos = s0;
                s0 = peg$f15(s4, s8);
              } else {
                peg$currPos = s0;
                s0 = peg$FAILED;
              }
            } else {
              peg$currPos = s0;
              s0 = peg$FAILED;
            }
          } else {
            peg$currPos = s0;
            s0 = peg$FAILED;
          }
        } else {
          peg$currPos = s0;
          s0 = peg$FAILED;
        }
      } else {
        peg$currPos = s0;
        s0 = peg$FAILED;
      }
    } else {
      peg$currPos = s0;
      s0 = peg$FAILED;
    }

    return s0;
  }

  function peg$parseUnion() {
    var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10;

    s0 = peg$currPos;
    if (input.substr(peg$currPos, 5) === peg$c12) {
      s1 = peg$c12;
      peg$currPos += 5;
    } else {
      s1 = peg$FAILED;
      if (peg$silentFails === 0) { peg$fail(peg$e12); }
    }
    if (s1 !== peg$FAILED) {
      s2 = peg$parse_();
      if (s2 !== peg$FAILED) {
        peg$savedPos = peg$currPos;
        s3 = peg$f16();
        if (s3) {
          s3 = undefined;
        } else {
          s3 = peg$FAILED;
        }
        if (s3 !== peg$FAILED) {
          s4 = peg$parseIdentifier();
          if (s4 !== peg$FAILED) {
            s5 = peg$parse__();
            if (input.charCodeAt(peg$currPos) === 123) {
              s6 = peg$c9;
              peg$currPos++;
            } else {
              s6 = peg$FAILED;
              if (peg$silentFails === 0) { peg$fail(peg$e9); }
            }
            if (s6 !== peg$FAILED) {
              s7 = peg$parse__();
              s8 = [];
              s9 = peg$parseField();
              while (s9 !== peg$FAILED) {
                s8.push(s9);
                s9 = peg$parseField();
              }
              s9 = peg$parse__();
              if (input.charCodeAt(peg$currPos) === 125) {
                s10 = peg$c10;
                peg$currPos++;
              } else {
                s10 = peg$FAILED;
                if (peg$silentFails === 0) { peg$fail(peg$e10); }
              }
              if (s10 !== peg$FAILED) {
                peg$savedPos = s0;
                s0 = peg$f17(s4, s8);
              } else {
                peg$currPos = s0;
                s0 = peg$FAILED;
              }
            } else {
              peg$currPos = s0;
              s0 = peg$FAILED;
            }
          } else {
            peg$currPos = s0;
            s0 = peg$FAILED;
          }
        } else {
          peg$currPos = s0;
          s0 = peg$FAILED;
        }
      } else {
        peg$currPos = s0;
        s0 = peg$FAILED;
      }
    } else {
      peg$currPos = s0;
      s0 = peg$FAILED;
    }

    return s0;
  }

  function peg$parseException() {
    var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10;

    s0 = peg$currPos;
    if (input.substr(peg$currPos, 9) === peg$c13) {
      s1 = peg$c13;
      peg$currPos += 9;
    } else {
      s1 = peg$FAILED;
      if (peg$silentFails === 0) { peg$fail(peg$e13); }
    }
    if (s1 !== peg$FAILED) {
      s2 = peg$parse_();
      if (s2 !== peg$FAILED) {
        peg$savedPos = peg$currPos;
        s3 = peg$f18();
        if (s3) {
          s3 = undefined;
        } else {
          s3 = peg$FAILED;
        }
        if (s3 !== peg$FAILED) {
          s4 = peg$parseIdentifier();
          if (s4 !== peg$FAILED) {
            s5 = peg$parse__();
            if (input.charCodeAt(peg$currPos) === 123) {
              s6 = peg$c9;
              peg$currPos++;
            } else {
              s6 = peg$FAILED;
              if (peg$silentFails === 0) { peg$fail(peg$e9); }
            }
            if (s6 !== peg$FAILED) {
              s7 = peg$parse__();
              s8 = [];
              s9 = peg$parseField();
              while (s9 !== peg$FAILED) {
                s8.push(s9);
                s9 = peg$parseField();
              }
              s9 = peg$parse__();
              if (input.charCodeAt(peg$currPos) === 125) {
                s10 = peg$c10;
                peg$currPos++;
              } else {
                s10 = peg$FAILED;
                if (peg$silentFails === 0) { peg$fail(peg$e10); }
              }
              if (s10 !== peg$FAILED) {
                peg$savedPos = s0;
                s0 = peg$f19(s4, s8);
              } else {
                peg$currPos = s0;
                s0 = peg$FAILED;
              }
            } else {
              peg$currPos = s0;
              s0 = peg$FAILED;
            }
          } else {
            peg$currPos = s0;
            s0 = peg$FAILED;
          }
        } else {
          peg$currPos = s0;
          s0 = peg$FAILED;
        }
      } else {
        peg$currPos = s0;
        s0 = peg$FAILED;
      }
    } else {
      peg$currPos = s0;
      s0 = peg$FAILED;
    }

    return s0;
  }

  function peg$parseService() {
    var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11;

    s0 = peg$currPos;
    if (input.substr(peg$currPos, 7) === peg$c14) {
      s1 = peg$c14;
      peg$currPos += 7;
    } else {
      s1 = peg$FAILED;
      if (peg$silentFails === 0) { peg$fail(peg$e14); }
    }
    if (s1 !== peg$FAILED) {
      s2 = peg$parse_();
      if (s2 !== peg$FAILED) {
        peg$savedPos = peg$currPos;
        s3 = peg$f20();
        if (s3) {
          s3 = undefined;
        } else {
          s3 = peg$FAILED;
        }
        if (s3 !== peg$FAILED) {
          s4 = peg$parseIdentifier();
          if (s4 !== peg$FAILED) {
            s5 = peg$currPos;
            s6 = peg$parse_();
            if (s6 !== peg$FAILED) {
              if (input.substr(peg$currPos, 7) === peg$c15) {
                s7 = peg$c15;
                peg$currPos += 7;
              } else {
                s7 = peg$FAILED;
                if (peg$silentFails === 0) { peg$fail(peg$e15); }
              }
              if (s7 !== peg$FAILED) {
                s8 = peg$parse_();
                if (s8 !== peg$FAILED) {
                  s9 = peg$parseIdentifier();
                  if (s9 !== peg$FAILED) {
                    s5 = s9;
                  } else {
                    peg$currPos = s5;
                    s5 = peg$FAILED;
                  }
                } else {
                  peg$currPos = s5;
                  s5 = peg$FAILED;
                }
              } else {
                peg$currPos = s5;
                s5 = peg$FAILED;
              }
            } else {
              peg$currPos = s5;
              s5 = peg$FAILED;
            }
            if (s5 === peg$FAILED) {
              s5 = null;
            }
            s6 = peg$parse__();
            if (input.charCodeAt(peg$currPos) === 123) {
              s7 = peg$c9;
              peg$currPos++;
            } else {
              s7 = peg$FAILED;
              if (peg$silentFails === 0) { peg$fail(peg$e9); }
            }
            if (s7 !== peg$FAILED) {
              s8 = peg$parse__();
              s9 = [];
              s10 = peg$parseFunction();
              while (s10 !== peg$FAILED) {
                s9.push(s10);
                s10 = peg$parseFunction();
              }
              s10 = peg$parse__();
              if (input.charCodeAt(peg$currPos) === 125) {
                s11 = peg$c10;
                peg$currPos++;
              } else {
                s11 = peg$FAILED;
                if (peg$silentFails === 0) { peg$fail(peg$e10); }
              }
              if (s11 !== peg$FAILED) {
                peg$savedPos = s0;
                s0 = peg$f21(s4, s5, s9);
              } else {
                peg$currPos = s0;
                s0 = peg$FAILED;
              }
            } else {
              peg$currPos = s0;
              s0 = peg$FAILED;
            }
          } else {
            peg$currPos = s0;
            s0 = peg$FAILED;
          }
        } else {
          peg$currPos = s0;
          s0 = peg$FAILED;
        }
      } else {
        peg$currPos = s0;
        s0 = peg$FAILED;
      }
    } else {
      peg$currPos = s0;
      s0 = peg$FAILED;
    }

    return s0;
  }

  function peg$parseField() {
    var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12;

    s0 = peg$currPos;
    s1 = peg$parseFieldID();
    if (s1 === peg$FAILED) {
      s1 = null;
    }
    s2 = peg$parseFieldReq();
    if (s2 === peg$FAILED) {
      s2 = null;
    }
    s3 = peg$parse__();
    s4 = peg$parseFieldType();
    if (s4 !== peg$FAILED) {
      s5 = peg$parse_();
      if (s5 !== peg$FAILED) {
        s6 = peg$parseIdentifier();
        if (s6 !== peg$FAILED) {
          peg$savedPos = peg$currPos;
          s7 = peg$f22(s1, s2, s4, s6);
          if (s7) {
            s7 = undefined;
          } else {
            s7 = peg$FAILED;
          }
          if (s7 !== peg$FAILED) {
            s8 = peg$currPos;
            s9 = peg$parse__();
            if (input.charCodeAt(peg$currPos) === 61) {
              s10 = peg$c6;
              peg$currPos++;
            } else {
              s10 = peg$FAILED;
              if (peg$silentFails === 0) { peg$fail(peg$e6); }
            }
            if (s10 !== peg$FAILED) {
              s11 = peg$parse__();
              s12 = peg$parseConstValue();
              if (s12 !== peg$FAILED) {
                s8 = s12;
              } else {
                peg$currPos = s8;
                s8 = peg$FAILED;
              }
            } else {
              peg$currPos = s8;
              s8 = peg$FAILED;
            }
            if (s8 === peg$FAILED) {
              s8 = null;
            }
            s9 = peg$parse__();
            s10 = peg$parseListSeparator();
            if (s10 === peg$FAILED) {
              s10 = null;
            }
            peg$savedPos = s0;
            s0 = peg$f23(s1, s2, s4, s6, s8);
          } else {
            peg$currPos = s0;
            s0 = peg$FAILED;
          }
        } else {
          peg$currPos = s0;
          s0 = peg$FAILED;
        }
      } else {
        peg$currPos = s0;
        s0 = peg$FAILED;
      }
    } else {
      peg$currPos = s0;
      s0 = peg$FAILED;
    }

    return s0;
  }

  function peg$parseFieldID() {
    var s0, s1, s2, s3, s4;

    s0 = peg$currPos;
    s1 = peg$parseIntConstant();
    if (s1 !== peg$FAILED) {
      s2 = peg$parse__();
      if (input.charCodeAt(peg$currPos) === 58) {
        s3 = peg$c16;
        peg$currPos++;
      } else {
        s3 = peg$FAILED;
        if (peg$silentFails === 0) { peg$fail(peg$e16); }
      }
      if (s3 !== peg$FAILED) {
        s4 = peg$parse__();
        s0 = s1;
      } else {
        peg$currPos = s0;
        s0 = peg$FAILED;
      }
    } else {
      peg$currPos = s0;
      s0 = peg$FAILED;
    }

    return s0;
  }

  function peg$parseFieldReq() {
    var s0, s1;

    s0 = peg$currPos;
    if (input.substr(peg$currPos, 8) === peg$c17) {
      s1 = peg$c17;
      peg$currPos += 8;
    } else {
      s1 = peg$FAILED;
      if (peg$silentFails === 0) { peg$fail(peg$e17); }
    }
    if (s1 !== peg$FAILED) {
      peg$savedPos = s0;
      s1 = peg$f24();
    }
    s0 = s1;
    if (s0 === peg$FAILED) {
      s0 = peg$currPos;
      if (input.substr(peg$currPos, 8) === peg$c18) {
        s1 = peg$c18;
        peg$currPos += 8;
      } else {
        s1 = peg$FAILED;
        if (peg$silentFails === 0) { peg$fail(peg$e18); }
      }
      if (s1 !== peg$FAILED) {
        peg$savedPos = s0;
        s1 = peg$f25();
      }
      s0 = s1;
    }

    return s0;
  }

  function peg$parseFunction() {
    var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13, s14, s15, s16;

    s0 = peg$currPos;
    if (input.substr(peg$currPos, 6) === peg$c19) {
      s1 = peg$c19;
      peg$currPos += 6;
    } else {
      s1 = peg$FAILED;
      if (peg$silentFails === 0) { peg$fail(peg$e19); }
    }
    if (s1 === peg$FAILED) {
      s1 = null;
    }
    s2 = peg$parse__();
    s3 = peg$parseFunctionType();
    if (s3 !== peg$FAILED) {
      s4 = peg$parse_();
      if (s4 !== peg$FAILED) {
        s5 = peg$parseIdentifier();
        if (s5 !== peg$FAILED) {
          peg$savedPos = peg$currPos;
          s6 = peg$f26(s1, s3, s5);
          if (s6) {
            s6 = undefined;
          } else {
            s6 = peg$FAILED;
          }
          if (s6 !== peg$FAILED) {
            s7 = peg$parse__();
            if (input.charCodeAt(peg$currPos) === 40) {
              s8 = peg$c20;
              peg$currPos++;
            } else {
              s8 = peg$FAILED;
              if (peg$silentFails === 0) { peg$fail(peg$e20); }
            }
            if (s8 !== peg$FAILED) {
              s9 = peg$parse__();
              s10 = [];
              s11 = peg$parseField();
              while (s11 !== peg$FAILED) {
                s10.push(s11);
                s11 = peg$parseField();
              }
              s11 = peg$parse__();
              if (input.charCodeAt(peg$currPos) === 41) {
                s12 = peg$c21;
                peg$currPos++;
              } else {
                s12 = peg$FAILED;
                if (peg$silentFails === 0) { peg$fail(peg$e21); }
              }
              if (s12 !== peg$FAILED) {
                s13 = peg$parse__();
                s14 = peg$parseThrows();
                if (s14 === peg$FAILED) {
                  s14 = null;
                }
                s15 = peg$parse__();
                s16 = peg$parseListSeparator();
                if (s16 === peg$FAILED) {
                  s16 = null;
                }
                peg$savedPos = s0;
                s0 = peg$f27(s1, s3, s5, s10, s14);
              } else {
                peg$currPos = s0;
                s0 = peg$FAILED;
              }
            } else {
              peg$currPos = s0;
              s0 = peg$FAILED;
            }
          } else {
            peg$currPos = s0;
            s0 = peg$FAILED;
          }
        } else {
          peg$currPos = s0;
          s0 = peg$FAILED;
        }
      } else {
        peg$currPos = s0;
        s0 = peg$FAILED;
      }
    } else {
      peg$currPos = s0;
      s0 = peg$FAILED;
    }

    return s0;
  }

  function peg$parseFunctionType() {
    var s0, s1;

    s0 = peg$currPos;
    if (input.substr(peg$currPos, 4) === peg$c22) {
      s1 = peg$c22;
      peg$currPos += 4;
    } else {
      s1 = peg$FAILED;
      if (peg$silentFails === 0) { peg$fail(peg$e22); }
    }
    if (s1 !== peg$FAILED) {
      peg$savedPos = s0;
      s1 = peg$f28();
    }
    s0 = s1;
    if (s0 === peg$FAILED) {
      s0 = peg$parseFieldType();
    }

    return s0;
  }

  function peg$parseThrows() {
    var s0, s1, s2, s3, s4, s5, s6, s7;

    s0 = peg$currPos;
    if (input.substr(peg$currPos, 6) === peg$c23) {
      s1 = peg$c23;
      peg$currPos += 6;
    } else {
      s1 = peg$FAILED;
      if (peg$silentFails === 0) { peg$fail(peg$e23); }
    }
    if (s1 !== peg$FAILED) {
      s2 = peg$parse__();
      if (input.charCodeAt(peg$currPos) === 40) {
        s3 = peg$c20;
        peg$currPos++;
      } else {
        s3 = peg$FAILED;
        if (peg$silentFails === 0) { peg$fail(peg$e20); }
      }
      if (s3 !== peg$FAILED) {
        s4 = peg$parse__();
        s5 = [];
        s6 = peg$parseField();
        while (s6 !== peg$FAILED) {
          s5.push(s6);
          s6 = peg$parseField();
        }
        s6 = peg$parse__();
        if (input.charCodeAt(peg$currPos) === 41) {
          s7 = peg$c21;
          peg$currPos++;
        } else {
          s7 = peg$FAILED;
          if (peg$silentFails === 0) { peg$fail(peg$e21); }
        }
        if (s7 !== peg$FAILED) {
          s0 = s5;
        } else {
          peg$currPos = s0;
          s0 = peg$FAILED;
        }
      } else {
        peg$currPos = s0;
        s0 = peg$FAILED;
      }
    } else {
      peg$currPos = s0;
      s0 = peg$FAILED;
    }

    return s0;
  }

  function peg$parseFieldType() {
    var s0, s1;

    s0 = peg$parseContainerType();
    if (s0 === peg$FAILED) {
      s0 = peg$currPos;
      s1 = peg$parseIdentifier();
      if (s1 !== peg$FAILED) {
        peg$savedPos = s0;
        s1 = peg$f29(s1);
      }
      s0 = s1;
    }

    return s0;
  }

  function peg$parseBaseType() {
    var s0, s1;

    s0 = peg$currPos;
    if (input.substr(peg$currPos, 4) === peg$c24) {
      s1 = peg$c24;
      peg$currPos += 4;
    } else {
      s1 = peg$FAILED;
      if (peg$silentFails === 0) { peg$fail(peg$e24); }
    }
    if (s1 === peg$FAILED) {
      if (input.substr(peg$currPos, 4) === peg$c25) {
        s1 = peg$c25;
        peg$currPos += 4;
      } else {
        s1 = peg$FAILED;
        if (peg$silentFails === 0) { peg$fail(peg$e25); }
      }
      if (s1 === peg$FAILED) {
        if (input.substr(peg$currPos, 2) === peg$c26) {
          s1 = peg$c26;
          peg$currPos += 2;
        } else {
          s1 = peg$FAILED;
          if (peg$silentFails === 0) { peg$fail(peg$e26); }
        }
        if (s1 === peg$FAILED) {
          if (input.substr(peg$currPos, 3) === peg$c27) {
            s1 = peg$c27;
            peg$currPos += 3;
          } else {
            s1 = peg$FAILED;
            if (peg$silentFails === 0) { peg$fail(peg$e27); }
          }
          if (s1 === peg$FAILED) {
            if (input.substr(peg$currPos, 3) === peg$c28) {
              s1 = peg$c28;
              peg$currPos += 3;
            } else {
              s1 = peg$FAILED;
              if (peg$silentFails === 0) { peg$fail(peg$e28); }
            }
            if (s1 === peg$FAILED) {
              if (input.substr(peg$currPos, 3) === peg$c29) {
                s1 = peg$c29;
                peg$currPos += 3;
              } else {
                s1 = peg$FAILED;
                if (peg$silentFails === 0) { peg$fail(peg$e29); }
              }
              if (s1 === peg$FAILED) {
                if (input.substr(peg$currPos, 6) === peg$c30) {
                  s1 = peg$c30;
                  peg$currPos += 6;
                } else {
                  s1 = peg$FAILED;
                  if (peg$silentFails === 0) { peg$fail(peg$e30); }
                }
                if (s1 === peg$FAILED) {
                  if (input.substr(peg$currPos, 6) === peg$c31) {
                    s1 = peg$c31;
                    peg$currPos += 6;
                  } else {
                    s1 = peg$FAILED;
                    if (peg$silentFails === 0) { peg$fail(peg$e31); }
                  }
                  if (s1 === peg$FAILED) {
                    if (input.substr(peg$currPos, 6) === peg$c32) {
                      s1 = peg$c32;
                      peg$currPos += 6;
                    } else {
                      s1 = peg$FAILED;
                      if (peg$silentFails === 0) { peg$fail(peg$e32); }
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
    if (s1 !== peg$FAILED) {
      peg$savedPos = s0;
      s1 = peg$f30();
    }
    s0 = s1;

    return s0;
  }

  function peg$parseContainerType() {
    var s0;

    s0 = peg$parseMapType();
    if (s0 === peg$FAILED) {
      s0 = peg$parseSetType();
      if (s0 === peg$FAILED) {
        s0 = peg$parseListType();
      }
    }

    return s0;
  }

  function peg$parseMapType() {
    var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12;

    s0 = peg$currPos;
    if (input.substr(peg$currPos, 3) === peg$c33) {
      s1 = peg$c33;
      peg$currPos += 3;
    } else {
      s1 = peg$FAILED;
      if (peg$silentFails === 0) { peg$fail(peg$e33); }
    }
    if (s1 !== peg$FAILED) {
      s2 = peg$currPos;
      s3 = peg$parse_();
      if (s3 !== peg$FAILED) {
        s4 = peg$parseCppType();
        if (s4 !== peg$FAILED) {
          s3 = [s3, s4];
          s2 = s3;
        } else {
          peg$currPos = s2;
          s2 = peg$FAILED;
        }
      } else {
        peg$currPos = s2;
        s2 = peg$FAILED;
      }
      if (s2 === peg$FAILED) {
        s2 = null;
      }
      s3 = peg$parse__();
      if (input.charCodeAt(peg$currPos) === 60) {
        s4 = peg$c34;
        peg$currPos++;
      } else {
        s4 = peg$FAILED;
        if (peg$silentFails === 0) { peg$fail(peg$e34); }
      }
      if (s4 !== peg$FAILED) {
        s5 = peg$parse__();
        s6 = peg$parseFieldType();
        if (s6 !== peg$FAILED) {
          s7 = peg$parse__();
          if (input.charCodeAt(peg$currPos) === 44) {
            s8 = peg$c35;
            peg$currPos++;
          } else {
            s8 = peg$FAILED;
            if (peg$silentFails === 0) { peg$fail(peg$e35); }
          }
          if (s8 !== peg$FAILED) {
            s9 = peg$parse__();
            s10 = peg$parseFieldType();
            if (s10 !== peg$FAILED) {
              s11 = peg$parse__();
              if (input.charCodeAt(peg$currPos) === 62) {
                s12 = peg$c36;
                peg$currPos++;
              } else {
                s12 = peg$FAILED;
                if (peg$silentFails === 0) { peg$fail(peg$e36); }
              }
              if (s12 !== peg$FAILED) {
                peg$savedPos = s0;
                s0 = peg$f31(s6, s10);
              } else {
                peg$currPos = s0;
                s0 = peg$FAILED;
              }
            } else {
              peg$currPos = s0;
              s0 = peg$FAILED;
            }
          } else {
            peg$currPos = s0;
            s0 = peg$FAILED;
          }
        } else {
          peg$currPos = s0;
          s0 = peg$FAILED;
        }
      } else {
        peg$currPos = s0;
        s0 = peg$FAILED;
      }
    } else {
      peg$currPos = s0;
      s0 = peg$FAILED;
    }

    return s0;
  }

  function peg$parseSetType() {
    var s0, s1, s2, s3, s4, s5, s6, s7, s8;

    s0 = peg$currPos;
    if (input.substr(peg$currPos, 3) === peg$c37) {
      s1 = peg$c37;
      peg$currPos += 3;
    } else {
      s1 = peg$FAILED;
      if (peg$silentFails === 0) { peg$fail(peg$e37); }
    }
    if (s1 !== peg$FAILED) {
      s2 = peg$currPos;
      s3 = peg$parse_();
      if (s3 !== peg$FAILED) {
        s4 = peg$parseCppType();
        if (s4 !== peg$FAILED) {
          s3 = [s3, s4];
          s2 = s3;
        } else {
          peg$currPos = s2;
          s2 = peg$FAILED;
        }
      } else {
        peg$currPos = s2;
        s2 = peg$FAILED;
      }
      if (s2 === peg$FAILED) {
        s2 = null;
      }
      s3 = peg$parse__();
      if (input.charCodeAt(peg$currPos) === 60) {
        s4 = peg$c34;
        peg$currPos++;
      } else {
        s4 = peg$FAILED;
        if (peg$silentFails === 0) { peg$fail(peg$e34); }
      }
      if (s4 !== peg$FAILED) {
        s5 = peg$parse__();
        s6 = peg$parseFieldType();
        if (s6 !== peg$FAILED) {
          s7 = peg$parse__();
          if (input.charCodeAt(peg$currPos) === 62) {
            s8 = peg$c36;
            peg$currPos++;
          } else {
            s8 = peg$FAILED;
            if (peg$silentFails === 0) { peg$fail(peg$e36); }
          }
          if (s8 !== peg$FAILED) {
            peg$savedPos = s0;
            s0 = peg$f32(s6);
          } else {
            peg$currPos = s0;
            s0 = peg$FAILED;
          }
        } else {
          peg$currPos = s0;
          s0 = peg$FAILED;
        }
      } else {
        peg$currPos = s0;
        s0 = peg$FAILED;
      }
    } else {
      peg$currPos = s0;
      s0 = peg$FAILED;
    }

    return s0;
  }

  function peg$parseListType() {
    var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10;

    s0 = peg$currPos;
    if (input.substr(peg$currPos, 4) === peg$c38) {
      s1 = peg$c38;
      peg$currPos += 4;
    } else {
      s1 = peg$FAILED;
      if (peg$silentFails === 0) { peg$fail(peg$e38); }
    }
    if (s1 !== peg$FAILED) {
      s2 = peg$parse__();
      if (input.charCodeAt(peg$currPos) === 60) {
        s3 = peg$c34;
        peg$currPos++;
      } else {
        s3 = peg$FAILED;
        if (peg$silentFails === 0) { peg$fail(peg$e34); }
      }
      if (s3 !== peg$FAILED) {
        s4 = peg$parse__();
        s5 = peg$parseFieldType();
        if (s5 !== peg$FAILED) {
          s6 = peg$parse__();
          if (input.charCodeAt(peg$currPos) === 62) {
            s7 = peg$c36;
            peg$currPos++;
          } else {
            s7 = peg$FAILED;
            if (peg$silentFails === 0) { peg$fail(peg$e36); }
          }
          if (s7 !== peg$FAILED) {
            s8 = peg$currPos;
            s9 = peg$parse__();
            s10 = peg$parseCppType();
            if (s10 !== peg$FAILED) {
              s9 = [s9, s10];
              s8 = s9;
            } else {
              peg$currPos = s8;
              s8 = peg$FAILED;
            }
            if (s8 === peg$FAILED) {
              s8 = null;
            }
            peg$savedPos = s0;
            s0 = peg$f33(s5);
          } else {
            peg$currPos = s0;
            s0 = peg$FAILED;
          }
        } else {
          peg$currPos = s0;
          s0 = peg$FAILED;
        }
      } else {
        peg$currPos = s0;
        s0 = peg$FAILED;
      }
    } else {
      peg$currPos = s0;
      s0 = peg$FAILED;
    }

    return s0;
  }

  function peg$parseCppType() {
    var s0, s1, s2, s3;

    s0 = peg$currPos;
    if (input.substr(peg$currPos, 8) === peg$c39) {
      s1 = peg$c39;
      peg$currPos += 8;
    } else {
      s1 = peg$FAILED;
      if (peg$silentFails === 0) { peg$fail(peg$e39); }
    }
    if (s1 !== peg$FAILED) {
      s2 = peg$parse_();
      if (s2 !== peg$FAILED) {
        s3 = peg$parseLiteral();
        if (s3 !== peg$FAILED) {
          s1 = [s1, s2, s3];
          s0 = s1;
        } else {
          peg$currPos = s0;
          s0 = peg$FAILED;
        }
      } else {
        peg$currPos = s0;
        s0 = peg$FAILED;
      }
    } else {
      peg$currPos = s0;
      s0 = peg$FAILED;
    }

    return s0;
  }

  function peg$parseConstValue() {
    var s0, s1;

    s0 = peg$currPos;
    s1 = peg$parseHexConstant();
    if (s1 === peg$FAILED) {
      s1 = peg$parseDoubleConstant();
      if (s1 === peg$FAILED) {
        s1 = peg$parseIntConstant();
        if (s1 === peg$FAILED) {
          s1 = peg$parseLiteral();
          if (s1 === peg$FAILED) {
            s1 = peg$parseIdentifier();
            if (s1 === peg$FAILED) {
              s1 = peg$parseConstList();
              if (s1 === peg$FAILED) {
                s1 = peg$parseConstMap();
              }
            }
          }
        }
      }
    }
    if (s1 !== peg$FAILED) {
      peg$savedPos = s0;
      s1 = peg$f34(s1);
    }
    s0 = s1;

    return s0;
  }

  function peg$parseDoubleConstant() {
    var s0, s1, s2, s3, s4, s5, s6;

    peg$silentFails++;
    s0 = peg$currPos;
    s1 = input.charAt(peg$currPos);
    if (peg$r0.test(s1)) {
      peg$currPos++;
    } else {
      s1 = peg$FAILED;
      if (peg$silentFails === 0) { peg$fail(peg$e41); }
    }
    if (s1 === peg$FAILED) {
      s1 = null;
    }
    s2 = [];
    s3 = input.charAt(peg$currPos);
    if (peg$r1.test(s3)) {
      peg$currPos++;
    } else {
      s3 = peg$FAILED;
      if (peg$silentFails === 0) { peg$fail(peg$e42); }
    }
    if (s3 !== peg$FAILED) {
      while (s3 !== peg$FAILED) {
        s2.push(s3);
        s3 = input.charAt(peg$currPos);
        if (peg$r1.test(s3)) {
          peg$currPos++;
        } else {
          s3 = peg$FAILED;
          if (peg$silentFails === 0) { peg$fail(peg$e42); }
        }
      }
    } else {
      s2 = peg$FAILED;
    }
    if (s2 !== peg$FAILED) {
      s3 = peg$currPos;
      if (input.charCodeAt(peg$currPos) === 46) {
        s4 = peg$c40;
        peg$currPos++;
      } else {
        s4 = peg$FAILED;
        if (peg$silentFails === 0) { peg$fail(peg$e43); }
      }
      if (s4 !== peg$FAILED) {
        s5 = [];
        s6 = input.charAt(peg$currPos);
        if (peg$r1.test(s6)) {
          peg$currPos++;
        } else {
          s6 = peg$FAILED;
          if (peg$silentFails === 0) { peg$fail(peg$e42); }
        }
        if (s6 !== peg$FAILED) {
          while (s6 !== peg$FAILED) {
            s5.push(s6);
            s6 = input.charAt(peg$currPos);
            if (peg$r1.test(s6)) {
              peg$currPos++;
            } else {
              s6 = peg$FAILED;
              if (peg$silentFails === 0) { peg$fail(peg$e42); }
            }
          }
        } else {
          s5 = peg$FAILED;
        }
        if (s5 !== peg$FAILED) {
          s4 = [s4, s5];
          s3 = s4;
        } else {
          peg$currPos = s3;
          s3 = peg$FAILED;
        }
      } else {
        peg$currPos = s3;
        s3 = peg$FAILED;
      }
      if (s3 === peg$FAILED) {
        s3 = null;
      }
      s4 = peg$currPos;
      s5 = input.charAt(peg$currPos);
      if (peg$r2.test(s5)) {
        peg$currPos++;
      } else {
        s5 = peg$FAILED;
        if (peg$silentFails === 0) { peg$fail(peg$e44); }
      }
      if (s5 !== peg$FAILED) {
        s6 = peg$parseIntConstant();
        if (s6 !== peg$FAILED) {
          s5 = [s5, s6];
          s4 = s5;
        } else {
          peg$currPos = s4;
          s4 = peg$FAILED;
        }
      } else {
        peg$currPos = s4;
        s4 = peg$FAILED;
      }
      if (s4 === peg$FAILED) {
        s4 = null;
      }
      peg$savedPos = s0;
      s0 = peg$f35();
    } else {
      peg$currPos = s0;
      s0 = peg$FAILED;
    }
    peg$silentFails--;
    if (s0 === peg$FAILED) {
      s1 = peg$FAILED;
      if (peg$silentFails === 0) { peg$fail(peg$e40); }
    }

    return s0;
  }

  function peg$parseHexConstant() {
    var s0, s1, s2, s3, s4;

    peg$silentFails++;
    s0 = peg$currPos;
    s1 = input.charAt(peg$currPos);
    if (peg$r0.test(s1)) {
      peg$currPos++;
    } else {
      s1 = peg$FAILED;
      if (peg$silentFails === 0) { peg$fail(peg$e41); }
    }
    if (s1 === peg$FAILED) {
      s1 = null;
    }
    if (input.substr(peg$currPos, 2) === peg$c41) {
      s2 = peg$c41;
      peg$currPos += 2;
    } else {
      s2 = peg$FAILED;
      if (peg$silentFails === 0) { peg$fail(peg$e46); }
    }
    if (s2 !== peg$FAILED) {
      s3 = [];
      s4 = input.charAt(peg$currPos);
      if (peg$r3.test(s4)) {
        peg$currPos++;
      } else {
        s4 = peg$FAILED;
        if (peg$silentFails === 0) { peg$fail(peg$e47); }
      }
      if (s4 !== peg$FAILED) {
        while (s4 !== peg$FAILED) {
          s3.push(s4);
          s4 = input.charAt(peg$currPos);
          if (peg$r3.test(s4)) {
            peg$currPos++;
          } else {
            s4 = peg$FAILED;
            if (peg$silentFails === 0) { peg$fail(peg$e47); }
          }
        }
      } else {
        s3 = peg$FAILED;
      }
      if (s3 !== peg$FAILED) {
        peg$savedPos = s0;
        s0 = peg$f36();
      } else {
        peg$currPos = s0;
        s0 = peg$FAILED;
      }
    } else {
      peg$currPos = s0;
      s0 = peg$FAILED;
    }
    peg$silentFails--;
    if (s0 === peg$FAILED) {
      s1 = peg$FAILED;
      if (peg$silentFails === 0) { peg$fail(peg$e45); }
    }

    return s0;
  }

  function peg$parseIntConstant() {
    var s0, s1, s2, s3;

    peg$silentFails++;
    s0 = peg$currPos;
    s1 = input.charAt(peg$currPos);
    if (peg$r0.test(s1)) {
      peg$currPos++;
    } else {
      s1 = peg$FAILED;
      if (peg$silentFails === 0) { peg$fail(peg$e41); }
    }
    if (s1 === peg$FAILED) {
      s1 = null;
    }
    s2 = [];
    s3 = input.charAt(peg$currPos);
    if (peg$r1.test(s3)) {
      peg$currPos++;
    } else {
      s3 = peg$FAILED;
      if (peg$silentFails === 0) { peg$fail(peg$e42); }
    }
    if (s3 !== peg$FAILED) {
      while (s3 !== peg$FAILED) {
        s2.push(s3);
        s3 = input.charAt(peg$currPos);
        if (peg$r1.test(s3)) {
          peg$currPos++;
        } else {
          s3 = peg$FAILED;
          if (peg$silentFails === 0) { peg$fail(peg$e42); }
        }
      }
    } else {
      s2 = peg$FAILED;
    }
    if (s2 !== peg$FAILED) {
      peg$savedPos = s0;
      s0 = peg$f37();
    } else {
      peg$currPos = s0;
      s0 = peg$FAILED;
    }
    peg$silentFails--;
    if (s0 === peg$FAILED) {
      s1 = peg$FAILED;
      if (peg$silentFails === 0) { peg$fail(peg$e48); }
    }

    return s0;
  }

  function peg$parseConstList() {
    var s0, s1, s2, s3, s4, s5, s6, s7, s8;

    s0 = peg$currPos;
    if (input.charCodeAt(peg$currPos) === 91) {
      s1 = peg$c42;
      peg$currPos++;
    } else {
      s1 = peg$FAILED;
      if (peg$silentFails === 0) { peg$fail(peg$e49); }
    }
    if (s1 !== peg$FAILED) {
      s2 = peg$parse__();
      s3 = [];
      s4 = peg$currPos;
      s5 = peg$parseConstValue();
      if (s5 !== peg$FAILED) {
        s6 = peg$parse__();
        s7 = peg$parseListSeparator();
        if (s7 === peg$FAILED) {
          s7 = null;
        }
        s8 = peg$parse__();
        s4 = s5;
      } else {
        peg$currPos = s4;
        s4 = peg$FAILED;
      }
      while (s4 !== peg$FAILED) {
        s3.push(s4);
        s4 = peg$currPos;
        s5 = peg$parseConstValue();
        if (s5 !== peg$FAILED) {
          s6 = peg$parse__();
          s7 = peg$parseListSeparator();
          if (s7 === peg$FAILED) {
            s7 = null;
          }
          s8 = peg$parse__();
          s4 = s5;
        } else {
          peg$currPos = s4;
          s4 = peg$FAILED;
        }
      }
      s4 = peg$parse__();
      if (input.charCodeAt(peg$currPos) === 93) {
        s5 = peg$c43;
        peg$currPos++;
      } else {
        s5 = peg$FAILED;
        if (peg$silentFails === 0) { peg$fail(peg$e50); }
      }
      if (s5 !== peg$FAILED) {
        s0 = s3;
      } else {
        peg$currPos = s0;
        s0 = peg$FAILED;
      }
    } else {
      peg$currPos = s0;
      s0 = peg$FAILED;
    }

    return s0;
  }

  function peg$parseConstMap() {
    var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12;

    s0 = peg$currPos;
    if (input.charCodeAt(peg$currPos) === 123) {
      s1 = peg$c9;
      peg$currPos++;
    } else {
      s1 = peg$FAILED;
      if (peg$silentFails === 0) { peg$fail(peg$e9); }
    }
    if (s1 !== peg$FAILED) {
      s2 = peg$parse__();
      s3 = [];
      s4 = peg$currPos;
      s5 = peg$parseConstValue();
      if (s5 !== peg$FAILED) {
        s6 = peg$parse__();
        if (input.charCodeAt(peg$currPos) === 58) {
          s7 = peg$c16;
          peg$currPos++;
        } else {
          s7 = peg$FAILED;
          if (peg$silentFails === 0) { peg$fail(peg$e16); }
        }
        if (s7 !== peg$FAILED) {
          s8 = peg$parse__();
          s9 = peg$parseConstValue();
          if (s9 !== peg$FAILED) {
            s10 = peg$parse__();
            s11 = peg$parseListSeparator();
            if (s11 === peg$FAILED) {
              s11 = null;
            }
            s12 = peg$parse__();
            peg$savedPos = s4;
            s4 = peg$f38(s5, s9);
          } else {
            peg$currPos = s4;
            s4 = peg$FAILED;
          }
        } else {
          peg$currPos = s4;
          s4 = peg$FAILED;
        }
      } else {
        peg$currPos = s4;
        s4 = peg$FAILED;
      }
      while (s4 !== peg$FAILED) {
        s3.push(s4);
        s4 = peg$currPos;
        s5 = peg$parseConstValue();
        if (s5 !== peg$FAILED) {
          s6 = peg$parse__();
          if (input.charCodeAt(peg$currPos) === 58) {
            s7 = peg$c16;
            peg$currPos++;
          } else {
            s7 = peg$FAILED;
            if (peg$silentFails === 0) { peg$fail(peg$e16); }
          }
          if (s7 !== peg$FAILED) {
            s8 = peg$parse__();
            s9 = peg$parseConstValue();
            if (s9 !== peg$FAILED) {
              s10 = peg$parse__();
              s11 = peg$parseListSeparator();
              if (s11 === peg$FAILED) {
                s11 = null;
              }
              s12 = peg$parse__();
              peg$savedPos = s4;
              s4 = peg$f38(s5, s9);
            } else {
              peg$currPos = s4;
              s4 = peg$FAILED;
            }
          } else {
            peg$currPos = s4;
            s4 = peg$FAILED;
          }
        } else {
          peg$currPos = s4;
          s4 = peg$FAILED;
        }
      }
      s4 = peg$parse__();
      if (input.charCodeAt(peg$currPos) === 125) {
        s5 = peg$c10;
        peg$currPos++;
      } else {
        s5 = peg$FAILED;
        if (peg$silentFails === 0) { peg$fail(peg$e10); }
      }
      if (s5 !== peg$FAILED) {
        peg$savedPos = s0;
        s0 = peg$f39(s3);
      } else {
        peg$currPos = s0;
        s0 = peg$FAILED;
      }
    } else {
      peg$currPos = s0;
      s0 = peg$FAILED;
    }

    return s0;
  }

  function peg$parseEscapedChar() {
    var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9;

    s0 = peg$currPos;
    if (input.charCodeAt(peg$currPos) === 92) {
      s1 = peg$c44;
      peg$currPos++;
    } else {
      s1 = peg$FAILED;
      if (peg$silentFails === 0) { peg$fail(peg$e51); }
    }
    if (s1 !== peg$FAILED) {
      s2 = input.charAt(peg$currPos);
      if (peg$r4.test(s2)) {
        peg$currPos++;
      } else {
        s2 = peg$FAILED;
        if (peg$silentFails === 0) { peg$fail(peg$e52); }
      }
      if (s2 === peg$FAILED) {
        s2 = peg$currPos;
        if (input.charCodeAt(peg$currPos) === 98) {
          s3 = peg$c45;
          peg$currPos++;
        } else {
          s3 = peg$FAILED;
          if (peg$silentFails === 0) { peg$fail(peg$e53); }
        }
        if (s3 !== peg$FAILED) {
          peg$savedPos = s2;
          s3 = peg$f40();
        }
        s2 = s3;
        if (s2 === peg$FAILED) {
          s2 = peg$currPos;
          if (input.charCodeAt(peg$currPos) === 102) {
            s3 = peg$c46;
            peg$currPos++;
          } else {
            s3 = peg$FAILED;
            if (peg$silentFails === 0) { peg$fail(peg$e54); }
          }
          if (s3 !== peg$FAILED) {
            peg$savedPos = s2;
            s3 = peg$f41();
          }
          s2 = s3;
          if (s2 === peg$FAILED) {
            s2 = peg$currPos;
            if (input.charCodeAt(peg$currPos) === 110) {
              s3 = peg$c47;
              peg$currPos++;
            } else {
              s3 = peg$FAILED;
              if (peg$silentFails === 0) { peg$fail(peg$e55); }
            }
            if (s3 !== peg$FAILED) {
              peg$savedPos = s2;
              s3 = peg$f42();
            }
            s2 = s3;
            if (s2 === peg$FAILED) {
              s2 = peg$currPos;
              if (input.charCodeAt(peg$currPos) === 114) {
                s3 = peg$c48;
                peg$currPos++;
              } else {
                s3 = peg$FAILED;
                if (peg$silentFails === 0) { peg$fail(peg$e56); }
              }
              if (s3 !== peg$FAILED) {
                peg$savedPos = s2;
                s3 = peg$f43();
              }
              s2 = s3;
              if (s2 === peg$FAILED) {
                s2 = peg$currPos;
                if (input.charCodeAt(peg$currPos) === 116) {
                  s3 = peg$c49;
                  peg$currPos++;
                } else {
                  s3 = peg$FAILED;
                  if (peg$silentFails === 0) { peg$fail(peg$e57); }
                }
                if (s3 !== peg$FAILED) {
                  peg$savedPos = s2;
                  s3 = peg$f44();
                }
                s2 = s3;
                if (s2 === peg$FAILED) {
                  s2 = peg$currPos;
                  if (input.charCodeAt(peg$currPos) === 117) {
                    s3 = peg$c50;
                    peg$currPos++;
                  } else {
                    s3 = peg$FAILED;
                    if (peg$silentFails === 0) { peg$fail(peg$e58); }
                  }
                  if (s3 !== peg$FAILED) {
                    s4 = peg$currPos;
                    s5 = peg$currPos;
                    s6 = input.charAt(peg$currPos);
                    if (peg$r3.test(s6)) {
                      peg$currPos++;
                    } else {
                      s6 = peg$FAILED;
                      if (peg$silentFails === 0) { peg$fail(peg$e47); }
                    }
                    if (s6 !== peg$FAILED) {
                      s7 = input.charAt(peg$currPos);
                      if (peg$r3.test(s7)) {
                        peg$currPos++;
                      } else {
                        s7 = peg$FAILED;
                        if (peg$silentFails === 0) { peg$fail(peg$e47); }
                      }
                      if (s7 !== peg$FAILED) {
                        s8 = input.charAt(peg$currPos);
                        if (peg$r3.test(s8)) {
                          peg$currPos++;
                        } else {
                          s8 = peg$FAILED;
                          if (peg$silentFails === 0) { peg$fail(peg$e47); }
                        }
                        if (s8 !== peg$FAILED) {
                          s9 = input.charAt(peg$currPos);
                          if (peg$r3.test(s9)) {
                            peg$currPos++;
                          } else {
                            s9 = peg$FAILED;
                            if (peg$silentFails === 0) { peg$fail(peg$e47); }
                          }
                          if (s9 !== peg$FAILED) {
                            s6 = [s6, s7, s8, s9];
                            s5 = s6;
                          } else {
                            peg$currPos = s5;
                            s5 = peg$FAILED;
                          }
                        } else {
                          peg$currPos = s5;
                          s5 = peg$FAILED;
                        }
                      } else {
                        peg$currPos = s5;
                        s5 = peg$FAILED;
                      }
                    } else {
                      peg$currPos = s5;
                      s5 = peg$FAILED;
                    }
                    if (s5 !== peg$FAILED) {
                      s4 = input.substring(s4, peg$currPos);
                    } else {
                      s4 = s5;
                    }
                    if (s4 !== peg$FAILED) {
                      peg$savedPos = s2;
                      s2 = peg$f45(s4);
                    } else {
                      peg$currPos = s2;
                      s2 = peg$FAILED;
                    }
                  } else {
                    peg$currPos = s2;
                    s2 = peg$FAILED;
                  }
                }
              }
            }
          }
        }
      }
      if (s2 !== peg$FAILED) {
        s0 = s2;
      } else {
        peg$currPos = s0;
        s0 = peg$FAILED;
      }
    } else {
      peg$currPos = s0;
      s0 = peg$FAILED;
    }

    return s0;
  }

  function peg$parseLiteral() {
    var s0, s1, s2, s3, s4;

    peg$silentFails++;
    s0 = peg$currPos;
    s1 = peg$currPos;
    if (input.charCodeAt(peg$currPos) === 34) {
      s2 = peg$c51;
      peg$currPos++;
    } else {
      s2 = peg$FAILED;
      if (peg$silentFails === 0) { peg$fail(peg$e60); }
    }
    if (s2 !== peg$FAILED) {
      s3 = [];
      s4 = peg$parseEscapedChar();
      if (s4 === peg$FAILED) {
        s4 = input.charAt(peg$currPos);
        if (peg$r5.test(s4)) {
          peg$currPos++;
        } else {
          s4 = peg$FAILED;
          if (peg$silentFails === 0) { peg$fail(peg$e61); }
        }
      }
      while (s4 !== peg$FAILED) {
        s3.push(s4);
        s4 = peg$parseEscapedChar();
        if (s4 === peg$FAILED) {
          s4 = input.charAt(peg$currPos);
          if (peg$r5.test(s4)) {
            peg$currPos++;
          } else {
            s4 = peg$FAILED;
            if (peg$silentFails === 0) { peg$fail(peg$e61); }
          }
        }
      }
      if (input.charCodeAt(peg$currPos) === 34) {
        s4 = peg$c51;
        peg$currPos++;
      } else {
        s4 = peg$FAILED;
        if (peg$silentFails === 0) { peg$fail(peg$e60); }
      }
      if (s4 !== peg$FAILED) {
        s1 = s3;
      } else {
        peg$currPos = s1;
        s1 = peg$FAILED;
      }
    } else {
      peg$currPos = s1;
      s1 = peg$FAILED;
    }
    if (s1 === peg$FAILED) {
      s1 = peg$currPos;
      if (input.charCodeAt(peg$currPos) === 39) {
        s2 = peg$c52;
        peg$currPos++;
      } else {
        s2 = peg$FAILED;
        if (peg$silentFails === 0) { peg$fail(peg$e62); }
      }
      if (s2 !== peg$FAILED) {
        s3 = [];
        s4 = peg$parseEscapedChar();
        if (s4 === peg$FAILED) {
          s4 = input.charAt(peg$currPos);
          if (peg$r6.test(s4)) {
            peg$currPos++;
          } else {
            s4 = peg$FAILED;
            if (peg$silentFails === 0) { peg$fail(peg$e63); }
          }
        }
        while (s4 !== peg$FAILED) {
          s3.push(s4);
          s4 = peg$parseEscapedChar();
          if (s4 === peg$FAILED) {
            s4 = input.charAt(peg$currPos);
            if (peg$r6.test(s4)) {
              peg$currPos++;
            } else {
              s4 = peg$FAILED;
              if (peg$silentFails === 0) { peg$fail(peg$e63); }
            }
          }
        }
        if (input.charCodeAt(peg$currPos) === 39) {
          s4 = peg$c52;
          peg$currPos++;
        } else {
          s4 = peg$FAILED;
          if (peg$silentFails === 0) { peg$fail(peg$e62); }
        }
        if (s4 !== peg$FAILED) {
          s1 = s3;
        } else {
          peg$currPos = s1;
          s1 = peg$FAILED;
        }
      } else {
        peg$currPos = s1;
        s1 = peg$FAILED;
      }
    }
    if (s1 !== peg$FAILED) {
      peg$savedPos = s0;
      s1 = peg$f46(s1);
    }
    s0 = s1;
    peg$silentFails--;
    if (s0 === peg$FAILED) {
      s1 = peg$FAILED;
      if (peg$silentFails === 0) { peg$fail(peg$e59); }
    }

    return s0;
  }

  function peg$parseIdentifier() {
    var s0, s1, s2, s3;

    peg$silentFails++;
    s0 = peg$currPos;
    s1 = input.charAt(peg$currPos);
    if (peg$r7.test(s1)) {
      peg$currPos++;
    } else {
      s1 = peg$FAILED;
      if (peg$silentFails === 0) { peg$fail(peg$e65); }
    }
    if (s1 !== peg$FAILED) {
      s2 = [];
      s3 = input.charAt(peg$currPos);
      if (peg$r8.test(s3)) {
        peg$currPos++;
      } else {
        s3 = peg$FAILED;
        if (peg$silentFails === 0) { peg$fail(peg$e66); }
      }
      while (s3 !== peg$FAILED) {
        s2.push(s3);
        s3 = input.charAt(peg$currPos);
        if (peg$r8.test(s3)) {
          peg$currPos++;
        } else {
          s3 = peg$FAILED;
          if (peg$silentFails === 0) { peg$fail(peg$e66); }
        }
      }
      peg$savedPos = s0;
      s0 = peg$f47();
    } else {
      peg$currPos = s0;
      s0 = peg$FAILED;
    }
    peg$silentFails--;
    if (s0 === peg$FAILED) {
      s1 = peg$FAILED;
      if (peg$silentFails === 0) { peg$fail(peg$e64); }
    }

    return s0;
  }

  function peg$parseListSeparator() {
    var s0, s1, s2;

    peg$silentFails++;
    s0 = peg$currPos;
    s1 = input.charAt(peg$currPos);
    if (peg$r9.test(s1)) {
      peg$currPos++;
    } else {
      s1 = peg$FAILED;
      if (peg$silentFails === 0) { peg$fail(peg$e68); }
    }
    if (s1 !== peg$FAILED) {
      s2 = peg$parse__();
      s1 = [s1, s2];
      s0 = s1;
    } else {
      peg$currPos = s0;
      s0 = peg$FAILED;
    }
    if (s0 === peg$FAILED) {
      s0 = peg$parse_();
    }
    peg$silentFails--;
    if (s0 === peg$FAILED) {
      s1 = peg$FAILED;
      if (peg$silentFails === 0) { peg$fail(peg$e67); }
    }

    return s0;
  }

  function peg$parse_() {
    var s0, s1;

    peg$silentFails++;
    s0 = [];
    s1 = peg$parseWhitespace();
    if (s1 !== peg$FAILED) {
      while (s1 !== peg$FAILED) {
        s0.push(s1);
        s1 = peg$parseWhitespace();
      }
    } else {
      s0 = peg$FAILED;
    }
    peg$silentFails--;
    if (s0 === peg$FAILED) {
      s1 = peg$FAILED;
      if (peg$silentFails === 0) { peg$fail(peg$e69); }
    }

    return s0;
  }

  function peg$parse__() {
    var s0, s1;

    peg$silentFails++;
    s0 = [];
    s1 = peg$parseWhitespace();
    while (s1 !== peg$FAILED) {
      s0.push(s1);
      s1 = peg$parseWhitespace();
    }
    peg$silentFails--;
    s1 = peg$FAILED;
    if (peg$silentFails === 0) { peg$fail(peg$e69); }

    return s0;
  }

  function peg$parseWhitespace() {
    var s0;

    s0 = peg$parseEmpty();
    if (s0 === peg$FAILED) {
      s0 = peg$parseDocComment();
      if (s0 === peg$FAILED) {
        s0 = peg$parseBlockComment();
        if (s0 === peg$FAILED) {
          s0 = peg$parseLineComment();
        }
      }
    }

    return s0;
  }

  function peg$parseEmpty() {
    var s0;

    s0 = input.charAt(peg$currPos);
    if (peg$r10.test(s0)) {
      peg$currPos++;
    } else {
      s0 = peg$FAILED;
      if (peg$silentFails === 0) { peg$fail(peg$e70); }
    }

    return s0;
  }

  function peg$parseLineComment() {
    var s0, s1, s2, s3;

    s0 = peg$currPos;
    if (input.substr(peg$currPos, 2) === peg$c53) {
      s1 = peg$c53;
      peg$currPos += 2;
    } else {
      s1 = peg$FAILED;
      if (peg$silentFails === 0) { peg$fail(peg$e71); }
    }
    if (s1 === peg$FAILED) {
      if (input.charCodeAt(peg$currPos) === 35) {
        s1 = peg$c54;
        peg$currPos++;
      } else {
        s1 = peg$FAILED;
        if (peg$silentFails === 0) { peg$fail(peg$e72); }
      }
    }
    if (s1 !== peg$FAILED) {
      s2 = [];
      s3 = input.charAt(peg$currPos);
      if (peg$r11.test(s3)) {
        peg$currPos++;
      } else {
        s3 = peg$FAILED;
        if (peg$silentFails === 0) { peg$fail(peg$e73); }
      }
      while (s3 !== peg$FAILED) {
        s2.push(s3);
        s3 = input.charAt(peg$currPos);
        if (peg$r11.test(s3)) {
          peg$currPos++;
        } else {
          s3 = peg$FAILED;
          if (peg$silentFails === 0) { peg$fail(peg$e73); }
        }
      }
      s1 = [s1, s2];
      s0 = s1;
    } else {
      peg$currPos = s0;
      s0 = peg$FAILED;
    }

    return s0;
  }

  function peg$parseBlockComment() {
    var s0, s1, s2, s3, s4, s5, s6, s7;

    s0 = peg$currPos;
    if (input.substr(peg$currPos, 2) === peg$c55) {
      s1 = peg$c55;
      peg$currPos += 2;
    } else {
      s1 = peg$FAILED;
      if (peg$silentFails === 0) { peg$fail(peg$e74); }
    }
    if (s1 !== peg$FAILED) {
      s2 = [];
      s3 = input.charAt(peg$currPos);
      if (peg$r12.test(s3)) {
        peg$currPos++;
      } else {
        s3 = peg$FAILED;
        if (peg$silentFails === 0) { peg$fail(peg$e75); }
      }
      while (s3 !== peg$FAILED) {
        s2.push(s3);
        s3 = input.charAt(peg$currPos);
        if (peg$r12.test(s3)) {
          peg$currPos++;
        } else {
          s3 = peg$FAILED;
          if (peg$silentFails === 0) { peg$fail(peg$e75); }
        }
      }
      s3 = [];
      s4 = peg$currPos;
      if (input.charCodeAt(peg$currPos) === 42) {
        s5 = peg$c4;
        peg$currPos++;
      } else {
        s5 = peg$FAILED;
        if (peg$silentFails === 0) { peg$fail(peg$e4); }
      }
      if (s5 !== peg$FAILED) {
        s6 = [];
        s7 = input.charAt(peg$currPos);
        if (peg$r13.test(s7)) {
          peg$currPos++;
        } else {
          s7 = peg$FAILED;
          if (peg$silentFails === 0) { peg$fail(peg$e76); }
        }
        while (s7 !== peg$FAILED) {
          s6.push(s7);
          s7 = input.charAt(peg$currPos);
          if (peg$r13.test(s7)) {
            peg$currPos++;
          } else {
            s7 = peg$FAILED;
            if (peg$silentFails === 0) { peg$fail(peg$e76); }
          }
        }
        s5 = [s5, s6];
        s4 = s5;
      } else {
        peg$currPos = s4;
        s4 = peg$FAILED;
      }
      while (s4 !== peg$FAILED) {
        s3.push(s4);
        s4 = peg$currPos;
        if (input.charCodeAt(peg$currPos) === 42) {
          s5 = peg$c4;
          peg$currPos++;
        } else {
          s5 = peg$FAILED;
          if (peg$silentFails === 0) { peg$fail(peg$e4); }
        }
        if (s5 !== peg$FAILED) {
          s6 = [];
          s7 = input.charAt(peg$currPos);
          if (peg$r13.test(s7)) {
            peg$currPos++;
          } else {
            s7 = peg$FAILED;
            if (peg$silentFails === 0) { peg$fail(peg$e76); }
          }
          while (s7 !== peg$FAILED) {
            s6.push(s7);
            s7 = input.charAt(peg$currPos);
            if (peg$r13.test(s7)) {
              peg$currPos++;
            } else {
              s7 = peg$FAILED;
              if (peg$silentFails === 0) { peg$fail(peg$e76); }
            }
          }
          s5 = [s5, s6];
          s4 = s5;
        } else {
          peg$currPos = s4;
          s4 = peg$FAILED;
        }
      }
      if (input.charCodeAt(peg$currPos) === 47) {
        s4 = peg$c56;
        peg$currPos++;
      } else {
        s4 = peg$FAILED;
        if (peg$silentFails === 0) { peg$fail(peg$e77); }
      }
      if (s4 !== peg$FAILED) {
        s1 = [s1, s2, s3, s4];
        s0 = s1;
      } else {
        peg$currPos = s0;
        s0 = peg$FAILED;
      }
    } else {
      peg$currPos = s0;
      s0 = peg$FAILED;
    }

    return s0;
  }

  function peg$parseDocComment() {
    var s0, s1, s2, s3, s4, s5, s6, s7;

    s0 = peg$currPos;
    if (input.substr(peg$currPos, 3) === peg$c57) {
      s1 = peg$c57;
      peg$currPos += 3;
    } else {
      s1 = peg$FAILED;
      if (peg$silentFails === 0) { peg$fail(peg$e78); }
    }
    if (s1 !== peg$FAILED) {
      s2 = [];
      s3 = input.charAt(peg$currPos);
      if (peg$r12.test(s3)) {
        peg$currPos++;
      } else {
        s3 = peg$FAILED;
        if (peg$silentFails === 0) { peg$fail(peg$e75); }
      }
      while (s3 !== peg$FAILED) {
        s2.push(s3);
        s3 = input.charAt(peg$currPos);
        if (peg$r12.test(s3)) {
          peg$currPos++;
        } else {
          s3 = peg$FAILED;
          if (peg$silentFails === 0) { peg$fail(peg$e75); }
        }
      }
      s3 = [];
      s4 = peg$currPos;
      if (input.charCodeAt(peg$currPos) === 42) {
        s5 = peg$c4;
        peg$currPos++;
      } else {
        s5 = peg$FAILED;
        if (peg$silentFails === 0) { peg$fail(peg$e4); }
      }
      if (s5 !== peg$FAILED) {
        s6 = [];
        s7 = input.charAt(peg$currPos);
        if (peg$r13.test(s7)) {
          peg$currPos++;
        } else {
          s7 = peg$FAILED;
          if (peg$silentFails === 0) { peg$fail(peg$e76); }
        }
        while (s7 !== peg$FAILED) {
          s6.push(s7);
          s7 = input.charAt(peg$currPos);
          if (peg$r13.test(s7)) {
            peg$currPos++;
          } else {
            s7 = peg$FAILED;
            if (peg$silentFails === 0) { peg$fail(peg$e76); }
          }
        }
        s5 = [s5, s6];
        s4 = s5;
      } else {
        peg$currPos = s4;
        s4 = peg$FAILED;
      }
      while (s4 !== peg$FAILED) {
        s3.push(s4);
        s4 = peg$currPos;
        if (input.charCodeAt(peg$currPos) === 42) {
          s5 = peg$c4;
          peg$currPos++;
        } else {
          s5 = peg$FAILED;
          if (peg$silentFails === 0) { peg$fail(peg$e4); }
        }
        if (s5 !== peg$FAILED) {
          s6 = [];
          s7 = input.charAt(peg$currPos);
          if (peg$r13.test(s7)) {
            peg$currPos++;
          } else {
            s7 = peg$FAILED;
            if (peg$silentFails === 0) { peg$fail(peg$e76); }
          }
          while (s7 !== peg$FAILED) {
            s6.push(s7);
            s7 = input.charAt(peg$currPos);
            if (peg$r13.test(s7)) {
              peg$currPos++;
            } else {
              s7 = peg$FAILED;
              if (peg$silentFails === 0) { peg$fail(peg$e76); }
            }
          }
          s5 = [s5, s6];
          s4 = s5;
        } else {
          peg$currPos = s4;
          s4 = peg$FAILED;
        }
      }
      if (input.charCodeAt(peg$currPos) === 47) {
        s4 = peg$c56;
        peg$currPos++;
      } else {
        s4 = peg$FAILED;
        if (peg$silentFails === 0) { peg$fail(peg$e77); }
      }
      if (s4 !== peg$FAILED) {
        peg$savedPos = s0;
        s0 = peg$f48();
      } else {
        peg$currPos = s0;
        s0 = peg$FAILED;
      }
    } else {
      peg$currPos = s0;
      s0 = peg$FAILED;
    }

    return s0;
  }


  const debug = options.debug ? console.debug : () => {};
  let _doc = null;
  let mdoc = null;
  let fdoc = null;
  let sdoc = null;

  function doc(pos) {
    const d = _doc;
    _doc = null;
    if (d) {
      debug('pop', pos, d);
      return d;
    } else {
      debug('pop', pos, undefined);
      return undefined;
    }
  }

  peg$result = peg$startRuleFunction();

  if (options.peg$library) {
    return /** @type {any} */ ({
      peg$result,
      peg$currPos,
      peg$FAILED,
      peg$maxFailExpected,
      peg$maxFailPos
    });
  }
  if (peg$result !== peg$FAILED && peg$currPos === input.length) {
    return peg$result;
  } else {
    if (peg$result !== peg$FAILED && peg$currPos < input.length) {
      peg$fail(peg$endExpectation());
    }

    throw peg$buildStructuredError(
      peg$maxFailExpected,
      peg$maxFailPos < input.length ? input.charAt(peg$maxFailPos) : null,
      peg$maxFailPos < input.length
        ? peg$computeLocation(peg$maxFailPos, peg$maxFailPos + 1)
        : peg$computeLocation(peg$maxFailPos, peg$maxFailPos)
    );
  }
}

const peg$allowedStartRules = [
  "start"
];

export {
  peg$allowedStartRules as StartRules,
  peg$SyntaxError as SyntaxError,
  peg$parse as parse
};
