UNPKG

@spiralup/jfl-parser

Version:

Parser for JHipster Form definition Language

1,678 lines (1,577 loc) 168 kB
/* * Generated by PEG.js 0.10.0. * * http://pegjs.org/ */ "use strict"; 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); peg$SyntaxError.buildMessage = function(expected, found) { var DESCRIBE_EXPECTATION_FNS = { literal: function(expectation) { return "\"" + literalEscape(expectation.text) + "\""; }, "class": function(expectation) { var escapedParts = "", i; for (i = 0; i < expectation.parts.length; i++) { escapedParts += expectation.parts[i] instanceof Array ? classEscape(expectation.parts[i][0]) + "-" + classEscape(expectation.parts[i][1]) : classEscape(expectation.parts[i]); } return "[" + (expectation.inverted ? "^" : "") + escapedParts + "]"; }, any: function(expectation) { return "any character"; }, end: function(expectation) { 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 = new Array(expected.length), i, j; for (i = 0; i < expected.length; i++) { descriptions[i] = describeExpectation(expected[i]); } 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 !== void 0 ? options : {}; var peg$FAILED = {}, peg$startRuleFunctions = { start: peg$parsestart }, peg$startRuleFunction = peg$parsestart, peg$c0 = function(p) { return p; }, peg$c1 = function(fd, p) { parsed.forms = addUniqueElements([fd], parsed.forms); return parsed; }, peg$c2 = function(md, p) { parsed.menus = flattenArray(addUniqueElements([md], parsed.menus)); return parsed; }, peg$c3 = "", peg$c4 = function() { return parsed; }, peg$c5 = function(jd, f, t, fb) { return { name: f, title: t, body: fb, comment: formatComment(jd) }; }, peg$c6 = function(f, fb) { return { name: f, title: t, body: fb, comment: '' }; }, peg$c7 = function(t) {return t}, peg$c8 = "{", peg$c9 = peg$literalExpectation("{", false), peg$c10 = "}", peg$c11 = peg$literalExpectation("}", false), peg$c12 = function(e, t, pfl, lfl, prop, fdl, vdl, sdl) { return {entity:e, template:t, properties:prop, parent:pfl, linked:lfl, fields:fdl, views:vdl, subforms:sdl} ; }, peg$c13 = function() { return { entity:"", template:"", properties:[], parent:[], linked:[], fields:[], views:[], subforms:[] }; }, peg$c14 = function(e) { return e; }, peg$c15 = function() { return "" }, peg$c16 = function(pfl) { return pfl; }, peg$c17 = function() { return []; }, peg$c18 = function(lfl) { return lfl; }, peg$c19 = ",", peg$c20 = peg$literalExpectation(",", false), peg$c21 = function(fdl) { return fdl;}, peg$c22 = function(prop) { return prop;}, peg$c23 = function(vd) { return vd;}, peg$c24 = function(vd, vdl) { return addUniqueElements([vd], vdl ); }, peg$c25 = function(fd, fdl) { return addUniqueElements([fd], fdl ); }, peg$c26 = function(com, f, t, vl, dflt, props, com2) { return { name: f, title: t, validations: vl, default: dflt, properties:props, comment: formatComment( com || com2) }; }, peg$c27 = function(fd, fdl) { return addUniqueElements([fd], fdl ); }, peg$c28 = function(v, vl) { return addUniqueElements([v], vl); }, peg$c29 = function(t) { return t }, peg$c30 = function(d) {return d}, peg$c31 = function() { return null;}, peg$c32 = function(f, sub) { return addUniqueElements([f], sub); }, peg$c33 = function() { return ['*']; }, peg$c34 = function(f, sub) { return addUniqueElements([f], sub)}, peg$c35 = function(f, sub) { return addElements([f], sub); }, peg$c36 = function(f, sub) { return addElements([f], sub); }, peg$c37 = function(sub) { return sub; }, peg$c38 = function() { return [];}, peg$c39 = function(e, sub) { return addUniqueElements([e], sub); }, peg$c40 = function(e) { return [e]; }, peg$c41 = function(decl, ex) { return {included:decl, excluded:ex};}, peg$c42 = function(decl, ex) { return {included:decl, excluded:ex}; }, peg$c43 = function(n, fl, rl) {return {view:n, fields:fl, roles:rl };}, peg$c44 = function(s) { return s; }, peg$c45 = function(f) { return f;}, peg$c46 = function(d) { return d;}, peg$c47 = function(n) { return n;}, peg$c48 = ":", peg$c49 = peg$literalExpectation(":", false), peg$c50 = function(p, v, com2) { return { name: p, value: v, comment: formatComment( com2) }; }, peg$c51 = function(jd, m, t, f, p, mb) { return { name: m, title: t, form:f, parent: p, body: mb, comment: formatComment(jd) }; }, peg$c52 = function(jd, m, t, p, mb) { return { name: m, title: t, form:null, parent: p, body: mb, comment: formatComment(jd) }; }, peg$c53 = function(m, t, f, p, mb) { return { name: m, title: t, form:f, parent: p, body: mb, comment: formatComment(jd) }; }, peg$c54 = function(mdl) { return mdl; }, peg$c55 = function(md, mdl) { return addUniqueElements([md], mdl ); }, peg$c56 = function(p) {return p;}, peg$c57 = peg$otherExpectation("string"), peg$c58 = "\"", peg$c59 = peg$literalExpectation("\"", false), peg$c60 = function(chars) { return chars.join(""); }, peg$c61 = "'", peg$c62 = peg$literalExpectation("'", false), peg$c63 = function(chars) { return chars.join(""); }, peg$c64 = "\\", peg$c65 = peg$literalExpectation("\\", false), peg$c66 = function() { return text(); }, peg$c67 = peg$anyExpectation(), peg$c68 = /^[\n\r\u2028\u2029]/, peg$c69 = peg$classExpectation(["\n", "\r", "\u2028", "\u2029"], false, false), peg$c70 = function() { return { key: 'required', value: '' }; }, peg$c71 = "(", peg$c72 = peg$literalExpectation("(", false), peg$c73 = ")", peg$c74 = peg$literalExpectation(")", false), peg$c75 = function(int) { return { key: 'minlength', value: int }; }, peg$c76 = function(int) { return { key: 'maxlength', value: int }; }, peg$c77 = function(int) { return { key: 'minbytes', value: int }; }, peg$c78 = function(int) { return { key: 'maxbytes', value: int }; }, peg$c79 = function(int) { return { key: 'max', value: int };}, peg$c80 = function(int) { return { key: 'min', value: int };}, peg$c81 = function(regex) { return { key: 'pattern', value: regex }; }, peg$c82 = function(notAComment) { return notAComment.join(''); }, peg$c83 = "/*", peg$c84 = peg$literalExpectation("/*", false), peg$c85 = /^[*]/, peg$c86 = peg$classExpectation(["*"], false, false), peg$c87 = "/", peg$c88 = peg$literalExpectation("/", false), peg$c89 = function(char) { return char; }, peg$c90 = "entity", peg$c91 = peg$literalExpectation("entity", false), peg$c92 = "table", peg$c93 = peg$literalExpectation("table", false), peg$c94 = "form", peg$c95 = peg$literalExpectation("form", false), peg$c96 = "subform", peg$c97 = peg$literalExpectation("subform", false), peg$c98 = "fields", peg$c99 = peg$literalExpectation("fields", false), peg$c100 = "menu", peg$c101 = peg$literalExpectation("menu", false), peg$c102 = "title", peg$c103 = peg$literalExpectation("title", false), peg$c104 = "parent", peg$c105 = peg$literalExpectation("parent", false), peg$c106 = "all", peg$c107 = peg$literalExpectation("all", false), peg$c108 = "*", peg$c109 = peg$literalExpectation("*", false), peg$c110 = "for", peg$c111 = peg$literalExpectation("for", false), peg$c112 = "with", peg$c113 = peg$literalExpectation("with", false), peg$c114 = "except", peg$c115 = peg$literalExpectation("except", false), peg$c116 = "required", peg$c117 = peg$literalExpectation("required", false), peg$c118 = "minlength", peg$c119 = peg$literalExpectation("minlength", false), peg$c120 = "maxlength", peg$c121 = peg$literalExpectation("maxlength", false), peg$c122 = "minbytes", peg$c123 = peg$literalExpectation("minbytes", false), peg$c124 = "maxbytes", peg$c125 = peg$literalExpectation("maxbytes", false), peg$c126 = "max", peg$c127 = peg$literalExpectation("max", false), peg$c128 = "min", peg$c129 = peg$literalExpectation("min", false), peg$c130 = "pattern", peg$c131 = peg$literalExpectation("pattern", false), peg$c132 = "list", peg$c133 = peg$literalExpectation("list", false), peg$c134 = "edit", peg$c135 = peg$literalExpectation("edit", false), peg$c136 = "show", peg$c137 = peg$literalExpectation("show", false), peg$c138 = "view", peg$c139 = peg$literalExpectation("view", false), peg$c140 = "template", peg$c141 = peg$literalExpectation("template", false), peg$c142 = "views", peg$c143 = peg$literalExpectation("views", false), peg$c144 = "roles", peg$c145 = peg$literalExpectation("roles", false), peg$c146 = "linked", peg$c147 = peg$literalExpectation("linked", false), peg$c148 = "default", peg$c149 = peg$literalExpectation("default", false), peg$c150 = "properties", peg$c151 = peg$literalExpectation("properties", false), peg$c152 = /^[A-Z]/, peg$c153 = peg$classExpectation([["A", "Z"]], false, false), peg$c154 = /^[A-z0-9]/, peg$c155 = peg$classExpectation([["A", "z"], ["0", "9"]], false, false), peg$c156 = function(head, tail) { return `${head}${tail.join('')}`; }, peg$c157 = /^[_]/, peg$c158 = peg$classExpectation(["_"], false, false), peg$c159 = /^[A-Z0-9]/, peg$c160 = peg$classExpectation([["A", "Z"], ["0", "9"]], false, false), peg$c161 = /^[A-Z0-9_]/, peg$c162 = peg$classExpectation([["A", "Z"], ["0", "9"], "_"], false, false), peg$c163 = function(underscore, head, tail) { return `${underscore.join('')}${head}${tail.join('')}`; }, peg$c164 = "-", peg$c165 = peg$literalExpectation("-", false), peg$c166 = /^[0-9]/, peg$c167 = peg$classExpectation([["0", "9"]], false, false), peg$c168 = function(negative, int) { return parseInt(`${(negative ? negative : '') + int.join('')}`, 10); }, peg$c169 = /^[a-zA-Z]/, peg$c170 = peg$classExpectation([["a", "z"], ["A", "Z"]], false, false), peg$c171 = /^[A-z0-9()]/, peg$c172 = peg$classExpectation([["A", "z"], ["0", "9"], "(", ")"], false, false), peg$c173 = /^[A-z.0-9]/, peg$c174 = peg$classExpectation([["A", "z"], ".", ["0", "9"]], false, false), peg$c175 = /^[.]/, peg$c176 = peg$classExpectation(["."], false, false), peg$c177 = function(head, tail, point, tailDec) { return `${head}${tail.join('')}.${tailDec.join('')}`; }, peg$c178 = /^['\n'|'\t'|'\r'|' '|\u2028|\u2029]/, peg$c179 = peg$classExpectation(["'", "\n", "'", "|", "'", "\t", "'", "|", "'", "\r", "'", "|", "'", " ", "'", "|", "\u2028", "|", "\u2029"], false, false), peg$c180 = /^['\t'|' '|\u2028|\u2029]/, peg$c181 = peg$classExpectation(["'", "\t", "'", "|", "'", " ", "'", "|", "\u2028", "|", "\u2029"], false, false), peg$c182 = /^[A-z0-9!@#$%\^&*()_+\-=[\]{};':\\|,.<>\/? ]/, peg$c183 = peg$classExpectation([["A", "z"], ["0", "9"], "!", "@", "#", "$", "%", "^", "&", "*", "(", ")", "_", "+", "-", "=", "[", "]", "{", "}", ";", "'", ":", "\\", "|", ",", ".", "<", ">", "/", "?", " "], false, false), peg$c184 = function(word) { return word.join('') }, peg$c185 = /^["|']/, peg$c186 = peg$classExpectation(["\"", "|", "'"], false, false), peg$currPos = 0, peg$savedPos = 0, peg$posDetailsCache = [{ line: 1, column: 1 }], 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, location) { location = location !== void 0 ? 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 !== void 0 ? 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], p; if (details) { return details; } else { p = pos - 1; while (!peg$posDetailsCache[p]) { 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) { 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$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; s0 = peg$currPos; s1 = peg$parseprog(); if (s1 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c0(s1); } s0 = s1; return s0; } function peg$parseprog() { var s0, s1, s2, s3, s4; s0 = peg$currPos; s1 = []; s2 = peg$parseSPACE(); while (s2 !== peg$FAILED) { s1.push(s2); s2 = peg$parseSPACE(); } if (s1 !== peg$FAILED) { s2 = peg$parseformDecl(); if (s2 !== peg$FAILED) { s3 = []; s4 = peg$parseSPACE(); while (s4 !== peg$FAILED) { s3.push(s4); s4 = peg$parseSPACE(); } if (s3 !== peg$FAILED) { s4 = peg$parseprog(); if (s4 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c1(s2, 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; } if (s0 === peg$FAILED) { s0 = peg$currPos; s1 = []; s2 = peg$parseSPACE(); while (s2 !== peg$FAILED) { s1.push(s2); s2 = peg$parseSPACE(); } if (s1 !== peg$FAILED) { s2 = peg$parsemenuDecl(); if (s2 !== peg$FAILED) { s3 = []; s4 = peg$parseSPACE(); while (s4 !== peg$FAILED) { s3.push(s4); s4 = peg$parseSPACE(); } if (s3 !== peg$FAILED) { s4 = peg$parseprog(); if (s4 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c2(s2, 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; } if (s0 === peg$FAILED) { s0 = peg$currPos; s1 = peg$c3; if (s1 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c4(); } s0 = s1; } } return s0; } function peg$parseformDecl() { var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11; s0 = peg$currPos; s1 = peg$parsecomment(); if (s1 === peg$FAILED) { s1 = null; } if (s1 !== peg$FAILED) { s2 = []; s3 = peg$parseSPACE(); while (s3 !== peg$FAILED) { s2.push(s3); s3 = peg$parseSPACE(); } if (s2 !== peg$FAILED) { s3 = peg$parseFORM(); if (s3 !== peg$FAILED) { s4 = []; s5 = peg$parseSPACE(); while (s5 !== peg$FAILED) { s4.push(s5); s5 = peg$parseSPACE(); } if (s4 !== peg$FAILED) { s5 = peg$parseFORM_NAME(); if (s5 !== peg$FAILED) { s6 = []; s7 = peg$parseSPACE(); while (s7 !== peg$FAILED) { s6.push(s7); s7 = peg$parseSPACE(); } if (s6 !== peg$FAILED) { s7 = peg$parseoptionalTitle(); if (s7 === peg$FAILED) { s7 = null; } if (s7 !== peg$FAILED) { s8 = []; s9 = peg$parseSPACE(); while (s9 !== peg$FAILED) { s8.push(s9); s9 = peg$parseSPACE(); } if (s8 !== peg$FAILED) { s9 = peg$parseformBody(); if (s9 === peg$FAILED) { s9 = null; } if (s9 !== peg$FAILED) { s10 = []; s11 = peg$parseSPACE(); while (s11 !== peg$FAILED) { s10.push(s11); s11 = peg$parseSPACE(); } if (s10 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c5(s1, s5, s7, s9); 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; } } 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; } if (s0 === peg$FAILED) { s0 = peg$currPos; s1 = peg$parseFORM(); if (s1 !== peg$FAILED) { s2 = []; s3 = peg$parseSPACE(); while (s3 !== peg$FAILED) { s2.push(s3); s3 = peg$parseSPACE(); } if (s2 !== peg$FAILED) { s3 = peg$parseFORM_NAME(); if (s3 !== peg$FAILED) { s4 = []; s5 = peg$parseSPACE(); while (s5 !== peg$FAILED) { s4.push(s5); s5 = peg$parseSPACE(); } if (s4 !== peg$FAILED) { s5 = peg$parseformBody(); if (s5 === peg$FAILED) { s5 = null; } if (s5 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c6(s3, s5); 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; } } else { peg$currPos = s0; s0 = peg$FAILED; } } return s0; } function peg$parseoptionalTitle() { var s0, s1, s2, s3; s0 = peg$currPos; s1 = peg$parseTITLE(); if (s1 !== peg$FAILED) { s2 = []; s3 = peg$parseSPACE(); while (s3 !== peg$FAILED) { s2.push(s3); s3 = peg$parseSPACE(); } if (s2 !== peg$FAILED) { s3 = peg$parsetitle(); if (s3 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c7(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$parseformBody() { var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13, s14, s15, s16, s17, s18, s19; s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 123) { s1 = peg$c8; peg$currPos++; } else { s1 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c9); } } if (s1 !== peg$FAILED) { s2 = []; s3 = peg$parseSPACE(); while (s3 !== peg$FAILED) { s2.push(s3); s3 = peg$parseSPACE(); } if (s2 !== peg$FAILED) { s3 = peg$parseformBodyEntity(); if (s3 === peg$FAILED) { s3 = null; } if (s3 !== peg$FAILED) { s4 = []; s5 = peg$parseSPACE(); while (s5 !== peg$FAILED) { s4.push(s5); s5 = peg$parseSPACE(); } if (s4 !== peg$FAILED) { s5 = peg$parseformBodyTemplate(); if (s5 === peg$FAILED) { s5 = null; } if (s5 !== peg$FAILED) { s6 = []; s7 = peg$parseSPACE(); while (s7 !== peg$FAILED) { s6.push(s7); s7 = peg$parseSPACE(); } if (s6 !== peg$FAILED) { s7 = peg$parseformBodyParentFields(); if (s7 === peg$FAILED) { s7 = null; } if (s7 !== peg$FAILED) { s8 = []; s9 = peg$parseSPACE(); while (s9 !== peg$FAILED) { s8.push(s9); s9 = peg$parseSPACE(); } if (s8 !== peg$FAILED) { s9 = peg$parseformBodyLinkedFields(); if (s9 === peg$FAILED) { s9 = null; } if (s9 !== peg$FAILED) { s10 = []; s11 = peg$parseSPACE(); while (s11 !== peg$FAILED) { s10.push(s11); s11 = peg$parseSPACE(); } if (s10 !== peg$FAILED) { s11 = peg$parseformBodyProperties(); if (s11 === peg$FAILED) { s11 = null; } if (s11 !== peg$FAILED) { s12 = []; s13 = peg$parseSPACE(); while (s13 !== peg$FAILED) { s12.push(s13); s13 = peg$parseSPACE(); } if (s12 !== peg$FAILED) { s13 = peg$parseformBodyFields(); if (s13 === peg$FAILED) { s13 = null; } if (s13 !== peg$FAILED) { s14 = []; s15 = peg$parseSPACE(); while (s15 !== peg$FAILED) { s14.push(s15); s15 = peg$parseSPACE(); } if (s14 !== peg$FAILED) { s15 = peg$parseformBodyViews(); if (s15 === peg$FAILED) { s15 = null; } if (s15 !== peg$FAILED) { s16 = []; s17 = peg$parseSPACE(); while (s17 !== peg$FAILED) { s16.push(s17); s17 = peg$parseSPACE(); } if (s16 !== peg$FAILED) { s17 = peg$parsesubformDeclList(); if (s17 === peg$FAILED) { s17 = null; } if (s17 !== peg$FAILED) { s18 = []; s19 = peg$parseSPACE(); while (s19 !== peg$FAILED) { s18.push(s19); s19 = peg$parseSPACE(); } if (s18 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 125) { s19 = peg$c10; peg$currPos++; } else { s19 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c11); } } if (s19 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c12(s3, s5, s7, s9, s11, s13, s15, s17); 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; } } 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; } } 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; } if (s0 === peg$FAILED) { s0 = peg$currPos; s1 = peg$c3; if (s1 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c13(); } s0 = s1; } return s0; } function peg$parseformBodyEntity() { var s0, s1, s2, s3; s0 = peg$currPos; s1 = peg$parseENTITY(); if (s1 !== peg$FAILED) { s2 = []; s3 = peg$parseSPACE(); while (s3 !== peg$FAILED) { s2.push(s3); s3 = peg$parseSPACE(); } if (s2 !== peg$FAILED) { s3 = peg$parseENTITY_NAME(); if (s3 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c14(s3); 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; s1 = peg$c3; if (s1 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c15(); } s0 = s1; } return s0; } function peg$parseformBodyTemplate() { var s0, s1, s2, s3; s0 = peg$currPos; s1 = peg$parseTEMPLATE(); if (s1 !== peg$FAILED) { s2 = []; s3 = peg$parseSPACE(); while (s3 !== peg$FAILED) { s2.push(s3); s3 = peg$parseSPACE(); } if (s2 !== peg$FAILED) { s3 = peg$parsetitle(); if (s3 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c14(s3); 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; s1 = peg$c3; if (s1 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c15(); } s0 = s1; } return s0; } function peg$parseformBodyParentFields() { var s0, s1, s2, s3, s4, s5; s0 = peg$currPos; s1 = peg$parsePARENT(); if (s1 !== peg$FAILED) { s2 = []; s3 = peg$parseSPACE(); while (s3 !== peg$FAILED) { s2.push(s3); s3 = peg$parseSPACE(); } if (s2 !== peg$FAILED) { s3 = peg$parseFIELDS(); if (s3 !== peg$FAILED) { s4 = []; s5 = peg$parseSPACE(); while (s5 !== peg$FAILED) { s4.push(s5); s5 = peg$parseSPACE(); } if (s4 !== peg$FAILED) { s5 = peg$parseexactFieldAndConstantList(); if (s5 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c16(s5); 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; } } else { peg$currPos = s0; s0 = peg$FAILED; } if (s0 === peg$FAILED) { s0 = peg$currPos; s1 = peg$c3; if (s1 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c17(); } s0 = s1; } return s0; } function peg$parseformBodyLinkedFields() { var s0, s1, s2, s3, s4, s5; s0 = peg$currPos; s1 = peg$parseLINKED(); if (s1 !== peg$FAILED) { s2 = []; s3 = peg$parseSPACE(); while (s3 !== peg$FAILED) { s2.push(s3); s3 = peg$parseSPACE(); } if (s2 !== peg$FAILED) { s3 = peg$parseFIELDS(); if (s3 !== peg$FAILED) { s4 = []; s5 = peg$parseSPACE(); while (s5 !== peg$FAILED) { s4.push(s5); s5 = peg$parseSPACE(); } if (s4 !== peg$FAILED) { s5 = peg$parseexactFieldList(); if (s5 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c18(s5); 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; } } else { peg$currPos = s0; s0 = peg$FAILED; } if (s0 === peg$FAILED) { s0 = peg$currPos; s1 = peg$c3; if (s1 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c17(); } s0 = s1; } return s0; } function peg$parseformBodyFields() { var s0, s1, s2, s3, s4, s5, s6, s7; s0 = peg$currPos; s1 = peg$parseFIELDS(); if (s1 !== peg$FAILED) { s2 = []; s3 = peg$parseSPACE(); while (s3 !== peg$FAILED) { s2.push(s3); s3 = peg$parseSPACE(); } if (s2 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 123) { s3 = peg$c8; peg$currPos++; } else { s3 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c9); } } if (s3 !== peg$FAILED) { s4 = peg$parsefieldDeclList(); if (s4 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 125) { s5 = peg$c10; peg$currPos++; } else { s5 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c11); } } if (s5 !== peg$FAILED) { s6 = []; s7 = peg$parseSPACE(); while (s7 !== peg$FAILED) { s6.push(s7); s7 = peg$parseSPACE(); } if (s6 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 44) { s7 = peg$c19; peg$currPos++; } else { s7 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c20); } } if (s7 === peg$FAILED) { s7 = null; } if (s7 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c21(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; } } 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; s1 = peg$c3; if (s1 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c17(); } s0 = s1; } return s0; } function peg$parseformBodyProperties() { var s0, s1, s2, s3, s4, s5, s6, s7; s0 = peg$currPos; s1 = peg$parsePROPERTIES(); if (s1 !== peg$FAILED) { s2 = []; s3 = peg$parseSPACE(); while (s3 !== peg$FAILED) { s2.push(s3); s3 = peg$parseSPACE(); } if (s2 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 123) { s3 = peg$c8; peg$currPos++; } else { s3 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c9); } } if (s3 !== peg$FAILED) { s4 = peg$parsepropertyDeclList(); if (s4 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 125) { s5 = peg$c10; peg$currPos++; } else { s5 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c11); } } if (s5 !== peg$FAILED) { s6 = []; s7 = peg$parseSPACE(); while (s7 !== peg$FAILED) { s6.push(s7); s7 = peg$parseSPACE(); } if (s6 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 44) { s7 = peg$c19; peg$currPos++; } else { s7 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c20); } } if (s7 === peg$FAILED) { s7 = null; } if (s7 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c22(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; } } 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; s1 = peg$c3; if (s1 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c17(); } s0 = s1; } return s0; } function peg$parseformFieldProperties() { var s0, s1, s2, s3, s4, s5; s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 123) { s1 = peg$c8; peg$currPos++; } else { s1 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c9); } } if (s1 !== peg$FAILED) { s2 = peg$parsepropertyDeclList(); if (s2 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 125) { s3 = peg$c10; peg$currPos++; } else { s3 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c11); } } if (s3 !== peg$FAILED) { s4 = []; s5 = peg$parseSPACE(); while (s5 !== peg$FAILED) { s4.push(s5); s5 = peg$parseSPACE(); } if (s4 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 44) { s5 = peg$c19; peg$currPos++; } else { s5 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c20); } } if (s5 === peg$FAILED) { s5 = null; } if (s5 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c22(s2); 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; } } else { peg$currPos = s0; s0 = peg$FAILED; } if (s0 === peg$FAILED) { s0 = peg$currPos; s1 = peg$c3; if (s1 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c17(); } s0 = s1; } return s0; } function peg$parseformBodyViews() { var s0, s1, s2, s3, s4, s5, s6, s7, s8; s0 = peg$currPos; s1 = peg$parseVIEWS(); if (s1 !== peg$FAILED) { s2 = []; s3 = peg$parseSPACE(); while (s3 !== peg$FAILED) { s2.push(s3); s3 = peg$parseSPACE(); } if (s2 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 123) { s3 = peg$c8; peg$currPos++; } else { s3 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c9); } } if (s3 !== peg$FAILED) { s4 = []; s5 = peg$parseSPACE(); while (s5 !== peg$FAILED) { s4.push(s5); s5 = peg$parseSPACE(); } if (s4 !== peg$FAILED) { s5 = peg$parseviewDeclList(); if (s5 === peg$FAILED) { s5 = null; } if (s5 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 125) { s6 = peg$c10; peg$currPos++; } else { s6 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c11); } } if (s6 !== peg$FAILED) { s7 = []; s8 = peg$parseSPACE(); while (s8 !== peg$FAILED) { s7.push(s8); s8 = peg$parseSPACE(); } if (s7 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 44) { s8 = peg$c19; peg$currPos++; } else { s8 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c20); } } if (s8 === peg$FAILED) { s8 = null; } if (s8 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c23(s5); 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; } } 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; } if (s0 === peg$FAILED) { s0 = peg$currPos; s1 = peg$c3; if (s1 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c17(); } s0 = s1; } return s0; } function peg$parseviewDeclList() { var s0, s1, s2, s3, s4, s5; s0 = peg$currPos; s1 = []; s2 = peg$parseSPACE(); while (s2 !== peg$FAILED) { s1.push(s2); s2 = peg$parseSPACE(); } if (s1 !== peg$FAILED) { s2 = peg$parseviewDecl(); if (s2 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 44) { s3 = peg$c19; peg$currPos++; } else { s3 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c20); } } if (s3 === peg$FAILED) { s3 = null; } if (s3 !== peg$FAILED) { s4 = []; s5 = peg$parseSPACE(); while (s5 !== peg$FAILED) { s4.push(s5); s5 = peg$parseSPACE(); } if (s4 !== peg$FAILED) { s5 = peg$parseviewDeclList(); if (s5 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c24(s2, s5); 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; } } else { peg$currPos = s0; s0 = peg$FAILED; } if (s0 === peg$FAILED) { s0 = peg$currPos; s1 = peg$c3; if (s1 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c17(); } s0 = s1; } return s0; } function peg$parsesubformDeclList() { var s0, s1, s2, s3, s4, s5; s0 = peg$currPos; s1 = []; s2 = peg$parseSPACE(); while (s2 !== peg$FAILED) { s1.push(s2); s2 = peg$parseSPACE(); } if (s1 !== peg$FAILED) { s2 = peg$parseformDecl(); if (s2 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 44) { s3 = peg$c19; peg$currPos++; } else { s3 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c20); } } if (s3 === peg$FAILED) { s3 = null; } if (s3 !== peg$FAILED) { s4 = []; s5 = peg$parseS