diff --git a/CHANGELOG.md b/CHANGELOG.md index ba120fbb..b55ea095 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ - Deprecates `sid` and `star` properties of the `AirportModel` in favor of `sidCollection` and `starCollection` [#54](https://github.com/n8rzz/atc/issues/54) - Adds [Express](expressjs.com) server to serve static assets and add [travis](travis-ci.org) config file for travis continuous integration [#169](https://github.com/n8rzz/atc/issues/169) - Rewrites the CommandParser from the ground up [#114](https://github.com/n8rzz/atc/issues/114) +- Removes `Pegjs` and references completing switch to new CommandParser [#216](https://github.com/n8rzz/atc/issues/216) @@ -27,10 +28,12 @@ - Updates `PositionModel` to run all calculations through the static `.calculatePosition()` method and vastly simplifies internal logic. - Refactors the the function names in `FixCollection` to better fit their function. `init()` to `addItems()` and `destroy()` to `removeItems()` [#186] (https://github.com/n8rzz/atc/issues/186) - Adds gulp-cli and adds [tools readme](tools/README.md) link to gulp issues with Windows [#194](https://github.com/n8rzz/atc/issues/194) -- Changes `routeString` to `routeCode` to better fit what it is and also fixs trancpercy in to the `routeModel` [#188] (https://github.com/n8rzz/atc/issues/188) - -.toUpperCase() is now called on intilization and removed from the getter - Prevents collision detection for aircraft that are outside of our airspace [#134](https://github.com/n8rzz/atc/issues/134) - Originally reported under [#736](https://github.com/zlsa/atc/issues/736) +- Changes `routeString` to `routeCode` in `routeModel` [#188] (https://github.com/n8rzz/atc/issues/188) + -`.toUpperCase()` is now called on initialization and removed from the getter +- Escape clears commands but not callsign if commands are present [#211] (https://github.com/n8rzz/atc/issues/211) + - Originally reported under [#763](https://github.com/zlsa/atc/issues/763) @@ -77,4 +80,4 @@ - Updates `FixCollection.findFixByName()` to accept upper, mixed, or lower case fix name [#109](https://github.com/n8rzz/atc/issues/109) - Switching to a previously loaded airport does not clear previous airport fixes [#115](https://github.com/n8rzz/atc/issues/115) - Fixes `parseElevation()` so that it does not return NaN when it is given the string `'Infinity'` [#191] (https://github.com/n8rzz/atc/issues/191) - - Originally reported under [#756](https://github.com/zlsa/atc/issues/756) \ No newline at end of file + - Originally reported under [#756](https://github.com/zlsa/atc/issues/756) diff --git a/package.json b/package.json index e86dbebb..c8edbdfd 100644 --- a/package.json +++ b/package.json @@ -70,7 +70,6 @@ "express": "^4.14.0", "jquery": "^3.1.0", "lodash": "^4.15.0", - "pegjs": "^0.9.0", "raf": "^3.3.0" }, "devDependencies": { diff --git a/src/assets/scripts/App.js b/src/assets/scripts/App.js index 6508fed7..037a718f 100644 --- a/src/assets/scripts/App.js +++ b/src/assets/scripts/App.js @@ -1,5 +1,4 @@ import $ from 'jquery'; -import peg from 'pegjs'; import ContentQueue from './contentQueue/ContentQueue'; import LoadingView from './LoadingView'; import AirportController from './airport/AirportController'; @@ -13,7 +12,6 @@ import { speech_init } from './speech'; import { time, calculateDeltaTime } from './utilities/timeHelpers'; import { LOG } from './constants/logLevel'; -window.peg = peg; window.zlsa = {}; window.zlsa.atc = {}; const prop = {}; @@ -23,9 +21,6 @@ const prop = {}; // This will need to be re-worked, and current global functions should be exported and // imported as needed in each file. require('./util'); -// this module doesnt appear to be in use anywhere -// require('./animation'); -require('./parser'); // saved as this.prop.version and this.prop.version_string const VERSION = [3, 2, 0]; diff --git a/src/assets/scripts/InputController.js b/src/assets/scripts/InputController.js index 974eaa24..a54a8b20 100644 --- a/src/assets/scripts/InputController.js +++ b/src/assets/scripts/InputController.js @@ -182,7 +182,7 @@ export default class InputController { this.input = input; this.input.command = ''; this.input.callsign = ''; - this.input.data = ''; + // this.input.data = ''; this.input.history = []; this.input.history_item = null; this.input.click = [0, 0]; @@ -286,7 +286,9 @@ export default class InputController { if (nearest[0]) { if (nearest[1] < window.uiController.px_to_km(80)) { - this.input_select(nearest[0].getCallsign().toUpperCase()); + this.input.callsign = nearest[0].getCallsign().toUpperCase(); + + this.input_select(this.input.callsign); } else { this.input_select(); } @@ -576,8 +578,16 @@ export default class InputController { break; case KEY_CODES.ESCAPE: + const currentCommandValue = this.$commandInput.val(); + + // if the current commandInput value contains a callsign and commands, only clear the commands + if (currentCommandValue.trim() !== this.input.callsign) { + this.$commandInput.val(`${this.input.callsign} `); + + return; + } + this.$commandInput.val(''); - e.preventDefault(); break; default: diff --git a/src/assets/scripts/parser.js b/src/assets/scripts/parser.js deleted file mode 100644 index 91b90954..00000000 --- a/src/assets/scripts/parser.js +++ /dev/null @@ -1,2791 +0,0 @@ -/* eslint-disable */ -zlsa.atc.Parser = (function() { - - /* - * Generated by PEG.js 0.9.0. - * - * http://pegjs.org/ - */ - - function peg$subclass(child, parent) { - function ctor() { this.constructor = child; } - ctor.prototype = parent.prototype; - child.prototype = new ctor(); - } - - function peg$SyntaxError(message, expected, found, location) { - this.message = message; - this.expected = expected; - this.found = found; - this.location = location; - this.name = "SyntaxError"; - - if (typeof Error.captureStackTrace === "function") { - Error.captureStackTrace(this, peg$SyntaxError); - } - } - - peg$subclass(peg$SyntaxError, Error); - - function peg$parse(input) { - var options = arguments.length > 1 ? arguments[1] : {}, - parser = this, - - peg$FAILED = {}, - - peg$startRuleFunctions = { InputParseGrammar: peg$parseInputParseGrammar }, - peg$startRuleFunction = peg$parseInputParseGrammar, - - peg$c0 = "version", - peg$c1 = { type: "literal", value: "version", description: "\"version\"" }, - peg$c2 = function() {return ['version', null] }, - peg$c3 = "tutorial", - peg$c4 = { type: "literal", value: "tutorial", description: "\"tutorial\"" }, - peg$c5 = function() {return ['tutorial', null] }, - peg$c6 = "auto", - peg$c7 = { type: "literal", value: "auto", description: "\"auto\"" }, - peg$c8 = function() {return ['auto', null] }, - peg$c9 = "pause", - peg$c10 = { type: "literal", value: "pause", description: "\"pause\"" }, - peg$c11 = function() {return ['pause', null] }, - peg$c12 = "clear", - peg$c13 = { type: "literal", value: "clear", description: "\"clear\"" }, - peg$c14 = function() {return ['clear', null] }, - peg$c15 = function(cmd) { return {command: cmd[0], args: cmd[1]}}, - peg$c16 = function(cmd) { return {command: 'transmit', callsign: cmd[0], args: cmd[1]}}, - peg$c17 = "timewarp", - peg$c18 = { type: "literal", value: "timewarp", description: "\"timewarp\"" }, - peg$c19 = "speedup", - peg$c20 = { type: "literal", value: "speedup", description: "\"speedup\"" }, - peg$c21 = "slowmo", - peg$c22 = { type: "literal", value: "slowmo", description: "\"slowmo\"" }, - peg$c23 = "timescale", - peg$c24 = { type: "literal", value: "timescale", description: "\"timescale\"" }, - peg$c25 = function(command) {return command}, - peg$c26 = "airport", - peg$c27 = { type: "literal", value: "airport", description: "\"airport\"" }, - peg$c28 = "rate", - peg$c29 = { type: "literal", value: "rate", description: "\"rate\"" }, - peg$c30 = "abort", - peg$c31 = { type: "literal", value: "abort", description: "\"abort\"" }, - peg$c32 = function() {return ["abort"]}, - peg$c33 = "\u2B61", - peg$c34 = { type: "literal", value: "\u2B61", description: "\"\\u2B61\"" }, - peg$c35 = "\u2B63", - peg$c36 = { type: "literal", value: "\u2B63", description: "\"\\u2B63\"" }, - peg$c37 = function(arg) {return ["altitude", arg*100, null]}, - peg$c38 = "altitude", - peg$c39 = { type: "literal", value: "altitude", description: "\"altitude\"" }, - peg$c40 = "climb", - peg$c41 = { type: "literal", value: "climb", description: "\"climb\"" }, - peg$c42 = "descend", - peg$c43 = { type: "literal", value: "descend", description: "\"descend\"" }, - peg$c44 = "a", - peg$c45 = { type: "literal", value: "a", description: "\"a\"" }, - peg$c46 = "c", - peg$c47 = { type: "literal", value: "c", description: "\"c\"" }, - peg$c48 = "d", - peg$c49 = { type: "literal", value: "d", description: "\"d\"" }, - peg$c50 = function(arg) {return arg*100}, - peg$c51 = "expedite", - peg$c52 = { type: "literal", value: "expedite", description: "\"expedite\"" }, - peg$c53 = "x", - peg$c54 = { type: "literal", value: "x", description: "\"x\"" }, - peg$c55 = function(altitude) {return true}, - peg$c56 = function(altitude, expedite) { return ((altitude == null) && (expedite == null)) }, - peg$c57 = function(altitude, expedite) {return ["altitude", altitude, expedite]}, - peg$c58 = "clearedasfiled", - peg$c59 = { type: "literal", value: "clearedasfiled", description: "\"clearedasfiled\"" }, - peg$c60 = "caf", - peg$c61 = { type: "literal", value: "caf", description: "\"caf\"" }, - peg$c62 = function() { return ["clearedAsFiled"] }, - peg$c63 = "climbviasid", - peg$c64 = { type: "literal", value: "climbviasid", description: "\"climbviasid\"" }, - peg$c65 = "cvs", - peg$c66 = { type: "literal", value: "cvs", description: "\"cvs\"" }, - peg$c67 = function() {return ["climbViaSID"] }, - peg$c68 = "debug", - peg$c69 = { type: "literal", value: "debug", description: "\"debug\"" }, - peg$c70 = "log", - peg$c71 = { type: "literal", value: "log", description: "\"log\"" }, - peg$c72 = function() {return ["debug"]}, - peg$c73 = "delete", - peg$c74 = { type: "literal", value: "delete", description: "\"delete\"" }, - peg$c75 = "del", - peg$c76 = { type: "literal", value: "del", description: "\"del\"" }, - peg$c77 = "kill", - peg$c78 = { type: "literal", value: "kill", description: "\"kill\"" }, - peg$c79 = function() {return ["delete"]}, - peg$c80 = "descendviastar", - peg$c81 = { type: "literal", value: "descendviastar", description: "\"descendviastar\"" }, - peg$c82 = "dvs", - peg$c83 = { type: "literal", value: "dvs", description: "\"dvs\"" }, - peg$c84 = function() {return ["descendViaSTAR"]}, - peg$c85 = "direct", - peg$c86 = { type: "literal", value: "direct", description: "\"direct\"" }, - peg$c87 = "dct", - peg$c88 = { type: "literal", value: "dct", description: "\"dct\"" }, - peg$c89 = "pd", - peg$c90 = { type: "literal", value: "pd", description: "\"pd\"" }, - peg$c91 = function() {return "direct"}, - peg$c92 = "fix", - peg$c93 = { type: "literal", value: "fix", description: "\"fix\"" }, - peg$c94 = "f", - peg$c95 = { type: "literal", value: "f", description: "\"f\"" }, - peg$c96 = "track", - peg$c97 = { type: "literal", value: "track", description: "\"track\"" }, - peg$c98 = function() {return "fix"}, - peg$c99 = "fph", - peg$c100 = { type: "literal", value: "fph", description: "\"fph\"" }, - peg$c101 = function() {return ['flyPresentHeading']}, - peg$c102 = function(cmd) { return [cmd[0], cmd[1], cmd[2][0], cmd[2][1]] }, - peg$c103 = "\u2BA2", - peg$c104 = { type: "literal", value: "\u2BA2", description: "\"\\u2BA2\"" }, - peg$c105 = function() {return "left"}, - peg$c106 = "\u2BA3", - peg$c107 = { type: "literal", value: "\u2BA3", description: "\"\\u2BA3\"" }, - peg$c108 = function() {return "right"}, - peg$c109 = "fh", - peg$c110 = { type: "literal", value: "fh", description: "\"fh\"" }, - peg$c111 = function() {return null}, - peg$c112 = function(dir, arg) {return ['heading', dir, arg]}, - peg$c113 = "heading", - peg$c114 = { type: "literal", value: "heading", description: "\"heading\"" }, - peg$c115 = "turn", - peg$c116 = { type: "literal", value: "turn", description: "\"turn\"" }, - peg$c117 = "t", - peg$c118 = { type: "literal", value: "t", description: "\"t\"" }, - peg$c119 = "h", - peg$c120 = { type: "literal", value: "h", description: "\"h\"" }, - peg$c121 = function() {return "heading"}, - peg$c122 = function(arg) {return arg}, - peg$c123 = /^[0-9]/, - peg$c124 = { type: "class", value: "[0-9]", description: "[0-9]" }, - peg$c125 = function() {return [parseInt(text()), false]}, - peg$c126 = function() {return [parseInt(text()), true]}, - peg$c127 = "hold", - peg$c128 = { type: "literal", value: "hold", description: "\"hold\"" }, - peg$c129 = "min", - peg$c130 = { type: "literal", value: "min", description: "\"min\"" }, - peg$c131 = "nm", - peg$c132 = { type: "literal", value: "nm", description: "\"nm\"" }, - peg$c133 = function(dir, length, fix) {return ["hold", - dir, - length ? length[1] + length[2] : null, - fix ? fix[2] : null]}, - peg$c134 = function(cmd) {return [cmd[0], cmd[1], cmd[2]]}, - peg$c135 = "land", - peg$c136 = { type: "literal", value: "land", description: "\"land\"" }, - peg$c137 = "l", - peg$c138 = { type: "literal", value: "l", description: "\"l\"" }, - peg$c139 = "ils", - peg$c140 = { type: "literal", value: "ils", description: "\"ils\"" }, - peg$c141 = function() {return "land"}, - peg$c142 = /^[a-z]/i, - peg$c143 = { type: "class", value: "[a-z]i", description: "[a-z]i" }, - peg$c144 = function(cmd, variant, arg) {return [variant, arg]}, - peg$c145 = function(cmd, arg) { return [cmd, arg[0], arg[1]] }, - peg$c146 = "\u2B50", - peg$c147 = { type: "literal", value: "\u2B50", description: "\"\\u2B50\"" }, - peg$c148 = "movedatablock", - peg$c149 = { type: "literal", value: "movedatablock", description: "\"movedatablock\"" }, - peg$c150 = "`", - peg$c151 = { type: "literal", value: "`", description: "\"`\"" }, - peg$c152 = function() {return "moveDataBlock"}, - peg$c153 = /^[1-9]/, - peg$c154 = { type: "class", value: "[1-9]", description: "[1-9]" }, - peg$c155 = "route", - peg$c156 = { type: "literal", value: "route", description: "\"route\"" }, - peg$c157 = function(arg) {return ["route", arg]}, - peg$c158 = "reroute", - peg$c159 = { type: "literal", value: "reroute", description: "\"reroute\"" }, - peg$c160 = "rr", - peg$c161 = { type: "literal", value: "rr", description: "\"rr\"" }, - peg$c162 = function(arg) {return ["reroute", arg]}, - peg$c163 = "sayroute", - peg$c164 = { type: "literal", value: "sayroute", description: "\"sayroute\"" }, - peg$c165 = "sr", - peg$c166 = { type: "literal", value: "sr", description: "\"sr\"" }, - peg$c167 = function() {return ["sayRoute"]}, - peg$c168 = "sid", - peg$c169 = { type: "literal", value: "sid", description: "\"sid\"" }, - peg$c170 = function(arg) {return ["sid", arg]}, - peg$c171 = "+", - peg$c172 = { type: "literal", value: "+", description: "\"+\"" }, - peg$c173 = "-", - peg$c174 = { type: "literal", value: "-", description: "\"-\"" }, - peg$c175 = "speed", - peg$c176 = { type: "literal", value: "speed", description: "\"speed\"" }, - peg$c177 = "slow", - peg$c178 = { type: "literal", value: "slow", description: "\"slow\"" }, - peg$c179 = "sp", - peg$c180 = { type: "literal", value: "sp", description: "\"sp\"" }, - peg$c181 = function() {return "speed"}, - peg$c182 = "star", - peg$c183 = { type: "literal", value: "star", description: "\"star\"" }, - peg$c184 = function(arg) {return ["star", arg]}, - peg$c185 = "takeoff", - peg$c186 = { type: "literal", value: "takeoff", description: "\"takeoff\"" }, - peg$c187 = "to", - peg$c188 = { type: "literal", value: "to", description: "\"to\"" }, - peg$c189 = "cto", - peg$c190 = { type: "literal", value: "cto", description: "\"cto\"" }, - peg$c191 = function() {return ["takeoff"]}, - peg$c192 = "taxi", - peg$c193 = { type: "literal", value: "taxi", description: "\"taxi\"" }, - peg$c194 = "wait", - peg$c195 = { type: "literal", value: "wait", description: "\"wait\"" }, - peg$c196 = "w", - peg$c197 = { type: "literal", value: "w", description: "\"w\"" }, - peg$c198 = function(runway) {return ["taxi", runway]}, - peg$c199 = "left", - peg$c200 = { type: "literal", value: "left", description: "\"left\"" }, - peg$c201 = "right", - peg$c202 = { type: "literal", value: "right", description: "\"right\"" }, - peg$c203 = "r", - peg$c204 = { type: "literal", value: "r", description: "\"r\"" }, - peg$c205 = function(dir) {return dir}, - peg$c206 = function(fix) {return fix[2]}, - peg$c207 = /^[ \t]/, - peg$c208 = { type: "class", value: "[ \\t]", description: "[ \\t]" }, - peg$c209 = ".", - peg$c210 = { type: "literal", value: ".", description: "\".\"" }, - peg$c211 = function() { - return parseFloat(text()); - }, - peg$c212 = /^[a-zA-Z0-9.]/, - peg$c213 = { type: "class", value: "[a-zA-Z0-9.]", description: "[a-zA-Z0-9.]" }, - peg$c214 = { type: "other", description: "whiteSpace" }, - peg$c215 = function(arg) {return parseInt(arg)}, - - peg$currPos = 0, - peg$savedPos = 0, - peg$posDetailsCache = [{ 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$savedPos, peg$currPos); - } - - function location() { - return peg$computeLocation(peg$savedPos, peg$currPos); - } - - function expected(description) { - throw peg$buildException( - null, - [{ type: "other", description: description }], - input.substring(peg$savedPos, peg$currPos), - peg$computeLocation(peg$savedPos, peg$currPos) - ); - } - - function error(message) { - throw peg$buildException( - message, - null, - input.substring(peg$savedPos, peg$currPos), - peg$computeLocation(peg$savedPos, peg$currPos) - ); - } - - function peg$computePosDetails(pos) { - var details = peg$posDetailsCache[pos], - p, ch; - - if (details) { - return details; - } else { - p = pos - 1; - while (!peg$posDetailsCache[p]) { - p--; - } - - details = peg$posDetailsCache[p]; - details = { - line: details.line, - column: details.column, - seenCR: details.seenCR - }; - - while (p < pos) { - 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; - } - - p++; - } - - peg$posDetailsCache[pos] = details; - return details; - } - } - - function peg$computeLocation(startPos, endPos) { - var startPosDetails = peg$computePosDetails(startPos), - endPosDetails = peg$computePosDetails(endPos); - - return { - start: { - offset: startPos, - line: startPosDetails.line, - column: startPosDetails.column - }, - end: { - offset: endPos, - line: endPosDetails.line, - column: endPosDetails.column - } - }; - } - - 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, found, location) { - 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(/[\u0100-\u0FFF]/g, function(ch) { return '\\u0' + hex(ch); }) - .replace(/[\u1000-\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."; - } - - if (expected !== null) { - cleanupExpected(expected); - } - - return new peg$SyntaxError( - message !== null ? message : buildMessage(expected, found), - expected, - found, - location - ); - } - - function peg$parseInputParseGrammar() { - var s0; - - s0 = peg$parsesystemCommand(); - if (s0 === peg$FAILED) { - s0 = peg$parsetransmissionCommand(); - } - - return s0; - } - - function peg$parsesystemCommand() { - var s0, s1, s2; - - s0 = peg$currPos; - s1 = peg$currPos; - if (input.substr(peg$currPos, 7) === peg$c0) { - s2 = peg$c0; - peg$currPos += 7; - } else { - s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c1); } - } - if (s2 !== peg$FAILED) { - peg$savedPos = s1; - s2 = peg$c2(); - } - s1 = s2; - if (s1 === peg$FAILED) { - s1 = peg$currPos; - if (input.substr(peg$currPos, 8) === peg$c3) { - s2 = peg$c3; - peg$currPos += 8; - } else { - s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c4); } - } - if (s2 !== peg$FAILED) { - peg$savedPos = s1; - s2 = peg$c5(); - } - s1 = s2; - if (s1 === peg$FAILED) { - s1 = peg$currPos; - if (input.substr(peg$currPos, 4) === peg$c6) { - s2 = peg$c6; - peg$currPos += 4; - } else { - s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c7); } - } - if (s2 !== peg$FAILED) { - peg$savedPos = s1; - s2 = peg$c8(); - } - s1 = s2; - if (s1 === peg$FAILED) { - s1 = peg$currPos; - if (input.substr(peg$currPos, 5) === peg$c9) { - s2 = peg$c9; - peg$currPos += 5; - } else { - s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c10); } - } - if (s2 !== peg$FAILED) { - peg$savedPos = s1; - s2 = peg$c11(); - } - s1 = s2; - if (s1 === peg$FAILED) { - s1 = peg$currPos; - if (input.substr(peg$currPos, 5) === peg$c12) { - s2 = peg$c12; - peg$currPos += 5; - } else { - s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c13); } - } - if (s2 !== peg$FAILED) { - peg$savedPos = s1; - s2 = peg$c14(); - } - s1 = s2; - if (s1 === peg$FAILED) { - s1 = peg$parseairportCommand(); - if (s1 === peg$FAILED) { - s1 = peg$parserateCommand(); - if (s1 === peg$FAILED) { - s1 = peg$parsetimewarpCommand(); - } - } - } - } - } - } - } - if (s1 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c15(s1); - } - s0 = s1; - - return s0; - } - - function peg$parsetransmissionCommand() { - var s0, s1; - - s0 = peg$currPos; - s1 = peg$parseaircraftCommand(); - if (s1 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c16(s1); - } - s0 = s1; - - return s0; - } - - function peg$parsetimewarpCommand() { - var s0, s1, s2, s3; - - s0 = peg$currPos; - s1 = peg$currPos; - if (input.substr(peg$currPos, 8) === peg$c17) { - s2 = peg$c17; - peg$currPos += 8; - } else { - s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c18); } - } - if (s2 === peg$FAILED) { - if (input.substr(peg$currPos, 7) === peg$c19) { - s2 = peg$c19; - peg$currPos += 7; - } else { - s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c20); } - } - if (s2 === peg$FAILED) { - if (input.substr(peg$currPos, 6) === peg$c21) { - s2 = peg$c21; - peg$currPos += 6; - } else { - s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c22); } - } - if (s2 === peg$FAILED) { - if (input.substr(peg$currPos, 9) === peg$c23) { - s2 = peg$c23; - peg$currPos += 9; - } else { - s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c24); } - } - } - } - } - if (s2 !== peg$FAILED) { - s3 = peg$parsewhiteSpace(); - if (s3 !== peg$FAILED) { - peg$savedPos = s1; - s2 = peg$c25(s2); - s1 = s2; - } else { - peg$currPos = s1; - s1 = peg$FAILED; - } - } else { - peg$currPos = s1; - s1 = peg$FAILED; - } - if (s1 !== peg$FAILED) { - s2 = peg$parseinteger(); - if (s2 !== peg$FAILED) { - s1 = [s1, s2]; - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - - return s0; - } - - function peg$parseairportCommand() { - var s0, s1, s2, s3; - - s0 = peg$currPos; - s1 = peg$currPos; - if (input.substr(peg$currPos, 7) === peg$c26) { - s2 = peg$c26; - peg$currPos += 7; - } else { - s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c27); } - } - if (s2 !== peg$FAILED) { - s3 = peg$parsewhiteSpace(); - if (s3 !== peg$FAILED) { - peg$savedPos = s1; - s2 = peg$c25(s2); - s1 = s2; - } else { - peg$currPos = s1; - s1 = peg$FAILED; - } - } else { - peg$currPos = s1; - s1 = peg$FAILED; - } - if (s1 !== peg$FAILED) { - s2 = peg$parsestring(); - if (s2 !== peg$FAILED) { - s1 = [s1, s2]; - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - - return s0; - } - - function peg$parserateCommand() { - var s0, s1, s2, s3; - - s0 = peg$currPos; - s1 = peg$currPos; - if (input.substr(peg$currPos, 4) === peg$c28) { - s2 = peg$c28; - peg$currPos += 4; - } else { - s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c29); } - } - if (s2 !== peg$FAILED) { - s3 = peg$parsewhiteSpace(); - if (s3 !== peg$FAILED) { - peg$savedPos = s1; - s2 = peg$c25(s2); - s1 = s2; - } else { - peg$currPos = s1; - s1 = peg$FAILED; - } - } else { - peg$currPos = s1; - s1 = peg$FAILED; - } - if (s1 !== peg$FAILED) { - s2 = peg$parsefloat(); - if (s2 !== peg$FAILED) { - s1 = [s1, s2]; - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - - return s0; - } - - function peg$parseaircraftCommand() { - var s0, s1, s2; - - s0 = peg$currPos; - s1 = peg$parsestring(); - if (s1 !== peg$FAILED) { - s2 = peg$parseaircraftSubCommand(); - if (s2 !== peg$FAILED) { - s1 = [s1, s2]; - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - - return s0; - } - - function peg$parseaircraftSubCommand() { - var s0, s1, s2, s3; - - s0 = []; - s1 = peg$currPos; - s2 = peg$parsewhiteSpace(); - if (s2 !== peg$FAILED) { - s3 = peg$parsecmdAbort(); - if (s3 === peg$FAILED) { - s3 = peg$parsecmdDirect(); - if (s3 === peg$FAILED) { - s3 = peg$parsecmdAltitude(); - if (s3 === peg$FAILED) { - s3 = peg$parsecmdClearedAsFiled(); - if (s3 === peg$FAILED) { - s3 = peg$parsecmdClimbViaSID(); - if (s3 === peg$FAILED) { - s3 = peg$parsecmdDebug(); - if (s3 === peg$FAILED) { - s3 = peg$parsecmdDelete(); - if (s3 === peg$FAILED) { - s3 = peg$parsecmdDescendViaSTAR(); - if (s3 === peg$FAILED) { - s3 = peg$parsecmdFix(); - if (s3 === peg$FAILED) { - s3 = peg$parsecmdFlyPresentHeading(); - if (s3 === peg$FAILED) { - s3 = peg$parsecmdHeading(); - if (s3 === peg$FAILED) { - s3 = peg$parsecmdHold(); - if (s3 === peg$FAILED) { - s3 = peg$parsecmdLand(); - if (s3 === peg$FAILED) { - s3 = peg$parsecmdMoveDataBlock(); - if (s3 === peg$FAILED) { - s3 = peg$parsecmdRoute(); - if (s3 === peg$FAILED) { - s3 = peg$parsecmdReRoute(); - if (s3 === peg$FAILED) { - s3 = peg$parsecmdSayRoute(); - if (s3 === peg$FAILED) { - s3 = peg$parsecmdSID(); - if (s3 === peg$FAILED) { - s3 = peg$parsecmdSpeed(); - if (s3 === peg$FAILED) { - s3 = peg$parsecmdSTAR(); - if (s3 === peg$FAILED) { - s3 = peg$parsecmdTakeoff(); - if (s3 === peg$FAILED) { - s3 = peg$parsecmdTaxi(); - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - if (s3 !== peg$FAILED) { - peg$savedPos = s1; - s2 = peg$c25(s3); - s1 = s2; - } else { - peg$currPos = s1; - s1 = peg$FAILED; - } - } else { - peg$currPos = s1; - s1 = peg$FAILED; - } - if (s1 !== peg$FAILED) { - while (s1 !== peg$FAILED) { - s0.push(s1); - s1 = peg$currPos; - s2 = peg$parsewhiteSpace(); - if (s2 !== peg$FAILED) { - s3 = peg$parsecmdAbort(); - if (s3 === peg$FAILED) { - s3 = peg$parsecmdDirect(); - if (s3 === peg$FAILED) { - s3 = peg$parsecmdAltitude(); - if (s3 === peg$FAILED) { - s3 = peg$parsecmdClearedAsFiled(); - if (s3 === peg$FAILED) { - s3 = peg$parsecmdClimbViaSID(); - if (s3 === peg$FAILED) { - s3 = peg$parsecmdDebug(); - if (s3 === peg$FAILED) { - s3 = peg$parsecmdDelete(); - if (s3 === peg$FAILED) { - s3 = peg$parsecmdDescendViaSTAR(); - if (s3 === peg$FAILED) { - s3 = peg$parsecmdFix(); - if (s3 === peg$FAILED) { - s3 = peg$parsecmdFlyPresentHeading(); - if (s3 === peg$FAILED) { - s3 = peg$parsecmdHeading(); - if (s3 === peg$FAILED) { - s3 = peg$parsecmdHold(); - if (s3 === peg$FAILED) { - s3 = peg$parsecmdLand(); - if (s3 === peg$FAILED) { - s3 = peg$parsecmdMoveDataBlock(); - if (s3 === peg$FAILED) { - s3 = peg$parsecmdRoute(); - if (s3 === peg$FAILED) { - s3 = peg$parsecmdReRoute(); - if (s3 === peg$FAILED) { - s3 = peg$parsecmdSayRoute(); - if (s3 === peg$FAILED) { - s3 = peg$parsecmdSID(); - if (s3 === peg$FAILED) { - s3 = peg$parsecmdSpeed(); - if (s3 === peg$FAILED) { - s3 = peg$parsecmdSTAR(); - if (s3 === peg$FAILED) { - s3 = peg$parsecmdTakeoff(); - if (s3 === peg$FAILED) { - s3 = peg$parsecmdTaxi(); - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - if (s3 !== peg$FAILED) { - peg$savedPos = s1; - s2 = peg$c25(s3); - s1 = s2; - } else { - peg$currPos = s1; - s1 = peg$FAILED; - } - } else { - peg$currPos = s1; - s1 = peg$FAILED; - } - } - } else { - s0 = peg$FAILED; - } - - return s0; - } - - function peg$parsecmdAbort() { - var s0, s1; - - s0 = peg$currPos; - if (input.substr(peg$currPos, 5) === peg$c30) { - s1 = peg$c30; - peg$currPos += 5; - } else { - s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c31); } - } - if (s1 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c32(); - } - s0 = s1; - - return s0; - } - - function peg$parsecmdAltitude() { - var s0; - - s0 = peg$parsecmdAltitudeShort(); - if (s0 === peg$FAILED) { - s0 = peg$parsecmdAltitudeLong(); - } - - return s0; - } - - function peg$parsecmdAltitudeShort() { - var s0, s1, s2; - - s0 = peg$currPos; - if (input.charCodeAt(peg$currPos) === 11105) { - s1 = peg$c33; - peg$currPos++; - } else { - s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c34); } - } - if (s1 === peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 11107) { - s1 = peg$c35; - peg$currPos++; - } else { - s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c36); } - } - } - if (s1 !== peg$FAILED) { - s2 = peg$parseinteger(); - if (s2 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c37(s2); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - - return s0; - } - - function peg$parsecmdAltitudeLong() { - var s0, s1, s2, s3, s4, s5; - - s0 = peg$currPos; - if (input.substr(peg$currPos, 8) === peg$c38) { - s1 = peg$c38; - peg$currPos += 8; - } else { - s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c39); } - } - if (s1 === peg$FAILED) { - if (input.substr(peg$currPos, 5) === peg$c40) { - s1 = peg$c40; - peg$currPos += 5; - } else { - s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c41); } - } - if (s1 === peg$FAILED) { - if (input.substr(peg$currPos, 7) === peg$c42) { - s1 = peg$c42; - peg$currPos += 7; - } else { - s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c43); } - } - if (s1 === peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 97) { - s1 = peg$c44; - peg$currPos++; - } else { - s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c45); } - } - if (s1 === peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 99) { - s1 = peg$c46; - peg$currPos++; - } else { - s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c47); } - } - if (s1 === peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 100) { - s1 = peg$c48; - peg$currPos++; - } else { - s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c49); } - } - } - } - } - } - } - if (s1 !== peg$FAILED) { - s2 = peg$currPos; - s3 = peg$parse_(); - if (s3 !== peg$FAILED) { - s4 = peg$parseinteger(); - if (s4 !== peg$FAILED) { - peg$savedPos = s2; - s3 = peg$c50(s4); - s2 = s3; - } else { - peg$currPos = s2; - s2 = peg$FAILED; - } - } else { - peg$currPos = s2; - s2 = peg$FAILED; - } - if (s2 === peg$FAILED) { - s2 = null; - } - if (s2 !== peg$FAILED) { - s3 = peg$currPos; - s4 = peg$parse_(); - if (s4 !== peg$FAILED) { - if (input.substr(peg$currPos, 8) === peg$c51) { - s5 = peg$c51; - peg$currPos += 8; - } else { - s5 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c52); } - } - if (s5 === peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 120) { - s5 = peg$c53; - peg$currPos++; - } else { - s5 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c54); } - } - } - if (s5 !== peg$FAILED) { - peg$savedPos = s3; - s4 = peg$c55(s2); - s3 = s4; - } else { - peg$currPos = s3; - s3 = peg$FAILED; - } - } else { - peg$currPos = s3; - s3 = peg$FAILED; - } - if (s3 === peg$FAILED) { - s3 = null; - } - if (s3 !== peg$FAILED) { - peg$savedPos = peg$currPos; - s4 = peg$c56(s2, s3); - if (s4) { - s4 = peg$FAILED; - } else { - s4 = void 0; - } - if (s4 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c57(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; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - - return s0; - } - - function peg$parsecmdClearedAsFiled() { - var s0, s1; - - s0 = peg$currPos; - if (input.substr(peg$currPos, 14) === peg$c58) { - s1 = peg$c58; - peg$currPos += 14; - } else { - s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c59); } - } - if (s1 === peg$FAILED) { - if (input.substr(peg$currPos, 3) === peg$c60) { - s1 = peg$c60; - peg$currPos += 3; - } else { - s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c61); } - } - } - if (s1 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c62(); - } - s0 = s1; - - return s0; - } - - function peg$parsecmdClimbViaSID() { - var s0, s1; - - s0 = peg$currPos; - if (input.substr(peg$currPos, 11) === peg$c63) { - s1 = peg$c63; - peg$currPos += 11; - } else { - s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c64); } - } - if (s1 === peg$FAILED) { - if (input.substr(peg$currPos, 3) === peg$c65) { - s1 = peg$c65; - peg$currPos += 3; - } else { - s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c66); } - } - } - if (s1 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c67(); - } - s0 = s1; - - return s0; - } - - function peg$parsecmdDebug() { - var s0, s1, s2, s3; - - s0 = peg$currPos; - if (input.substr(peg$currPos, 5) === peg$c68) { - s1 = peg$c68; - peg$currPos += 5; - } else { - s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c69); } - } - if (s1 !== peg$FAILED) { - s2 = peg$parse_(); - if (s2 !== peg$FAILED) { - if (input.substr(peg$currPos, 3) === peg$c70) { - s3 = peg$c70; - peg$currPos += 3; - } else { - s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c71); } - } - if (s3 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c72(); - 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$parsecmdDelete() { - var s0, s1; - - s0 = peg$currPos; - if (input.substr(peg$currPos, 6) === peg$c73) { - s1 = peg$c73; - peg$currPos += 6; - } else { - s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c74); } - } - if (s1 === peg$FAILED) { - if (input.substr(peg$currPos, 3) === peg$c75) { - s1 = peg$c75; - peg$currPos += 3; - } else { - s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c76); } - } - if (s1 === peg$FAILED) { - if (input.substr(peg$currPos, 4) === peg$c77) { - s1 = peg$c77; - peg$currPos += 4; - } else { - s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c78); } - } - } - } - if (s1 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c79(); - } - s0 = s1; - - return s0; - } - - function peg$parsecmdDescendViaSTAR() { - var s0, s1; - - s0 = peg$currPos; - if (input.substr(peg$currPos, 14) === peg$c80) { - s1 = peg$c80; - peg$currPos += 14; - } else { - s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c81); } - } - if (s1 === peg$FAILED) { - if (input.substr(peg$currPos, 3) === peg$c82) { - s1 = peg$c82; - peg$currPos += 3; - } else { - s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c83); } - } - } - if (s1 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c84(); - } - s0 = s1; - - return s0; - } - - function peg$parsecmdDirect() { - var s0, s1, s2; - - s0 = peg$currPos; - s1 = peg$currPos; - if (input.substr(peg$currPos, 6) === peg$c85) { - s2 = peg$c85; - peg$currPos += 6; - } else { - s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c86); } - } - if (s2 === peg$FAILED) { - if (input.substr(peg$currPos, 3) === peg$c87) { - s2 = peg$c87; - peg$currPos += 3; - } else { - s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c88); } - } - if (s2 === peg$FAILED) { - if (input.substr(peg$currPos, 2) === peg$c89) { - s2 = peg$c89; - peg$currPos += 2; - } else { - s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c90); } - } - } - } - if (s2 !== peg$FAILED) { - peg$savedPos = s1; - s2 = peg$c91(); - } - s1 = s2; - if (s1 !== peg$FAILED) { - s2 = peg$parsefixToken(); - if (s2 !== peg$FAILED) { - s1 = [s1, s2]; - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - - return s0; - } - - function peg$parsecmdFix() { - var s0, s1, s2, s3; - - s0 = peg$currPos; - s1 = peg$currPos; - if (input.substr(peg$currPos, 3) === peg$c92) { - s2 = peg$c92; - peg$currPos += 3; - } else { - s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c93); } - } - if (s2 === peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 102) { - s2 = peg$c94; - peg$currPos++; - } else { - s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c95); } - } - if (s2 === peg$FAILED) { - if (input.substr(peg$currPos, 5) === peg$c96) { - s2 = peg$c96; - peg$currPos += 5; - } else { - s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c97); } - } - } - } - if (s2 !== peg$FAILED) { - peg$savedPos = s1; - s2 = peg$c98(); - } - s1 = s2; - if (s1 !== peg$FAILED) { - s2 = []; - s3 = peg$parsefixToken(); - if (s3 !== peg$FAILED) { - while (s3 !== peg$FAILED) { - s2.push(s3); - s3 = peg$parsefixToken(); - } - } else { - s2 = peg$FAILED; - } - if (s2 !== peg$FAILED) { - s1 = [s1, s2]; - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - - return s0; - } - - function peg$parsecmdFlyPresentHeading() { - var s0, s1; - - s0 = peg$currPos; - if (input.substr(peg$currPos, 3) === peg$c99) { - s1 = peg$c99; - peg$currPos += 3; - } else { - s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c100); } - } - if (s1 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c101(); - } - s0 = s1; - - return s0; - } - - function peg$parsecmdHeading() { - var s0, s1; - - s0 = peg$currPos; - s1 = peg$parsecmdHeadingShort(); - if (s1 === peg$FAILED) { - s1 = peg$parsecmdHeadingLong(); - } - if (s1 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c102(s1); - } - s0 = s1; - - return s0; - } - - function peg$parsecmdHeadingShort() { - var s0, s1, s2; - - s0 = peg$currPos; - s1 = peg$currPos; - if (input.charCodeAt(peg$currPos) === 11170) { - s2 = peg$c103; - peg$currPos++; - } else { - s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c104); } - } - if (s2 !== peg$FAILED) { - peg$savedPos = s1; - s2 = peg$c105(); - } - s1 = s2; - if (s1 === peg$FAILED) { - s1 = peg$currPos; - if (input.charCodeAt(peg$currPos) === 11171) { - s2 = peg$c106; - peg$currPos++; - } else { - s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c107); } - } - if (s2 !== peg$FAILED) { - peg$savedPos = s1; - s2 = peg$c108(); - } - s1 = s2; - if (s1 === peg$FAILED) { - s1 = peg$currPos; - if (input.substr(peg$currPos, 2) === peg$c109) { - s2 = peg$c109; - peg$currPos += 2; - } else { - s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c110); } - } - if (s2 !== peg$FAILED) { - peg$savedPos = s1; - s2 = peg$c111(); - } - s1 = s2; - } - } - if (s1 !== peg$FAILED) { - s2 = peg$parseargHeading(); - if (s2 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c112(s1, s2); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - - return s0; - } - - function peg$parsecmdHeadingLong() { - var s0, s1, s2, s3, s4, s5; - - s0 = peg$currPos; - s1 = peg$currPos; - if (input.substr(peg$currPos, 7) === peg$c113) { - s2 = peg$c113; - peg$currPos += 7; - } else { - s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c114); } - } - if (s2 === peg$FAILED) { - if (input.substr(peg$currPos, 4) === peg$c115) { - s2 = peg$c115; - peg$currPos += 4; - } else { - s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c116); } - } - if (s2 === peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 116) { - s2 = peg$c117; - peg$currPos++; - } else { - s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c118); } - } - if (s2 === peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 104) { - s2 = peg$c119; - peg$currPos++; - } else { - s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c120); } - } - } - } - } - if (s2 !== peg$FAILED) { - peg$savedPos = s1; - s2 = peg$c121(); - } - s1 = s2; - if (s1 !== peg$FAILED) { - s2 = peg$parsedirection(); - if (s2 === peg$FAILED) { - s2 = null; - } - if (s2 !== peg$FAILED) { - s3 = peg$currPos; - s4 = peg$parse_(); - if (s4 !== peg$FAILED) { - s5 = peg$parseargHeading(); - if (s5 !== peg$FAILED) { - peg$savedPos = s3; - s4 = peg$c122(s5); - s3 = s4; - } else { - peg$currPos = s3; - s3 = peg$FAILED; - } - } else { - peg$currPos = s3; - s3 = peg$FAILED; - } - 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$parseargHeading() { - var s0, s1, s2, s3; - - s0 = peg$currPos; - if (peg$c123.test(input.charAt(peg$currPos))) { - s1 = input.charAt(peg$currPos); - peg$currPos++; - } else { - s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c124); } - } - if (s1 !== peg$FAILED) { - if (peg$c123.test(input.charAt(peg$currPos))) { - s2 = input.charAt(peg$currPos); - peg$currPos++; - } else { - s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c124); } - } - if (s2 !== peg$FAILED) { - if (peg$c123.test(input.charAt(peg$currPos))) { - s3 = input.charAt(peg$currPos); - peg$currPos++; - } else { - s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c124); } - } - if (s3 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c125(); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - if (s0 === peg$FAILED) { - s0 = peg$currPos; - if (peg$c123.test(input.charAt(peg$currPos))) { - s1 = input.charAt(peg$currPos); - peg$currPos++; - } else { - s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c124); } - } - if (s1 !== peg$FAILED) { - if (peg$c123.test(input.charAt(peg$currPos))) { - s2 = input.charAt(peg$currPos); - peg$currPos++; - } else { - s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c124); } - } - if (s2 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c126(); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } - - return s0; - } - - function peg$parsecmdHold() { - var s0, s1, s2, s3, s4, s5, s6, s7; - - s0 = peg$currPos; - if (input.substr(peg$currPos, 4) === peg$c127) { - s1 = peg$c127; - peg$currPos += 4; - } else { - s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c128); } - } - if (s1 !== peg$FAILED) { - s2 = peg$parsedirection(); - if (s2 === peg$FAILED) { - s2 = null; - } - if (s2 !== peg$FAILED) { - s3 = peg$currPos; - s4 = peg$parse_(); - if (s4 !== peg$FAILED) { - s5 = peg$parseinteger(); - if (s5 !== peg$FAILED) { - if (input.substr(peg$currPos, 3) === peg$c129) { - s6 = peg$c129; - peg$currPos += 3; - } else { - s6 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c130); } - } - if (s6 === peg$FAILED) { - if (input.substr(peg$currPos, 2) === peg$c131) { - s6 = peg$c131; - peg$currPos += 2; - } else { - s6 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c132); } - } - } - if (s6 !== peg$FAILED) { - s4 = [s4, s5, s6]; - s3 = s4; - } else { - peg$currPos = s3; - s3 = peg$FAILED; - } - } else { - peg$currPos = s3; - s3 = peg$FAILED; - } - } else { - peg$currPos = s3; - s3 = peg$FAILED; - } - if (s3 === peg$FAILED) { - s3 = null; - } - if (s3 !== peg$FAILED) { - s4 = peg$currPos; - s5 = peg$currPos; - peg$silentFails++; - s6 = peg$parseaircraftSubCommand(); - peg$silentFails--; - if (s6 === peg$FAILED) { - s5 = void 0; - } else { - peg$currPos = s5; - s5 = peg$FAILED; - } - if (s5 !== peg$FAILED) { - s6 = peg$parse_(); - if (s6 !== peg$FAILED) { - s7 = peg$parsestring(); - if (s7 !== peg$FAILED) { - s5 = [s5, s6, s7]; - s4 = s5; - } else { - peg$currPos = s4; - s4 = peg$FAILED; - } - } else { - peg$currPos = s4; - s4 = peg$FAILED; - } - } else { - peg$currPos = s4; - s4 = peg$FAILED; - } - if (s4 === peg$FAILED) { - s4 = null; - } - if (s4 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c133(s2, s3, s4); - s0 = s1; - } 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$parsecmdLand() { - var s0, s1; - - s0 = peg$currPos; - s1 = peg$parsecmdLandShort(); - if (s1 === peg$FAILED) { - s1 = peg$parsecmdLandLong(); - } - if (s1 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c134(s1); - } - s0 = s1; - - return s0; - } - - function peg$parsecmdLandLong() { - var s0, s1, s2, s3, s4, s5; - - s0 = peg$currPos; - s1 = peg$currPos; - if (input.substr(peg$currPos, 4) === peg$c135) { - s2 = peg$c135; - peg$currPos += 4; - } else { - s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c136); } - } - if (s2 === peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 108) { - s2 = peg$c137; - peg$currPos++; - } else { - s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c138); } - } - if (s2 === peg$FAILED) { - if (input.substr(peg$currPos, 3) === peg$c139) { - s2 = peg$c139; - peg$currPos += 3; - } else { - s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c140); } - } - } - } - if (s2 !== peg$FAILED) { - peg$savedPos = s1; - s2 = peg$c141(); - } - s1 = s2; - if (s1 !== peg$FAILED) { - s2 = peg$currPos; - s3 = peg$parsewhiteSpace(); - if (s3 !== peg$FAILED) { - if (peg$c142.test(input.charAt(peg$currPos))) { - s4 = input.charAt(peg$currPos); - peg$currPos++; - } else { - s4 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c143); } - } - if (s4 === peg$FAILED) { - s4 = null; - } - if (s4 !== peg$FAILED) { - s5 = peg$parsestring(); - if (s5 !== peg$FAILED) { - peg$savedPos = s2; - s3 = peg$c144(s1, s4, s5); - s2 = s3; - } else { - peg$currPos = s2; - s2 = peg$FAILED; - } - } else { - peg$currPos = s2; - s2 = peg$FAILED; - } - } else { - peg$currPos = s2; - s2 = peg$FAILED; - } - if (s2 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c145(s1, s2); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - - return s0; - } - - function peg$parsecmdLandShort() { - var s0, s1, s2, s3, s4; - - s0 = peg$currPos; - s1 = peg$currPos; - if (input.charCodeAt(peg$currPos) === 11088) { - s2 = peg$c146; - peg$currPos++; - } else { - s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c147); } - } - if (s2 !== peg$FAILED) { - peg$savedPos = s1; - s2 = peg$c141(); - } - s1 = s2; - if (s1 !== peg$FAILED) { - s2 = peg$currPos; - if (peg$c142.test(input.charAt(peg$currPos))) { - s3 = input.charAt(peg$currPos); - peg$currPos++; - } else { - s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c143); } - } - if (s3 === peg$FAILED) { - s3 = null; - } - if (s3 !== peg$FAILED) { - s4 = peg$parsestring(); - if (s4 !== peg$FAILED) { - peg$savedPos = s2; - s3 = peg$c144(s1, s3, s4); - s2 = s3; - } else { - peg$currPos = s2; - s2 = peg$FAILED; - } - } else { - peg$currPos = s2; - s2 = peg$FAILED; - } - if (s2 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c145(s1, s2); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - - return s0; - } - - function peg$parsecmdMoveDataBlock() { - var s0, s1, s2, s3, s4; - - s0 = peg$currPos; - s1 = peg$currPos; - s2 = peg$currPos; - if (input.substr(peg$currPos, 13) === peg$c148) { - s3 = peg$c148; - peg$currPos += 13; - } else { - s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c149); } - } - if (s3 !== peg$FAILED) { - s4 = peg$parsewhiteSpace(); - 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) { - if (input.charCodeAt(peg$currPos) === 96) { - s2 = peg$c150; - peg$currPos++; - } else { - s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c151); } - } - } - if (s2 !== peg$FAILED) { - peg$savedPos = s1; - s2 = peg$c152(); - } - s1 = s2; - if (s1 !== peg$FAILED) { - if (peg$c153.test(input.charAt(peg$currPos))) { - s2 = input.charAt(peg$currPos); - peg$currPos++; - } else { - s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c154); } - } - if (s2 !== peg$FAILED) { - s1 = [s1, s2]; - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - - return s0; - } - - function peg$parsecmdRoute() { - var s0, s1, s2, s3; - - s0 = peg$currPos; - if (input.substr(peg$currPos, 5) === peg$c155) { - s1 = peg$c155; - peg$currPos += 5; - } else { - s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c156); } - } - if (s1 !== peg$FAILED) { - s2 = peg$parse_(); - if (s2 !== peg$FAILED) { - s3 = peg$parsestring(); - if (s3 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c157(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$parsecmdReRoute() { - var s0, s1, s2, s3; - - s0 = peg$currPos; - if (input.substr(peg$currPos, 7) === peg$c158) { - s1 = peg$c158; - peg$currPos += 7; - } else { - s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c159); } - } - if (s1 === peg$FAILED) { - if (input.substr(peg$currPos, 2) === peg$c160) { - s1 = peg$c160; - peg$currPos += 2; - } else { - s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c161); } - } - } - if (s1 !== peg$FAILED) { - s2 = peg$parse_(); - if (s2 !== peg$FAILED) { - s3 = peg$parsestring(); - if (s3 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c162(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$parsecmdSayRoute() { - var s0, s1; - - s0 = peg$currPos; - if (input.substr(peg$currPos, 8) === peg$c163) { - s1 = peg$c163; - peg$currPos += 8; - } else { - s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c164); } - } - if (s1 === peg$FAILED) { - if (input.substr(peg$currPos, 2) === peg$c165) { - s1 = peg$c165; - peg$currPos += 2; - } else { - s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c166); } - } - } - if (s1 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c167(); - } - s0 = s1; - - return s0; - } - - function peg$parsecmdSID() { - var s0, s1, s2, s3; - - s0 = peg$currPos; - if (input.substr(peg$currPos, 3) === peg$c168) { - s1 = peg$c168; - peg$currPos += 3; - } else { - s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c169); } - } - if (s1 !== peg$FAILED) { - s2 = peg$parse_(); - if (s2 !== peg$FAILED) { - s3 = peg$parsestring(); - if (s3 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c170(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$parsecmdSpeed() { - var s0, s1, s2, s3, s4; - - s0 = peg$currPos; - s1 = peg$currPos; - if (input.charCodeAt(peg$currPos) === 43) { - s2 = peg$c171; - peg$currPos++; - } else { - s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c172); } - } - if (s2 === peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 45) { - s2 = peg$c173; - peg$currPos++; - } else { - s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c174); } - } - } - if (s2 === peg$FAILED) { - s2 = peg$currPos; - if (input.substr(peg$currPos, 5) === peg$c175) { - s3 = peg$c175; - peg$currPos += 5; - } else { - s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c176); } - } - if (s3 === peg$FAILED) { - if (input.substr(peg$currPos, 4) === peg$c177) { - s3 = peg$c177; - peg$currPos += 4; - } else { - s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c178); } - } - if (s3 === peg$FAILED) { - if (input.substr(peg$currPos, 2) === peg$c179) { - s3 = peg$c179; - peg$currPos += 2; - } else { - s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c180); } - } - } - } - if (s3 !== peg$FAILED) { - s4 = peg$parse_(); - 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) { - peg$savedPos = s1; - s2 = peg$c181(); - } - s1 = s2; - if (s1 !== peg$FAILED) { - s2 = peg$parseinteger(); - if (s2 !== peg$FAILED) { - s1 = [s1, s2]; - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - - return s0; - } - - function peg$parsecmdSTAR() { - var s0, s1, s2, s3; - - s0 = peg$currPos; - if (input.substr(peg$currPos, 4) === peg$c182) { - s1 = peg$c182; - peg$currPos += 4; - } else { - s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c183); } - } - if (s1 !== peg$FAILED) { - s2 = peg$parse_(); - if (s2 !== peg$FAILED) { - s3 = peg$parsestring(); - if (s3 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c184(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$parsecmdTakeoff() { - var s0, s1; - - s0 = peg$currPos; - if (input.substr(peg$currPos, 7) === peg$c185) { - s1 = peg$c185; - peg$currPos += 7; - } else { - s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c186); } - } - if (s1 === peg$FAILED) { - if (input.substr(peg$currPos, 2) === peg$c187) { - s1 = peg$c187; - peg$currPos += 2; - } else { - s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c188); } - } - if (s1 === peg$FAILED) { - if (input.substr(peg$currPos, 3) === peg$c189) { - s1 = peg$c189; - peg$currPos += 3; - } else { - s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c190); } - } - } - } - if (s1 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c191(); - } - s0 = s1; - - return s0; - } - - function peg$parsecmdTaxi() { - var s0, s1, s2, s3, s4; - - s0 = peg$currPos; - if (input.substr(peg$currPos, 4) === peg$c192) { - s1 = peg$c192; - peg$currPos += 4; - } else { - s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c193); } - } - if (s1 === peg$FAILED) { - if (input.substr(peg$currPos, 4) === peg$c194) { - s1 = peg$c194; - peg$currPos += 4; - } else { - s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c195); } - } - if (s1 === peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 119) { - s1 = peg$c196; - peg$currPos++; - } else { - s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c197); } - } - } - } - if (s1 !== peg$FAILED) { - s2 = peg$currPos; - s3 = peg$parse_(); - if (s3 !== peg$FAILED) { - s4 = peg$parsestring(); - if (s4 !== peg$FAILED) { - peg$savedPos = s2; - s3 = peg$c122(s4); - s2 = s3; - } else { - peg$currPos = s2; - s2 = peg$FAILED; - } - } else { - peg$currPos = s2; - s2 = peg$FAILED; - } - if (s2 === peg$FAILED) { - s2 = null; - } - if (s2 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c198(s2); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - - return s0; - } - - function peg$parsedirection() { - var s0, s1, s2, s3; - - s0 = peg$currPos; - s1 = peg$parsewhiteSpace(); - if (s1 !== peg$FAILED) { - s2 = peg$currPos; - if (input.substr(peg$currPos, 4) === peg$c199) { - s3 = peg$c199; - peg$currPos += 4; - } else { - s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c200); } - } - if (s3 === peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 108) { - s3 = peg$c137; - peg$currPos++; - } else { - s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c138); } - } - } - if (s3 !== peg$FAILED) { - peg$savedPos = s2; - s3 = peg$c105(); - } - s2 = s3; - if (s2 === peg$FAILED) { - s2 = peg$currPos; - if (input.substr(peg$currPos, 5) === peg$c201) { - s3 = peg$c201; - peg$currPos += 5; - } else { - s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c202); } - } - if (s3 === peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 114) { - s3 = peg$c203; - peg$currPos++; - } else { - s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c204); } - } - } - if (s3 !== peg$FAILED) { - peg$savedPos = s2; - s3 = peg$c108(); - } - s2 = s3; - } - if (s2 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c205(s2); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - - return s0; - } - - function peg$parsefixToken() { - var s0, s1, s2, s3, s4; - - s0 = peg$currPos; - s1 = peg$currPos; - s2 = peg$currPos; - peg$silentFails++; - s3 = peg$parseaircraftSubCommand(); - peg$silentFails--; - if (s3 === peg$FAILED) { - s2 = void 0; - } else { - peg$currPos = s2; - s2 = peg$FAILED; - } - if (s2 !== peg$FAILED) { - s3 = peg$parse_(); - if (s3 !== peg$FAILED) { - s4 = peg$parsestring(); - if (s4 !== peg$FAILED) { - s2 = [s2, s3, s4]; - s1 = s2; - } else { - peg$currPos = s1; - s1 = peg$FAILED; - } - } else { - peg$currPos = s1; - s1 = peg$FAILED; - } - } else { - peg$currPos = s1; - s1 = peg$FAILED; - } - if (s1 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c206(s1); - } - s0 = s1; - - return s0; - } - - function peg$parsewhiteSpace() { - var s0, s1, s2; - - s0 = peg$currPos; - s1 = []; - if (peg$c207.test(input.charAt(peg$currPos))) { - s2 = input.charAt(peg$currPos); - peg$currPos++; - } else { - s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c208); } - } - if (s2 !== peg$FAILED) { - while (s2 !== peg$FAILED) { - s1.push(s2); - if (peg$c207.test(input.charAt(peg$currPos))) { - s2 = input.charAt(peg$currPos); - peg$currPos++; - } else { - s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c208); } - } - } - } else { - s1 = peg$FAILED; - } - if (s1 !== peg$FAILED) { - s0 = input.substring(s0, peg$currPos); - } else { - s0 = s1; - } - - return s0; - } - - function peg$parsefloat() { - var s0, s1, s2, s3, s4, s5, s6, s7, s8; - - s0 = peg$currPos; - s1 = peg$currPos; - s2 = peg$currPos; - if (input.charCodeAt(peg$currPos) === 45) { - s3 = peg$c173; - peg$currPos++; - } else { - s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c174); } - } - if (s3 === peg$FAILED) { - s3 = null; - } - if (s3 !== peg$FAILED) { - s4 = []; - if (peg$c123.test(input.charAt(peg$currPos))) { - s5 = input.charAt(peg$currPos); - peg$currPos++; - } else { - s5 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c124); } - } - if (s5 !== peg$FAILED) { - while (s5 !== peg$FAILED) { - s4.push(s5); - if (peg$c123.test(input.charAt(peg$currPos))) { - s5 = input.charAt(peg$currPos); - peg$currPos++; - } else { - s5 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c124); } - } - } - } else { - s4 = peg$FAILED; - } - if (s4 !== peg$FAILED) { - s5 = peg$currPos; - if (input.charCodeAt(peg$currPos) === 46) { - s6 = peg$c209; - peg$currPos++; - } else { - s6 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c210); } - } - if (s6 !== peg$FAILED) { - s7 = []; - if (peg$c123.test(input.charAt(peg$currPos))) { - s8 = input.charAt(peg$currPos); - peg$currPos++; - } else { - s8 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c124); } - } - if (s8 !== peg$FAILED) { - while (s8 !== peg$FAILED) { - s7.push(s8); - if (peg$c123.test(input.charAt(peg$currPos))) { - s8 = input.charAt(peg$currPos); - peg$currPos++; - } else { - s8 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c124); } - } - } - } else { - s7 = peg$FAILED; - } - if (s7 !== peg$FAILED) { - s6 = [s6, s7]; - s5 = s6; - } else { - peg$currPos = s5; - s5 = peg$FAILED; - } - } else { - peg$currPos = s5; - s5 = peg$FAILED; - } - if (s5 === peg$FAILED) { - s5 = null; - } - if (s5 !== peg$FAILED) { - s3 = [s3, s4, s5]; - s2 = s3; - } else { - peg$currPos = s2; - s2 = peg$FAILED; - } - } else { - peg$currPos = s2; - s2 = peg$FAILED; - } - } else { - peg$currPos = s2; - s2 = peg$FAILED; - } - if (s2 !== peg$FAILED) { - s1 = input.substring(s1, peg$currPos); - } else { - s1 = s2; - } - if (s1 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c211(); - } - s0 = s1; - - return s0; - } - - function peg$parsestring() { - var s0, s1, s2; - - s0 = peg$currPos; - s1 = []; - if (peg$c212.test(input.charAt(peg$currPos))) { - s2 = input.charAt(peg$currPos); - peg$currPos++; - } else { - s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c213); } - } - if (s2 !== peg$FAILED) { - while (s2 !== peg$FAILED) { - s1.push(s2); - if (peg$c212.test(input.charAt(peg$currPos))) { - s2 = input.charAt(peg$currPos); - peg$currPos++; - } else { - s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c213); } - } - } - } else { - s1 = peg$FAILED; - } - if (s1 !== peg$FAILED) { - s0 = input.substring(s0, peg$currPos); - } else { - s0 = s1; - } - - return s0; - } - - function peg$parse_() { - var s0, s1; - - peg$silentFails++; - s0 = []; - if (peg$c207.test(input.charAt(peg$currPos))) { - s1 = input.charAt(peg$currPos); - peg$currPos++; - } else { - s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c208); } - } - if (s1 !== peg$FAILED) { - while (s1 !== peg$FAILED) { - s0.push(s1); - if (peg$c207.test(input.charAt(peg$currPos))) { - s1 = input.charAt(peg$currPos); - peg$currPos++; - } else { - s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c208); } - } - } - } else { - s0 = peg$FAILED; - } - peg$silentFails--; - if (s0 === peg$FAILED) { - s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c214); } - } - - return s0; - } - - function peg$parseinteger() { - var s0, s1, s2, s3, s4, s5; - - s0 = peg$currPos; - s1 = peg$currPos; - s2 = peg$currPos; - if (input.charCodeAt(peg$currPos) === 45) { - s3 = peg$c173; - peg$currPos++; - } else { - s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c174); } - } - if (s3 === peg$FAILED) { - s3 = null; - } - if (s3 !== peg$FAILED) { - s4 = []; - if (peg$c123.test(input.charAt(peg$currPos))) { - s5 = input.charAt(peg$currPos); - peg$currPos++; - } else { - s5 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c124); } - } - if (s5 !== peg$FAILED) { - while (s5 !== peg$FAILED) { - s4.push(s5); - if (peg$c123.test(input.charAt(peg$currPos))) { - s5 = input.charAt(peg$currPos); - peg$currPos++; - } else { - s5 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c124); } - } - } - } else { - s4 = peg$FAILED; - } - 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) { - s1 = input.substring(s1, peg$currPos); - } else { - s1 = s2; - } - if (s1 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c215(s1); - } - s0 = s1; - - return s0; - } - - 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 < input.length ? input.charAt(peg$maxFailPos) : null, - peg$maxFailPos < input.length - ? peg$computeLocation(peg$maxFailPos, peg$maxFailPos + 1) - : peg$computeLocation(peg$maxFailPos, peg$maxFailPos) - ); - } - } - - return { - SyntaxError: peg$SyntaxError, - parse: peg$parse - }; -})(); diff --git a/tools/compile-parser.html b/tools/compile-parser.html deleted file mode 100644 index ae8ee778..00000000 --- a/tools/compile-parser.html +++ /dev/null @@ -1,196 +0,0 @@ - - -
-