asmimproved-dbgmits
Version:
Provides the ability to control GDB and LLDB programmatically via GDB/MI.
1,336 lines (1,218 loc) • 36.2 kB
JavaScript
module.exports = (function() {
/*
* Generated by PEG.js 0.8.0.
*
* http://pegjs.majda.cz/
*/
function peg$subclass(child, parent) {
function ctor() { this.constructor = child; }
ctor.prototype = parent.prototype;
child.prototype = new ctor();
}
function SyntaxError(message, expected, found, offset, line, column) {
this.message = message;
this.expected = expected;
this.found = found;
this.offset = offset;
this.line = line;
this.column = column;
this.name = "SyntaxError";
}
peg$subclass(SyntaxError, Error);
function parse(input) {
var options = arguments.length > 1 ? arguments[1] : {},
peg$FAILED = {},
peg$startRuleFunctions = { start: peg$parsestart },
peg$startRuleFunction = peg$parsestart,
peg$c0 = peg$FAILED,
peg$c1 = null,
peg$c2 = "^",
peg$c3 = { type: "literal", value: "^", description: "\"^\"" },
peg$c4 = function(t, resultType, results) {
return {
token: t,
recordType: resultType,
data: mioutput.createObjFromResultList(results)
}
},
peg$c5 = /^[*+=]/,
peg$c6 = { type: "class", value: "[*+=]", description: "[*+=]" },
peg$c7 = function(t, at, ac, results) {
return {
token: t,
recordType: mioutput.getAsyncRecordType(at),
data: [ac, mioutput.createObjFromResultList(results)]
}
},
peg$c8 = "done",
peg$c9 = { type: "literal", value: "done", description: "\"done\"" },
peg$c10 = function() { return mioutput.RecordType.Done; },
peg$c11 = "running",
peg$c12 = { type: "literal", value: "running", description: "\"running\"" },
peg$c13 = function() { return mioutput.RecordType.Running; },
peg$c14 = "connected",
peg$c15 = { type: "literal", value: "connected", description: "\"connected\"" },
peg$c16 = function() { return mioutput.RecordType.Connected; },
peg$c17 = "error",
peg$c18 = { type: "literal", value: "error", description: "\"error\"" },
peg$c19 = function() { return mioutput.RecordType.Error; },
peg$c20 = "exit",
peg$c21 = { type: "literal", value: "exit", description: "\"exit\"" },
peg$c22 = function() { return mioutput.RecordType.Exit; },
peg$c23 = [],
peg$c24 = ",",
peg$c25 = { type: "literal", value: ",", description: "\",\"" },
peg$c26 = function(r) { return r; },
peg$c27 = function(first, rest) {
var results = [first];
if (rest) {
// append the contents of rest to results
Array.prototype.push.apply(results, rest);
}
return mioutput.createObjFromResultList(results);
},
peg$c28 = "=",
peg$c29 = { type: "literal", value: "=", description: "\"=\"" },
peg$c30 = function(n, v, rest) {
return {
name: n,
value: rest ? [v].concat(rest) : v
};
},
peg$c31 = function(v) { return v; },
peg$c32 = function(first, rest) {
var values = [first];
if (rest) {
Array.prototype.push.apply(values, rest);
}
return values;
},
peg$c33 = { type: "other", description: "variable-identifier" },
peg$c34 = function() { return text(); },
peg$c35 = /^[a-z]/i,
peg$c36 = { type: "class", value: "[a-z]i", description: "[a-z]i" },
peg$c37 = /^[\-_]/,
peg$c38 = { type: "class", value: "[\\-_]", description: "[\\-_]" },
peg$c39 = "{}",
peg$c40 = { type: "literal", value: "{}", description: "\"{}\"" },
peg$c41 = function() { return {}; },
peg$c42 = "{",
peg$c43 = { type: "literal", value: "{", description: "\"{\"" },
peg$c44 = "}",
peg$c45 = { type: "literal", value: "}", description: "\"}\"" },
peg$c46 = function(results) { return results; },
peg$c47 = "[]",
peg$c48 = { type: "literal", value: "[]", description: "\"[]\"" },
peg$c49 = function() { return []; },
peg$c50 = "[",
peg$c51 = { type: "literal", value: "[", description: "\"[\"" },
peg$c52 = "]",
peg$c53 = { type: "literal", value: "]", description: "\"]\"" },
peg$c54 = function(values) { return values; },
peg$c55 = "~",
peg$c56 = { type: "literal", value: "~", description: "\"~\"" },
peg$c57 = function(streamText) {
return {
recordType: mioutput.RecordType.DebuggerConsoleOutput,
data: streamText
}
},
peg$c58 = "@",
peg$c59 = { type: "literal", value: "@", description: "\"@\"" },
peg$c60 = function(streamText) {
return {
recordType: mioutput.RecordType.TargetOutput,
data: streamText
}
},
peg$c61 = "&",
peg$c62 = { type: "literal", value: "&", description: "\"&\"" },
peg$c63 = function(streamText) {
return {
recordType: mioutput.RecordType.DebuggerLogOutput,
data: streamText
}
},
peg$c64 = { type: "other", description: "double-quoted-string" },
peg$c65 = "\"",
peg$c66 = { type: "literal", value: "\"", description: "\"\\\"\"" },
peg$c67 = function(chars) { return chars.join(''); },
peg$c68 = "'",
peg$c69 = { type: "literal", value: "'", description: "\"'\"" },
peg$c70 = "\\",
peg$c71 = { type: "literal", value: "\\", description: "\"\\\\\"" },
peg$c72 = "n",
peg$c73 = { type: "literal", value: "n", description: "\"n\"" },
peg$c74 = function() { return '\n'; },
peg$c75 = "r",
peg$c76 = { type: "literal", value: "r", description: "\"r\"" },
peg$c77 = function() { return '\r'; },
peg$c78 = "t",
peg$c79 = { type: "literal", value: "t", description: "\"t\"" },
peg$c80 = function() { return '\t'; },
peg$c81 = void 0,
peg$c82 = { type: "any", description: "any character" },
peg$c83 = function(char) { return char; },
peg$c84 = /^[0-9]/,
peg$c85 = { type: "class", value: "[0-9]", description: "[0-9]" },
peg$c86 = function(digits) { return digits.join(''); },
peg$currPos = 0,
peg$reportedPos = 0,
peg$cachedPos = 0,
peg$cachedPosDetails = { line: 1, column: 1, seenCR: false },
peg$maxFailPos = 0,
peg$maxFailExpected = [],
peg$silentFails = 0,
peg$result;
if ("startRule" in options) {
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$reportedPos, peg$currPos);
}
function offset() {
return peg$reportedPos;
}
function line() {
return peg$computePosDetails(peg$reportedPos).line;
}
function column() {
return peg$computePosDetails(peg$reportedPos).column;
}
function expected(description) {
throw peg$buildException(
null,
[{ type: "other", description: description }],
peg$reportedPos
);
}
function error(message) {
throw peg$buildException(message, null, peg$reportedPos);
}
function peg$computePosDetails(pos) {
function advance(details, startPos, endPos) {
var p, ch;
for (p = startPos; p < endPos; p++) {
ch = input.charAt(p);
if (ch === "\n") {
if (!details.seenCR) { details.line++; }
details.column = 1;
details.seenCR = false;
} else if (ch === "\r" || ch === "\u2028" || ch === "\u2029") {
details.line++;
details.column = 1;
details.seenCR = true;
} else {
details.column++;
details.seenCR = false;
}
}
}
if (peg$cachedPos !== pos) {
if (peg$cachedPos > pos) {
peg$cachedPos = 0;
peg$cachedPosDetails = { line: 1, column: 1, seenCR: false };
}
advance(peg$cachedPosDetails, peg$cachedPos, pos);
peg$cachedPos = pos;
}
return peg$cachedPosDetails;
}
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$buildException(message, expected, pos) {
function cleanupExpected(expected) {
var i = 1;
expected.sort(function(a, b) {
if (a.description < b.description) {
return -1;
} else if (a.description > b.description) {
return 1;
} else {
return 0;
}
});
while (i < expected.length) {
if (expected[i - 1] === expected[i]) {
expected.splice(i, 1);
} else {
i++;
}
}
}
function buildMessage(expected, found) {
function stringEscape(s) {
function hex(ch) { return ch.charCodeAt(0).toString(16).toUpperCase(); }
return s
.replace(/\\/g, '\\\\')
.replace(/"/g, '\\"')
.replace(/\x08/g, '\\b')
.replace(/\t/g, '\\t')
.replace(/\n/g, '\\n')
.replace(/\f/g, '\\f')
.replace(/\r/g, '\\r')
.replace(/[\x00-\x07\x0B\x0E\x0F]/g, function(ch) { return '\\x0' + hex(ch); })
.replace(/[\x10-\x1F\x80-\xFF]/g, function(ch) { return '\\x' + hex(ch); })
.replace(/[\u0180-\u0FFF]/g, function(ch) { return '\\u0' + hex(ch); })
.replace(/[\u1080-\uFFFF]/g, function(ch) { return '\\u' + hex(ch); });
}
var expectedDescs = new Array(expected.length),
expectedDesc, foundDesc, i;
for (i = 0; i < expected.length; i++) {
expectedDescs[i] = expected[i].description;
}
expectedDesc = expected.length > 1
? expectedDescs.slice(0, -1).join(", ")
+ " or "
+ expectedDescs[expected.length - 1]
: expectedDescs[0];
foundDesc = found ? "\"" + stringEscape(found) + "\"" : "end of input";
return "Expected " + expectedDesc + " but " + foundDesc + " found.";
}
var posDetails = peg$computePosDetails(pos),
found = pos < input.length ? input.charAt(pos) : null;
if (expected !== null) {
cleanupExpected(expected);
}
return new SyntaxError(
message !== null ? message : buildMessage(expected, found),
expected,
found,
pos,
posDetails.line,
posDetails.column
);
}
function peg$parsestart() {
var s0;
s0 = peg$parseout_of_band_record();
if (s0 === peg$FAILED) {
s0 = peg$parseresult_record();
}
return s0;
}
function peg$parseresult_record() {
var s0, s1, s2, s3, s4;
s0 = peg$currPos;
s1 = peg$parsetoken();
if (s1 === peg$FAILED) {
s1 = peg$c1;
}
if (s1 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 94) {
s2 = peg$c2;
peg$currPos++;
} else {
s2 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c3); }
}
if (s2 !== peg$FAILED) {
s3 = peg$parseresult_class();
if (s3 !== peg$FAILED) {
s4 = peg$parsecomma_prefixed_results();
if (s4 === peg$FAILED) {
s4 = peg$c1;
}
if (s4 !== peg$FAILED) {
peg$reportedPos = s0;
s1 = peg$c4(s1, s3, s4);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$c0;
}
} else {
peg$currPos = s0;
s0 = peg$c0;
}
} else {
peg$currPos = s0;
s0 = peg$c0;
}
} else {
peg$currPos = s0;
s0 = peg$c0;
}
return s0;
}
function peg$parseout_of_band_record() {
var s0;
s0 = peg$parseasync_record();
if (s0 === peg$FAILED) {
s0 = peg$parsestream_record();
}
return s0;
}
function peg$parseasync_record() {
var s0, s1, s2, s3, s4;
s0 = peg$currPos;
s1 = peg$parsetoken();
if (s1 === peg$FAILED) {
s1 = peg$c1;
}
if (s1 !== peg$FAILED) {
if (peg$c5.test(input.charAt(peg$currPos))) {
s2 = input.charAt(peg$currPos);
peg$currPos++;
} else {
s2 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c6); }
}
if (s2 !== peg$FAILED) {
s3 = peg$parsevariable();
if (s3 !== peg$FAILED) {
s4 = peg$parsecomma_prefixed_results();
if (s4 === peg$FAILED) {
s4 = peg$c1;
}
if (s4 !== peg$FAILED) {
peg$reportedPos = s0;
s1 = peg$c7(s1, s2, s3, s4);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$c0;
}
} else {
peg$currPos = s0;
s0 = peg$c0;
}
} else {
peg$currPos = s0;
s0 = peg$c0;
}
} else {
peg$currPos = s0;
s0 = peg$c0;
}
return s0;
}
function peg$parseresult_class() {
var s0, s1;
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$c9); }
}
if (s1 !== peg$FAILED) {
peg$reportedPos = s0;
s1 = peg$c10();
}
s0 = s1;
if (s0 === peg$FAILED) {
s0 = peg$currPos;
if (input.substr(peg$currPos, 7) === peg$c11) {
s1 = peg$c11;
peg$currPos += 7;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c12); }
}
if (s1 !== peg$FAILED) {
peg$reportedPos = s0;
s1 = peg$c13();
}
s0 = s1;
if (s0 === peg$FAILED) {
s0 = peg$currPos;
if (input.substr(peg$currPos, 9) === peg$c14) {
s1 = peg$c14;
peg$currPos += 9;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c15); }
}
if (s1 !== peg$FAILED) {
peg$reportedPos = s0;
s1 = peg$c16();
}
s0 = s1;
if (s0 === peg$FAILED) {
s0 = peg$currPos;
if (input.substr(peg$currPos, 5) === peg$c17) {
s1 = peg$c17;
peg$currPos += 5;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c18); }
}
if (s1 !== peg$FAILED) {
peg$reportedPos = s0;
s1 = peg$c19();
}
s0 = s1;
if (s0 === peg$FAILED) {
s0 = peg$currPos;
if (input.substr(peg$currPos, 4) === peg$c20) {
s1 = peg$c20;
peg$currPos += 4;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c21); }
}
if (s1 !== peg$FAILED) {
peg$reportedPos = s0;
s1 = peg$c22();
}
s0 = s1;
}
}
}
}
return s0;
}
function peg$parsecomma_prefixed_results() {
var s0, s1, s2, s3;
s0 = [];
s1 = peg$currPos;
if (input.charCodeAt(peg$currPos) === 44) {
s2 = peg$c24;
peg$currPos++;
} else {
s2 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c25); }
}
if (s2 !== peg$FAILED) {
s3 = peg$parseresult();
if (s3 !== peg$FAILED) {
peg$reportedPos = s1;
s2 = peg$c26(s3);
s1 = s2;
} else {
peg$currPos = s1;
s1 = peg$c0;
}
} else {
peg$currPos = s1;
s1 = peg$c0;
}
if (s1 !== peg$FAILED) {
while (s1 !== peg$FAILED) {
s0.push(s1);
s1 = peg$currPos;
if (input.charCodeAt(peg$currPos) === 44) {
s2 = peg$c24;
peg$currPos++;
} else {
s2 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c25); }
}
if (s2 !== peg$FAILED) {
s3 = peg$parseresult();
if (s3 !== peg$FAILED) {
peg$reportedPos = s1;
s2 = peg$c26(s3);
s1 = s2;
} else {
peg$currPos = s1;
s1 = peg$c0;
}
} else {
peg$currPos = s1;
s1 = peg$c0;
}
}
} else {
s0 = peg$c0;
}
return s0;
}
function peg$parseresult_list() {
var s0, s1, s2;
s0 = peg$currPos;
s1 = peg$parseresult();
if (s1 !== peg$FAILED) {
s2 = peg$parsecomma_prefixed_results();
if (s2 === peg$FAILED) {
s2 = peg$c1;
}
if (s2 !== peg$FAILED) {
peg$reportedPos = s0;
s1 = peg$c27(s1, s2);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$c0;
}
} else {
peg$currPos = s0;
s0 = peg$c0;
}
return s0;
}
function peg$parseresult() {
var s0, s1, s2, s3, s4;
s0 = peg$currPos;
s1 = peg$parsevariable();
if (s1 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 61) {
s2 = peg$c28;
peg$currPos++;
} else {
s2 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c29); }
}
if (s2 !== peg$FAILED) {
s3 = peg$parsevalue();
if (s3 !== peg$FAILED) {
s4 = peg$parsecomma_prefixed_values();
if (s4 === peg$FAILED) {
s4 = peg$c1;
}
if (s4 !== peg$FAILED) {
peg$reportedPos = s0;
s1 = peg$c30(s1, s3, s4);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$c0;
}
} else {
peg$currPos = s0;
s0 = peg$c0;
}
} else {
peg$currPos = s0;
s0 = peg$c0;
}
} else {
peg$currPos = s0;
s0 = peg$c0;
}
return s0;
}
function peg$parsecomma_prefixed_values() {
var s0, s1, s2, s3;
s0 = [];
s1 = peg$currPos;
if (input.charCodeAt(peg$currPos) === 44) {
s2 = peg$c24;
peg$currPos++;
} else {
s2 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c25); }
}
if (s2 !== peg$FAILED) {
s3 = peg$parsevalue();
if (s3 !== peg$FAILED) {
peg$reportedPos = s1;
s2 = peg$c31(s3);
s1 = s2;
} else {
peg$currPos = s1;
s1 = peg$c0;
}
} else {
peg$currPos = s1;
s1 = peg$c0;
}
if (s1 !== peg$FAILED) {
while (s1 !== peg$FAILED) {
s0.push(s1);
s1 = peg$currPos;
if (input.charCodeAt(peg$currPos) === 44) {
s2 = peg$c24;
peg$currPos++;
} else {
s2 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c25); }
}
if (s2 !== peg$FAILED) {
s3 = peg$parsevalue();
if (s3 !== peg$FAILED) {
peg$reportedPos = s1;
s2 = peg$c31(s3);
s1 = s2;
} else {
peg$currPos = s1;
s1 = peg$c0;
}
} else {
peg$currPos = s1;
s1 = peg$c0;
}
}
} else {
s0 = peg$c0;
}
return s0;
}
function peg$parsevalue_list() {
var s0, s1, s2;
s0 = peg$currPos;
s1 = peg$parsevalue();
if (s1 !== peg$FAILED) {
s2 = peg$parsecomma_prefixed_values();
if (s2 === peg$FAILED) {
s2 = peg$c1;
}
if (s2 !== peg$FAILED) {
peg$reportedPos = s0;
s1 = peg$c32(s1, s2);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$c0;
}
} else {
peg$currPos = s0;
s0 = peg$c0;
}
return s0;
}
function peg$parsevariable() {
var s0, s1, s2, s3;
peg$silentFails++;
s0 = peg$currPos;
s1 = peg$parsevariable_start();
if (s1 !== peg$FAILED) {
s2 = [];
s3 = peg$parsevariable_part();
while (s3 !== peg$FAILED) {
s2.push(s3);
s3 = peg$parsevariable_part();
}
if (s2 !== peg$FAILED) {
peg$reportedPos = s0;
s1 = peg$c34();
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$c0;
}
} else {
peg$currPos = s0;
s0 = peg$c0;
}
peg$silentFails--;
if (s0 === peg$FAILED) {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c33); }
}
return s0;
}
function peg$parsevariable_start() {
var s0;
if (peg$c35.test(input.charAt(peg$currPos))) {
s0 = input.charAt(peg$currPos);
peg$currPos++;
} else {
s0 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c36); }
}
return s0;
}
function peg$parsevariable_part() {
var s0;
s0 = peg$parsevariable_start();
if (s0 === peg$FAILED) {
if (peg$c37.test(input.charAt(peg$currPos))) {
s0 = input.charAt(peg$currPos);
peg$currPos++;
} else {
s0 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c38); }
}
}
return s0;
}
function peg$parsevalue() {
var s0;
s0 = peg$parsec_string();
if (s0 === peg$FAILED) {
s0 = peg$parsetuple();
if (s0 === peg$FAILED) {
s0 = peg$parselist();
}
}
return s0;
}
function peg$parsetuple() {
var s0, s1, s2, s3;
s0 = peg$currPos;
if (input.substr(peg$currPos, 2) === peg$c39) {
s1 = peg$c39;
peg$currPos += 2;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c40); }
}
if (s1 !== peg$FAILED) {
peg$reportedPos = s0;
s1 = peg$c41();
}
s0 = s1;
if (s0 === peg$FAILED) {
s0 = peg$currPos;
if (input.charCodeAt(peg$currPos) === 123) {
s1 = peg$c42;
peg$currPos++;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c43); }
}
if (s1 !== peg$FAILED) {
s2 = peg$parseresult_list();
if (s2 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 125) {
s3 = peg$c44;
peg$currPos++;
} else {
s3 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c45); }
}
if (s3 !== peg$FAILED) {
peg$reportedPos = s0;
s1 = peg$c46(s2);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$c0;
}
} else {
peg$currPos = s0;
s0 = peg$c0;
}
} else {
peg$currPos = s0;
s0 = peg$c0;
}
}
return s0;
}
function peg$parselist() {
var s0, s1, s2, s3;
s0 = peg$currPos;
if (input.substr(peg$currPos, 2) === peg$c47) {
s1 = peg$c47;
peg$currPos += 2;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c48); }
}
if (s1 !== peg$FAILED) {
peg$reportedPos = s0;
s1 = peg$c49();
}
s0 = s1;
if (s0 === peg$FAILED) {
s0 = peg$currPos;
if (input.charCodeAt(peg$currPos) === 91) {
s1 = peg$c50;
peg$currPos++;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c51); }
}
if (s1 !== peg$FAILED) {
s2 = peg$parsevalue_list();
if (s2 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 93) {
s3 = peg$c52;
peg$currPos++;
} else {
s3 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c53); }
}
if (s3 !== peg$FAILED) {
peg$reportedPos = s0;
s1 = peg$c54(s2);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$c0;
}
} else {
peg$currPos = s0;
s0 = peg$c0;
}
} else {
peg$currPos = s0;
s0 = peg$c0;
}
if (s0 === peg$FAILED) {
s0 = peg$currPos;
if (input.charCodeAt(peg$currPos) === 91) {
s1 = peg$c50;
peg$currPos++;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c51); }
}
if (s1 !== peg$FAILED) {
s2 = peg$parseresult_list();
if (s2 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 93) {
s3 = peg$c52;
peg$currPos++;
} else {
s3 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c53); }
}
if (s3 !== peg$FAILED) {
peg$reportedPos = s0;
s1 = peg$c46(s2);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$c0;
}
} else {
peg$currPos = s0;
s0 = peg$c0;
}
} else {
peg$currPos = s0;
s0 = peg$c0;
}
}
}
return s0;
}
function peg$parsestream_record() {
var s0;
s0 = peg$parseconsole_stream_output();
if (s0 === peg$FAILED) {
s0 = peg$parsetarget_stream_output();
if (s0 === peg$FAILED) {
s0 = peg$parselog_stream_output();
}
}
return s0;
}
function peg$parseconsole_stream_output() {
var s0, s1, s2;
s0 = peg$currPos;
if (input.charCodeAt(peg$currPos) === 126) {
s1 = peg$c55;
peg$currPos++;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c56); }
}
if (s1 !== peg$FAILED) {
s2 = peg$parsec_string();
if (s2 !== peg$FAILED) {
peg$reportedPos = s0;
s1 = peg$c57(s2);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$c0;
}
} else {
peg$currPos = s0;
s0 = peg$c0;
}
return s0;
}
function peg$parsetarget_stream_output() {
var s0, s1, s2;
s0 = peg$currPos;
if (input.charCodeAt(peg$currPos) === 64) {
s1 = peg$c58;
peg$currPos++;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c59); }
}
if (s1 !== peg$FAILED) {
s2 = peg$parsec_string();
if (s2 !== peg$FAILED) {
peg$reportedPos = s0;
s1 = peg$c60(s2);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$c0;
}
} else {
peg$currPos = s0;
s0 = peg$c0;
}
return s0;
}
function peg$parselog_stream_output() {
var s0, s1, s2;
s0 = peg$currPos;
if (input.charCodeAt(peg$currPos) === 38) {
s1 = peg$c61;
peg$currPos++;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c62); }
}
if (s1 !== peg$FAILED) {
s2 = peg$parsec_string();
if (s2 !== peg$FAILED) {
peg$reportedPos = s0;
s1 = peg$c63(s2);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$c0;
}
} else {
peg$currPos = s0;
s0 = peg$c0;
}
return s0;
}
function peg$parsec_string() {
var s0, s1, s2, s3;
peg$silentFails++;
s0 = peg$currPos;
if (input.charCodeAt(peg$currPos) === 34) {
s1 = peg$c65;
peg$currPos++;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c66); }
}
if (s1 !== peg$FAILED) {
s2 = [];
s3 = peg$parsec_string_char();
while (s3 !== peg$FAILED) {
s2.push(s3);
s3 = peg$parsec_string_char();
}
if (s2 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 34) {
s3 = peg$c65;
peg$currPos++;
} else {
s3 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c66); }
}
if (s3 !== peg$FAILED) {
peg$reportedPos = s0;
s1 = peg$c67(s2);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$c0;
}
} else {
peg$currPos = s0;
s0 = peg$c0;
}
} else {
peg$currPos = s0;
s0 = peg$c0;
}
peg$silentFails--;
if (s0 === peg$FAILED) {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c64); }
}
return s0;
}
function peg$parseescape_char() {
var s0, s1;
if (input.charCodeAt(peg$currPos) === 39) {
s0 = peg$c68;
peg$currPos++;
} else {
s0 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c69); }
}
if (s0 === peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 34) {
s0 = peg$c65;
peg$currPos++;
} else {
s0 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c66); }
}
if (s0 === peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 92) {
s0 = peg$c70;
peg$currPos++;
} else {
s0 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c71); }
}
if (s0 === peg$FAILED) {
s0 = peg$currPos;
if (input.charCodeAt(peg$currPos) === 110) {
s1 = peg$c72;
peg$currPos++;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c73); }
}
if (s1 !== peg$FAILED) {
peg$reportedPos = s0;
s1 = peg$c74();
}
s0 = s1;
if (s0 === peg$FAILED) {
s0 = peg$currPos;
if (input.charCodeAt(peg$currPos) === 114) {
s1 = peg$c75;
peg$currPos++;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c76); }
}
if (s1 !== peg$FAILED) {
peg$reportedPos = s0;
s1 = peg$c77();
}
s0 = s1;
if (s0 === peg$FAILED) {
s0 = peg$currPos;
if (input.charCodeAt(peg$currPos) === 116) {
s1 = peg$c78;
peg$currPos++;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c79); }
}
if (s1 !== peg$FAILED) {
peg$reportedPos = s0;
s1 = peg$c80();
}
s0 = s1;
}
}
}
}
}
return s0;
}
function peg$parsec_string_char() {
var s0, s1, s2;
s0 = peg$currPos;
s1 = peg$currPos;
peg$silentFails++;
if (input.charCodeAt(peg$currPos) === 34) {
s2 = peg$c65;
peg$currPos++;
} else {
s2 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c66); }
}
if (s2 === peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 92) {
s2 = peg$c70;
peg$currPos++;
} else {
s2 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c71); }
}
}
peg$silentFails--;
if (s2 === peg$FAILED) {
s1 = peg$c81;
} else {
peg$currPos = s1;
s1 = peg$c0;
}
if (s1 !== peg$FAILED) {
if (input.length > peg$currPos) {
s2 = input.charAt(peg$currPos);
peg$currPos++;
} else {
s2 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c82); }
}
if (s2 !== peg$FAILED) {
peg$reportedPos = s0;
s1 = peg$c34();
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$c0;
}
} else {
peg$currPos = s0;
s0 = peg$c0;
}
if (s0 === peg$FAILED) {
s0 = peg$currPos;
if (input.charCodeAt(peg$currPos) === 92) {
s1 = peg$c70;
peg$currPos++;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c71); }
}
if (s1 !== peg$FAILED) {
s2 = peg$parseescape_char();
if (s2 !== peg$FAILED) {
peg$reportedPos = s0;
s1 = peg$c83(s2);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$c0;
}
} else {
peg$currPos = s0;
s0 = peg$c0;
}
}
return s0;
}
function peg$parsetoken() {
var s0, s1, s2;
s0 = peg$currPos;
s1 = [];
if (peg$c84.test(input.charAt(peg$currPos))) {
s2 = input.charAt(peg$currPos);
peg$currPos++;
} else {
s2 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c85); }
}
if (s2 !== peg$FAILED) {
while (s2 !== peg$FAILED) {
s1.push(s2);
if (peg$c84.test(input.charAt(peg$currPos))) {
s2 = input.charAt(peg$currPos);
peg$currPos++;
} else {
s2 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c85); }
}
}
} else {
s1 = peg$c0;
}
if (s1 !== peg$FAILED) {
peg$reportedPos = s0;
s1 = peg$c86(s1);
}
s0 = s1;
return s0;
}
// Start of code that is injected into the generated PEG parser.
var mioutput = require('./mi_output');
peg$result = peg$startRuleFunction();
if (peg$result !== peg$FAILED && peg$currPos === input.length) {
return peg$result;
} else {
if (peg$result !== peg$FAILED && peg$currPos < input.length) {
peg$fail({ type: "end", description: "end of input" });
}
throw peg$buildException(null, peg$maxFailExpected, peg$maxFailPos);
}
}
return {
SyntaxError: SyntaxError,
parse: parse
};
})();