diff --git a/package.json b/package.json index 63596df..f1add7d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@arbiter/evidence-dsl", - "version": "1.9.0", + "version": "1.10.0", "description": "Evidence DSL v2 compiler: translates the natural Evidence DSL (ADR-000) into @arbiter/core relation configurations.", "license": "ISC", "type": "module", diff --git a/src/grammar/dsl.peggy b/src/grammar/dsl.peggy index 9e6381a..96fb217 100644 --- a/src/grammar/dsl.peggy +++ b/src/grammar/dsl.peggy @@ -54,11 +54,14 @@ Definition "A type definition" } Field - = name:Identifier _ ":" _ fieldType:Type _ isArray:("[]")? _ behavior:Behavior? _ cache:CacheDirective? { + = name:Identifier _ ":" _ fieldType:Type optional:("?")? _ isArray:("[]")? _ behavior:Behavior? _ cache:CacheDirective? { return { type: "Field", name, fieldType, + // `field: type` is REQUIRED on node insert; `field: type?` is optional. + // Presence is enforced by the DSLRuntime when a node is created. + required: !optional, isArray: !!isArray, behavior: behavior || null, cache: cache || null @@ -392,7 +395,7 @@ Boolean "A boolean literal" = value:("true" / "false") { return { type: "Literal", value: value === "true" }; } Duration "A time duration literal" - = value:([0-9]+ ("h" / "d" / "w" / "m")) { return { type: "Literal", value: text(), unit: text().slice(-1) }; } + = value:([0-9]+ ("s" / "m" / "h" / "d" / "w")) { return { type: "Literal", value: text(), unit: text().slice(-1) }; } // -- Core Tokens & Whitespace -- diff --git a/src/parser/GeneratedParser.js b/src/parser/GeneratedParser.js index c32418d..d847704 100644 --- a/src/parser/GeneratedParser.js +++ b/src/parser/GeneratedParser.js @@ -169,75 +169,76 @@ function peg$parse(input, options) { const peg$c2 = "{"; const peg$c3 = "}"; const peg$c4 = ":"; - const peg$c5 = "[]"; - const peg$c6 = "fact"; - const peg$c7 = "relation"; - const peg$c8 = "*"; - const peg$c9 = "("; - const peg$c10 = ")"; - const peg$c11 = "source"; - const peg$c12 = "within"; - const peg$c13 = "evidence"; - const peg$c14 = "measure"; - const peg$c15 = "return"; - const peg$c16 = "NEVER"; - const peg$c17 = "ALWAYS"; - const peg$c18 = "REQUIRES"; - const peg$c19 = "WHEN"; - const peg$c20 = "UNLESS"; - const peg$c21 = "|"; - const peg$c22 = "fusion"; - const peg$c23 = ","; - const peg$c24 = "with"; - const peg$c25 = "aggregate"; - const peg$c26 = "USING"; - const peg$c27 = "PROVIDES"; - const peg$c28 = "BEHAVES"; - const peg$c29 = "AS"; - const peg$c30 = "edge"; - const peg$c31 = "transitive"; - const peg$c32 = "hierarchical"; - const peg$c33 = "symmetrical_graph"; - const peg$c34 = "symmetrical"; - const peg$c35 = "limit"; - const peg$c36 = "decaying"; - const peg$c37 = "up"; - const peg$c38 = "down"; - const peg$c39 = "neutral"; - const peg$c40 = "stable"; - const peg$c41 = "hourly"; - const peg$c42 = "daily"; - const peg$c43 = "weekly"; - const peg$c44 = "monthly"; - const peg$c45 = "blurring"; - const peg$c46 = "fixed"; - const peg$c47 = "adaptive"; - const peg$c48 = "confidence"; - const peg$c49 = "confidence_90"; - const peg$c50 = "confidence_95"; - const peg$c51 = "confidence_99"; - const peg$c52 = "ttl"; - const peg$c53 = "CACHE"; - const peg$c54 = "eager"; - const peg$c55 = "lazy"; - const peg$c56 = "||"; - const peg$c57 = "&&"; - const peg$c58 = "is"; - const peg$c59 = "=="; - const peg$c60 = "!="; - const peg$c61 = ">="; - const peg$c62 = "<="; - const peg$c63 = "NOT"; - const peg$c64 = "!"; - const peg$c65 = "."; - const peg$c66 = "\""; - const peg$c67 = "\\"; - const peg$c68 = "'"; - const peg$c69 = "true"; - const peg$c70 = "false"; - const peg$c71 = "//"; - const peg$c72 = "/*"; - const peg$c73 = "*/"; + const peg$c5 = "?"; + const peg$c6 = "[]"; + const peg$c7 = "fact"; + const peg$c8 = "relation"; + const peg$c9 = "*"; + const peg$c10 = "("; + const peg$c11 = ")"; + const peg$c12 = "source"; + const peg$c13 = "within"; + const peg$c14 = "evidence"; + const peg$c15 = "measure"; + const peg$c16 = "return"; + const peg$c17 = "NEVER"; + const peg$c18 = "ALWAYS"; + const peg$c19 = "REQUIRES"; + const peg$c20 = "WHEN"; + const peg$c21 = "UNLESS"; + const peg$c22 = "|"; + const peg$c23 = "fusion"; + const peg$c24 = ","; + const peg$c25 = "with"; + const peg$c26 = "aggregate"; + const peg$c27 = "USING"; + const peg$c28 = "PROVIDES"; + const peg$c29 = "BEHAVES"; + const peg$c30 = "AS"; + const peg$c31 = "edge"; + const peg$c32 = "transitive"; + const peg$c33 = "hierarchical"; + const peg$c34 = "symmetrical_graph"; + const peg$c35 = "symmetrical"; + const peg$c36 = "limit"; + const peg$c37 = "decaying"; + const peg$c38 = "up"; + const peg$c39 = "down"; + const peg$c40 = "neutral"; + const peg$c41 = "stable"; + const peg$c42 = "hourly"; + const peg$c43 = "daily"; + const peg$c44 = "weekly"; + const peg$c45 = "monthly"; + const peg$c46 = "blurring"; + const peg$c47 = "fixed"; + const peg$c48 = "adaptive"; + const peg$c49 = "confidence"; + const peg$c50 = "confidence_90"; + const peg$c51 = "confidence_95"; + const peg$c52 = "confidence_99"; + const peg$c53 = "ttl"; + const peg$c54 = "CACHE"; + const peg$c55 = "eager"; + const peg$c56 = "lazy"; + const peg$c57 = "||"; + const peg$c58 = "&&"; + const peg$c59 = "is"; + const peg$c60 = "=="; + const peg$c61 = "!="; + const peg$c62 = ">="; + const peg$c63 = "<="; + const peg$c64 = "NOT"; + const peg$c65 = "!"; + const peg$c66 = "."; + const peg$c67 = "\""; + const peg$c68 = "\\"; + const peg$c69 = "'"; + const peg$c70 = "true"; + const peg$c71 = "false"; + const peg$c72 = "//"; + const peg$c73 = "/*"; + const peg$c74 = "*/"; const peg$r0 = /^[<>]/; const peg$r1 = /^[+\-]/; @@ -245,7 +246,7 @@ function peg$parse(input, options) { const peg$r3 = /^["\\]/; const peg$r4 = /^['\\]/; const peg$r5 = /^[0-9]/; - const peg$r6 = /^[dhmw]/; + const peg$r6 = /^[dhmsw]/; const peg$r7 = /^[a-zA-Z_]/; const peg$r8 = /^[a-zA-Z0-9_]/; const peg$r9 = /^[ \t]/; @@ -258,99 +259,100 @@ function peg$parse(input, options) { const peg$e3 = peg$literalExpectation("{", false); const peg$e4 = peg$literalExpectation("}", false); const peg$e5 = peg$literalExpectation(":", false); - const peg$e6 = peg$literalExpectation("[]", false); - const peg$e7 = peg$otherExpectation("A statement of fact (or relation in ADR-000)"); - const peg$e8 = peg$literalExpectation("fact", false); - const peg$e9 = peg$literalExpectation("relation", false); - const peg$e10 = peg$literalExpectation("*", false); - const peg$e11 = peg$literalExpectation("(", false); - const peg$e12 = peg$literalExpectation(")", false); - const peg$e13 = peg$otherExpectation("An injectable source (proof provider)"); - const peg$e14 = peg$literalExpectation("source", false); - const peg$e15 = peg$otherExpectation("A freshness constraint on a source"); - const peg$e16 = peg$literalExpectation("within", false); - const peg$e17 = peg$otherExpectation("An evidence rule"); - const peg$e18 = peg$literalExpectation("evidence", false); - const peg$e19 = peg$otherExpectation("A derived measurement or value"); - const peg$e20 = peg$literalExpectation("measure", false); - const peg$e21 = peg$literalExpectation("return", false); - const peg$e22 = peg$literalExpectation("NEVER", false); - const peg$e23 = peg$literalExpectation("ALWAYS", false); - const peg$e24 = peg$literalExpectation("REQUIRES", false); - const peg$e25 = peg$literalExpectation("WHEN", false); - const peg$e26 = peg$literalExpectation("UNLESS", false); - const peg$e27 = peg$literalExpectation("|", false); - const peg$e28 = peg$literalExpectation("fusion", false); - const peg$e29 = peg$literalExpectation(",", false); - const peg$e30 = peg$literalExpectation("with", false); - const peg$e31 = peg$literalExpectation("aggregate", false); - const peg$e32 = peg$literalExpectation("USING", false); - const peg$e33 = peg$literalExpectation("PROVIDES", false); - const peg$e34 = peg$literalExpectation("BEHAVES", false); - const peg$e35 = peg$literalExpectation("AS", false); - const peg$e36 = peg$literalExpectation("edge", false); - const peg$e37 = peg$literalExpectation("transitive", false); - const peg$e38 = peg$literalExpectation("hierarchical", false); - const peg$e39 = peg$literalExpectation("symmetrical_graph", false); - const peg$e40 = peg$literalExpectation("symmetrical", false); - const peg$e41 = peg$literalExpectation("limit", false); - const peg$e42 = peg$literalExpectation("decaying", false); - const peg$e43 = peg$literalExpectation("up", false); - const peg$e44 = peg$literalExpectation("down", false); - const peg$e45 = peg$literalExpectation("neutral", false); - const peg$e46 = peg$literalExpectation("stable", false); - const peg$e47 = peg$literalExpectation("hourly", false); - const peg$e48 = peg$literalExpectation("daily", false); - const peg$e49 = peg$literalExpectation("weekly", false); - const peg$e50 = peg$literalExpectation("monthly", false); - const peg$e51 = peg$literalExpectation("blurring", false); - const peg$e52 = peg$literalExpectation("fixed", false); - const peg$e53 = peg$literalExpectation("adaptive", false); - const peg$e54 = peg$literalExpectation("confidence", false); - const peg$e55 = peg$literalExpectation("confidence_90", false); - const peg$e56 = peg$literalExpectation("confidence_95", false); - const peg$e57 = peg$literalExpectation("confidence_99", false); - const peg$e58 = peg$literalExpectation("ttl", false); - const peg$e59 = peg$literalExpectation("CACHE", false); - const peg$e60 = peg$literalExpectation("eager", false); - const peg$e61 = peg$literalExpectation("lazy", false); - const peg$e62 = peg$literalExpectation("||", false); - const peg$e63 = peg$literalExpectation("&&", false); - const peg$e64 = peg$literalExpectation("is", false); - const peg$e65 = peg$literalExpectation("==", false); - const peg$e66 = peg$literalExpectation("!=", false); - const peg$e67 = peg$literalExpectation(">=", false); - const peg$e68 = peg$literalExpectation("<=", false); - const peg$e69 = peg$classExpectation(["<", ">"], false, false, false); - const peg$e70 = peg$classExpectation(["+", "-"], false, false, false); - const peg$e71 = peg$classExpectation(["*", "/"], false, false, false); - const peg$e72 = peg$literalExpectation("NOT", false); - const peg$e73 = peg$literalExpectation("!", false); - const peg$e74 = peg$literalExpectation(".", false); - const peg$e75 = peg$otherExpectation("The non-recursive base for an expression chain"); - const peg$e76 = peg$otherExpectation("A string literal"); - const peg$e77 = peg$literalExpectation("\"", false); - const peg$e78 = peg$classExpectation(["\"", "\\"], false, false, false); - const peg$e79 = peg$anyExpectation(); - const peg$e80 = peg$literalExpectation("\\", false); - const peg$e81 = peg$literalExpectation("'", false); - const peg$e82 = peg$classExpectation(["'", "\\"], false, false, false); - const peg$e83 = peg$otherExpectation("A floating-point number"); - const peg$e84 = peg$classExpectation([["0", "9"]], false, false, false); - const peg$e85 = peg$otherExpectation("An integer"); - const peg$e86 = peg$otherExpectation("A boolean literal"); - const peg$e87 = peg$literalExpectation("true", false); - const peg$e88 = peg$literalExpectation("false", false); - const peg$e89 = peg$otherExpectation("A time duration literal"); - const peg$e90 = peg$classExpectation(["d", "h", "m", "w"], false, false, false); - const peg$e91 = peg$classExpectation([["a", "z"], ["A", "Z"], "_"], false, false, false); - const peg$e92 = peg$classExpectation([["a", "z"], ["A", "Z"], ["0", "9"], "_"], false, false, false); - const peg$e93 = peg$classExpectation([" ", "\t"], false, false, false); - const peg$e94 = peg$classExpectation([" ", "\t", "\r", "\n"], false, false, false); - const peg$e95 = peg$literalExpectation("//", false); - const peg$e96 = peg$classExpectation(["\r", "\n"], true, false, false); - const peg$e97 = peg$literalExpectation("/*", false); - const peg$e98 = peg$literalExpectation("*/", false); + const peg$e6 = peg$literalExpectation("?", false); + const peg$e7 = peg$literalExpectation("[]", false); + const peg$e8 = peg$otherExpectation("A statement of fact (or relation in ADR-000)"); + const peg$e9 = peg$literalExpectation("fact", false); + const peg$e10 = peg$literalExpectation("relation", false); + const peg$e11 = peg$literalExpectation("*", false); + const peg$e12 = peg$literalExpectation("(", false); + const peg$e13 = peg$literalExpectation(")", false); + const peg$e14 = peg$otherExpectation("An injectable source (proof provider)"); + const peg$e15 = peg$literalExpectation("source", false); + const peg$e16 = peg$otherExpectation("A freshness constraint on a source"); + const peg$e17 = peg$literalExpectation("within", false); + const peg$e18 = peg$otherExpectation("An evidence rule"); + const peg$e19 = peg$literalExpectation("evidence", false); + const peg$e20 = peg$otherExpectation("A derived measurement or value"); + const peg$e21 = peg$literalExpectation("measure", false); + const peg$e22 = peg$literalExpectation("return", false); + const peg$e23 = peg$literalExpectation("NEVER", false); + const peg$e24 = peg$literalExpectation("ALWAYS", false); + const peg$e25 = peg$literalExpectation("REQUIRES", false); + const peg$e26 = peg$literalExpectation("WHEN", false); + const peg$e27 = peg$literalExpectation("UNLESS", false); + const peg$e28 = peg$literalExpectation("|", false); + const peg$e29 = peg$literalExpectation("fusion", false); + const peg$e30 = peg$literalExpectation(",", false); + const peg$e31 = peg$literalExpectation("with", false); + const peg$e32 = peg$literalExpectation("aggregate", false); + const peg$e33 = peg$literalExpectation("USING", false); + const peg$e34 = peg$literalExpectation("PROVIDES", false); + const peg$e35 = peg$literalExpectation("BEHAVES", false); + const peg$e36 = peg$literalExpectation("AS", false); + const peg$e37 = peg$literalExpectation("edge", false); + const peg$e38 = peg$literalExpectation("transitive", false); + const peg$e39 = peg$literalExpectation("hierarchical", false); + const peg$e40 = peg$literalExpectation("symmetrical_graph", false); + const peg$e41 = peg$literalExpectation("symmetrical", false); + const peg$e42 = peg$literalExpectation("limit", false); + const peg$e43 = peg$literalExpectation("decaying", false); + const peg$e44 = peg$literalExpectation("up", false); + const peg$e45 = peg$literalExpectation("down", false); + const peg$e46 = peg$literalExpectation("neutral", false); + const peg$e47 = peg$literalExpectation("stable", false); + const peg$e48 = peg$literalExpectation("hourly", false); + const peg$e49 = peg$literalExpectation("daily", false); + const peg$e50 = peg$literalExpectation("weekly", false); + const peg$e51 = peg$literalExpectation("monthly", false); + const peg$e52 = peg$literalExpectation("blurring", false); + const peg$e53 = peg$literalExpectation("fixed", false); + const peg$e54 = peg$literalExpectation("adaptive", false); + const peg$e55 = peg$literalExpectation("confidence", false); + const peg$e56 = peg$literalExpectation("confidence_90", false); + const peg$e57 = peg$literalExpectation("confidence_95", false); + const peg$e58 = peg$literalExpectation("confidence_99", false); + const peg$e59 = peg$literalExpectation("ttl", false); + const peg$e60 = peg$literalExpectation("CACHE", false); + const peg$e61 = peg$literalExpectation("eager", false); + const peg$e62 = peg$literalExpectation("lazy", false); + const peg$e63 = peg$literalExpectation("||", false); + const peg$e64 = peg$literalExpectation("&&", false); + const peg$e65 = peg$literalExpectation("is", false); + const peg$e66 = peg$literalExpectation("==", false); + const peg$e67 = peg$literalExpectation("!=", false); + const peg$e68 = peg$literalExpectation(">=", false); + const peg$e69 = peg$literalExpectation("<=", false); + const peg$e70 = peg$classExpectation(["<", ">"], false, false, false); + const peg$e71 = peg$classExpectation(["+", "-"], false, false, false); + const peg$e72 = peg$classExpectation(["*", "/"], false, false, false); + const peg$e73 = peg$literalExpectation("NOT", false); + const peg$e74 = peg$literalExpectation("!", false); + const peg$e75 = peg$literalExpectation(".", false); + const peg$e76 = peg$otherExpectation("The non-recursive base for an expression chain"); + const peg$e77 = peg$otherExpectation("A string literal"); + const peg$e78 = peg$literalExpectation("\"", false); + const peg$e79 = peg$classExpectation(["\"", "\\"], false, false, false); + const peg$e80 = peg$anyExpectation(); + const peg$e81 = peg$literalExpectation("\\", false); + const peg$e82 = peg$literalExpectation("'", false); + const peg$e83 = peg$classExpectation(["'", "\\"], false, false, false); + const peg$e84 = peg$otherExpectation("A floating-point number"); + const peg$e85 = peg$classExpectation([["0", "9"]], false, false, false); + const peg$e86 = peg$otherExpectation("An integer"); + const peg$e87 = peg$otherExpectation("A boolean literal"); + const peg$e88 = peg$literalExpectation("true", false); + const peg$e89 = peg$literalExpectation("false", false); + const peg$e90 = peg$otherExpectation("A time duration literal"); + const peg$e91 = peg$classExpectation(["d", "h", "m", "s", "w"], false, false, false); + const peg$e92 = peg$classExpectation([["a", "z"], ["A", "Z"], "_"], false, false, false); + const peg$e93 = peg$classExpectation([["a", "z"], ["A", "Z"], ["0", "9"], "_"], false, false, false); + const peg$e94 = peg$classExpectation([" ", "\t"], false, false, false); + const peg$e95 = peg$classExpectation([" ", "\t", "\r", "\n"], false, false, false); + const peg$e96 = peg$literalExpectation("//", false); + const peg$e97 = peg$classExpectation(["\r", "\n"], true, false, false); + const peg$e98 = peg$literalExpectation("/*", false); + const peg$e99 = peg$literalExpectation("*/", false); function peg$f0(statements) { const allStatements = statements.map(s => s[0]); @@ -367,11 +369,14 @@ function peg$parse(input, options) { function peg$f1(name, fields) { return { type: "Definition", name, fields: fields.map(f => f[0]) }; } - function peg$f2(name, fieldType, isArray, behavior, cache) { + function peg$f2(name, fieldType, optional, isArray, behavior, cache) { return { type: "Field", name, fieldType, + // `field: type` is REQUIRED on node insert; `field: type?` is optional. + // Presence is enforced by the DSLRuntime when a node is created. + required: !optional, isArray: !!isArray, behavior: behavior || null, cache: cache || null @@ -895,7 +900,7 @@ function peg$parse(input, options) { } function peg$parseField() { - let s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11; + let s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12; s0 = peg$currPos; s1 = peg$parseIdentifier(); @@ -912,29 +917,39 @@ function peg$parse(input, options) { s4 = peg$parse_(); s5 = peg$parseIdentifier(); if (s5 !== peg$FAILED) { - s6 = peg$parse_(); - if (input.substr(peg$currPos, 2) === peg$c5) { - s7 = peg$c5; - peg$currPos += 2; + if (input.charCodeAt(peg$currPos) === 63) { + s6 = peg$c5; + peg$currPos++; } else { - s7 = peg$FAILED; + s6 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$e6); } } - if (s7 === peg$FAILED) { - s7 = null; + if (s6 === peg$FAILED) { + s6 = null; } - s8 = peg$parse_(); - s9 = peg$parseBehavior(); - if (s9 === peg$FAILED) { - s9 = null; + s7 = peg$parse_(); + if (input.substr(peg$currPos, 2) === peg$c6) { + s8 = peg$c6; + peg$currPos += 2; + } else { + s8 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e7); } } - s10 = peg$parse_(); - s11 = peg$parseCacheDirective(); - if (s11 === peg$FAILED) { - s11 = null; + if (s8 === peg$FAILED) { + s8 = null; + } + s9 = peg$parse_(); + s10 = peg$parseBehavior(); + if (s10 === peg$FAILED) { + s10 = null; + } + s11 = peg$parse_(); + s12 = peg$parseCacheDirective(); + if (s12 === peg$FAILED) { + s12 = null; } peg$savedPos = s0; - s0 = peg$f2(s1, s5, s7, s9, s11); + s0 = peg$f2(s1, s5, s6, s8, s10, s12); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -956,31 +971,31 @@ function peg$parse(input, options) { peg$silentFails++; s0 = peg$currPos; - if (input.substr(peg$currPos, 4) === peg$c6) { - s1 = peg$c6; + if (input.substr(peg$currPos, 4) === peg$c7) { + s1 = peg$c7; peg$currPos += 4; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e8); } + if (peg$silentFails === 0) { peg$fail(peg$e9); } } if (s1 === peg$FAILED) { - if (input.substr(peg$currPos, 8) === peg$c7) { - s1 = peg$c7; + if (input.substr(peg$currPos, 8) === peg$c8) { + s1 = peg$c8; peg$currPos += 8; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e9); } + if (peg$silentFails === 0) { peg$fail(peg$e10); } } } if (s1 !== peg$FAILED) { s2 = peg$parse__(); if (s2 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 42) { - s3 = peg$c8; + s3 = peg$c9; peg$currPos++; } else { s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e10); } + if (peg$silentFails === 0) { peg$fail(peg$e11); } } if (s3 === peg$FAILED) { s3 = null; @@ -989,11 +1004,11 @@ function peg$parse(input, options) { if (s4 !== peg$FAILED) { s5 = peg$parse_(); if (input.charCodeAt(peg$currPos) === 40) { - s6 = peg$c9; + s6 = peg$c10; peg$currPos++; } else { s6 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e11); } + if (peg$silentFails === 0) { peg$fail(peg$e12); } } if (s6 !== peg$FAILED) { s7 = peg$parse_(); @@ -1003,11 +1018,11 @@ function peg$parse(input, options) { } s9 = peg$parse_(); if (input.charCodeAt(peg$currPos) === 41) { - s10 = peg$c10; + s10 = peg$c11; peg$currPos++; } else { s10 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e12); } + if (peg$silentFails === 0) { peg$fail(peg$e13); } } if (s10 !== peg$FAILED) { s11 = peg$parse_(); @@ -1074,7 +1089,7 @@ function peg$parse(input, options) { peg$silentFails--; if (s0 === peg$FAILED) { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e7); } + if (peg$silentFails === 0) { peg$fail(peg$e8); } } return s0; @@ -1085,22 +1100,22 @@ function peg$parse(input, options) { peg$silentFails++; s0 = peg$currPos; - if (input.substr(peg$currPos, 6) === peg$c11) { - s1 = peg$c11; + if (input.substr(peg$currPos, 6) === peg$c12) { + s1 = peg$c12; peg$currPos += 6; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e14); } + if (peg$silentFails === 0) { peg$fail(peg$e15); } } if (s1 !== peg$FAILED) { s2 = peg$parse__(); if (s2 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 42) { - s3 = peg$c8; + s3 = peg$c9; peg$currPos++; } else { s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e10); } + if (peg$silentFails === 0) { peg$fail(peg$e11); } } if (s3 === peg$FAILED) { s3 = null; @@ -1109,11 +1124,11 @@ function peg$parse(input, options) { if (s4 !== peg$FAILED) { s5 = peg$parse_(); if (input.charCodeAt(peg$currPos) === 40) { - s6 = peg$c9; + s6 = peg$c10; peg$currPos++; } else { s6 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e11); } + if (peg$silentFails === 0) { peg$fail(peg$e12); } } if (s6 !== peg$FAILED) { s7 = peg$parse_(); @@ -1123,11 +1138,11 @@ function peg$parse(input, options) { } s9 = peg$parse_(); if (input.charCodeAt(peg$currPos) === 41) { - s10 = peg$c10; + s10 = peg$c11; peg$currPos++; } else { s10 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e12); } + if (peg$silentFails === 0) { peg$fail(peg$e13); } } if (s10 !== peg$FAILED) { s11 = peg$parse_(); @@ -1165,7 +1180,7 @@ function peg$parse(input, options) { peg$silentFails--; if (s0 === peg$FAILED) { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e13); } + if (peg$silentFails === 0) { peg$fail(peg$e14); } } return s0; @@ -1176,12 +1191,12 @@ function peg$parse(input, options) { peg$silentFails++; s0 = peg$currPos; - if (input.substr(peg$currPos, 6) === peg$c12) { - s1 = peg$c12; + if (input.substr(peg$currPos, 6) === peg$c13) { + s1 = peg$c13; peg$currPos += 6; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e16); } + if (peg$silentFails === 0) { peg$fail(peg$e17); } } if (s1 !== peg$FAILED) { s2 = peg$parse__(); @@ -1205,7 +1220,7 @@ function peg$parse(input, options) { peg$silentFails--; if (s0 === peg$FAILED) { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e15); } + if (peg$silentFails === 0) { peg$fail(peg$e16); } } return s0; @@ -1216,22 +1231,22 @@ function peg$parse(input, options) { peg$silentFails++; s0 = peg$currPos; - if (input.substr(peg$currPos, 8) === peg$c13) { - s1 = peg$c13; + if (input.substr(peg$currPos, 8) === peg$c14) { + s1 = peg$c14; peg$currPos += 8; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e18); } + if (peg$silentFails === 0) { peg$fail(peg$e19); } } if (s1 !== peg$FAILED) { s2 = peg$parse__(); if (s2 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 42) { - s3 = peg$c8; + s3 = peg$c9; peg$currPos++; } else { s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e10); } + if (peg$silentFails === 0) { peg$fail(peg$e11); } } if (s3 === peg$FAILED) { s3 = null; @@ -1240,11 +1255,11 @@ function peg$parse(input, options) { if (s4 !== peg$FAILED) { s5 = peg$parse_(); if (input.charCodeAt(peg$currPos) === 40) { - s6 = peg$c9; + s6 = peg$c10; peg$currPos++; } else { s6 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e11); } + if (peg$silentFails === 0) { peg$fail(peg$e12); } } if (s6 !== peg$FAILED) { s7 = peg$parse_(); @@ -1254,11 +1269,11 @@ function peg$parse(input, options) { } s9 = peg$parse_(); if (input.charCodeAt(peg$currPos) === 41) { - s10 = peg$c10; + s10 = peg$c11; peg$currPos++; } else { s10 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e12); } + if (peg$silentFails === 0) { peg$fail(peg$e13); } } if (s10 !== peg$FAILED) { s11 = peg$parse_(); @@ -1324,7 +1339,7 @@ function peg$parse(input, options) { peg$silentFails--; if (s0 === peg$FAILED) { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e17); } + if (peg$silentFails === 0) { peg$fail(peg$e18); } } return s0; @@ -1335,12 +1350,12 @@ function peg$parse(input, options) { peg$silentFails++; s0 = peg$currPos; - if (input.substr(peg$currPos, 7) === peg$c14) { - s1 = peg$c14; + if (input.substr(peg$currPos, 7) === peg$c15) { + s1 = peg$c15; peg$currPos += 7; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e20); } + if (peg$silentFails === 0) { peg$fail(peg$e21); } } if (s1 !== peg$FAILED) { s2 = peg$parse__(); @@ -1349,11 +1364,11 @@ function peg$parse(input, options) { if (s3 !== peg$FAILED) { s4 = peg$parse_(); if (input.charCodeAt(peg$currPos) === 40) { - s5 = peg$c9; + s5 = peg$c10; peg$currPos++; } else { s5 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e11); } + if (peg$silentFails === 0) { peg$fail(peg$e12); } } if (s5 !== peg$FAILED) { s6 = peg$parse_(); @@ -1363,11 +1378,11 @@ function peg$parse(input, options) { } s8 = peg$parse_(); if (input.charCodeAt(peg$currPos) === 41) { - s9 = peg$c10; + s9 = peg$c11; peg$currPos++; } else { s9 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e12); } + if (peg$silentFails === 0) { peg$fail(peg$e13); } } if (s9 !== peg$FAILED) { s10 = peg$parse_(); @@ -1428,7 +1443,7 @@ function peg$parse(input, options) { peg$silentFails--; if (s0 === peg$FAILED) { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e19); } + if (peg$silentFails === 0) { peg$fail(peg$e20); } } return s0; @@ -1548,12 +1563,12 @@ function peg$parse(input, options) { let s0, s1, s2, s3; s0 = peg$currPos; - if (input.substr(peg$currPos, 6) === peg$c15) { - s1 = peg$c15; + if (input.substr(peg$currPos, 6) === peg$c16) { + s1 = peg$c16; peg$currPos += 6; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e21); } + if (peg$silentFails === 0) { peg$fail(peg$e22); } } if (s1 !== peg$FAILED) { s2 = peg$parse__(); @@ -1582,28 +1597,28 @@ function peg$parse(input, options) { let s0, s1, s2, s3, s4, s5, s6, s7; s0 = peg$currPos; - if (input.substr(peg$currPos, 5) === peg$c16) { - s1 = peg$c16; + if (input.substr(peg$currPos, 5) === peg$c17) { + s1 = peg$c17; peg$currPos += 5; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e22); } + if (peg$silentFails === 0) { peg$fail(peg$e23); } } if (s1 === peg$FAILED) { - if (input.substr(peg$currPos, 6) === peg$c17) { - s1 = peg$c17; + if (input.substr(peg$currPos, 6) === peg$c18) { + s1 = peg$c18; peg$currPos += 6; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e23); } + if (peg$silentFails === 0) { peg$fail(peg$e24); } } if (s1 === peg$FAILED) { - if (input.substr(peg$currPos, 8) === peg$c18) { - s1 = peg$c18; + if (input.substr(peg$currPos, 8) === peg$c19) { + s1 = peg$c19; peg$currPos += 8; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e24); } + if (peg$silentFails === 0) { peg$fail(peg$e25); } } } } @@ -1628,12 +1643,12 @@ function peg$parse(input, options) { } if (s0 === peg$FAILED) { s0 = peg$currPos; - if (input.substr(peg$currPos, 4) === peg$c19) { - s1 = peg$c19; + if (input.substr(peg$currPos, 4) === peg$c20) { + s1 = peg$c20; peg$currPos += 4; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e25); } + if (peg$silentFails === 0) { peg$fail(peg$e26); } } if (s1 !== peg$FAILED) { s2 = peg$parse__(); @@ -1642,12 +1657,12 @@ function peg$parse(input, options) { if (s3 !== peg$FAILED) { s4 = peg$parse__(); if (s4 !== peg$FAILED) { - if (input.substr(peg$currPos, 6) === peg$c20) { - s5 = peg$c20; + if (input.substr(peg$currPos, 6) === peg$c21) { + s5 = peg$c21; peg$currPos += 6; } else { s5 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e26); } + if (peg$silentFails === 0) { peg$fail(peg$e27); } } if (s5 !== peg$FAILED) { s6 = peg$parse__(); @@ -1686,12 +1701,12 @@ function peg$parse(input, options) { } if (s0 === peg$FAILED) { s0 = peg$currPos; - if (input.substr(peg$currPos, 4) === peg$c19) { - s1 = peg$c19; + if (input.substr(peg$currPos, 4) === peg$c20) { + s1 = peg$c20; peg$currPos += 4; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e25); } + if (peg$silentFails === 0) { peg$fail(peg$e26); } } if (s1 !== peg$FAILED) { s2 = peg$parse__(); @@ -1790,11 +1805,11 @@ function peg$parse(input, options) { if (s1 !== peg$FAILED) { s2 = peg$parse_(); if (input.charCodeAt(peg$currPos) === 124) { - s3 = peg$c21; + s3 = peg$c22; peg$currPos++; } else { s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e27); } + if (peg$silentFails === 0) { peg$fail(peg$e28); } } if (s3 !== peg$FAILED) { s4 = peg$parse_(); @@ -1802,21 +1817,21 @@ function peg$parse(input, options) { if (s5 !== peg$FAILED) { s6 = peg$parse_(); if (input.charCodeAt(peg$currPos) === 124) { - s7 = peg$c21; + s7 = peg$c22; peg$currPos++; } else { s7 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e27); } + if (peg$silentFails === 0) { peg$fail(peg$e28); } } if (s7 !== peg$FAILED) { s8 = peg$parse_(); s9 = peg$currPos; - if (input.substr(peg$currPos, 6) === peg$c22) { - s10 = peg$c22; + if (input.substr(peg$currPos, 6) === peg$c23) { + s10 = peg$c23; peg$currPos += 6; } else { s10 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e28); } + if (peg$silentFails === 0) { peg$fail(peg$e29); } } if (s10 !== peg$FAILED) { s11 = peg$parse__(); @@ -1908,11 +1923,11 @@ function peg$parse(input, options) { if (s1 !== peg$FAILED) { s2 = peg$parse_(); if (input.charCodeAt(peg$currPos) === 40) { - s3 = peg$c9; + s3 = peg$c10; peg$currPos++; } else { s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e11); } + if (peg$silentFails === 0) { peg$fail(peg$e12); } } if (s3 !== peg$FAILED) { s4 = peg$parse_(); @@ -1922,11 +1937,11 @@ function peg$parse(input, options) { } s6 = peg$parse_(); if (input.charCodeAt(peg$currPos) === 41) { - s7 = peg$c10; + s7 = peg$c11; peg$currPos++; } else { s7 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e12); } + if (peg$silentFails === 0) { peg$fail(peg$e13); } } if (s7 !== peg$FAILED) { peg$savedPos = s0; @@ -1957,11 +1972,11 @@ function peg$parse(input, options) { s3 = peg$currPos; s4 = peg$parse_(); if (input.charCodeAt(peg$currPos) === 44) { - s5 = peg$c23; + s5 = peg$c24; peg$currPos++; } else { s5 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e29); } + if (peg$silentFails === 0) { peg$fail(peg$e30); } } if (s5 !== peg$FAILED) { s6 = peg$parse_(); @@ -1982,11 +1997,11 @@ function peg$parse(input, options) { s3 = peg$currPos; s4 = peg$parse_(); if (input.charCodeAt(peg$currPos) === 44) { - s5 = peg$c23; + s5 = peg$c24; peg$currPos++; } else { s5 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e29); } + if (peg$silentFails === 0) { peg$fail(peg$e30); } } if (s5 !== peg$FAILED) { s6 = peg$parse_(); @@ -2018,11 +2033,11 @@ function peg$parse(input, options) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 42) { - s1 = peg$c8; + s1 = peg$c9; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e10); } + if (peg$silentFails === 0) { peg$fail(peg$e11); } } if (s1 !== peg$FAILED) { s2 = peg$parse_(); @@ -2050,11 +2065,11 @@ function peg$parse(input, options) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 124) { - s1 = peg$c21; + s1 = peg$c22; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e27); } + if (peg$silentFails === 0) { peg$fail(peg$e28); } } if (s1 !== peg$FAILED) { s2 = peg$parse_(); @@ -2062,11 +2077,11 @@ function peg$parse(input, options) { if (s3 !== peg$FAILED) { s4 = peg$parse_(); if (input.charCodeAt(peg$currPos) === 124) { - s5 = peg$c21; + s5 = peg$c22; peg$currPos++; } else { s5 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e27); } + if (peg$silentFails === 0) { peg$fail(peg$e28); } } if (s5 !== peg$FAILED) { peg$savedPos = s0; @@ -2091,12 +2106,12 @@ function peg$parse(input, options) { let s0, s1, s2, s3; s0 = peg$currPos; - if (input.substr(peg$currPos, 4) === peg$c24) { - s1 = peg$c24; + if (input.substr(peg$currPos, 4) === peg$c25) { + s1 = peg$c25; peg$currPos += 4; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e30); } + if (peg$silentFails === 0) { peg$fail(peg$e31); } } if (s1 !== peg$FAILED) { s2 = peg$parse__(); @@ -2125,12 +2140,12 @@ function peg$parse(input, options) { let s0, s1, s2, s3, s4, s5, s6, s7, s8, s9; s0 = peg$currPos; - if (input.substr(peg$currPos, 6) === peg$c22) { - s1 = peg$c22; + if (input.substr(peg$currPos, 6) === peg$c23) { + s1 = peg$c23; peg$currPos += 6; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e28); } + if (peg$silentFails === 0) { peg$fail(peg$e29); } } if (s1 !== peg$FAILED) { s2 = peg$parse__(); @@ -2197,12 +2212,12 @@ function peg$parse(input, options) { let s0, s1, s2, s3, s4, s5, s6, s7, s8, s9; s0 = peg$currPos; - if (input.substr(peg$currPos, 9) === peg$c25) { - s1 = peg$c25; + if (input.substr(peg$currPos, 9) === peg$c26) { + s1 = peg$c26; peg$currPos += 9; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e31); } + if (peg$silentFails === 0) { peg$fail(peg$e32); } } if (s1 !== peg$FAILED) { s2 = peg$parse__(); @@ -2262,12 +2277,12 @@ function peg$parse(input, options) { let s0, s1, s2, s3; s0 = peg$currPos; - if (input.substr(peg$currPos, 5) === peg$c26) { - s1 = peg$c26; + if (input.substr(peg$currPos, 5) === peg$c27) { + s1 = peg$c27; peg$currPos += 5; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e32); } + if (peg$silentFails === 0) { peg$fail(peg$e33); } } if (s1 !== peg$FAILED) { s2 = peg$parse__(); @@ -2325,11 +2340,11 @@ function peg$parse(input, options) { s3 = peg$currPos; s4 = peg$parse_(); if (input.charCodeAt(peg$currPos) === 44) { - s5 = peg$c23; + s5 = peg$c24; peg$currPos++; } else { s5 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e29); } + if (peg$silentFails === 0) { peg$fail(peg$e30); } } if (s5 !== peg$FAILED) { s6 = peg$parse_(); @@ -2350,11 +2365,11 @@ function peg$parse(input, options) { s3 = peg$currPos; s4 = peg$parse_(); if (input.charCodeAt(peg$currPos) === 44) { - s5 = peg$c23; + s5 = peg$c24; peg$currPos++; } else { s5 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e29); } + if (peg$silentFails === 0) { peg$fail(peg$e30); } } if (s5 !== peg$FAILED) { s6 = peg$parse_(); @@ -2400,12 +2415,12 @@ function peg$parse(input, options) { s5 = peg$parseIdentifier(); if (s5 !== peg$FAILED) { s6 = peg$parse_(); - if (input.substr(peg$currPos, 2) === peg$c5) { - s7 = peg$c5; + if (input.substr(peg$currPos, 2) === peg$c6) { + s7 = peg$c6; peg$currPos += 2; } else { s7 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e6); } + if (peg$silentFails === 0) { peg$fail(peg$e7); } } if (s7 === peg$FAILED) { s7 = null; @@ -2432,12 +2447,12 @@ function peg$parse(input, options) { let s0, s1, s2, s3; s0 = peg$currPos; - if (input.substr(peg$currPos, 8) === peg$c27) { - s1 = peg$c27; + if (input.substr(peg$currPos, 8) === peg$c28) { + s1 = peg$c28; peg$currPos += 8; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e33); } + if (peg$silentFails === 0) { peg$fail(peg$e34); } } if (s1 !== peg$FAILED) { s2 = peg$parse__(); @@ -2466,56 +2481,56 @@ function peg$parse(input, options) { let s0, s1, s2, s3, s4, s5, s6, s7; s0 = peg$currPos; - if (input.substr(peg$currPos, 7) === peg$c28) { - s1 = peg$c28; + if (input.substr(peg$currPos, 7) === peg$c29) { + s1 = peg$c29; peg$currPos += 7; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e34); } + if (peg$silentFails === 0) { peg$fail(peg$e35); } } if (s1 !== peg$FAILED) { s2 = peg$parse__(); if (s2 !== peg$FAILED) { - if (input.substr(peg$currPos, 2) === peg$c29) { - s3 = peg$c29; + if (input.substr(peg$currPos, 2) === peg$c30) { + s3 = peg$c30; peg$currPos += 2; } else { s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e35); } + if (peg$silentFails === 0) { peg$fail(peg$e36); } } if (s3 !== peg$FAILED) { s4 = peg$parse__(); if (s4 !== peg$FAILED) { - if (input.substr(peg$currPos, 4) === peg$c30) { - s5 = peg$c30; + if (input.substr(peg$currPos, 4) === peg$c31) { + s5 = peg$c31; peg$currPos += 4; } else { s5 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e36); } + if (peg$silentFails === 0) { peg$fail(peg$e37); } } if (s5 === peg$FAILED) { - if (input.substr(peg$currPos, 10) === peg$c31) { - s5 = peg$c31; + if (input.substr(peg$currPos, 10) === peg$c32) { + s5 = peg$c32; peg$currPos += 10; } else { s5 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e37); } + if (peg$silentFails === 0) { peg$fail(peg$e38); } } if (s5 === peg$FAILED) { - if (input.substr(peg$currPos, 12) === peg$c32) { - s5 = peg$c32; + if (input.substr(peg$currPos, 12) === peg$c33) { + s5 = peg$c33; peg$currPos += 12; } else { s5 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e38); } + if (peg$silentFails === 0) { peg$fail(peg$e39); } } if (s5 === peg$FAILED) { - if (input.substr(peg$currPos, 17) === peg$c33) { - s5 = peg$c33; + if (input.substr(peg$currPos, 17) === peg$c34) { + s5 = peg$c34; peg$currPos += 17; } else { s5 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e39); } + if (peg$silentFails === 0) { peg$fail(peg$e40); } } } } @@ -2545,12 +2560,12 @@ function peg$parse(input, options) { } if (s0 === peg$FAILED) { s0 = peg$currPos; - if (input.substr(peg$currPos, 7) === peg$c28) { - s1 = peg$c28; + if (input.substr(peg$currPos, 7) === peg$c29) { + s1 = peg$c29; peg$currPos += 7; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e34); } + if (peg$silentFails === 0) { peg$fail(peg$e35); } } if (s1 !== peg$FAILED) { s2 = peg$parse__(); @@ -2606,12 +2621,12 @@ function peg$parse(input, options) { let s0, s1; s0 = peg$currPos; - if (input.substr(peg$currPos, 10) === peg$c31) { - s1 = peg$c31; + if (input.substr(peg$currPos, 10) === peg$c32) { + s1 = peg$c32; peg$currPos += 10; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e37); } + if (peg$silentFails === 0) { peg$fail(peg$e38); } } if (s1 !== peg$FAILED) { peg$savedPos = s0; @@ -2620,12 +2635,12 @@ function peg$parse(input, options) { s0 = s1; if (s0 === peg$FAILED) { s0 = peg$currPos; - if (input.substr(peg$currPos, 11) === peg$c34) { - s1 = peg$c34; + if (input.substr(peg$currPos, 11) === peg$c35) { + s1 = peg$c35; peg$currPos += 11; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e40); } + if (peg$silentFails === 0) { peg$fail(peg$e41); } } if (s1 !== peg$FAILED) { peg$savedPos = s0; @@ -2641,12 +2656,12 @@ function peg$parse(input, options) { let s0, s1, s2, s3; s0 = peg$currPos; - if (input.substr(peg$currPos, 5) === peg$c35) { - s1 = peg$c35; + if (input.substr(peg$currPos, 5) === peg$c36) { + s1 = peg$c36; peg$currPos += 5; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e41); } + if (peg$silentFails === 0) { peg$fail(peg$e42); } } if (s1 !== peg$FAILED) { s2 = peg$parse__(); @@ -2675,12 +2690,12 @@ function peg$parse(input, options) { let s0, s1, s2, s3, s4, s5, s6, s7; s0 = peg$currPos; - if (input.substr(peg$currPos, 7) === peg$c28) { - s1 = peg$c28; + if (input.substr(peg$currPos, 7) === peg$c29) { + s1 = peg$c29; peg$currPos += 7; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e34); } + if (peg$silentFails === 0) { peg$fail(peg$e35); } } if (s1 !== peg$FAILED) { s2 = peg$parse__(); @@ -2741,46 +2756,46 @@ function peg$parse(input, options) { let s0, s1, s2, s3, s4, s5; s0 = peg$currPos; - if (input.substr(peg$currPos, 8) === peg$c36) { - s1 = peg$c36; + if (input.substr(peg$currPos, 8) === peg$c37) { + s1 = peg$c37; peg$currPos += 8; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e42); } + if (peg$silentFails === 0) { peg$fail(peg$e43); } } if (s1 !== peg$FAILED) { s2 = peg$parse__(); if (s2 !== peg$FAILED) { - if (input.substr(peg$currPos, 2) === peg$c37) { - s3 = peg$c37; + if (input.substr(peg$currPos, 2) === peg$c38) { + s3 = peg$c38; peg$currPos += 2; } else { s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e43); } + if (peg$silentFails === 0) { peg$fail(peg$e44); } } if (s3 === peg$FAILED) { - if (input.substr(peg$currPos, 4) === peg$c38) { - s3 = peg$c38; + if (input.substr(peg$currPos, 4) === peg$c39) { + s3 = peg$c39; peg$currPos += 4; } else { s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e44); } + if (peg$silentFails === 0) { peg$fail(peg$e45); } } if (s3 === peg$FAILED) { - if (input.substr(peg$currPos, 7) === peg$c39) { - s3 = peg$c39; + if (input.substr(peg$currPos, 7) === peg$c40) { + s3 = peg$c40; peg$currPos += 7; } else { s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e45); } + if (peg$silentFails === 0) { peg$fail(peg$e46); } } if (s3 === peg$FAILED) { - if (input.substr(peg$currPos, 6) === peg$c40) { - s3 = peg$c40; + if (input.substr(peg$currPos, 6) === peg$c41) { + s3 = peg$c41; peg$currPos += 6; } else { s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e46); } + if (peg$silentFails === 0) { peg$fail(peg$e47); } } } } @@ -2788,36 +2803,36 @@ function peg$parse(input, options) { if (s3 !== peg$FAILED) { s4 = peg$parse__(); if (s4 !== peg$FAILED) { - if (input.substr(peg$currPos, 6) === peg$c41) { - s5 = peg$c41; + if (input.substr(peg$currPos, 6) === peg$c42) { + s5 = peg$c42; peg$currPos += 6; } else { s5 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e47); } + if (peg$silentFails === 0) { peg$fail(peg$e48); } } if (s5 === peg$FAILED) { - if (input.substr(peg$currPos, 5) === peg$c42) { - s5 = peg$c42; + if (input.substr(peg$currPos, 5) === peg$c43) { + s5 = peg$c43; peg$currPos += 5; } else { s5 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e48); } + if (peg$silentFails === 0) { peg$fail(peg$e49); } } if (s5 === peg$FAILED) { - if (input.substr(peg$currPos, 6) === peg$c43) { - s5 = peg$c43; + if (input.substr(peg$currPos, 6) === peg$c44) { + s5 = peg$c44; peg$currPos += 6; } else { s5 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e49); } + if (peg$silentFails === 0) { peg$fail(peg$e50); } } if (s5 === peg$FAILED) { - if (input.substr(peg$currPos, 7) === peg$c44) { - s5 = peg$c44; + if (input.substr(peg$currPos, 7) === peg$c45) { + s5 = peg$c45; peg$currPos += 7; } else { s5 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e50); } + if (peg$silentFails === 0) { peg$fail(peg$e51); } } } } @@ -2853,38 +2868,38 @@ function peg$parse(input, options) { let s0, s1, s2, s3, s4, s5, s6; s0 = peg$currPos; - if (input.substr(peg$currPos, 8) === peg$c45) { - s1 = peg$c45; + if (input.substr(peg$currPos, 8) === peg$c46) { + s1 = peg$c46; peg$currPos += 8; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e51); } + if (peg$silentFails === 0) { peg$fail(peg$e52); } } if (s1 !== peg$FAILED) { s2 = peg$parse__(); if (s2 !== peg$FAILED) { - if (input.substr(peg$currPos, 5) === peg$c46) { - s3 = peg$c46; + if (input.substr(peg$currPos, 5) === peg$c47) { + s3 = peg$c47; peg$currPos += 5; } else { s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e52); } + if (peg$silentFails === 0) { peg$fail(peg$e53); } } if (s3 === peg$FAILED) { - if (input.substr(peg$currPos, 8) === peg$c47) { - s3 = peg$c47; + if (input.substr(peg$currPos, 8) === peg$c48) { + s3 = peg$c48; peg$currPos += 8; } else { s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e53); } + if (peg$silentFails === 0) { peg$fail(peg$e54); } } if (s3 === peg$FAILED) { - if (input.substr(peg$currPos, 10) === peg$c48) { - s3 = peg$c48; + if (input.substr(peg$currPos, 10) === peg$c49) { + s3 = peg$c49; peg$currPos += 10; } else { s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e54); } + if (peg$silentFails === 0) { peg$fail(peg$e55); } } } } @@ -2892,28 +2907,28 @@ function peg$parse(input, options) { s4 = peg$currPos; s5 = peg$parse__(); if (s5 !== peg$FAILED) { - if (input.substr(peg$currPos, 13) === peg$c49) { - s6 = peg$c49; + if (input.substr(peg$currPos, 13) === peg$c50) { + s6 = peg$c50; peg$currPos += 13; } else { s6 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e55); } + if (peg$silentFails === 0) { peg$fail(peg$e56); } } if (s6 === peg$FAILED) { - if (input.substr(peg$currPos, 13) === peg$c50) { - s6 = peg$c50; + if (input.substr(peg$currPos, 13) === peg$c51) { + s6 = peg$c51; peg$currPos += 13; } else { s6 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e56); } + if (peg$silentFails === 0) { peg$fail(peg$e57); } } if (s6 === peg$FAILED) { - if (input.substr(peg$currPos, 13) === peg$c51) { - s6 = peg$c51; + if (input.substr(peg$currPos, 13) === peg$c52) { + s6 = peg$c52; peg$currPos += 13; } else { s6 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e57); } + if (peg$silentFails === 0) { peg$fail(peg$e58); } } } } @@ -2953,12 +2968,12 @@ function peg$parse(input, options) { let s0, s1, s2, s3; s0 = peg$currPos; - if (input.substr(peg$currPos, 3) === peg$c52) { - s1 = peg$c52; + if (input.substr(peg$currPos, 3) === peg$c53) { + s1 = peg$c53; peg$currPos += 3; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e58); } + if (peg$silentFails === 0) { peg$fail(peg$e59); } } if (s1 !== peg$FAILED) { s2 = peg$parse__(); @@ -2987,30 +3002,30 @@ function peg$parse(input, options) { let s0, s1, s2, s3; s0 = peg$currPos; - if (input.substr(peg$currPos, 5) === peg$c53) { - s1 = peg$c53; + if (input.substr(peg$currPos, 5) === peg$c54) { + s1 = peg$c54; peg$currPos += 5; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e59); } + if (peg$silentFails === 0) { peg$fail(peg$e60); } } if (s1 !== peg$FAILED) { s2 = peg$parse__(); if (s2 !== peg$FAILED) { - if (input.substr(peg$currPos, 5) === peg$c54) { - s3 = peg$c54; + if (input.substr(peg$currPos, 5) === peg$c55) { + s3 = peg$c55; peg$currPos += 5; } else { s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e60); } + if (peg$silentFails === 0) { peg$fail(peg$e61); } } if (s3 === peg$FAILED) { - if (input.substr(peg$currPos, 4) === peg$c55) { - s3 = peg$c55; + if (input.substr(peg$currPos, 4) === peg$c56) { + s3 = peg$c56; peg$currPos += 4; } else { s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e61); } + if (peg$silentFails === 0) { peg$fail(peg$e62); } } } if (s3 !== peg$FAILED) { @@ -3041,12 +3056,12 @@ function peg$parse(input, options) { s2 = []; s3 = peg$currPos; s4 = peg$parse_(); - if (input.substr(peg$currPos, 2) === peg$c56) { - s5 = peg$c56; + if (input.substr(peg$currPos, 2) === peg$c57) { + s5 = peg$c57; peg$currPos += 2; } else { s5 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e62); } + if (peg$silentFails === 0) { peg$fail(peg$e63); } } if (s5 !== peg$FAILED) { s6 = peg$parse_(); @@ -3066,12 +3081,12 @@ function peg$parse(input, options) { s2.push(s3); s3 = peg$currPos; s4 = peg$parse_(); - if (input.substr(peg$currPos, 2) === peg$c56) { - s5 = peg$c56; + if (input.substr(peg$currPos, 2) === peg$c57) { + s5 = peg$c57; peg$currPos += 2; } else { s5 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e62); } + if (peg$silentFails === 0) { peg$fail(peg$e63); } } if (s5 !== peg$FAILED) { s6 = peg$parse_(); @@ -3107,12 +3122,12 @@ function peg$parse(input, options) { s2 = []; s3 = peg$currPos; s4 = peg$parse_(); - if (input.substr(peg$currPos, 2) === peg$c57) { - s5 = peg$c57; + if (input.substr(peg$currPos, 2) === peg$c58) { + s5 = peg$c58; peg$currPos += 2; } else { s5 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e63); } + if (peg$silentFails === 0) { peg$fail(peg$e64); } } if (s5 !== peg$FAILED) { s6 = peg$parse_(); @@ -3132,12 +3147,12 @@ function peg$parse(input, options) { s2.push(s3); s3 = peg$currPos; s4 = peg$parse_(); - if (input.substr(peg$currPos, 2) === peg$c57) { - s5 = peg$c57; + if (input.substr(peg$currPos, 2) === peg$c58) { + s5 = peg$c58; peg$currPos += 2; } else { s5 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e63); } + if (peg$silentFails === 0) { peg$fail(peg$e64); } } if (s5 !== peg$FAILED) { s6 = peg$parse_(); @@ -3171,12 +3186,12 @@ function peg$parse(input, options) { s1 = peg$parseTemporalComparison(); if (s1 !== peg$FAILED) { s2 = peg$parse_(); - if (input.substr(peg$currPos, 2) === peg$c58) { - s3 = peg$c58; + if (input.substr(peg$currPos, 2) === peg$c59) { + s3 = peg$c59; peg$currPos += 2; } else { s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e64); } + if (peg$silentFails === 0) { peg$fail(peg$e65); } } if (s3 !== peg$FAILED) { s4 = peg$parse__(); @@ -3208,14 +3223,67 @@ function peg$parse(input, options) { s2 = []; s3 = peg$currPos; s4 = peg$parse_(); - if (input.substr(peg$currPos, 2) === peg$c59) { - s5 = peg$c59; + if (input.substr(peg$currPos, 2) === peg$c60) { + s5 = peg$c60; peg$currPos += 2; } else { s5 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e65); } + if (peg$silentFails === 0) { peg$fail(peg$e66); } } if (s5 === peg$FAILED) { + if (input.substr(peg$currPos, 2) === peg$c61) { + s5 = peg$c61; + peg$currPos += 2; + } else { + s5 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e67); } + } + if (s5 === peg$FAILED) { + if (input.substr(peg$currPos, 2) === peg$c62) { + s5 = peg$c62; + peg$currPos += 2; + } else { + s5 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e68); } + } + if (s5 === peg$FAILED) { + if (input.substr(peg$currPos, 2) === peg$c63) { + s5 = peg$c63; + peg$currPos += 2; + } else { + s5 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e69); } + } + if (s5 === peg$FAILED) { + s5 = input.charAt(peg$currPos); + if (peg$r0.test(s5)) { + peg$currPos++; + } else { + s5 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e70); } + } + } + } + } + } + if (s5 !== peg$FAILED) { + s6 = peg$parse_(); + s7 = peg$parseTemporalComparison(); + if (s7 !== peg$FAILED) { + s4 = [s4, s5, s6, s7]; + s3 = s4; + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + while (s3 !== peg$FAILED) { + s2.push(s3); + s3 = peg$currPos; + s4 = peg$parse_(); if (input.substr(peg$currPos, 2) === peg$c60) { s5 = peg$c60; peg$currPos += 2; @@ -3240,65 +3308,12 @@ function peg$parse(input, options) { if (peg$silentFails === 0) { peg$fail(peg$e68); } } if (s5 === peg$FAILED) { - s5 = input.charAt(peg$currPos); - if (peg$r0.test(s5)) { - peg$currPos++; - } else { - s5 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e69); } - } - } - } - } - } - if (s5 !== peg$FAILED) { - s6 = peg$parse_(); - s7 = peg$parseTemporalComparison(); - if (s7 !== peg$FAILED) { - s4 = [s4, s5, s6, s7]; - s3 = s4; - } else { - peg$currPos = s3; - s3 = peg$FAILED; - } - } else { - peg$currPos = s3; - s3 = peg$FAILED; - } - while (s3 !== peg$FAILED) { - s2.push(s3); - s3 = peg$currPos; - s4 = peg$parse_(); - if (input.substr(peg$currPos, 2) === peg$c59) { - s5 = peg$c59; - peg$currPos += 2; - } else { - s5 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e65); } - } - if (s5 === peg$FAILED) { - if (input.substr(peg$currPos, 2) === peg$c60) { - s5 = peg$c60; - peg$currPos += 2; - } else { - s5 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e66); } - } - if (s5 === peg$FAILED) { - if (input.substr(peg$currPos, 2) === peg$c61) { - s5 = peg$c61; - peg$currPos += 2; - } else { - s5 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e67); } - } - if (s5 === peg$FAILED) { - if (input.substr(peg$currPos, 2) === peg$c62) { - s5 = peg$c62; + if (input.substr(peg$currPos, 2) === peg$c63) { + s5 = peg$c63; peg$currPos += 2; } else { s5 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e68); } + if (peg$silentFails === 0) { peg$fail(peg$e69); } } if (s5 === peg$FAILED) { s5 = input.charAt(peg$currPos); @@ -3306,7 +3321,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s5 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e69); } + if (peg$silentFails === 0) { peg$fail(peg$e70); } } } } @@ -3345,12 +3360,12 @@ function peg$parse(input, options) { s1 = peg$parseAddition(); if (s1 !== peg$FAILED) { s2 = peg$parse_(); - if (input.substr(peg$currPos, 6) === peg$c12) { - s3 = peg$c12; + if (input.substr(peg$currPos, 6) === peg$c13) { + s3 = peg$c13; peg$currPos += 6; } else { s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e16); } + if (peg$silentFails === 0) { peg$fail(peg$e17); } } if (s3 !== peg$FAILED) { s4 = peg$parse__(); @@ -3396,7 +3411,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s5 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e70); } + if (peg$silentFails === 0) { peg$fail(peg$e71); } } if (s5 !== peg$FAILED) { s6 = peg$parse_i(); @@ -3421,7 +3436,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s5 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e70); } + if (peg$silentFails === 0) { peg$fail(peg$e71); } } if (s5 !== peg$FAILED) { s6 = peg$parse_i(); @@ -3462,7 +3477,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s5 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e71); } + if (peg$silentFails === 0) { peg$fail(peg$e72); } } if (s5 !== peg$FAILED) { s6 = peg$parse_i(); @@ -3487,7 +3502,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s5 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e71); } + if (peg$silentFails === 0) { peg$fail(peg$e72); } } if (s5 !== peg$FAILED) { s6 = peg$parse_i(); @@ -3518,20 +3533,20 @@ function peg$parse(input, options) { let s0, s1, s2, s3; s0 = peg$currPos; - if (input.substr(peg$currPos, 3) === peg$c63) { - s1 = peg$c63; + if (input.substr(peg$currPos, 3) === peg$c64) { + s1 = peg$c64; peg$currPos += 3; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e72); } + if (peg$silentFails === 0) { peg$fail(peg$e73); } } if (s1 === peg$FAILED) { if (input.charCodeAt(peg$currPos) === 33) { - s1 = peg$c64; + s1 = peg$c65; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e73); } + if (peg$silentFails === 0) { peg$fail(peg$e74); } } } if (s1 !== peg$FAILED) { @@ -3593,11 +3608,11 @@ function peg$parse(input, options) { s3 = peg$currPos; s4 = peg$parse_(); if (input.charCodeAt(peg$currPos) === 46) { - s5 = peg$c65; + s5 = peg$c66; peg$currPos++; } else { s5 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e74); } + if (peg$silentFails === 0) { peg$fail(peg$e75); } } if (s5 !== peg$FAILED) { s6 = peg$parse_(); @@ -3619,11 +3634,11 @@ function peg$parse(input, options) { s3 = peg$currPos; s4 = peg$parse_(); if (input.charCodeAt(peg$currPos) === 46) { - s5 = peg$c65; + s5 = peg$c66; peg$currPos++; } else { s5 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e74); } + if (peg$silentFails === 0) { peg$fail(peg$e75); } } if (s5 !== peg$FAILED) { s6 = peg$parse_(); @@ -3672,11 +3687,11 @@ function peg$parse(input, options) { if (s0 === peg$FAILED) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 40) { - s1 = peg$c9; + s1 = peg$c10; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e11); } + if (peg$silentFails === 0) { peg$fail(peg$e12); } } if (s1 !== peg$FAILED) { s2 = peg$parse_(); @@ -3684,11 +3699,11 @@ function peg$parse(input, options) { if (s3 !== peg$FAILED) { s4 = peg$parse_(); if (input.charCodeAt(peg$currPos) === 41) { - s5 = peg$c10; + s5 = peg$c11; peg$currPos++; } else { s5 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e12); } + if (peg$silentFails === 0) { peg$fail(peg$e13); } } if (s5 !== peg$FAILED) { peg$savedPos = s0; @@ -3712,7 +3727,7 @@ function peg$parse(input, options) { peg$silentFails--; if (s0 === peg$FAILED) { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e75); } + if (peg$silentFails === 0) { peg$fail(peg$e76); } } return s0; @@ -3723,22 +3738,22 @@ function peg$parse(input, options) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 42) { - s1 = peg$c8; + s1 = peg$c9; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e10); } + if (peg$silentFails === 0) { peg$fail(peg$e11); } } if (s1 !== peg$FAILED) { s2 = peg$parseIdentifier(); if (s2 !== peg$FAILED) { s3 = peg$parse_(); if (input.charCodeAt(peg$currPos) === 40) { - s4 = peg$c9; + s4 = peg$c10; peg$currPos++; } else { s4 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e11); } + if (peg$silentFails === 0) { peg$fail(peg$e12); } } if (s4 !== peg$FAILED) { s5 = peg$parse_(); @@ -3748,11 +3763,11 @@ function peg$parse(input, options) { } s7 = peg$parse_(); if (input.charCodeAt(peg$currPos) === 41) { - s8 = peg$c10; + s8 = peg$c11; peg$currPos++; } else { s8 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e12); } + if (peg$silentFails === 0) { peg$fail(peg$e13); } } if (s8 !== peg$FAILED) { peg$savedPos = s0; @@ -3784,11 +3799,11 @@ function peg$parse(input, options) { s1 = peg$parseIdentifier(); if (s1 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 40) { - s2 = peg$c9; + s2 = peg$c10; peg$currPos++; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e11); } + if (peg$silentFails === 0) { peg$fail(peg$e12); } } if (s2 !== peg$FAILED) { s3 = peg$parse_(); @@ -3798,11 +3813,11 @@ function peg$parse(input, options) { } s5 = peg$parse_(); if (input.charCodeAt(peg$currPos) === 41) { - s6 = peg$c10; + s6 = peg$c11; peg$currPos++; } else { s6 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e12); } + if (peg$silentFails === 0) { peg$fail(peg$e13); } } if (s6 !== peg$FAILED) { peg$savedPos = s0; @@ -3847,11 +3862,11 @@ function peg$parse(input, options) { s3 = peg$currPos; s4 = peg$parse_(); if (input.charCodeAt(peg$currPos) === 44) { - s5 = peg$c23; + s5 = peg$c24; peg$currPos++; } else { s5 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e29); } + if (peg$silentFails === 0) { peg$fail(peg$e30); } } if (s5 !== peg$FAILED) { s6 = peg$parse_(); @@ -3872,11 +3887,11 @@ function peg$parse(input, options) { s3 = peg$currPos; s4 = peg$parse_(); if (input.charCodeAt(peg$currPos) === 44) { - s5 = peg$c23; + s5 = peg$c24; peg$currPos++; } else { s5 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e29); } + if (peg$silentFails === 0) { peg$fail(peg$e30); } } if (s5 !== peg$FAILED) { s6 = peg$parse_(); @@ -3913,11 +3928,11 @@ function peg$parse(input, options) { s3 = peg$currPos; s4 = peg$parse_(); if (input.charCodeAt(peg$currPos) === 44) { - s5 = peg$c23; + s5 = peg$c24; peg$currPos++; } else { s5 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e29); } + if (peg$silentFails === 0) { peg$fail(peg$e30); } } if (s5 !== peg$FAILED) { s6 = peg$parse_(); @@ -3938,11 +3953,11 @@ function peg$parse(input, options) { s3 = peg$currPos; s4 = peg$parse_(); if (input.charCodeAt(peg$currPos) === 44) { - s5 = peg$c23; + s5 = peg$c24; peg$currPos++; } else { s5 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e29); } + if (peg$silentFails === 0) { peg$fail(peg$e30); } } if (s5 !== peg$FAILED) { s6 = peg$parse_(); @@ -3995,11 +4010,11 @@ function peg$parse(input, options) { peg$silentFails++; s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 34) { - s1 = peg$c66; + s1 = peg$c67; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e77); } + if (peg$silentFails === 0) { peg$fail(peg$e78); } } if (s1 !== peg$FAILED) { s2 = []; @@ -4011,7 +4026,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s5 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e78); } + if (peg$silentFails === 0) { peg$fail(peg$e79); } } peg$silentFails--; if (s5 === peg$FAILED) { @@ -4026,7 +4041,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s5 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e79); } + if (peg$silentFails === 0) { peg$fail(peg$e80); } } if (s5 !== peg$FAILED) { s4 = [s4, s5]; @@ -4042,11 +4057,11 @@ function peg$parse(input, options) { if (s3 === peg$FAILED) { s3 = peg$currPos; if (input.charCodeAt(peg$currPos) === 92) { - s4 = peg$c67; + s4 = peg$c68; peg$currPos++; } else { s4 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e80); } + if (peg$silentFails === 0) { peg$fail(peg$e81); } } if (s4 !== peg$FAILED) { if (input.length > peg$currPos) { @@ -4054,7 +4069,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s5 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e79); } + if (peg$silentFails === 0) { peg$fail(peg$e80); } } if (s5 !== peg$FAILED) { s4 = [s4, s5]; @@ -4078,7 +4093,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s5 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e78); } + if (peg$silentFails === 0) { peg$fail(peg$e79); } } peg$silentFails--; if (s5 === peg$FAILED) { @@ -4093,7 +4108,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s5 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e79); } + if (peg$silentFails === 0) { peg$fail(peg$e80); } } if (s5 !== peg$FAILED) { s4 = [s4, s5]; @@ -4109,11 +4124,11 @@ function peg$parse(input, options) { if (s3 === peg$FAILED) { s3 = peg$currPos; if (input.charCodeAt(peg$currPos) === 92) { - s4 = peg$c67; + s4 = peg$c68; peg$currPos++; } else { s4 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e80); } + if (peg$silentFails === 0) { peg$fail(peg$e81); } } if (s4 !== peg$FAILED) { if (input.length > peg$currPos) { @@ -4121,7 +4136,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s5 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e79); } + if (peg$silentFails === 0) { peg$fail(peg$e80); } } if (s5 !== peg$FAILED) { s4 = [s4, s5]; @@ -4137,11 +4152,11 @@ function peg$parse(input, options) { } } if (input.charCodeAt(peg$currPos) === 34) { - s3 = peg$c66; + s3 = peg$c67; peg$currPos++; } else { s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e77); } + if (peg$silentFails === 0) { peg$fail(peg$e78); } } if (s3 !== peg$FAILED) { peg$savedPos = s0; @@ -4157,11 +4172,11 @@ function peg$parse(input, options) { if (s0 === peg$FAILED) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 39) { - s1 = peg$c68; + s1 = peg$c69; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e81); } + if (peg$silentFails === 0) { peg$fail(peg$e82); } } if (s1 !== peg$FAILED) { s2 = []; @@ -4173,7 +4188,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s5 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e82); } + if (peg$silentFails === 0) { peg$fail(peg$e83); } } peg$silentFails--; if (s5 === peg$FAILED) { @@ -4188,7 +4203,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s5 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e79); } + if (peg$silentFails === 0) { peg$fail(peg$e80); } } if (s5 !== peg$FAILED) { s4 = [s4, s5]; @@ -4204,11 +4219,11 @@ function peg$parse(input, options) { if (s3 === peg$FAILED) { s3 = peg$currPos; if (input.charCodeAt(peg$currPos) === 92) { - s4 = peg$c67; + s4 = peg$c68; peg$currPos++; } else { s4 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e80); } + if (peg$silentFails === 0) { peg$fail(peg$e81); } } if (s4 !== peg$FAILED) { if (input.length > peg$currPos) { @@ -4216,7 +4231,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s5 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e79); } + if (peg$silentFails === 0) { peg$fail(peg$e80); } } if (s5 !== peg$FAILED) { s4 = [s4, s5]; @@ -4240,7 +4255,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s5 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e82); } + if (peg$silentFails === 0) { peg$fail(peg$e83); } } peg$silentFails--; if (s5 === peg$FAILED) { @@ -4255,7 +4270,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s5 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e79); } + if (peg$silentFails === 0) { peg$fail(peg$e80); } } if (s5 !== peg$FAILED) { s4 = [s4, s5]; @@ -4271,11 +4286,11 @@ function peg$parse(input, options) { if (s3 === peg$FAILED) { s3 = peg$currPos; if (input.charCodeAt(peg$currPos) === 92) { - s4 = peg$c67; + s4 = peg$c68; peg$currPos++; } else { s4 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e80); } + if (peg$silentFails === 0) { peg$fail(peg$e81); } } if (s4 !== peg$FAILED) { if (input.length > peg$currPos) { @@ -4283,7 +4298,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s5 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e79); } + if (peg$silentFails === 0) { peg$fail(peg$e80); } } if (s5 !== peg$FAILED) { s4 = [s4, s5]; @@ -4299,11 +4314,11 @@ function peg$parse(input, options) { } } if (input.charCodeAt(peg$currPos) === 39) { - s3 = peg$c68; + s3 = peg$c69; peg$currPos++; } else { s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e81); } + if (peg$silentFails === 0) { peg$fail(peg$e82); } } if (s3 !== peg$FAILED) { peg$savedPos = s0; @@ -4320,7 +4335,7 @@ function peg$parse(input, options) { peg$silentFails--; if (s0 === peg$FAILED) { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e76); } + if (peg$silentFails === 0) { peg$fail(peg$e77); } } return s0; @@ -4338,7 +4353,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e84); } + if (peg$silentFails === 0) { peg$fail(peg$e85); } } if (s3 !== peg$FAILED) { while (s3 !== peg$FAILED) { @@ -4348,7 +4363,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e84); } + if (peg$silentFails === 0) { peg$fail(peg$e85); } } } } else { @@ -4356,11 +4371,11 @@ function peg$parse(input, options) { } if (s2 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 46) { - s3 = peg$c65; + s3 = peg$c66; peg$currPos++; } else { s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e74); } + if (peg$silentFails === 0) { peg$fail(peg$e75); } } if (s3 !== peg$FAILED) { s4 = []; @@ -4369,7 +4384,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s5 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e84); } + if (peg$silentFails === 0) { peg$fail(peg$e85); } } if (s5 !== peg$FAILED) { while (s5 !== peg$FAILED) { @@ -4379,7 +4394,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s5 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e84); } + if (peg$silentFails === 0) { peg$fail(peg$e85); } } } } else { @@ -4408,7 +4423,7 @@ function peg$parse(input, options) { peg$silentFails--; if (s0 === peg$FAILED) { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e83); } + if (peg$silentFails === 0) { peg$fail(peg$e84); } } return s0; @@ -4425,7 +4440,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e84); } + if (peg$silentFails === 0) { peg$fail(peg$e85); } } if (s2 !== peg$FAILED) { while (s2 !== peg$FAILED) { @@ -4435,7 +4450,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e84); } + if (peg$silentFails === 0) { peg$fail(peg$e85); } } } } else { @@ -4449,7 +4464,7 @@ function peg$parse(input, options) { peg$silentFails--; if (s0 === peg$FAILED) { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e85); } + if (peg$silentFails === 0) { peg$fail(peg$e86); } } return s0; @@ -4460,20 +4475,20 @@ function peg$parse(input, options) { peg$silentFails++; s0 = peg$currPos; - if (input.substr(peg$currPos, 4) === peg$c69) { - s1 = peg$c69; + if (input.substr(peg$currPos, 4) === peg$c70) { + s1 = peg$c70; peg$currPos += 4; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e87); } + if (peg$silentFails === 0) { peg$fail(peg$e88); } } if (s1 === peg$FAILED) { - if (input.substr(peg$currPos, 5) === peg$c70) { - s1 = peg$c70; + if (input.substr(peg$currPos, 5) === peg$c71) { + s1 = peg$c71; peg$currPos += 5; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e88); } + if (peg$silentFails === 0) { peg$fail(peg$e89); } } } if (s1 !== peg$FAILED) { @@ -4484,7 +4499,7 @@ function peg$parse(input, options) { peg$silentFails--; if (s0 === peg$FAILED) { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e86); } + if (peg$silentFails === 0) { peg$fail(peg$e87); } } return s0; @@ -4502,7 +4517,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e84); } + if (peg$silentFails === 0) { peg$fail(peg$e85); } } if (s3 !== peg$FAILED) { while (s3 !== peg$FAILED) { @@ -4512,7 +4527,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e84); } + if (peg$silentFails === 0) { peg$fail(peg$e85); } } } } else { @@ -4524,7 +4539,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e90); } + if (peg$silentFails === 0) { peg$fail(peg$e91); } } if (s3 !== peg$FAILED) { s2 = [s2, s3]; @@ -4545,7 +4560,7 @@ function peg$parse(input, options) { peg$silentFails--; if (s0 === peg$FAILED) { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e89); } + if (peg$silentFails === 0) { peg$fail(peg$e90); } } return s0; @@ -4573,7 +4588,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s4 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e91); } + if (peg$silentFails === 0) { peg$fail(peg$e92); } } if (s4 !== peg$FAILED) { s5 = []; @@ -4582,7 +4597,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s6 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e92); } + if (peg$silentFails === 0) { peg$fail(peg$e93); } } while (s6 !== peg$FAILED) { s5.push(s6); @@ -4591,7 +4606,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s6 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e92); } + if (peg$silentFails === 0) { peg$fail(peg$e93); } } } s4 = [s4, s5]; @@ -4640,260 +4655,260 @@ function peg$parse(input, options) { if (peg$silentFails === 0) { peg$fail(peg$e2); } } if (s1 === peg$FAILED) { - if (input.substr(peg$currPos, 4) === peg$c6) { - s1 = peg$c6; + if (input.substr(peg$currPos, 4) === peg$c7) { + s1 = peg$c7; peg$currPos += 4; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e8); } + if (peg$silentFails === 0) { peg$fail(peg$e9); } } if (s1 === peg$FAILED) { - if (input.substr(peg$currPos, 8) === peg$c7) { - s1 = peg$c7; + if (input.substr(peg$currPos, 8) === peg$c8) { + s1 = peg$c8; peg$currPos += 8; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e9); } + if (peg$silentFails === 0) { peg$fail(peg$e10); } } if (s1 === peg$FAILED) { - if (input.substr(peg$currPos, 8) === peg$c13) { - s1 = peg$c13; + if (input.substr(peg$currPos, 8) === peg$c14) { + s1 = peg$c14; peg$currPos += 8; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e18); } + if (peg$silentFails === 0) { peg$fail(peg$e19); } } if (s1 === peg$FAILED) { - if (input.substr(peg$currPos, 7) === peg$c14) { - s1 = peg$c14; + if (input.substr(peg$currPos, 7) === peg$c15) { + s1 = peg$c15; peg$currPos += 7; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e20); } + if (peg$silentFails === 0) { peg$fail(peg$e21); } } if (s1 === peg$FAILED) { - if (input.substr(peg$currPos, 7) === peg$c28) { - s1 = peg$c28; + if (input.substr(peg$currPos, 7) === peg$c29) { + s1 = peg$c29; peg$currPos += 7; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e34); } + if (peg$silentFails === 0) { peg$fail(peg$e35); } } if (s1 === peg$FAILED) { - if (input.substr(peg$currPos, 2) === peg$c29) { - s1 = peg$c29; + if (input.substr(peg$currPos, 2) === peg$c30) { + s1 = peg$c30; peg$currPos += 2; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e35); } + if (peg$silentFails === 0) { peg$fail(peg$e36); } } if (s1 === peg$FAILED) { - if (input.substr(peg$currPos, 5) === peg$c53) { - s1 = peg$c53; + if (input.substr(peg$currPos, 5) === peg$c54) { + s1 = peg$c54; peg$currPos += 5; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e59); } + if (peg$silentFails === 0) { peg$fail(peg$e60); } } if (s1 === peg$FAILED) { - if (input.substr(peg$currPos, 8) === peg$c36) { - s1 = peg$c36; + if (input.substr(peg$currPos, 8) === peg$c37) { + s1 = peg$c37; peg$currPos += 8; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e42); } + if (peg$silentFails === 0) { peg$fail(peg$e43); } } if (s1 === peg$FAILED) { - if (input.substr(peg$currPos, 8) === peg$c45) { - s1 = peg$c45; + if (input.substr(peg$currPos, 8) === peg$c46) { + s1 = peg$c46; peg$currPos += 8; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e51); } + if (peg$silentFails === 0) { peg$fail(peg$e52); } } if (s1 === peg$FAILED) { - if (input.substr(peg$currPos, 3) === peg$c52) { - s1 = peg$c52; + if (input.substr(peg$currPos, 3) === peg$c53) { + s1 = peg$c53; peg$currPos += 3; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e58); } + if (peg$silentFails === 0) { peg$fail(peg$e59); } } if (s1 === peg$FAILED) { - if (input.substr(peg$currPos, 10) === peg$c31) { - s1 = peg$c31; + if (input.substr(peg$currPos, 10) === peg$c32) { + s1 = peg$c32; peg$currPos += 10; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e37); } + if (peg$silentFails === 0) { peg$fail(peg$e38); } } if (s1 === peg$FAILED) { - if (input.substr(peg$currPos, 11) === peg$c34) { - s1 = peg$c34; + if (input.substr(peg$currPos, 11) === peg$c35) { + s1 = peg$c35; peg$currPos += 11; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e40); } + if (peg$silentFails === 0) { peg$fail(peg$e41); } } if (s1 === peg$FAILED) { - if (input.substr(peg$currPos, 12) === peg$c32) { - s1 = peg$c32; + if (input.substr(peg$currPos, 12) === peg$c33) { + s1 = peg$c33; peg$currPos += 12; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e38); } + if (peg$silentFails === 0) { peg$fail(peg$e39); } } if (s1 === peg$FAILED) { - if (input.substr(peg$currPos, 17) === peg$c33) { - s1 = peg$c33; + if (input.substr(peg$currPos, 17) === peg$c34) { + s1 = peg$c34; peg$currPos += 17; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e39); } + if (peg$silentFails === 0) { peg$fail(peg$e40); } } if (s1 === peg$FAILED) { - if (input.substr(peg$currPos, 4) === peg$c30) { - s1 = peg$c30; + if (input.substr(peg$currPos, 4) === peg$c31) { + s1 = peg$c31; peg$currPos += 4; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e36); } + if (peg$silentFails === 0) { peg$fail(peg$e37); } } if (s1 === peg$FAILED) { - if (input.substr(peg$currPos, 5) === peg$c35) { - s1 = peg$c35; + if (input.substr(peg$currPos, 5) === peg$c36) { + s1 = peg$c36; peg$currPos += 5; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e41); } + if (peg$silentFails === 0) { peg$fail(peg$e42); } } if (s1 === peg$FAILED) { - if (input.substr(peg$currPos, 8) === peg$c27) { - s1 = peg$c27; + if (input.substr(peg$currPos, 8) === peg$c28) { + s1 = peg$c28; peg$currPos += 8; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e33); } + if (peg$silentFails === 0) { peg$fail(peg$e34); } } if (s1 === peg$FAILED) { - if (input.substr(peg$currPos, 6) === peg$c22) { - s1 = peg$c22; + if (input.substr(peg$currPos, 6) === peg$c23) { + s1 = peg$c23; peg$currPos += 6; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e28); } + if (peg$silentFails === 0) { peg$fail(peg$e29); } } if (s1 === peg$FAILED) { - if (input.substr(peg$currPos, 9) === peg$c25) { - s1 = peg$c25; + if (input.substr(peg$currPos, 9) === peg$c26) { + s1 = peg$c26; peg$currPos += 9; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e31); } + if (peg$silentFails === 0) { peg$fail(peg$e32); } } if (s1 === peg$FAILED) { - if (input.substr(peg$currPos, 5) === peg$c26) { - s1 = peg$c26; + if (input.substr(peg$currPos, 5) === peg$c27) { + s1 = peg$c27; peg$currPos += 5; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e32); } + if (peg$silentFails === 0) { peg$fail(peg$e33); } } if (s1 === peg$FAILED) { - if (input.substr(peg$currPos, 5) === peg$c16) { - s1 = peg$c16; + if (input.substr(peg$currPos, 5) === peg$c17) { + s1 = peg$c17; peg$currPos += 5; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e22); } + if (peg$silentFails === 0) { peg$fail(peg$e23); } } if (s1 === peg$FAILED) { - if (input.substr(peg$currPos, 6) === peg$c17) { - s1 = peg$c17; + if (input.substr(peg$currPos, 6) === peg$c18) { + s1 = peg$c18; peg$currPos += 6; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e23); } + if (peg$silentFails === 0) { peg$fail(peg$e24); } } if (s1 === peg$FAILED) { - if (input.substr(peg$currPos, 4) === peg$c19) { - s1 = peg$c19; + if (input.substr(peg$currPos, 4) === peg$c20) { + s1 = peg$c20; peg$currPos += 4; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e25); } + if (peg$silentFails === 0) { peg$fail(peg$e26); } } if (s1 === peg$FAILED) { - if (input.substr(peg$currPos, 6) === peg$c20) { - s1 = peg$c20; + if (input.substr(peg$currPos, 6) === peg$c21) { + s1 = peg$c21; peg$currPos += 6; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e26); } + if (peg$silentFails === 0) { peg$fail(peg$e27); } } if (s1 === peg$FAILED) { - if (input.substr(peg$currPos, 8) === peg$c18) { - s1 = peg$c18; + if (input.substr(peg$currPos, 8) === peg$c19) { + s1 = peg$c19; peg$currPos += 8; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e24); } + if (peg$silentFails === 0) { peg$fail(peg$e25); } } if (s1 === peg$FAILED) { - if (input.substr(peg$currPos, 4) === peg$c24) { - s1 = peg$c24; + if (input.substr(peg$currPos, 4) === peg$c25) { + s1 = peg$c25; peg$currPos += 4; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e30); } + if (peg$silentFails === 0) { peg$fail(peg$e31); } } if (s1 === peg$FAILED) { - if (input.substr(peg$currPos, 4) === peg$c69) { - s1 = peg$c69; + if (input.substr(peg$currPos, 4) === peg$c70) { + s1 = peg$c70; peg$currPos += 4; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e87); } + if (peg$silentFails === 0) { peg$fail(peg$e88); } } if (s1 === peg$FAILED) { - if (input.substr(peg$currPos, 5) === peg$c70) { - s1 = peg$c70; + if (input.substr(peg$currPos, 5) === peg$c71) { + s1 = peg$c71; peg$currPos += 5; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e88); } + if (peg$silentFails === 0) { peg$fail(peg$e89); } } if (s1 === peg$FAILED) { - if (input.substr(peg$currPos, 3) === peg$c63) { - s1 = peg$c63; + if (input.substr(peg$currPos, 3) === peg$c64) { + s1 = peg$c64; peg$currPos += 3; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e72); } + if (peg$silentFails === 0) { peg$fail(peg$e73); } } if (s1 === peg$FAILED) { - if (input.substr(peg$currPos, 6) === peg$c12) { - s1 = peg$c12; + if (input.substr(peg$currPos, 6) === peg$c13) { + s1 = peg$c13; peg$currPos += 6; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e16); } + if (peg$silentFails === 0) { peg$fail(peg$e17); } } if (s1 === peg$FAILED) { - if (input.substr(peg$currPos, 6) === peg$c15) { - s1 = peg$c15; + if (input.substr(peg$currPos, 6) === peg$c16) { + s1 = peg$c16; peg$currPos += 6; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e21); } + if (peg$silentFails === 0) { peg$fail(peg$e22); } } if (s1 === peg$FAILED) { - if (input.substr(peg$currPos, 2) === peg$c58) { - s1 = peg$c58; + if (input.substr(peg$currPos, 2) === peg$c59) { + s1 = peg$c59; peg$currPos += 2; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e64); } + if (peg$silentFails === 0) { peg$fail(peg$e65); } } } } @@ -4936,7 +4951,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e92); } + if (peg$silentFails === 0) { peg$fail(peg$e93); } } peg$silentFails--; if (s3 === peg$FAILED) { @@ -4988,7 +5003,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e93); } + if (peg$silentFails === 0) { peg$fail(peg$e94); } } while (s1 !== peg$FAILED) { s0.push(s1); @@ -4997,7 +5012,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e93); } + if (peg$silentFails === 0) { peg$fail(peg$e94); } } } @@ -5035,7 +5050,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e94); } + if (peg$silentFails === 0) { peg$fail(peg$e95); } } return s0; @@ -5045,12 +5060,12 @@ function peg$parse(input, options) { let s0, s1, s2, s3, s4, s5; s0 = peg$currPos; - if (input.substr(peg$currPos, 2) === peg$c71) { - s1 = peg$c71; + if (input.substr(peg$currPos, 2) === peg$c72) { + s1 = peg$c72; peg$currPos += 2; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e95); } + if (peg$silentFails === 0) { peg$fail(peg$e96); } } if (s1 !== peg$FAILED) { s2 = []; @@ -5059,7 +5074,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e96); } + if (peg$silentFails === 0) { peg$fail(peg$e97); } } while (s3 !== peg$FAILED) { s2.push(s3); @@ -5068,7 +5083,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e96); } + if (peg$silentFails === 0) { peg$fail(peg$e97); } } } s1 = [s1, s2]; @@ -5079,24 +5094,24 @@ function peg$parse(input, options) { } if (s0 === peg$FAILED) { s0 = peg$currPos; - if (input.substr(peg$currPos, 2) === peg$c72) { - s1 = peg$c72; + if (input.substr(peg$currPos, 2) === peg$c73) { + s1 = peg$c73; peg$currPos += 2; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e97); } + if (peg$silentFails === 0) { peg$fail(peg$e98); } } if (s1 !== peg$FAILED) { s2 = []; s3 = peg$currPos; s4 = peg$currPos; peg$silentFails++; - if (input.substr(peg$currPos, 2) === peg$c73) { - s5 = peg$c73; + if (input.substr(peg$currPos, 2) === peg$c74) { + s5 = peg$c74; peg$currPos += 2; } else { s5 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e98); } + if (peg$silentFails === 0) { peg$fail(peg$e99); } } peg$silentFails--; if (s5 === peg$FAILED) { @@ -5111,7 +5126,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s5 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e79); } + if (peg$silentFails === 0) { peg$fail(peg$e80); } } if (s5 !== peg$FAILED) { s4 = [s4, s5]; @@ -5129,12 +5144,12 @@ function peg$parse(input, options) { s3 = peg$currPos; s4 = peg$currPos; peg$silentFails++; - if (input.substr(peg$currPos, 2) === peg$c73) { - s5 = peg$c73; + if (input.substr(peg$currPos, 2) === peg$c74) { + s5 = peg$c74; peg$currPos += 2; } else { s5 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e98); } + if (peg$silentFails === 0) { peg$fail(peg$e99); } } peg$silentFails--; if (s5 === peg$FAILED) { @@ -5149,7 +5164,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s5 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e79); } + if (peg$silentFails === 0) { peg$fail(peg$e80); } } if (s5 !== peg$FAILED) { s4 = [s4, s5]; @@ -5163,12 +5178,12 @@ function peg$parse(input, options) { s3 = peg$FAILED; } } - if (input.substr(peg$currPos, 2) === peg$c73) { - s3 = peg$c73; + if (input.substr(peg$currPos, 2) === peg$c74) { + s3 = peg$c74; peg$currPos += 2; } else { s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e98); } + if (peg$silentFails === 0) { peg$fail(peg$e99); } } if (s3 !== peg$FAILED) { s1 = [s1, s2, s3]; diff --git a/src/runtime/DSLRuntime.js b/src/runtime/DSLRuntime.js index 2d573da..9dfe38f 100644 --- a/src/runtime/DSLRuntime.js +++ b/src/runtime/DSLRuntime.js @@ -103,7 +103,8 @@ export class DSLRuntime { fields: [...fields.entries()].map(([fieldName, f]) => ({ name: fieldName, type: f.type, - isArray: f.isArray + isArray: f.isArray, + required: f.required !== false })) })); const facts = [...this.relations.entries()] @@ -132,7 +133,7 @@ export class DSLRuntime { for (const def of this.program.definitions || []) { const fields = new Map(); for (const field of def.fields || []) { - fields.set(field.name, { type: field.fieldType, isArray: !!field.isArray }); + fields.set(field.name, { type: field.fieldType, isArray: !!field.isArray, required: field.required !== false }); } this.types.set(def.name, { fields }); } @@ -302,7 +303,7 @@ export class DSLRuntime { const b = behavior.behavior || behavior; if (b && b.behaviorType === 'ttl' && b.duration) { const n = parseInt(String(b.duration.value), 10); - const mult = { h: 3600_000, d: 86_400_000, w: 604_800_000, m: 60_000 }[b.duration.unit]; + const mult = { s: 1000, m: 60_000, h: 3600_000, d: 86_400_000, w: 604_800_000 }[b.duration.unit]; if (!Number.isNaN(n) && mult) return n * mult; } return null; @@ -313,30 +314,59 @@ export class DSLRuntime { * array of edge objects) into an array of partial-graph edge objects. The * destination follows the DSL fact's declared shape: unary and value-carrying * facts are self-edges on the subject; binary entity facts go subject → object. + * Provider-returned edges are validated against the fact's declared typing: + * a value-carrying fact must return an object with a value of the declared + * type, and possibilities must be in [0, 1]. A violation throws — it is a + * provider-authoring error, not a denial. */ - _normalizeProviderEdges(result, factMeta, user, object) { + _normalizeProviderEdges(result, factMeta, fact, user, object) { const edges = Array.isArray(result) ? result : [result]; const secondParamType = factMeta.params[1] && factMeta.params[1].type; - const defaultDst = factMeta.params.length >= 2 && this._isValueType(secondParamType) - ? user - : (factMeta.params.length >= 2 ? object : user); + const isValueFact = factMeta.params.length >= 2 && this._isValueType(secondParamType); + const defaultDst = isValueFact ? user : (factMeta.params.length >= 2 ? object : user); + const label = `provider for '${fact}'`; const out = []; for (const edge of edges) { const normalized = typeof edge === 'boolean' || typeof edge === 'number' - ? { src: user, dst: defaultDst, possibility: edge === true ? 1 : edge } - : { - ...(edge.relation ? { relation: edge.relation } : {}), - src: edge.src ?? user, - dst: edge.dst ?? defaultDst, - possibility: edge.possibility ?? 1, - ...(edge.value !== undefined ? { value: edge.value } : {}), - ...(edge.reliability !== undefined ? { reliability: edge.reliability } : {}) - }; + ? (() => { + if (isValueFact) { + throw new Error(`DSLRuntime: ${label} is a value-carrying fact — return { value, possibility } (got a bare ${typeof edge === 'number' ? 'number' : 'boolean'})`); + } + const possibility = edge === true ? 1 : edge; + this._checkPossibility(possibility, label); + return { src: user, dst: defaultDst, possibility }; + })() + : (() => { + const possibility = edge.possibility ?? 1; + this._checkPossibility(possibility, label); + if (edge.value !== undefined) { + if (!isValueFact) { + throw new Error(`DSLRuntime: ${label} returned a value for a non-value fact '${fact}'`); + } + this._checkScalarValue(secondParamType, edge.value, `${label}.value`); + } else if (isValueFact) { + throw new Error(`DSLRuntime: ${label} must supply a 'value' of type ${secondParamType}`); + } + return { + ...(edge.relation ? { relation: edge.relation } : {}), + src: edge.src ?? user, + dst: edge.dst ?? defaultDst, + possibility, + ...(edge.value !== undefined ? { value: edge.value } : {}), + ...(edge.reliability !== undefined ? { reliability: edge.reliability } : {}) + }; + })(); out.push(normalized); } return out; } + _checkPossibility(possibility, label) { + if (typeof possibility !== 'number' || !Number.isFinite(possibility) || possibility < 0 || possibility > 1) { + throw new Error(`DSLRuntime: ${label} returned invalid possibility ${possibility} (expected a number in [0, 1])`); + } + } + // --------------------------------------------------------------------------- // Schema validation helpers // --------------------------------------------------------------------------- @@ -405,6 +435,11 @@ export class DSLRuntime { if (this.types.has(typeName)) { const { fields } = this.types.get(typeName); for (const [name, field] of fields) { + // Required fields must be present on insert (`field: type` in the DSL; + // `field?: type` marks a field optional). + if (field.required && data[name] === undefined) { + throw new Error(`DSLRuntime: missing required field '${typeName}.${name}' on node insert`); + } if (data[name] !== undefined) this._checkFieldValue(field, data[name], `${typeName}.${name}`); } } else if (this.strictTypes) { @@ -634,7 +669,7 @@ export class DSLRuntime { satisfied.add(fact); continue; } - edges = this._normalizeProviderEdges(result, factMeta, user, object); + edges = this._normalizeProviderEdges(result, factMeta, fact, user, object); if (cachingEnabled && !isPerCheckOverride) this._providerCacheSet(fact, user, object, edges); } else { missingFacts.push({ relation: fact, reason: 'no_provider' }); diff --git a/tests/DSLRuntime.test.js b/tests/DSLRuntime.test.js index b03f41f..7ab24b8 100644 --- a/tests/DSLRuntime.test.js +++ b/tests/DSLRuntime.test.js @@ -20,9 +20,9 @@ import { Arbiter } from '@arbiter/core'; import { DSLRuntime } from '../src/runtime/DSLRuntime.js'; const BASE_DSL = ` - definition Employee { id: string level: number active: boolean } - definition Group { id: string } - definition Doc { id: string } + definition Employee { id: string? level: number? active: boolean? } + definition Group { id: string? } + definition Doc { id: string? } fact member_of(user: Employee, group: Group) fact *owns(user: Employee, doc: Doc) fact *user_score(user: Employee, value: number) @@ -164,8 +164,8 @@ describe('DSLRuntime', () => { it('derives transitive required facts through evidence composition', async () => { const dsl = ` - definition Employee { id: string } - definition Doc { id: string } + definition Employee { id: string? } + definition Doc { id: string? } fact *owns(user: Employee, doc: Doc) fact *banned(user: Employee) evidence can_read(user: Employee, doc: Doc) { owns(user, doc) } @@ -191,9 +191,9 @@ describe('DSLRuntime', () => { it('derives transitive required facts through a condition-step chain', () => { const dsl = ` - definition Employee { id: string } - definition Group { id: string } - definition Doc { id: string } + definition Employee { id: string? } + definition Group { id: string? } + definition Doc { id: string? } fact *member_of(user: Employee, group: Group) fact *can_view(group: Group, doc: Doc) fact *banned(group: Group) diff --git a/tests/DSLRuntimeCache.test.js b/tests/DSLRuntimeCache.test.js index 74af5bb..7dadf2d 100644 --- a/tests/DSLRuntimeCache.test.js +++ b/tests/DSLRuntimeCache.test.js @@ -14,8 +14,8 @@ import { Arbiter } from '@arbiter/core'; import { DSLRuntime } from '../src/runtime/DSLRuntime.js'; const BASE_DSL = ` - definition Employee { id: string } - definition Doc { id: string } + definition Employee { id: string? } + definition Doc { id: string? } fact *owns(user: Employee, doc: Doc) evidence can_read(user: Employee, doc: Doc) { owns(user, doc) } `; @@ -102,8 +102,8 @@ describe('DSLRuntime provider-result caching', () => { it('invalidateProviderCache() clears all or per relation', async () => { const dsl = ` - definition Employee { id: string } - definition Doc { id: string } + definition Employee { id: string? } + definition Doc { id: string? } fact *owns(user: Employee, doc: Doc) fact *banned(user: Employee) evidence can_read(user: Employee, doc: Doc) { owns(user, doc) } @@ -151,8 +151,8 @@ describe('DSLRuntime provider-result caching', () => { it('uses the DSL-declared fact TTL (BEHAVES { ttl X })', async () => { const dsl = ` - definition Employee { id: string } - definition Doc { id: string } + definition Employee { id: string? } + definition Doc { id: string? } fact *balance(user: Employee, amount: number) BEHAVES { ttl 1h } evidence can_spend(user: Employee, doc: Doc) { balance(user, 1) } `; diff --git a/tests/DSLRuntimeExt.test.js b/tests/DSLRuntimeExt.test.js index 260338f..37f03ce 100644 --- a/tests/DSLRuntimeExt.test.js +++ b/tests/DSLRuntimeExt.test.js @@ -14,8 +14,8 @@ import { Arbiter } from '@arbiter/core'; import { DSLRuntime } from '../src/runtime/DSLRuntime.js'; const BASE_DSL = ` - definition Employee { id: string level: number active: boolean } - definition Doc { id: string created: timestamp } + definition Employee { id: string? level: number? active: boolean? } + definition Doc { id: string? created: timestamp? } fact *owns(user: Employee, doc: Doc) fact *banned(user: Employee) evidence can_read(user: Employee, doc: Doc) { owns(user, doc) } @@ -73,8 +73,8 @@ describe('DSLRuntime extended', () => { // edge for a DIFFERENT injectable fact that can_open also requires via // composition — here we add a transitive requirement to prove the loop. const dsl = ` - definition Employee { id: string } - definition Doc { id: string } + definition Employee { id: string? } + definition Doc { id: string? } fact *owns(user: Employee, doc: Doc) fact *granted(user: Employee, doc: Doc) evidence base_read(user: Employee, doc: Doc) { owns(user, doc) } diff --git a/tests/DSLRuntimeTyping.test.js b/tests/DSLRuntimeTyping.test.js new file mode 100644 index 0000000..8120ab0 --- /dev/null +++ b/tests/DSLRuntimeTyping.test.js @@ -0,0 +1,96 @@ +/** + * tests/DSLRuntimeTyping.test.js — duration seconds, required fields, and + * type validation of insertions / updates / provider retrievals. + * + * - Duration literals now accept s/m/h/d/w: `BEHAVES { ttl 30s }` is 30s. + * - Definition fields are REQUIRED by default (`field: type`); `field: type?` + * marks a field optional. addNode enforces presence on insert. + * - Provider-returned edges are validated against the fact's declared typing: + * a value-carrying fact must return { value, possibility } with a value of + * the declared type, and possibilities must lie in [0, 1]. + */ +import { describe, it } from 'node:test'; +import assert from 'node:assert/strict'; +import { Arbiter } from '@arbiter/core'; +import { DSLRuntime } from '../src/runtime/DSLRuntime.js'; + +describe('DSLRuntime typing', () => { + it('accepts seconds/minutes/hours/days/weeks in duration literals', async () => { + const dsl = ` + definition Employee { id: string? } + definition Doc { id: string? } + fact *a(user: Employee, amount: number) BEHAVES { ttl 30s } + fact *b(user: Employee, amount: number) BEHAVES { ttl 2m } + fact *c(user: Employee, amount: number) BEHAVES { ttl 1h } + fact *d(user: Employee, amount: number) BEHAVES { ttl 3d } + fact *e(user: Employee, amount: number) BEHAVES { ttl 1w } + `; + const rt = new DSLRuntime(new Arbiter()).compile(dsl, 'rt-units'); + assert.equal(rt.relations.get('a').ttlMs, 30_000); + assert.equal(rt.relations.get('b').ttlMs, 120_000); + assert.equal(rt.relations.get('c').ttlMs, 3_600_000); + assert.equal(rt.relations.get('d').ttlMs, 259_200_000); + assert.equal(rt.relations.get('e').ttlMs, 604_800_000); + }); + + it('enforces required definition fields on node insert', () => { + const rt = new DSLRuntime(new Arbiter()).compile(` + definition Employee { id: string level: number active: boolean? } + `, 'rt-req'); + // id and level are required (no `?`); active is optional. + assert.throws(() => rt.addNode('u:1', 'Employee', { level: 3 }), /missing required field 'Employee.id'/); + assert.throws(() => rt.addNode('u:2', 'Employee', { id: 'u:2' }), /missing required field 'Employee.level'/); + rt.addNode('u:3', 'Employee', { id: 'u:3', level: 5 }); // both required, no active -> ok + rt.addNode('u:4', 'Employee', { id: 'u:4', level: 5, active: true }); + }); + + it('exposes requiredness in the schema snapshot', () => { + const rt = new DSLRuntime(new Arbiter()).compile(` + definition Employee { id: string level: number? } + `, 'rt-schema-req'); + const employee = rt.getSchema().types.find(t => t.name === 'Employee'); + assert.equal(employee.fields.find(f => f.name === 'id').required, true); + assert.equal(employee.fields.find(f => f.name === 'level').required, false); + }); + + it('validates a provider-returned value against the declared value type', async () => { + const rt = new DSLRuntime(new Arbiter()).compile(` + definition Employee { id: string? } + definition Doc { id: string? } + fact *balance(user: Employee, amount: number) + evidence can_spend(user: Employee, doc: Doc) { balance(user, 1) } + `, 'rt-valuetype'); + rt.addNode('u:1', 'Employee', {}); + rt.addNode('doc:9', 'Doc', {}); + rt.registerFact('balance', async () => ({ possibility: 1.0, value: 'high' })); + await assert.rejects(() => rt.check('u:1', 'can_spend', 'doc:9'), /must be number/); + }); + + it('requires a value for a value-carrying fact (no bare-number shorthand)', async () => { + const rt = new DSLRuntime(new Arbiter()).compile(` + definition Employee { id: string? } + definition Doc { id: string? } + fact *balance(user: Employee, amount: number) + evidence can_spend(user: Employee, doc: Doc) { balance(user, 1) } + `, 'rt-valshape'); + rt.addNode('u:1', 'Employee', {}); + rt.addNode('doc:9', 'Doc', {}); + rt.registerFact('balance', async () => 0.9); + await assert.rejects(() => rt.check('u:1', 'can_spend', 'doc:9'), /value-carrying fact/); + rt.registerFact('balance', async () => ({ possibility: 1.0 })); // missing value + await assert.rejects(() => rt.check('u:1', 'can_spend', 'doc:9'), /must supply a 'value'/); + }); + + it('rejects a provider-returned possibility outside [0, 1]', async () => { + const rt = new DSLRuntime(new Arbiter()).compile(` + definition Employee { id: string? } + definition Doc { id: string? } + fact *owns(user: Employee, doc: Doc) + evidence can_read(user: Employee, doc: Doc) { owns(user, doc) } + `, 'rt-poss'); + rt.addNode('u:1', 'Employee', {}); + rt.addNode('doc:9', 'Doc', {}); + rt.registerFact('owns', async () => ({ possibility: 2.0 })); + await assert.rejects(() => rt.check('u:1', 'can_read', 'doc:9'), /invalid possibility/); + }); +});