diff --git a/lde/src/experimental/parsers/lurch-to-tex-trace.js b/lde/src/experimental/parsers/lurch-to-tex-trace.js index 8b632cdf..a5a1aeef 100644 --- a/lde/src/experimental/parsers/lurch-to-tex-trace.js +++ b/lde/src/experimental/parsers/lurch-to-tex-trace.js @@ -873,94 +873,96 @@ function peg$parse(input, options) { var peg$f3 = function(a) { return txt(a) }; var peg$f4 = function() { return '~\\equiv~' }; var peg$f5 = function() { return 'Substitution' }; - var peg$f6 = function(a) { return `\\left\\{ ${a} \\right\\}` }; - var peg$f7 = function(a, b) { return `${txt(a)} ${b}` }; - var peg$f8 = function(body, a, b) { return `${body}\\text{ for some }${a}\\in ${b}` }; - var peg$f9 = function(body, a) { return `${body}\\text{ for some }${a}` }; - var peg$f10 = function(a, b, c) { return `${txt(a)}${b}\\in ${c}` }; - var peg$f11 = function(a, b, c) { return `${txt(a)}${b}\\text{ be such that }${c}` }; - var peg$f12 = function(a, b, c) { return `${txt(a)}${b}\\text{ such that }${c}` }; - var peg$f13 = function(a, b) { return `${txt(a)}${b}` }; - var peg$f14 = function(a) {return sequence(a.map(x=>(x=='cdot /'?'/':x))) }; - var peg$f15 = function(a) { return sequence(a) }; - var peg$f16 = function(b) { return `\\forall ${b}` }; - var peg$f17 = function(b) { return `\\exists ${b}` }; - var peg$f18 = function(b) { return `\\exists! ${b}` }; - var peg$f19 = function(a, b) { return `${a}.\\, ${b}` }; - var peg$f20 = function(a, b) { return `${a}\\mapsto ${b}` }; - var peg$f21 = function(a) { return a.join('\\Leftrightarrow ') }; - var peg$f22 = function(a) { return a.join('\\Rightarrow ') }; - var peg$f23 = function(a) { return a.join('\\text{ or }') }; - var peg$f24 = function(a) { return a.join('\\text{ and }') }; - var peg$f25 = function(b) { return '\\text{not } '+b }; - var peg$f26 = function(a, b, c) { return `${a}\\colon ${b}\\to ${c}` }; - var peg$f27 = function(a, b) { return `${a}\\text{ is a partition of }${b}` }; - var peg$f28 = function(a, b) { return `${a}\\text{ is a relation on} ${b}` }; - var peg$f29 = function(a, b, c) { return `${a}\\underset{${c}}{\\equiv}${b}` }; - var peg$f30 = function(a, c, b) { return `${a}\\underset{${c}}{\\equiv}${b}` }; - var peg$f31 = function(a) { return a.join('\\subseteq ') }; - var peg$f32 = function(a, b) { return `${a}\\notin ${b}` }; - var peg$f33 = function(a, b) { return `${a}\\in ${b}` }; - var peg$f34 = function(a, b) { return `${a}\\mid ${b}` }; - var peg$f35 = function(a) { return a.join('\\leq ') }; - var peg$f36 = function(a) { return a.join('\\lt ') }; - var peg$f37 = function(a, b) { return `${a}\\neq ${b}` }; - var peg$f38 = function(a) { return a.join('\\sim ') }; - var peg$f39 = function(a) { return texEquation(a) }; - var peg$f40 = function(a, b, c) { return `${a}${txt(' '+b)}${c}` }; - var peg$f41 = function(a, b, c) { return `${a}${txt(' '+b)}${c}` }; - var peg$f42 = function(a, b, c) { return (b.length==4) + var peg$f6 = function(a, b) { return `${txt(a)} ${sequence(b)}` }; + var peg$f7 = function(a) { return `${txt(a) }`}; + var peg$f8 = function(a) { return `\\left\\{ ${a} \\right\\}` }; + var peg$f9 = function(a, b) { return `${txt(a)} ${b}` }; + var peg$f10 = function(body, a, b) { return `${body}\\text{ for some }${a}\\in ${b}` }; + var peg$f11 = function(body, a) { return `${body}\\text{ for some }${a}` }; + var peg$f12 = function(a, b, c) { return `${txt(a)}${b}\\in ${c}` }; + var peg$f13 = function(a, b, c) { return `${txt(a)}${b}\\text{ be such that }${c}` }; + var peg$f14 = function(a, b, c) { return `${txt(a)}${b}\\text{ such that }${c}` }; + var peg$f15 = function(a, b) { return `${txt(a)}${b}` }; + var peg$f16 = function(a) {return sequence(a.map(x=>(x=='cdot /'?'/':x))) }; + var peg$f17 = function(a) { return sequence(a) }; + var peg$f18 = function(b) { return `\\forall ${b}` }; + var peg$f19 = function(b) { return `\\exists ${b}` }; + var peg$f20 = function(b) { return `\\exists! ${b}` }; + var peg$f21 = function(a, b) { return `${a}.\\, ${b}` }; + var peg$f22 = function(a, b) { return `${a}\\mapsto ${b}` }; + var peg$f23 = function(a) { return a.join('\\Leftrightarrow ') }; + var peg$f24 = function(a) { return a.join('\\Rightarrow ') }; + var peg$f25 = function(a) { return a.join('\\text{ or }') }; + var peg$f26 = function(a) { return a.join('\\text{ and }') }; + var peg$f27 = function(b) { return '\\text{not } '+b }; + var peg$f28 = function(a, b, c) { return `${a}\\colon ${b}\\to ${c}` }; + var peg$f29 = function(a, b) { return `${a}\\text{ is a partition of }${b}` }; + var peg$f30 = function(a, b) { return `${a}\\text{ is a relation on} ${b}` }; + var peg$f31 = function(a, b, c) { return `${a}\\underset{${c}}{\\equiv}${b}` }; + var peg$f32 = function(a, c, b) { return `${a}\\underset{${c}}{\\equiv}${b}` }; + var peg$f33 = function(a) { return a.join('\\subseteq ') }; + var peg$f34 = function(a, b) { return `${a}\\notin ${b}` }; + var peg$f35 = function(a, b) { return `${a}\\in ${b}` }; + var peg$f36 = function(a, b) { return `${a}\\mid ${b}` }; + var peg$f37 = function(a) { return a.join('\\leq ') }; + var peg$f38 = function(a) { return a.join('\\lt ') }; + var peg$f39 = function(a, b) { return `${a}\\neq ${b}` }; + var peg$f40 = function(a) { return a.join('\\sim ') }; + var peg$f41 = function(a) { return texEquation(a) }; + var peg$f42 = function(a, b, c) { return `${a}${txt(' '+b)}${c}` }; + var peg$f43 = function(a, b, c) { return `${a}${txt(' '+b)}${c}` }; + var peg$f44 = function(a, b, c) { return (b.length==4) ? `${a}\\text{ ${b[0]} }${txt(b[2])}${c}` : `${a}\\text{ ${b[0]} }${c}` }; - var peg$f43 = function(a) { return a.join('\\setminus ') }; - var peg$f44 = function(a) { return a.join('\\times ') }; - var peg$f45 = function(a) { return a.join('\\cup ') }; - var peg$f46 = function(a) { return a.join('\\cap ') }; - var peg$f47 = function(a) { return a.join('\\circ ') }; - var peg$f48 = function(k, a, f) { return union(f,k,a) }; - var peg$f49 = function(f, k, a) { return union(f,k,a) }; - var peg$f50 = function(f, k, a) { return summation(f,k,a) }; - var peg$f51 = function(k, a, f) { return intersect(f,k,a) }; - var peg$f52 = function(f, k, a) { return intersect(f,k,a) }; - var peg$f53 = function(f, k, a) { return intersect(f,k,a) }; - var peg$f54 = function(a, b) { return `\\binom{${nopar(a)}}{${nopar(b)}}` }; - var peg$f55 = function(a, b) { return texSum(a,b) }; - var peg$f56 = function(k, a, b, f) { return summation(f,k,a,b) }; - var peg$f57 = function(k, a, b, f) { return summation(f,k,a,b) }; - var peg$f58 = function(f, k, a, b) { return summation(f,k,a,b) }; - var peg$f59 = function(f, k, a, b) { return summation(f,k,a,b) }; - var peg$f60 = function(a) { return texProduct(a) }; - var peg$f61 = function(a) { return '/'+a }; - var peg$f62 = function(a) { return '-'+a }; - var peg$f63 = function(a) { return a+'!' }; - var peg$f64 = function(a) { return `{${a}}'` }; - var peg$f65 = function(a, b) { return `\\left(${a},${b}\\right)` }; - var peg$f66 = function(a, b) { return `\\mathcal{${a}}\\left(${b}\\right)` }; - var peg$f67 = function(a, b) { return `\\left\\{\\,${a}:\\,${b}\\right\\}` }; - var peg$f68 = function(a) { return `\\left\\{\\,${a}\\,\\right\\}` }; - var peg$f69 = function(a) { return `\\left[${a}\\right]` }; - var peg$f70 = function(a, b) { return `\\left[${a}\\right]_{${b}}` }; - var peg$f71 = function(b) { return `\\left\\langle\\,${b}\\,\\right\\rangle` }; - var peg$f72 = function(a, b) { return texPrefix(a,b) }; - var peg$f73 = function(a, b) { return `{${a}}^{${nopar(b)}}` }; - var peg$f74 = function(a) { return texJoin('\\star ',a) }; - var peg$f75 = function(a) { return `\\left[\\begin{matrix}\n ${ + var peg$f45 = function(a) { return a.join('\\setminus ') }; + var peg$f46 = function(a) { return a.join('\\times ') }; + var peg$f47 = function(a) { return a.join('\\cup ') }; + var peg$f48 = function(a) { return a.join('\\cap ') }; + var peg$f49 = function(a) { return a.join('\\circ ') }; + var peg$f50 = function(k, a, f) { return union(f,k,a) }; + var peg$f51 = function(f, k, a) { return union(f,k,a) }; + var peg$f52 = function(f, k, a) { return summation(f,k,a) }; + var peg$f53 = function(k, a, f) { return intersect(f,k,a) }; + var peg$f54 = function(f, k, a) { return intersect(f,k,a) }; + var peg$f55 = function(f, k, a) { return intersect(f,k,a) }; + var peg$f56 = function(a, b) { return `\\binom{${nopar(a)}}{${nopar(b)}}` }; + var peg$f57 = function(a, b) { return texSum(a,b) }; + var peg$f58 = function(k, a, b, f) { return summation(f,k,a,b) }; + var peg$f59 = function(k, a, b, f) { return summation(f,k,a,b) }; + var peg$f60 = function(f, k, a, b) { return summation(f,k,a,b) }; + var peg$f61 = function(f, k, a, b) { return summation(f,k,a,b) }; + var peg$f62 = function(a) { return texProduct(a) }; + var peg$f63 = function(a) { return '/'+a }; + var peg$f64 = function(a) { return '-'+a }; + var peg$f65 = function(a) { return a+'!' }; + var peg$f66 = function(a) { return `{${a}}'` }; + var peg$f67 = function(a, b) { return `\\left(${a},${b}\\right)` }; + var peg$f68 = function(a, b) { return `\\mathcal{${a}}\\left(${b}\\right)` }; + var peg$f69 = function(a, b) { return `\\left\\{\\,${a}:\\,${b}\\right\\}` }; + var peg$f70 = function(a) { return `\\left\\{\\,${a}\\,\\right\\}` }; + var peg$f71 = function(a) { return `\\left[${a}\\right]` }; + var peg$f72 = function(a, b) { return `\\left[${a}\\right]_{${b}}` }; + var peg$f73 = function(b) { return `\\left\\langle\\,${b}\\,\\right\\rangle` }; + var peg$f74 = function(a, b) { return texPrefix(a,b) }; + var peg$f75 = function(a, b) { return `{${a}}^{${nopar(b)}}` }; + var peg$f76 = function(a) { return texJoin('\\star ',a) }; + var peg$f77 = function(a) { return `\\left[\\begin{matrix}\n ${ a.map( s => s.replace(/,/g, ' & ') .replace(/\\left\\langle{|}\\right\\rangle/g,'')) .join(' \\\\\n ')}\n\\end{matrix}\\right]` }; - var peg$f76 = function(a) { return `\\left\\langle{${a}}\\right\\rangle` }; - var peg$f77 = function(a) { return `\\left\\langle{${a}}\\right\\rangle` }; - var peg$f78 = function(a, b) { return `\\left\\{\\,${a}:\\,${b}\\right\\}` }; - var peg$f79 = function(a) { return `\\left\\{\\,${a}\\,\\right\\}` }; - var peg$f80 = function(a) { return a }; - var peg$f81 = function(a) { + var peg$f78 = function(a) { return `\\left\\langle{${a}}\\right\\rangle` }; + var peg$f79 = function(a) { return `\\left\\langle{${a}}\\right\\rangle` }; + var peg$f80 = function(a, b) { return `\\left\\{\\,${a}:\\,${b}\\right\\}` }; + var peg$f81 = function(a) { return `\\left\\{\\,${a}\\,\\right\\}` }; + var peg$f82 = function(a) { return a }; + var peg$f83 = function(a) { // we have to check for ~ as a special case (see above) return (a === '\\sim') ? a : `\\left(${a}\\right)` }; - var peg$f82 = function(a) { return texsymbol(a) }; - var peg$f83 = function(a) { let b = texsymbol(a[0]+a[1].join('')) + var peg$f84 = function(a) { return texsymbol(a) }; + var peg$f85 = function(a) { let b = texsymbol(a[0]+a[1].join('')) return (b.length>1 && !b.startsWith('\\')) ? `\\text{${b}}` : b }; - var peg$f84 = function() { return undefined }; + var peg$f86 = function() { return undefined }; var peg$currPos = 0; var peg$savedPos = 0; var peg$posDetailsCache = [{ line: 1, column: 1 }]; @@ -1135,7 +1137,7 @@ function peg$parse(input, options) { location: peg$computeLocation(startPos, startPos, true) }); - var key = peg$currPos * 90 + 0; + var key = peg$currPos * 91 + 0; var cached = peg$resultsCache[key]; if (cached) { @@ -1217,7 +1219,7 @@ function peg$parse(input, options) { location: peg$computeLocation(startPos, startPos, true) }); - var key = peg$currPos * 90 + 1; + var key = peg$currPos * 91 + 1; var cached = peg$resultsCache[key]; if (cached) { @@ -1243,7 +1245,7 @@ function peg$parse(input, options) { s0 = peg$parseMeta(); if (s0 === peg$FAILED) { - s0 = peg$parseGivenLabel(); + s0 = peg$parseGiven(); if (s0 === peg$FAILED) { s0 = peg$parseEnvironment(); if (s0 === peg$FAILED) { @@ -1285,7 +1287,7 @@ function peg$parse(input, options) { location: peg$computeLocation(startPos, startPos, true) }); - var key = peg$currPos * 90 + 2; + var key = peg$currPos * 91 + 2; var cached = peg$resultsCache[key]; if (cached) { @@ -1350,7 +1352,7 @@ function peg$parse(input, options) { location: peg$computeLocation(startPos, startPos, true) }); - var key = peg$currPos * 90 + 3; + var key = peg$currPos * 91 + 3; var cached = peg$resultsCache[key]; if (cached) { @@ -1412,7 +1414,7 @@ function peg$parse(input, options) { location: peg$computeLocation(startPos, startPos, true) }); - var key = peg$currPos * 90 + 4; + var key = peg$currPos * 91 + 4; var cached = peg$resultsCache[key]; if (cached) { @@ -1477,7 +1479,7 @@ function peg$parse(input, options) { location: peg$computeLocation(startPos, startPos, true) }); - var key = peg$currPos * 90 + 5; + var key = peg$currPos * 91 + 5; var cached = peg$resultsCache[key]; if (cached) { @@ -1536,7 +1538,7 @@ function peg$parse(input, options) { location: peg$computeLocation(startPos, startPos, true) }); - var key = peg$currPos * 90 + 6; + var key = peg$currPos * 91 + 6; var cached = peg$resultsCache[key]; if (cached) { @@ -1595,7 +1597,7 @@ function peg$parse(input, options) { location: peg$computeLocation(startPos, startPos, true) }); - var key = peg$currPos * 90 + 7; + var key = peg$currPos * 91 + 7; var cached = peg$resultsCache[key]; if (cached) { @@ -1672,7 +1674,7 @@ function peg$parse(input, options) { location: peg$computeLocation(startPos, startPos, true) }); - var key = peg$currPos * 90 + 8; + var key = peg$currPos * 91 + 8; var cached = peg$resultsCache[key]; if (cached) { @@ -1773,7 +1775,7 @@ function peg$parse(input, options) { location: peg$computeLocation(startPos, startPos, true) }); - var key = peg$currPos * 90 + 9; + var key = peg$currPos * 91 + 9; var cached = peg$resultsCache[key]; if (cached) { @@ -1864,7 +1866,7 @@ function peg$parse(input, options) { location: peg$computeLocation(startPos, startPos, true) }); - var key = peg$currPos * 90 + 10; + var key = peg$currPos * 91 + 10; var cached = peg$resultsCache[key]; if (cached) { @@ -1970,7 +1972,7 @@ function peg$parse(input, options) { location: peg$computeLocation(startPos, startPos, true) }); - var key = peg$currPos * 90 + 11; + var key = peg$currPos * 91 + 11; var cached = peg$resultsCache[key]; if (cached) { @@ -2073,7 +2075,7 @@ function peg$parse(input, options) { location: peg$computeLocation(startPos, startPos, true) }); - var key = peg$currPos * 90 + 12; + var key = peg$currPos * 91 + 12; var cached = peg$resultsCache[key]; if (cached) { @@ -2141,7 +2143,7 @@ function peg$parse(input, options) { location: peg$computeLocation(startPos, startPos, true) }); - var key = peg$currPos * 90 + 13; + var key = peg$currPos * 91 + 13; var cached = peg$resultsCache[key]; if (cached) { @@ -2227,7 +2229,7 @@ function peg$parse(input, options) { location: peg$computeLocation(startPos, startPos, true) }); - var key = peg$currPos * 90 + 14; + var key = peg$currPos * 91 + 14; var cached = peg$resultsCache[key]; if (cached) { @@ -2331,7 +2333,7 @@ function peg$parse(input, options) { location: peg$computeLocation(startPos, startPos, true) }); - var key = peg$currPos * 90 + 15; + var key = peg$currPos * 91 + 15; var cached = peg$resultsCache[key]; if (cached) { @@ -2435,7 +2437,7 @@ function peg$parse(input, options) { location: peg$computeLocation(startPos, startPos, true) }); - var key = peg$currPos * 90 + 16; + var key = peg$currPos * 91 + 16; var cached = peg$resultsCache[key]; if (cached) { @@ -2548,7 +2550,7 @@ function peg$parse(input, options) { location: peg$computeLocation(startPos, startPos, true) }); - var key = peg$currPos * 90 + 17; + var key = peg$currPos * 91 + 17; var cached = peg$resultsCache[key]; if (cached) { @@ -2634,7 +2636,7 @@ function peg$parse(input, options) { location: peg$computeLocation(startPos, startPos, true) }); - var key = peg$currPos * 90 + 18; + var key = peg$currPos * 91 + 18; var cached = peg$resultsCache[key]; if (cached) { @@ -2720,7 +2722,7 @@ function peg$parse(input, options) { location: peg$computeLocation(startPos, startPos, true) }); - var key = peg$currPos * 90 + 19; + var key = peg$currPos * 91 + 19; var cached = peg$resultsCache[key]; if (cached) { @@ -2800,7 +2802,7 @@ function peg$parse(input, options) { location: peg$computeLocation(startPos, startPos, true) }); - var key = peg$currPos * 90 + 20; + var key = peg$currPos * 91 + 20; var cached = peg$resultsCache[key]; if (cached) { @@ -2858,6 +2860,125 @@ function peg$parse(input, options) { return s0; } + function peg$parseGiven() { + var startPos = peg$currPos; + var s0, s1, s2, s3, s4, s5, s6; + + peg$tracer.trace({ + type: "rule.enter", + rule: "Given", + location: peg$computeLocation(startPos, startPos, true) + }); + + var key = peg$currPos * 91 + 21; + var cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + + if (cached.result !== peg$FAILED) { + peg$tracer.trace({ + type: "rule.match", + rule: "Given", + result: cached.result, + location: peg$computeLocation(startPos, peg$currPos, true) + }); + } else { + peg$tracer.trace({ + type: "rule.fail", + rule: "Given", + location: peg$computeLocation(startPos, startPos, true) + }); + } + + return cached.result; + } + + s0 = peg$currPos; + s1 = peg$parseGivenLabel(); + if (s1 !== peg$FAILED) { + s2 = peg$parse_(); + s3 = peg$currPos; + s4 = []; + s5 = peg$parseExpression(); + while (s5 !== peg$FAILED) { + s4.push(s5); + s5 = peg$currPos; + s6 = peg$parsecomma(); + if (s6 !== peg$FAILED) { + s6 = peg$parseExpression(); + if (s6 === peg$FAILED) { + peg$currPos = s5; + s5 = peg$FAILED; + } else { + s5 = s6; + } + } else { + s5 = s6; + } + } + if (s4.length < 1) { + peg$currPos = s3; + s3 = peg$FAILED; + } else { + s3 = s4; + } + if (s3 !== peg$FAILED) { + s4 = peg$currPos; + peg$silentFails++; + s5 = peg$parsecomma(); + peg$silentFails--; + if (s5 === peg$FAILED) { + s4 = undefined; + } else { + peg$currPos = s4; + s4 = peg$FAILED; + } + if (s4 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f6(s1, s3); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + if (s0 === peg$FAILED) { + s0 = peg$currPos; + s1 = peg$parseGivenLabel(); + if (s1 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$f7(s1); + } + s0 = s1; + } + + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + + if (s0 !== peg$FAILED) { + peg$tracer.trace({ + type: "rule.match", + rule: "Given", + result: s0, + location: peg$computeLocation(startPos, peg$currPos, true) + }); + } else { + peg$tracer.trace({ + type: "rule.fail", + rule: "Given", + location: peg$computeLocation(startPos, startPos, true) + }); + } + + return s0; + } + function peg$parseGivenLabel() { var startPos = peg$currPos; var s0, s1, s2, s3, s4; @@ -2868,7 +2989,7 @@ function peg$parse(input, options) { location: peg$computeLocation(startPos, startPos, true) }); - var key = peg$currPos * 90 + 21; + var key = peg$currPos * 91 + 22; var cached = peg$resultsCache[key]; if (cached) { @@ -3019,7 +3140,7 @@ function peg$parse(input, options) { location: peg$computeLocation(startPos, startPos, true) }); - var key = peg$currPos * 90 + 22; + var key = peg$currPos * 91 + 23; var cached = peg$resultsCache[key]; if (cached) { @@ -3063,7 +3184,7 @@ function peg$parse(input, options) { } if (s3 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f6(s2); + s0 = peg$f8(s2); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -3107,7 +3228,7 @@ function peg$parse(input, options) { location: peg$computeLocation(startPos, startPos, true) }); - var key = peg$currPos * 90 + 23; + var key = peg$currPos * 91 + 24; var cached = peg$resultsCache[key]; if (cached) { @@ -3145,7 +3266,7 @@ function peg$parse(input, options) { s3 = peg$parseDeclareSeq(); if (s3 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f7(s1, s3); + s0 = peg$f9(s1, s3); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -3189,7 +3310,7 @@ function peg$parse(input, options) { location: peg$computeLocation(startPos, startPos, true) }); - var key = peg$currPos * 90 + 24; + var key = peg$currPos * 91 + 25; var cached = peg$resultsCache[key]; if (cached) { @@ -3255,7 +3376,7 @@ function peg$parse(input, options) { s11 = peg$parseExpression(); if (s11 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f8(s1, s7, s11); + s0 = peg$f10(s1, s7, s11); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -3329,7 +3450,7 @@ function peg$parse(input, options) { s7 = peg$parseSymbolSeq(); if (s7 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f9(s1, s7); + s0 = peg$f11(s1, s7); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -3390,7 +3511,7 @@ function peg$parse(input, options) { location: peg$computeLocation(startPos, startPos, true) }); - var key = peg$currPos * 90 + 25; + var key = peg$currPos * 91 + 26; var cached = peg$resultsCache[key]; if (cached) { @@ -3442,7 +3563,7 @@ function peg$parse(input, options) { s7 = peg$parseExpression(); if (s7 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f10(s1, s3, s7); + s0 = peg$f12(s1, s3, s7); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -3520,7 +3641,7 @@ function peg$parse(input, options) { s11 = peg$parseExpression(); if (s11 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f11(s1, s3, s11); + s0 = peg$f13(s1, s3, s11); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -3604,7 +3725,7 @@ function peg$parse(input, options) { s9 = peg$parseExpression(); if (s9 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f12(s1, s3, s9); + s0 = peg$f14(s1, s3, s9); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -3656,7 +3777,7 @@ function peg$parse(input, options) { s3 = peg$parseSymbolSeq(); if (s3 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f13(s1, s3); + s0 = peg$f15(s1, s3); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -3703,7 +3824,7 @@ function peg$parse(input, options) { location: peg$computeLocation(startPos, startPos, true) }); - var key = peg$currPos * 90 + 26; + var key = peg$currPos * 91 + 27; var cached = peg$resultsCache[key]; if (cached) { @@ -3785,7 +3906,7 @@ function peg$parse(input, options) { } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$f14(s1); + s1 = peg$f16(s1); } s0 = s1; @@ -3819,7 +3940,7 @@ function peg$parse(input, options) { location: peg$computeLocation(startPos, startPos, true) }); - var key = peg$currPos * 90 + 27; + var key = peg$currPos * 91 + 28; var cached = peg$resultsCache[key]; if (cached) { @@ -3871,7 +3992,7 @@ function peg$parse(input, options) { } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$f15(s1); + s1 = peg$f17(s1); } s0 = s1; @@ -3905,7 +4026,7 @@ function peg$parse(input, options) { location: peg$computeLocation(startPos, startPos, true) }); - var key = peg$currPos * 90 + 28; + var key = peg$currPos * 91 + 29; var cached = peg$resultsCache[key]; if (cached) { @@ -3943,7 +4064,7 @@ function peg$parse(input, options) { s3 = peg$parseBinding(); if (s3 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f16(s3); + s0 = peg$f18(s3); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -3971,7 +4092,7 @@ function peg$parse(input, options) { s3 = peg$parseBinding(); if (s3 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f17(s3); + s0 = peg$f19(s3); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -3999,7 +4120,7 @@ function peg$parse(input, options) { s3 = peg$parseBinding(); if (s3 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f18(s3); + s0 = peg$f20(s3); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -4045,7 +4166,7 @@ function peg$parse(input, options) { location: peg$computeLocation(startPos, startPos, true) }); - var key = peg$currPos * 90 + 29; + var key = peg$currPos * 91 + 30; var cached = peg$resultsCache[key]; if (cached) { @@ -4078,7 +4199,7 @@ function peg$parse(input, options) { s4 = peg$parseExpression(); if (s4 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f19(s1, s4); + s0 = peg$f21(s1, s4); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -4109,7 +4230,7 @@ function peg$parse(input, options) { s5 = peg$parseExpression(); if (s5 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f20(s1, s5); + s0 = peg$f22(s1, s5); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -4158,7 +4279,7 @@ function peg$parse(input, options) { location: peg$computeLocation(startPos, startPos, true) }); - var key = peg$currPos * 90 + 30; + var key = peg$currPos * 91 + 31; var cached = peg$resultsCache[key]; if (cached) { @@ -4237,7 +4358,7 @@ function peg$parse(input, options) { } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$f21(s1); + s1 = peg$f23(s1); } s0 = s1; @@ -4271,7 +4392,7 @@ function peg$parse(input, options) { location: peg$computeLocation(startPos, startPos, true) }); - var key = peg$currPos * 90 + 31; + var key = peg$currPos * 91 + 32; var cached = peg$resultsCache[key]; if (cached) { @@ -4356,7 +4477,7 @@ function peg$parse(input, options) { } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$f22(s1); + s1 = peg$f24(s1); } s0 = s1; @@ -4390,7 +4511,7 @@ function peg$parse(input, options) { location: peg$computeLocation(startPos, startPos, true) }); - var key = peg$currPos * 90 + 32; + var key = peg$currPos * 91 + 33; var cached = peg$resultsCache[key]; if (cached) { @@ -4478,7 +4599,7 @@ function peg$parse(input, options) { } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$f23(s1); + s1 = peg$f25(s1); } s0 = s1; @@ -4512,7 +4633,7 @@ function peg$parse(input, options) { location: peg$computeLocation(startPos, startPos, true) }); - var key = peg$currPos * 90 + 33; + var key = peg$currPos * 91 + 34; var cached = peg$resultsCache[key]; if (cached) { @@ -4600,7 +4721,7 @@ function peg$parse(input, options) { } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$f24(s1); + s1 = peg$f26(s1); } s0 = s1; @@ -4634,7 +4755,7 @@ function peg$parse(input, options) { location: peg$computeLocation(startPos, startPos, true) }); - var key = peg$currPos * 90 + 34; + var key = peg$currPos * 91 + 35; var cached = peg$resultsCache[key]; if (cached) { @@ -4673,7 +4794,7 @@ function peg$parse(input, options) { s4 = peg$parsePropArg(); if (s4 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f25(s4); + s0 = peg$f27(s4); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -4717,7 +4838,7 @@ function peg$parse(input, options) { location: peg$computeLocation(startPos, startPos, true) }); - var key = peg$currPos * 90 + 35; + var key = peg$currPos * 91 + 36; var cached = peg$resultsCache[key]; if (cached) { @@ -4815,7 +4936,7 @@ function peg$parse(input, options) { location: peg$computeLocation(startPos, startPos, true) }); - var key = peg$currPos * 90 + 36; + var key = peg$currPos * 91 + 37; var cached = peg$resultsCache[key]; if (cached) { @@ -4868,7 +4989,7 @@ function peg$parse(input, options) { s9 = peg$parseRelArg(); if (s9 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f26(s1, s5, s9); + s0 = peg$f28(s1, s5, s9); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -4924,7 +5045,7 @@ function peg$parse(input, options) { location: peg$computeLocation(startPos, startPos, true) }); - var key = peg$currPos * 90 + 37; + var key = peg$currPos * 91 + 38; var cached = peg$resultsCache[key]; if (cached) { @@ -5001,7 +5122,7 @@ function peg$parse(input, options) { } if (s11 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f27(s1, s11); + s0 = peg$f29(s1, s11); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -5096,7 +5217,7 @@ function peg$parse(input, options) { } if (s11 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f28(s1, s11); + s0 = peg$f30(s1, s11); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -5169,7 +5290,7 @@ function peg$parse(input, options) { location: peg$computeLocation(startPos, startPos, true) }); - var key = peg$currPos * 90 + 38; + var key = peg$currPos * 91 + 39; var cached = peg$resultsCache[key]; if (cached) { @@ -5232,7 +5353,7 @@ function peg$parse(input, options) { } if (s9 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f29(s1, s5, s9); + s0 = peg$f31(s1, s5, s9); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -5301,7 +5422,7 @@ function peg$parse(input, options) { } if (s9 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f30(s1, s5, s9); + s0 = peg$f32(s1, s5, s9); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -5362,7 +5483,7 @@ function peg$parse(input, options) { location: peg$computeLocation(startPos, startPos, true) }); - var key = peg$currPos * 90 + 39; + var key = peg$currPos * 91 + 40; var cached = peg$resultsCache[key]; if (cached) { @@ -5444,7 +5565,7 @@ function peg$parse(input, options) { } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$f31(s1); + s1 = peg$f33(s1); } s0 = s1; @@ -5478,7 +5599,7 @@ function peg$parse(input, options) { location: peg$computeLocation(startPos, startPos, true) }); - var key = peg$currPos * 90 + 40; + var key = peg$currPos * 91 + 41; var cached = peg$resultsCache[key]; if (cached) { @@ -5519,7 +5640,7 @@ function peg$parse(input, options) { s5 = peg$parseRelArg(); if (s5 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f32(s1, s5); + s0 = peg$f34(s1, s5); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -5567,7 +5688,7 @@ function peg$parse(input, options) { location: peg$computeLocation(startPos, startPos, true) }); - var key = peg$currPos * 90 + 41; + var key = peg$currPos * 91 + 42; var cached = peg$resultsCache[key]; if (cached) { @@ -5608,7 +5729,7 @@ function peg$parse(input, options) { s5 = peg$parseRelArg(); if (s5 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f33(s1, s5); + s0 = peg$f35(s1, s5); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -5656,7 +5777,7 @@ function peg$parse(input, options) { location: peg$computeLocation(startPos, startPos, true) }); - var key = peg$currPos * 90 + 42; + var key = peg$currPos * 91 + 43; var cached = peg$resultsCache[key]; if (cached) { @@ -5727,7 +5848,7 @@ function peg$parse(input, options) { s4 = peg$parseRelArg(); if (s4 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f34(s1, s4); + s0 = peg$f36(s1, s4); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -5771,7 +5892,7 @@ function peg$parse(input, options) { location: peg$computeLocation(startPos, startPos, true) }); - var key = peg$currPos * 90 + 43; + var key = peg$currPos * 91 + 44; var cached = peg$resultsCache[key]; if (cached) { @@ -5844,7 +5965,7 @@ function peg$parse(input, options) { } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$f35(s1); + s1 = peg$f37(s1); } s0 = s1; @@ -5878,7 +5999,7 @@ function peg$parse(input, options) { location: peg$computeLocation(startPos, startPos, true) }); - var key = peg$currPos * 90 + 44; + var key = peg$currPos * 91 + 45; var cached = peg$resultsCache[key]; if (cached) { @@ -5977,7 +6098,7 @@ function peg$parse(input, options) { } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$f36(s1); + s1 = peg$f38(s1); } s0 = s1; @@ -6011,7 +6132,7 @@ function peg$parse(input, options) { location: peg$computeLocation(startPos, startPos, true) }); - var key = peg$currPos * 90 + 45; + var key = peg$currPos * 91 + 46; var cached = peg$resultsCache[key]; if (cached) { @@ -6061,7 +6182,7 @@ function peg$parse(input, options) { s5 = peg$parseRelArg(); if (s5 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f37(s1, s5); + s0 = peg$f39(s1, s5); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -6109,7 +6230,7 @@ function peg$parse(input, options) { location: peg$computeLocation(startPos, startPos, true) }); - var key = peg$currPos * 90 + 46; + var key = peg$currPos * 91 + 47; var cached = peg$resultsCache[key]; if (cached) { @@ -6183,7 +6304,7 @@ function peg$parse(input, options) { } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$f38(s1); + s1 = peg$f40(s1); } s0 = s1; @@ -6217,7 +6338,7 @@ function peg$parse(input, options) { location: peg$computeLocation(startPos, startPos, true) }); - var key = peg$currPos * 90 + 47; + var key = peg$currPos * 91 + 48; var cached = peg$resultsCache[key]; if (cached) { @@ -6291,7 +6412,7 @@ function peg$parse(input, options) { } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$f39(s1); + s1 = peg$f41(s1); } s0 = s1; @@ -6325,7 +6446,7 @@ function peg$parse(input, options) { location: peg$computeLocation(startPos, startPos, true) }); - var key = peg$currPos * 90 + 48; + var key = peg$currPos * 91 + 49; var cached = peg$resultsCache[key]; if (cached) { @@ -6375,7 +6496,7 @@ function peg$parse(input, options) { s5 = peg$parseRelArg(); if (s5 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f40(s1, s3, s5); + s0 = peg$f42(s1, s3, s5); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -6423,7 +6544,7 @@ function peg$parse(input, options) { location: peg$computeLocation(startPos, startPos, true) }); - var key = peg$currPos * 90 + 49; + var key = peg$currPos * 91 + 50; var cached = peg$resultsCache[key]; if (cached) { @@ -6473,7 +6594,7 @@ function peg$parse(input, options) { s5 = peg$parseRelArg(); if (s5 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f41(s1, s3, s5); + s0 = peg$f43(s1, s3, s5); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -6521,7 +6642,7 @@ function peg$parse(input, options) { location: peg$computeLocation(startPos, startPos, true) }); - var key = peg$currPos * 90 + 50; + var key = peg$currPos * 91 + 51; var cached = peg$resultsCache[key]; if (cached) { @@ -6679,7 +6800,7 @@ function peg$parse(input, options) { s4 = peg$parseRelArg(); if (s4 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f42(s1, s3, s4); + s0 = peg$f44(s1, s3, s4); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -6723,7 +6844,7 @@ function peg$parse(input, options) { location: peg$computeLocation(startPos, startPos, true) }); - var key = peg$currPos * 90 + 51; + var key = peg$currPos * 91 + 52; var cached = peg$resultsCache[key]; if (cached) { @@ -6796,7 +6917,7 @@ function peg$parse(input, options) { } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$f43(s1); + s1 = peg$f45(s1); } s0 = s1; @@ -6830,7 +6951,7 @@ function peg$parse(input, options) { location: peg$computeLocation(startPos, startPos, true) }); - var key = peg$currPos * 90 + 52; + var key = peg$currPos * 91 + 53; var cached = peg$resultsCache[key]; if (cached) { @@ -6912,7 +7033,7 @@ function peg$parse(input, options) { } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$f44(s1); + s1 = peg$f46(s1); } s0 = s1; @@ -6946,7 +7067,7 @@ function peg$parse(input, options) { location: peg$computeLocation(startPos, startPos, true) }); - var key = peg$currPos * 90 + 53; + var key = peg$currPos * 91 + 54; var cached = peg$resultsCache[key]; if (cached) { @@ -7028,7 +7149,7 @@ function peg$parse(input, options) { } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$f45(s1); + s1 = peg$f47(s1); } s0 = s1; @@ -7062,7 +7183,7 @@ function peg$parse(input, options) { location: peg$computeLocation(startPos, startPos, true) }); - var key = peg$currPos * 90 + 54; + var key = peg$currPos * 91 + 55; var cached = peg$resultsCache[key]; if (cached) { @@ -7144,7 +7265,7 @@ function peg$parse(input, options) { } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$f46(s1); + s1 = peg$f48(s1); } s0 = s1; @@ -7178,7 +7299,7 @@ function peg$parse(input, options) { location: peg$computeLocation(startPos, startPos, true) }); - var key = peg$currPos * 90 + 55; + var key = peg$currPos * 91 + 56; var cached = peg$resultsCache[key]; if (cached) { @@ -7260,7 +7381,7 @@ function peg$parse(input, options) { } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$f47(s1); + s1 = peg$f49(s1); } s0 = s1; @@ -7294,7 +7415,7 @@ function peg$parse(input, options) { location: peg$computeLocation(startPos, startPos, true) }); - var key = peg$currPos * 90 + 56; + var key = peg$currPos * 91 + 57; var cached = peg$resultsCache[key]; if (cached) { @@ -7374,7 +7495,7 @@ function peg$parse(input, options) { location: peg$computeLocation(startPos, startPos, true) }); - var key = peg$currPos * 90 + 57; + var key = peg$currPos * 91 + 58; var cached = peg$resultsCache[key]; if (cached) { @@ -7434,7 +7555,7 @@ function peg$parse(input, options) { s11 = peg$parseRelativeComp(); if (s11 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f48(s3, s7, s11); + s0 = peg$f50(s3, s7, s11); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -7539,7 +7660,7 @@ function peg$parse(input, options) { s12 = peg$parseRelativeComp(); if (s12 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f49(s4, s8, s12); + s0 = peg$f51(s4, s8, s12); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -7613,7 +7734,7 @@ function peg$parse(input, options) { } if (s10 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f50(s4, s6, s8); + s0 = peg$f52(s4, s6, s8); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -7679,7 +7800,7 @@ function peg$parse(input, options) { location: peg$computeLocation(startPos, startPos, true) }); - var key = peg$currPos * 90 + 58; + var key = peg$currPos * 91 + 59; var cached = peg$resultsCache[key]; if (cached) { @@ -7759,7 +7880,7 @@ function peg$parse(input, options) { location: peg$computeLocation(startPos, startPos, true) }); - var key = peg$currPos * 90 + 59; + var key = peg$currPos * 91 + 60; var cached = peg$resultsCache[key]; if (cached) { @@ -7819,7 +7940,7 @@ function peg$parse(input, options) { s11 = peg$parseRelativeComp(); if (s11 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f51(s3, s7, s11); + s0 = peg$f53(s3, s7, s11); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -7924,7 +8045,7 @@ function peg$parse(input, options) { s12 = peg$parseRelativeComp(); if (s12 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f52(s4, s8, s12); + s0 = peg$f54(s4, s8, s12); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -7998,7 +8119,7 @@ function peg$parse(input, options) { } if (s10 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f53(s4, s6, s8); + s0 = peg$f55(s4, s6, s8); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -8064,7 +8185,7 @@ function peg$parse(input, options) { location: peg$computeLocation(startPos, startPos, true) }); - var key = peg$currPos * 90 + 60; + var key = peg$currPos * 91 + 61; var cached = peg$resultsCache[key]; if (cached) { @@ -8135,7 +8256,7 @@ function peg$parse(input, options) { location: peg$computeLocation(startPos, startPos, true) }); - var key = peg$currPos * 90 + 61; + var key = peg$currPos * 91 + 62; var cached = peg$resultsCache[key]; if (cached) { @@ -8182,7 +8303,7 @@ function peg$parse(input, options) { } if (s5 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f54(s1, s5); + s0 = peg$f56(s1, s5); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -8230,7 +8351,7 @@ function peg$parse(input, options) { location: peg$computeLocation(startPos, startPos, true) }); - var key = peg$currPos * 90 + 62; + var key = peg$currPos * 91 + 63; var cached = peg$resultsCache[key]; if (cached) { @@ -8323,7 +8444,7 @@ function peg$parse(input, options) { } if (s3 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f55(s1, s3); + s0 = peg$f57(s1, s3); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -8363,7 +8484,7 @@ function peg$parse(input, options) { location: peg$computeLocation(startPos, startPos, true) }); - var key = peg$currPos * 90 + 63; + var key = peg$currPos * 91 + 64; var cached = peg$resultsCache[key]; if (cached) { @@ -8478,7 +8599,7 @@ function peg$parse(input, options) { s11 = peg$parseProduct(); if (s11 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f56(s3, s5, s8, s11); + s0 = peg$f58(s3, s5, s8, s11); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -8584,7 +8705,7 @@ function peg$parse(input, options) { s14 = peg$parseProduct(); if (s14 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f57(s3, s7, s11, s14); + s0 = peg$f59(s3, s7, s11, s14); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -8790,7 +8911,7 @@ function peg$parse(input, options) { s13 = peg$parseProduct(); if (s13 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f58(s4, s7, s10, s13); + s0 = peg$f60(s4, s7, s10, s13); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -8887,7 +9008,7 @@ function peg$parse(input, options) { } if (s11 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f59(s4, s6, s8, s9); + s0 = peg$f61(s4, s6, s8, s9); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -8954,7 +9075,7 @@ function peg$parse(input, options) { location: peg$computeLocation(startPos, startPos, true) }); - var key = peg$currPos * 90 + 64; + var key = peg$currPos * 91 + 65; var cached = peg$resultsCache[key]; if (cached) { @@ -9077,7 +9198,7 @@ function peg$parse(input, options) { } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$f60(s1); + s1 = peg$f62(s1); } s0 = s1; @@ -9111,7 +9232,7 @@ function peg$parse(input, options) { location: peg$computeLocation(startPos, startPos, true) }); - var key = peg$currPos * 90 + 65; + var key = peg$currPos * 91 + 66; var cached = peg$resultsCache[key]; if (cached) { @@ -9148,7 +9269,7 @@ function peg$parse(input, options) { s3 = peg$parseExpArgs(); if (s3 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f61(s3); + s0 = peg$f63(s3); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -9188,7 +9309,7 @@ function peg$parse(input, options) { location: peg$computeLocation(startPos, startPos, true) }); - var key = peg$currPos * 90 + 66; + var key = peg$currPos * 91 + 67; var cached = peg$resultsCache[key]; if (cached) { @@ -9225,7 +9346,7 @@ function peg$parse(input, options) { s3 = peg$parseExpArgs(); if (s3 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f62(s3); + s0 = peg$f64(s3); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -9265,7 +9386,7 @@ function peg$parse(input, options) { location: peg$computeLocation(startPos, startPos, true) }); - var key = peg$currPos * 90 + 67; + var key = peg$currPos * 91 + 68; var cached = peg$resultsCache[key]; if (cached) { @@ -9339,7 +9460,7 @@ function peg$parse(input, options) { location: peg$computeLocation(startPos, startPos, true) }); - var key = peg$currPos * 90 + 68; + var key = peg$currPos * 91 + 69; var cached = peg$resultsCache[key]; if (cached) { @@ -9396,7 +9517,7 @@ function peg$parse(input, options) { } if (s4 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f63(s1); + s0 = peg$f65(s1); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -9440,7 +9561,7 @@ function peg$parse(input, options) { location: peg$computeLocation(startPos, startPos, true) }); - var key = peg$currPos * 90 + 69; + var key = peg$currPos * 91 + 70; var cached = peg$resultsCache[key]; if (cached) { @@ -9503,7 +9624,7 @@ function peg$parse(input, options) { } if (s4 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f64(s1); + s0 = peg$f66(s1); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -9547,7 +9668,7 @@ function peg$parse(input, options) { location: peg$computeLocation(startPos, startPos, true) }); - var key = peg$currPos * 90 + 70; + var key = peg$currPos * 91 + 71; var cached = peg$resultsCache[key]; if (cached) { @@ -9597,7 +9718,7 @@ function peg$parse(input, options) { } if (s7 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f65(s3, s5); + s0 = peg$f67(s3, s5); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -9649,7 +9770,7 @@ function peg$parse(input, options) { location: peg$computeLocation(startPos, startPos, true) }); - var key = peg$currPos * 90 + 71; + var key = peg$currPos * 91 + 72; var cached = peg$resultsCache[key]; if (cached) { @@ -9758,7 +9879,7 @@ function peg$parse(input, options) { } if (s3 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f66(s2, s3); + s0 = peg$f68(s2, s3); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -9806,7 +9927,7 @@ function peg$parse(input, options) { } if (s9 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f67(s3, s7); + s0 = peg$f69(s3, s7); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -9849,7 +9970,7 @@ function peg$parse(input, options) { } if (s5 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f68(s3); + s0 = peg$f70(s3); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -9881,7 +10002,7 @@ function peg$parse(input, options) { } if (s5 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f69(s3); + s0 = peg$f71(s3); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -9920,7 +10041,7 @@ function peg$parse(input, options) { } if (s6 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f70(s3, s5); + s0 = peg$f72(s3, s5); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -9963,7 +10084,7 @@ function peg$parse(input, options) { } if (s5 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f71(s3); + s0 = peg$f73(s3); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -10072,7 +10193,7 @@ function peg$parse(input, options) { } if (s2 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f72(s1, s2); + s0 = peg$f74(s1, s2); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -10118,7 +10239,7 @@ function peg$parse(input, options) { location: peg$computeLocation(startPos, startPos, true) }); - var key = peg$currPos * 90 + 72; + var key = peg$currPos * 91 + 73; var cached = peg$resultsCache[key]; if (cached) { @@ -10167,7 +10288,7 @@ function peg$parse(input, options) { } if (s5 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f73(s1, s5); + s0 = peg$f75(s1, s5); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -10211,7 +10332,7 @@ function peg$parse(input, options) { location: peg$computeLocation(startPos, startPos, true) }); - var key = peg$currPos * 90 + 73; + var key = peg$currPos * 91 + 74; var cached = peg$resultsCache[key]; if (cached) { @@ -10303,7 +10424,7 @@ function peg$parse(input, options) { } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$f74(s1); + s1 = peg$f76(s1); } s0 = s1; @@ -10337,7 +10458,7 @@ function peg$parse(input, options) { location: peg$computeLocation(startPos, startPos, true) }); - var key = peg$currPos * 90 + 74; + var key = peg$currPos * 91 + 75; var cached = peg$resultsCache[key]; if (cached) { @@ -10408,7 +10529,7 @@ function peg$parse(input, options) { location: peg$computeLocation(startPos, startPos, true) }); - var key = peg$currPos * 90 + 75; + var key = peg$currPos * 91 + 76; var cached = peg$resultsCache[key]; if (cached) { @@ -10481,7 +10602,7 @@ function peg$parse(input, options) { } if (s6 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f75(s3); + s0 = peg$f77(s3); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -10525,7 +10646,7 @@ function peg$parse(input, options) { location: peg$computeLocation(startPos, startPos, true) }); - var key = peg$currPos * 90 + 76; + var key = peg$currPos * 91 + 77; var cached = peg$resultsCache[key]; if (cached) { @@ -10581,7 +10702,7 @@ function peg$parse(input, options) { } if (s6 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f76(s3); + s0 = peg$f78(s3); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -10628,7 +10749,7 @@ function peg$parse(input, options) { } if (s6 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f77(s3); + s0 = peg$f79(s3); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -10677,7 +10798,7 @@ function peg$parse(input, options) { location: peg$computeLocation(startPos, startPos, true) }); - var key = peg$currPos * 90 + 77; + var key = peg$currPos * 91 + 78; var cached = peg$resultsCache[key]; if (cached) { @@ -10735,7 +10856,7 @@ function peg$parse(input, options) { } if (s9 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f78(s3, s7); + s0 = peg$f80(s3, s7); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -10778,7 +10899,7 @@ function peg$parse(input, options) { } if (s5 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f79(s3); + s0 = peg$f81(s3); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -10819,7 +10940,7 @@ function peg$parse(input, options) { location: peg$computeLocation(startPos, startPos, true) }); - var key = peg$currPos * 90 + 78; + var key = peg$currPos * 91 + 79; var cached = peg$resultsCache[key]; if (cached) { @@ -10871,7 +10992,7 @@ function peg$parse(input, options) { } if (s5 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f80(s3); + s0 = peg$f82(s3); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -10907,7 +11028,7 @@ function peg$parse(input, options) { } if (s5 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f81(s3); + s0 = peg$f83(s3); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -10952,7 +11073,7 @@ function peg$parse(input, options) { location: peg$computeLocation(startPos, startPos, true) }); - var key = peg$currPos * 90 + 79; + var key = peg$currPos * 91 + 80; var cached = peg$resultsCache[key]; if (cached) { @@ -11011,7 +11132,7 @@ function peg$parse(input, options) { location: peg$computeLocation(startPos, startPos, true) }); - var key = peg$currPos * 90 + 80; + var key = peg$currPos * 91 + 81; var cached = peg$resultsCache[key]; if (cached) { @@ -11120,7 +11241,7 @@ function peg$parse(input, options) { location: peg$computeLocation(startPos, startPos, true) }); - var key = peg$currPos * 90 + 81; + var key = peg$currPos * 91 + 82; var cached = peg$resultsCache[key]; if (cached) { @@ -11223,7 +11344,7 @@ function peg$parse(input, options) { location: peg$computeLocation(startPos, startPos, true) }); - var key = peg$currPos * 90 + 82; + var key = peg$currPos * 91 + 83; var cached = peg$resultsCache[key]; if (cached) { @@ -11294,7 +11415,7 @@ function peg$parse(input, options) { } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$f82(s1); + s1 = peg$f84(s1); } s0 = s1; if (s0 === peg$FAILED) { @@ -11356,7 +11477,7 @@ function peg$parse(input, options) { } if (s2 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f83(s2); + s0 = peg$f85(s2); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -11402,7 +11523,7 @@ function peg$parse(input, options) { location: peg$computeLocation(startPos, startPos, true) }); - var key = peg$currPos * 90 + 83; + var key = peg$currPos * 91 + 84; var cached = peg$resultsCache[key]; if (cached) { @@ -11776,7 +11897,7 @@ function peg$parse(input, options) { location: peg$computeLocation(startPos, startPos, true) }); - var key = peg$currPos * 90 + 84; + var key = peg$currPos * 91 + 85; var cached = peg$resultsCache[key]; if (cached) { @@ -11838,7 +11959,7 @@ function peg$parse(input, options) { location: peg$computeLocation(startPos, startPos, true) }); - var key = peg$currPos * 90 + 85; + var key = peg$currPos * 91 + 86; var cached = peg$resultsCache[key]; if (cached) { @@ -11876,7 +11997,7 @@ function peg$parse(input, options) { if (s1 !== peg$FAILED) { s2 = peg$parse_(); peg$savedPos = s0; - s0 = peg$f84(); + s0 = peg$f86(); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -11912,7 +12033,7 @@ function peg$parse(input, options) { location: peg$computeLocation(startPos, startPos, true) }); - var key = peg$currPos * 90 + 86; + var key = peg$currPos * 91 + 87; var cached = peg$resultsCache[key]; if (cached) { @@ -11984,7 +12105,7 @@ function peg$parse(input, options) { location: peg$computeLocation(startPos, startPos, true) }); - var key = peg$currPos * 90 + 87; + var key = peg$currPos * 91 + 88; var cached = peg$resultsCache[key]; if (cached) { @@ -12046,7 +12167,7 @@ function peg$parse(input, options) { location: peg$computeLocation(startPos, startPos, true) }); - var key = peg$currPos * 90 + 88; + var key = peg$currPos * 91 + 89; var cached = peg$resultsCache[key]; if (cached) { @@ -12123,7 +12244,7 @@ function peg$parse(input, options) { location: peg$computeLocation(startPos, startPos, true) }); - var key = peg$currPos * 90 + 89; + var key = peg$currPos * 91 + 90; var cached = peg$resultsCache[key]; if (cached) { diff --git a/lde/src/experimental/parsers/lurch-to-tex.js b/lde/src/experimental/parsers/lurch-to-tex.js index 08c42108..390fa0ee 100644 --- a/lde/src/experimental/parsers/lurch-to-tex.js +++ b/lde/src/experimental/parsers/lurch-to-tex.js @@ -820,95 +820,96 @@ function peg$parse(input, options) { var peg$f3 = function(a) { return txt(a) }; var peg$f4 = function() { return '~\\equiv~' }; var peg$f5 = function() { return 'Substitution' }; - var peg$f6 = function(a) { return `${txt(a) }`}; - var peg$f7 = function(a) { return `\\left\\{ ${a} \\right\\}` }; - var peg$f8 = function(a, b) { return `${txt(a)} ${b}` }; - var peg$f9 = function(body, a, b) { return `${body}\\text{ for some }${a}\\in ${b}` }; - var peg$f10 = function(body, a) { return `${body}\\text{ for some }${a}` }; - var peg$f11 = function(a, b, c) { return `${txt(a)}${b}\\in ${c}` }; - var peg$f12 = function(a, b, c) { return `${txt(a)}${b}\\text{ be such that }${c}` }; - var peg$f13 = function(a, b, c) { return `${txt(a)}${b}\\text{ such that }${c}` }; - var peg$f14 = function(a, b) { return `${txt(a)}${b}` }; - var peg$f15 = function(a) {return sequence(a.map(x=>(x=='cdot /'?'/':x))) }; - var peg$f16 = function(a) { return sequence(a) }; - var peg$f17 = function(b) { return `\\forall ${b}` }; - var peg$f18 = function(b) { return `\\exists ${b}` }; - var peg$f19 = function(b) { return `\\exists! ${b}` }; - var peg$f20 = function(a, b) { return `${a}.\\, ${b}` }; - var peg$f21 = function(a, b) { return `${a}\\mapsto ${b}` }; - var peg$f22 = function(a) { return a.join('\\Leftrightarrow ') }; - var peg$f23 = function(a) { return a.join('\\Rightarrow ') }; - var peg$f24 = function(a) { return a.join('\\text{ or }') }; - var peg$f25 = function(a) { return a.join('\\text{ and }') }; - var peg$f26 = function(b) { return '\\text{not } '+b }; - var peg$f27 = function(a, b, c) { return `${a}\\colon ${b}\\to ${c}` }; - var peg$f28 = function(a, b) { return `${a}\\text{ is a partition of }${b}` }; - var peg$f29 = function(a, b) { return `${a}\\text{ is a relation on} ${b}` }; - var peg$f30 = function(a, b, c) { return `${a}\\underset{${c}}{\\equiv}${b}` }; - var peg$f31 = function(a, c, b) { return `${a}\\underset{${c}}{\\equiv}${b}` }; - var peg$f32 = function(a) { return a.join('\\subseteq ') }; - var peg$f33 = function(a, b) { return `${a}\\notin ${b}` }; - var peg$f34 = function(a, b) { return `${a}\\in ${b}` }; - var peg$f35 = function(a, b) { return `${a}\\mid ${b}` }; - var peg$f36 = function(a) { return a.join('\\leq ') }; - var peg$f37 = function(a) { return a.join('\\lt ') }; - var peg$f38 = function(a, b) { return `${a}\\neq ${b}` }; - var peg$f39 = function(a) { return a.join('\\sim ') }; - var peg$f40 = function(a) { return texEquation(a) }; - var peg$f41 = function(a, b, c) { return `${a}${txt(' '+b)}${c}` }; + var peg$f6 = function(a, b) { return `${txt(a)} ${sequence(b)}` }; + var peg$f7 = function(a) { return `${txt(a) }`}; + var peg$f8 = function(a) { return `\\left\\{ ${a} \\right\\}` }; + var peg$f9 = function(a, b) { return `${txt(a)} ${b}` }; + var peg$f10 = function(body, a, b) { return `${body}\\text{ for some }${a}\\in ${b}` }; + var peg$f11 = function(body, a) { return `${body}\\text{ for some }${a}` }; + var peg$f12 = function(a, b, c) { return `${txt(a)}${b}\\in ${c}` }; + var peg$f13 = function(a, b, c) { return `${txt(a)}${b}\\text{ be such that }${c}` }; + var peg$f14 = function(a, b, c) { return `${txt(a)}${b}\\text{ such that }${c}` }; + var peg$f15 = function(a, b) { return `${txt(a)}${b}` }; + var peg$f16 = function(a) {return sequence(a.map(x=>(x=='cdot /'?'/':x))) }; + var peg$f17 = function(a) { return sequence(a) }; + var peg$f18 = function(b) { return `\\forall ${b}` }; + var peg$f19 = function(b) { return `\\exists ${b}` }; + var peg$f20 = function(b) { return `\\exists! ${b}` }; + var peg$f21 = function(a, b) { return `${a}.\\, ${b}` }; + var peg$f22 = function(a, b) { return `${a}\\mapsto ${b}` }; + var peg$f23 = function(a) { return a.join('\\Leftrightarrow ') }; + var peg$f24 = function(a) { return a.join('\\Rightarrow ') }; + var peg$f25 = function(a) { return a.join('\\text{ or }') }; + var peg$f26 = function(a) { return a.join('\\text{ and }') }; + var peg$f27 = function(b) { return '\\text{not } '+b }; + var peg$f28 = function(a, b, c) { return `${a}\\colon ${b}\\to ${c}` }; + var peg$f29 = function(a, b) { return `${a}\\text{ is a partition of }${b}` }; + var peg$f30 = function(a, b) { return `${a}\\text{ is a relation on} ${b}` }; + var peg$f31 = function(a, b, c) { return `${a}\\underset{${c}}{\\equiv}${b}` }; + var peg$f32 = function(a, c, b) { return `${a}\\underset{${c}}{\\equiv}${b}` }; + var peg$f33 = function(a) { return a.join('\\subseteq ') }; + var peg$f34 = function(a, b) { return `${a}\\notin ${b}` }; + var peg$f35 = function(a, b) { return `${a}\\in ${b}` }; + var peg$f36 = function(a, b) { return `${a}\\mid ${b}` }; + var peg$f37 = function(a) { return a.join('\\leq ') }; + var peg$f38 = function(a) { return a.join('\\lt ') }; + var peg$f39 = function(a, b) { return `${a}\\neq ${b}` }; + var peg$f40 = function(a) { return a.join('\\sim ') }; + var peg$f41 = function(a) { return texEquation(a) }; var peg$f42 = function(a, b, c) { return `${a}${txt(' '+b)}${c}` }; - var peg$f43 = function(a, b, c) { return (b.length==4) + var peg$f43 = function(a, b, c) { return `${a}${txt(' '+b)}${c}` }; + var peg$f44 = function(a, b, c) { return (b.length==4) ? `${a}\\text{ ${b[0]} }${txt(b[2])}${c}` : `${a}\\text{ ${b[0]} }${c}` }; - var peg$f44 = function(a) { return a.join('\\setminus ') }; - var peg$f45 = function(a) { return a.join('\\times ') }; - var peg$f46 = function(a) { return a.join('\\cup ') }; - var peg$f47 = function(a) { return a.join('\\cap ') }; - var peg$f48 = function(a) { return a.join('\\circ ') }; - var peg$f49 = function(k, a, f) { return union(f,k,a) }; - var peg$f50 = function(f, k, a) { return union(f,k,a) }; - var peg$f51 = function(f, k, a) { return summation(f,k,a) }; - var peg$f52 = function(k, a, f) { return intersect(f,k,a) }; - var peg$f53 = function(f, k, a) { return intersect(f,k,a) }; + var peg$f45 = function(a) { return a.join('\\setminus ') }; + var peg$f46 = function(a) { return a.join('\\times ') }; + var peg$f47 = function(a) { return a.join('\\cup ') }; + var peg$f48 = function(a) { return a.join('\\cap ') }; + var peg$f49 = function(a) { return a.join('\\circ ') }; + var peg$f50 = function(k, a, f) { return union(f,k,a) }; + var peg$f51 = function(f, k, a) { return union(f,k,a) }; + var peg$f52 = function(f, k, a) { return summation(f,k,a) }; + var peg$f53 = function(k, a, f) { return intersect(f,k,a) }; var peg$f54 = function(f, k, a) { return intersect(f,k,a) }; - var peg$f55 = function(a, b) { return `\\binom{${nopar(a)}}{${nopar(b)}}` }; - var peg$f56 = function(a, b) { return texSum(a,b) }; - var peg$f57 = function(k, a, b, f) { return summation(f,k,a,b) }; + var peg$f55 = function(f, k, a) { return intersect(f,k,a) }; + var peg$f56 = function(a, b) { return `\\binom{${nopar(a)}}{${nopar(b)}}` }; + var peg$f57 = function(a, b) { return texSum(a,b) }; var peg$f58 = function(k, a, b, f) { return summation(f,k,a,b) }; - var peg$f59 = function(f, k, a, b) { return summation(f,k,a,b) }; + var peg$f59 = function(k, a, b, f) { return summation(f,k,a,b) }; var peg$f60 = function(f, k, a, b) { return summation(f,k,a,b) }; - var peg$f61 = function(a) { return texProduct(a) }; - var peg$f62 = function(a) { return '/'+a }; - var peg$f63 = function(a) { return '-'+a }; - var peg$f64 = function(a) { return a+'!' }; - var peg$f65 = function(a) { return `{${a}}'` }; - var peg$f66 = function(a, b) { return `\\left(${a},${b}\\right)` }; - var peg$f67 = function(a, b) { return `\\mathcal{${a}}\\left(${b}\\right)` }; - var peg$f68 = function(a, b) { return `\\left\\{\\,${a}:\\,${b}\\right\\}` }; - var peg$f69 = function(a) { return `\\left\\{\\,${a}\\,\\right\\}` }; - var peg$f70 = function(a) { return `\\left[${a}\\right]` }; - var peg$f71 = function(a, b) { return `\\left[${a}\\right]_{${b}}` }; - var peg$f72 = function(b) { return `\\left\\langle\\,${b}\\,\\right\\rangle` }; - var peg$f73 = function(a, b) { return texPrefix(a,b) }; - var peg$f74 = function(a, b) { return `{${a}}^{${nopar(b)}}` }; - var peg$f75 = function(a) { return texJoin('\\star ',a) }; - var peg$f76 = function(a) { return `\\left[\\begin{matrix}\n ${ + var peg$f61 = function(f, k, a, b) { return summation(f,k,a,b) }; + var peg$f62 = function(a) { return texProduct(a) }; + var peg$f63 = function(a) { return '/'+a }; + var peg$f64 = function(a) { return '-'+a }; + var peg$f65 = function(a) { return a+'!' }; + var peg$f66 = function(a) { return `{${a}}'` }; + var peg$f67 = function(a, b) { return `\\left(${a},${b}\\right)` }; + var peg$f68 = function(a, b) { return `\\mathcal{${a}}\\left(${b}\\right)` }; + var peg$f69 = function(a, b) { return `\\left\\{\\,${a}:\\,${b}\\right\\}` }; + var peg$f70 = function(a) { return `\\left\\{\\,${a}\\,\\right\\}` }; + var peg$f71 = function(a) { return `\\left[${a}\\right]` }; + var peg$f72 = function(a, b) { return `\\left[${a}\\right]_{${b}}` }; + var peg$f73 = function(b) { return `\\left\\langle\\,${b}\\,\\right\\rangle` }; + var peg$f74 = function(a, b) { return texPrefix(a,b) }; + var peg$f75 = function(a, b) { return `{${a}}^{${nopar(b)}}` }; + var peg$f76 = function(a) { return texJoin('\\star ',a) }; + var peg$f77 = function(a) { return `\\left[\\begin{matrix}\n ${ a.map( s => s.replace(/,/g, ' & ') .replace(/\\left\\langle{|}\\right\\rangle/g,'')) .join(' \\\\\n ')}\n\\end{matrix}\\right]` }; - var peg$f77 = function(a) { return `\\left\\langle{${a}}\\right\\rangle` }; var peg$f78 = function(a) { return `\\left\\langle{${a}}\\right\\rangle` }; - var peg$f79 = function(a, b) { return `\\left\\{\\,${a}:\\,${b}\\right\\}` }; - var peg$f80 = function(a) { return `\\left\\{\\,${a}\\,\\right\\}` }; - var peg$f81 = function(a) { return a }; - var peg$f82 = function(a) { + var peg$f79 = function(a) { return `\\left\\langle{${a}}\\right\\rangle` }; + var peg$f80 = function(a, b) { return `\\left\\{\\,${a}:\\,${b}\\right\\}` }; + var peg$f81 = function(a) { return `\\left\\{\\,${a}\\,\\right\\}` }; + var peg$f82 = function(a) { return a }; + var peg$f83 = function(a) { // we have to check for ~ as a special case (see above) return (a === '\\sim') ? a : `\\left(${a}\\right)` }; - var peg$f83 = function(a) { return texsymbol(a) }; - var peg$f84 = function(a) { let b = texsymbol(a[0]+a[1].join('')) + var peg$f84 = function(a) { return texsymbol(a) }; + var peg$f85 = function(a) { let b = texsymbol(a[0]+a[1].join('')) return (b.length>1 && !b.startsWith('\\')) ? `\\text{${b}}` : b }; - var peg$f85 = function() { return undefined }; + var peg$f86 = function() { return undefined }; var peg$currPos = 0; var peg$savedPos = 0; var peg$posDetailsCache = [{ line: 1, column: 1 }]; @@ -2028,7 +2029,7 @@ function peg$parse(input, options) { } function peg$parseGiven() { - var s0, s1; + var s0, s1, s2, s3, s4, s5, s6; var key = peg$currPos * 91 + 21; var cached = peg$resultsCache[key]; @@ -2042,10 +2043,67 @@ function peg$parse(input, options) { s0 = peg$currPos; s1 = peg$parseGivenLabel(); if (s1 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$f6(s1); + s2 = peg$parse_(); + s3 = peg$currPos; + s4 = []; + s5 = peg$parseExpression(); + while (s5 !== peg$FAILED) { + s4.push(s5); + s5 = peg$currPos; + s6 = peg$parsecomma(); + if (s6 !== peg$FAILED) { + s6 = peg$parseExpression(); + if (s6 === peg$FAILED) { + peg$currPos = s5; + s5 = peg$FAILED; + } else { + s5 = s6; + } + } else { + s5 = s6; + } + } + if (s4.length < 1) { + peg$currPos = s3; + s3 = peg$FAILED; + } else { + s3 = s4; + } + if (s3 !== peg$FAILED) { + s4 = peg$currPos; + peg$silentFails++; + s5 = peg$parsecomma(); + peg$silentFails--; + if (s5 === peg$FAILED) { + s4 = undefined; + } else { + peg$currPos = s4; + s4 = peg$FAILED; + } + if (s4 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f6(s1, s3); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + if (s0 === peg$FAILED) { + s0 = peg$currPos; + s1 = peg$parseGivenLabel(); + if (s1 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$f7(s1); + } + s0 = s1; } - s0 = s1; peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; @@ -2198,7 +2256,7 @@ function peg$parse(input, options) { } if (s3 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f7(s2); + s0 = peg$f8(s2); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -2243,7 +2301,7 @@ function peg$parse(input, options) { s3 = peg$parseDeclareSeq(); if (s3 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f8(s1, s3); + s0 = peg$f9(s1, s3); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -2316,7 +2374,7 @@ function peg$parse(input, options) { s11 = peg$parseExpression(); if (s11 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f9(s1, s7, s11); + s0 = peg$f10(s1, s7, s11); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -2390,7 +2448,7 @@ function peg$parse(input, options) { s7 = peg$parseSymbolSeq(); if (s7 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f10(s1, s7); + s0 = peg$f11(s1, s7); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -2466,7 +2524,7 @@ function peg$parse(input, options) { s7 = peg$parseExpression(); if (s7 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f11(s1, s3, s7); + s0 = peg$f12(s1, s3, s7); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -2544,7 +2602,7 @@ function peg$parse(input, options) { s11 = peg$parseExpression(); if (s11 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f12(s1, s3, s11); + s0 = peg$f13(s1, s3, s11); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -2628,7 +2686,7 @@ function peg$parse(input, options) { s9 = peg$parseExpression(); if (s9 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f13(s1, s3, s9); + s0 = peg$f14(s1, s3, s9); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -2680,7 +2738,7 @@ function peg$parse(input, options) { s3 = peg$parseSymbolSeq(); if (s3 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f14(s1, s3); + s0 = peg$f15(s1, s3); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -2772,7 +2830,7 @@ function peg$parse(input, options) { } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$f15(s1); + s1 = peg$f16(s1); } s0 = s1; @@ -2821,7 +2879,7 @@ function peg$parse(input, options) { } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$f16(s1); + s1 = peg$f17(s1); } s0 = s1; @@ -2856,7 +2914,7 @@ function peg$parse(input, options) { s3 = peg$parseBinding(); if (s3 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f17(s3); + s0 = peg$f18(s3); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -2884,7 +2942,7 @@ function peg$parse(input, options) { s3 = peg$parseBinding(); if (s3 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f18(s3); + s0 = peg$f19(s3); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -2912,7 +2970,7 @@ function peg$parse(input, options) { s3 = peg$parseBinding(); if (s3 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f19(s3); + s0 = peg$f20(s3); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -2954,7 +3012,7 @@ function peg$parse(input, options) { s4 = peg$parseExpression(); if (s4 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f20(s1, s4); + s0 = peg$f21(s1, s4); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -2985,7 +3043,7 @@ function peg$parse(input, options) { s5 = peg$parseExpression(); if (s5 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f21(s1, s5); + s0 = peg$f22(s1, s5); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -3076,7 +3134,7 @@ function peg$parse(input, options) { } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$f22(s1); + s1 = peg$f23(s1); } s0 = s1; @@ -3158,7 +3216,7 @@ function peg$parse(input, options) { } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$f23(s1); + s1 = peg$f24(s1); } s0 = s1; @@ -3243,7 +3301,7 @@ function peg$parse(input, options) { } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$f24(s1); + s1 = peg$f25(s1); } s0 = s1; @@ -3328,7 +3386,7 @@ function peg$parse(input, options) { } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$f25(s1); + s1 = peg$f26(s1); } s0 = s1; @@ -3364,7 +3422,7 @@ function peg$parse(input, options) { s4 = peg$parsePropArg(); if (s4 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f26(s4); + s0 = peg$f27(s4); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -3485,7 +3543,7 @@ function peg$parse(input, options) { s9 = peg$parseRelArg(); if (s9 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f27(s1, s5, s9); + s0 = peg$f28(s1, s5, s9); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -3581,7 +3639,7 @@ function peg$parse(input, options) { } if (s11 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f28(s1, s11); + s0 = peg$f29(s1, s11); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -3676,7 +3734,7 @@ function peg$parse(input, options) { } if (s11 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f29(s1, s11); + s0 = peg$f30(s1, s11); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -3775,7 +3833,7 @@ function peg$parse(input, options) { } if (s9 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f30(s1, s5, s9); + s0 = peg$f31(s1, s5, s9); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -3844,7 +3902,7 @@ function peg$parse(input, options) { } if (s9 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f31(s1, s5, s9); + s0 = peg$f32(s1, s5, s9); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -3950,7 +4008,7 @@ function peg$parse(input, options) { } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$f32(s1); + s1 = peg$f33(s1); } s0 = s1; @@ -3988,7 +4046,7 @@ function peg$parse(input, options) { s5 = peg$parseRelArg(); if (s5 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f33(s1, s5); + s0 = peg$f34(s1, s5); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -4040,7 +4098,7 @@ function peg$parse(input, options) { s5 = peg$parseRelArg(); if (s5 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f34(s1, s5); + s0 = peg$f35(s1, s5); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -4122,7 +4180,7 @@ function peg$parse(input, options) { s4 = peg$parseRelArg(); if (s4 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f35(s1, s4); + s0 = peg$f36(s1, s4); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -4202,7 +4260,7 @@ function peg$parse(input, options) { } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$f36(s1); + s1 = peg$f37(s1); } s0 = s1; @@ -4298,7 +4356,7 @@ function peg$parse(input, options) { } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$f37(s1); + s1 = peg$f38(s1); } s0 = s1; @@ -4345,7 +4403,7 @@ function peg$parse(input, options) { s5 = peg$parseRelArg(); if (s5 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f38(s1, s5); + s0 = peg$f39(s1, s5); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -4430,7 +4488,7 @@ function peg$parse(input, options) { } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$f39(s1); + s1 = peg$f40(s1); } s0 = s1; @@ -4501,7 +4559,7 @@ function peg$parse(input, options) { } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$f40(s1); + s1 = peg$f41(s1); } s0 = s1; @@ -4548,7 +4606,7 @@ function peg$parse(input, options) { s5 = peg$parseRelArg(); if (s5 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f41(s1, s3, s5); + s0 = peg$f42(s1, s3, s5); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -4609,7 +4667,7 @@ function peg$parse(input, options) { s5 = peg$parseRelArg(); if (s5 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f42(s1, s3, s5); + s0 = peg$f43(s1, s3, s5); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -4778,7 +4836,7 @@ function peg$parse(input, options) { s4 = peg$parseRelArg(); if (s4 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f43(s1, s3, s4); + s0 = peg$f44(s1, s3, s4); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -4858,7 +4916,7 @@ function peg$parse(input, options) { } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$f44(s1); + s1 = peg$f45(s1); } s0 = s1; @@ -4937,7 +4995,7 @@ function peg$parse(input, options) { } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$f45(s1); + s1 = peg$f46(s1); } s0 = s1; @@ -5016,7 +5074,7 @@ function peg$parse(input, options) { } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$f46(s1); + s1 = peg$f47(s1); } s0 = s1; @@ -5095,7 +5153,7 @@ function peg$parse(input, options) { } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$f47(s1); + s1 = peg$f48(s1); } s0 = s1; @@ -5174,7 +5232,7 @@ function peg$parse(input, options) { } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$f48(s1); + s1 = peg$f49(s1); } s0 = s1; @@ -5274,7 +5332,7 @@ function peg$parse(input, options) { s11 = peg$parseRelativeComp(); if (s11 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f49(s3, s7, s11); + s0 = peg$f50(s3, s7, s11); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -5379,7 +5437,7 @@ function peg$parse(input, options) { s12 = peg$parseRelativeComp(); if (s12 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f50(s4, s8, s12); + s0 = peg$f51(s4, s8, s12); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -5453,7 +5511,7 @@ function peg$parse(input, options) { } if (s10 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f51(s4, s6, s8); + s0 = peg$f52(s4, s6, s8); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -5585,7 +5643,7 @@ function peg$parse(input, options) { s11 = peg$parseRelativeComp(); if (s11 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f52(s3, s7, s11); + s0 = peg$f53(s3, s7, s11); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -5690,7 +5748,7 @@ function peg$parse(input, options) { s12 = peg$parseRelativeComp(); if (s12 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f53(s4, s8, s12); + s0 = peg$f54(s4, s8, s12); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -5764,7 +5822,7 @@ function peg$parse(input, options) { } if (s10 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f54(s4, s6, s8); + s0 = peg$f55(s4, s6, s8); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -5874,7 +5932,7 @@ function peg$parse(input, options) { } if (s5 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f55(s1, s5); + s0 = peg$f56(s1, s5); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -5978,7 +6036,7 @@ function peg$parse(input, options) { } if (s3 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f56(s1, s3); + s0 = peg$f57(s1, s3); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -6096,7 +6154,7 @@ function peg$parse(input, options) { s11 = peg$parseProduct(); if (s11 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f57(s3, s5, s8, s11); + s0 = peg$f58(s3, s5, s8, s11); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -6202,7 +6260,7 @@ function peg$parse(input, options) { s14 = peg$parseProduct(); if (s14 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f58(s3, s7, s11, s14); + s0 = peg$f59(s3, s7, s11, s14); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -6408,7 +6466,7 @@ function peg$parse(input, options) { s13 = peg$parseProduct(); if (s13 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f59(s4, s7, s10, s13); + s0 = peg$f60(s4, s7, s10, s13); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -6505,7 +6563,7 @@ function peg$parse(input, options) { } if (s11 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f60(s4, s6, s8, s9); + s0 = peg$f61(s4, s6, s8, s9); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -6658,7 +6716,7 @@ function peg$parse(input, options) { } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$f61(s1); + s1 = peg$f62(s1); } s0 = s1; @@ -6692,7 +6750,7 @@ function peg$parse(input, options) { s3 = peg$parseExpArgs(); if (s3 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f62(s3); + s0 = peg$f63(s3); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -6732,7 +6790,7 @@ function peg$parse(input, options) { s3 = peg$parseExpArgs(); if (s3 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f63(s3); + s0 = peg$f64(s3); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -6829,7 +6887,7 @@ function peg$parse(input, options) { } if (s4 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f64(s1); + s0 = peg$f65(s1); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -6899,7 +6957,7 @@ function peg$parse(input, options) { } if (s4 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f65(s1); + s0 = peg$f66(s1); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -6956,7 +7014,7 @@ function peg$parse(input, options) { } if (s7 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f66(s3, s5); + s0 = peg$f67(s3, s5); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -7080,7 +7138,7 @@ function peg$parse(input, options) { } if (s3 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f67(s2, s3); + s0 = peg$f68(s2, s3); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -7128,7 +7186,7 @@ function peg$parse(input, options) { } if (s9 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f68(s3, s7); + s0 = peg$f69(s3, s7); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -7171,7 +7229,7 @@ function peg$parse(input, options) { } if (s5 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f69(s3); + s0 = peg$f70(s3); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -7203,7 +7261,7 @@ function peg$parse(input, options) { } if (s5 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f70(s3); + s0 = peg$f71(s3); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -7242,7 +7300,7 @@ function peg$parse(input, options) { } if (s6 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f71(s3, s5); + s0 = peg$f72(s3, s5); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -7285,7 +7343,7 @@ function peg$parse(input, options) { } if (s5 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f72(s3); + s0 = peg$f73(s3); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -7394,7 +7452,7 @@ function peg$parse(input, options) { } if (s2 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f73(s1, s2); + s0 = peg$f74(s1, s2); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -7452,7 +7510,7 @@ function peg$parse(input, options) { } if (s5 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f74(s1, s5); + s0 = peg$f75(s1, s5); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -7551,7 +7609,7 @@ function peg$parse(input, options) { } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$f75(s1); + s1 = peg$f76(s1); } s0 = s1; @@ -7655,7 +7713,7 @@ function peg$parse(input, options) { } if (s6 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f76(s3); + s0 = peg$f77(s3); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -7718,7 +7776,7 @@ function peg$parse(input, options) { } if (s6 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f77(s3); + s0 = peg$f78(s3); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -7765,7 +7823,7 @@ function peg$parse(input, options) { } if (s6 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f78(s3); + s0 = peg$f79(s3); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -7835,7 +7893,7 @@ function peg$parse(input, options) { } if (s9 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f79(s3, s7); + s0 = peg$f80(s3, s7); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -7878,7 +7936,7 @@ function peg$parse(input, options) { } if (s5 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f80(s3); + s0 = peg$f81(s3); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -7934,7 +7992,7 @@ function peg$parse(input, options) { } if (s5 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f81(s3); + s0 = peg$f82(s3); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -7970,7 +8028,7 @@ function peg$parse(input, options) { } if (s5 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f82(s3); + s0 = peg$f83(s3); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -8209,7 +8267,7 @@ function peg$parse(input, options) { } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$f83(s1); + s1 = peg$f84(s1); } s0 = s1; if (s0 === peg$FAILED) { @@ -8271,7 +8329,7 @@ function peg$parse(input, options) { } if (s2 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f84(s2); + s0 = peg$f85(s2); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -8680,7 +8738,7 @@ function peg$parse(input, options) { if (s1 !== peg$FAILED) { s2 = peg$parse_(); peg$savedPos = s0; - s0 = peg$f85(); + s0 = peg$f86(); } else { peg$currPos = s0; s0 = peg$FAILED; diff --git a/lde/src/experimental/parsers/lurch-to-tex.peggy b/lde/src/experimental/parsers/lurch-to-tex.peggy index 61042f3e..a42679af 100644 --- a/lde/src/experimental/parsers/lurch-to-tex.peggy +++ b/lde/src/experimental/parsers/lurch-to-tex.peggy @@ -546,7 +546,9 @@ Shorthand = Equiv / a:(BIH / Ruleset / Rule / Thm / Proof / Cases / Subs / Comma // Given = a:GivenLabel b:Environment { // return (/^\s*:\s*$/.test(a)) ? b : `${txt(a)} ${b}` } / // a:GivenLabel b:Expression|1..,comma| { return `${txt(a)} ${sequence(b)}` } -Given = a:GivenLabel { return `${txt(a) }`} +Given = a:GivenLabel _ b:Expression|1..,comma| !comma + { return `${txt(a)} ${sequence(b)}` } / + a:GivenLabel { return `${txt(a) }`} GivenLabel = $':' / $(('assume'i / 'given'i / 'suppose'i / 'if'i / 'from'i / 'define'i ) !alphanum) @@ -684,7 +686,7 @@ Relations = Maps / Partition / Congruent / Subset / ElementOf / NotEltOf / // // We imitate Algebraic operator precendence as much as possible and rank from // lowest to highest: set difference < set product < ∪ and ∩ (tied) < -// composition , complement (tie) Thus, as for Prop we only need for Set to +// composition, complement (tie) Thus, as for Prop we only need for Set to // point to the first one. Algebraic bubbles up from Composition. Set = RelativeComp @@ -873,7 +875,8 @@ Prefix = // LDE EFA's first { return `\\left\\{\\,${a}\\,\\right\\}` } / // allow 'class' to be case insensitive (one or two args) 'class('i _ a:Expression _')' { return `\\left[${a}\\right]` } / - 'class('i _ a:Expression comma b:Expression')' { return `\\left[${a}\\right]_{${b}}` } / + 'class('i _ a:Expression comma b:Expression')' + { return `\\left[${a}\\right]_{${b}}` } / // allow 'tuple' to be case insensitive and format it appropriately 'tuple('i _ b:ExpressionSeq _ ')' { return `\\left\\langle\\,${b}\\,\\right\\rangle` } / diff --git a/lurchmath/parsers/lurch-to-tex.js b/lurchmath/parsers/lurch-to-tex.js index 08c42108..390fa0ee 100644 --- a/lurchmath/parsers/lurch-to-tex.js +++ b/lurchmath/parsers/lurch-to-tex.js @@ -820,95 +820,96 @@ function peg$parse(input, options) { var peg$f3 = function(a) { return txt(a) }; var peg$f4 = function() { return '~\\equiv~' }; var peg$f5 = function() { return 'Substitution' }; - var peg$f6 = function(a) { return `${txt(a) }`}; - var peg$f7 = function(a) { return `\\left\\{ ${a} \\right\\}` }; - var peg$f8 = function(a, b) { return `${txt(a)} ${b}` }; - var peg$f9 = function(body, a, b) { return `${body}\\text{ for some }${a}\\in ${b}` }; - var peg$f10 = function(body, a) { return `${body}\\text{ for some }${a}` }; - var peg$f11 = function(a, b, c) { return `${txt(a)}${b}\\in ${c}` }; - var peg$f12 = function(a, b, c) { return `${txt(a)}${b}\\text{ be such that }${c}` }; - var peg$f13 = function(a, b, c) { return `${txt(a)}${b}\\text{ such that }${c}` }; - var peg$f14 = function(a, b) { return `${txt(a)}${b}` }; - var peg$f15 = function(a) {return sequence(a.map(x=>(x=='cdot /'?'/':x))) }; - var peg$f16 = function(a) { return sequence(a) }; - var peg$f17 = function(b) { return `\\forall ${b}` }; - var peg$f18 = function(b) { return `\\exists ${b}` }; - var peg$f19 = function(b) { return `\\exists! ${b}` }; - var peg$f20 = function(a, b) { return `${a}.\\, ${b}` }; - var peg$f21 = function(a, b) { return `${a}\\mapsto ${b}` }; - var peg$f22 = function(a) { return a.join('\\Leftrightarrow ') }; - var peg$f23 = function(a) { return a.join('\\Rightarrow ') }; - var peg$f24 = function(a) { return a.join('\\text{ or }') }; - var peg$f25 = function(a) { return a.join('\\text{ and }') }; - var peg$f26 = function(b) { return '\\text{not } '+b }; - var peg$f27 = function(a, b, c) { return `${a}\\colon ${b}\\to ${c}` }; - var peg$f28 = function(a, b) { return `${a}\\text{ is a partition of }${b}` }; - var peg$f29 = function(a, b) { return `${a}\\text{ is a relation on} ${b}` }; - var peg$f30 = function(a, b, c) { return `${a}\\underset{${c}}{\\equiv}${b}` }; - var peg$f31 = function(a, c, b) { return `${a}\\underset{${c}}{\\equiv}${b}` }; - var peg$f32 = function(a) { return a.join('\\subseteq ') }; - var peg$f33 = function(a, b) { return `${a}\\notin ${b}` }; - var peg$f34 = function(a, b) { return `${a}\\in ${b}` }; - var peg$f35 = function(a, b) { return `${a}\\mid ${b}` }; - var peg$f36 = function(a) { return a.join('\\leq ') }; - var peg$f37 = function(a) { return a.join('\\lt ') }; - var peg$f38 = function(a, b) { return `${a}\\neq ${b}` }; - var peg$f39 = function(a) { return a.join('\\sim ') }; - var peg$f40 = function(a) { return texEquation(a) }; - var peg$f41 = function(a, b, c) { return `${a}${txt(' '+b)}${c}` }; + var peg$f6 = function(a, b) { return `${txt(a)} ${sequence(b)}` }; + var peg$f7 = function(a) { return `${txt(a) }`}; + var peg$f8 = function(a) { return `\\left\\{ ${a} \\right\\}` }; + var peg$f9 = function(a, b) { return `${txt(a)} ${b}` }; + var peg$f10 = function(body, a, b) { return `${body}\\text{ for some }${a}\\in ${b}` }; + var peg$f11 = function(body, a) { return `${body}\\text{ for some }${a}` }; + var peg$f12 = function(a, b, c) { return `${txt(a)}${b}\\in ${c}` }; + var peg$f13 = function(a, b, c) { return `${txt(a)}${b}\\text{ be such that }${c}` }; + var peg$f14 = function(a, b, c) { return `${txt(a)}${b}\\text{ such that }${c}` }; + var peg$f15 = function(a, b) { return `${txt(a)}${b}` }; + var peg$f16 = function(a) {return sequence(a.map(x=>(x=='cdot /'?'/':x))) }; + var peg$f17 = function(a) { return sequence(a) }; + var peg$f18 = function(b) { return `\\forall ${b}` }; + var peg$f19 = function(b) { return `\\exists ${b}` }; + var peg$f20 = function(b) { return `\\exists! ${b}` }; + var peg$f21 = function(a, b) { return `${a}.\\, ${b}` }; + var peg$f22 = function(a, b) { return `${a}\\mapsto ${b}` }; + var peg$f23 = function(a) { return a.join('\\Leftrightarrow ') }; + var peg$f24 = function(a) { return a.join('\\Rightarrow ') }; + var peg$f25 = function(a) { return a.join('\\text{ or }') }; + var peg$f26 = function(a) { return a.join('\\text{ and }') }; + var peg$f27 = function(b) { return '\\text{not } '+b }; + var peg$f28 = function(a, b, c) { return `${a}\\colon ${b}\\to ${c}` }; + var peg$f29 = function(a, b) { return `${a}\\text{ is a partition of }${b}` }; + var peg$f30 = function(a, b) { return `${a}\\text{ is a relation on} ${b}` }; + var peg$f31 = function(a, b, c) { return `${a}\\underset{${c}}{\\equiv}${b}` }; + var peg$f32 = function(a, c, b) { return `${a}\\underset{${c}}{\\equiv}${b}` }; + var peg$f33 = function(a) { return a.join('\\subseteq ') }; + var peg$f34 = function(a, b) { return `${a}\\notin ${b}` }; + var peg$f35 = function(a, b) { return `${a}\\in ${b}` }; + var peg$f36 = function(a, b) { return `${a}\\mid ${b}` }; + var peg$f37 = function(a) { return a.join('\\leq ') }; + var peg$f38 = function(a) { return a.join('\\lt ') }; + var peg$f39 = function(a, b) { return `${a}\\neq ${b}` }; + var peg$f40 = function(a) { return a.join('\\sim ') }; + var peg$f41 = function(a) { return texEquation(a) }; var peg$f42 = function(a, b, c) { return `${a}${txt(' '+b)}${c}` }; - var peg$f43 = function(a, b, c) { return (b.length==4) + var peg$f43 = function(a, b, c) { return `${a}${txt(' '+b)}${c}` }; + var peg$f44 = function(a, b, c) { return (b.length==4) ? `${a}\\text{ ${b[0]} }${txt(b[2])}${c}` : `${a}\\text{ ${b[0]} }${c}` }; - var peg$f44 = function(a) { return a.join('\\setminus ') }; - var peg$f45 = function(a) { return a.join('\\times ') }; - var peg$f46 = function(a) { return a.join('\\cup ') }; - var peg$f47 = function(a) { return a.join('\\cap ') }; - var peg$f48 = function(a) { return a.join('\\circ ') }; - var peg$f49 = function(k, a, f) { return union(f,k,a) }; - var peg$f50 = function(f, k, a) { return union(f,k,a) }; - var peg$f51 = function(f, k, a) { return summation(f,k,a) }; - var peg$f52 = function(k, a, f) { return intersect(f,k,a) }; - var peg$f53 = function(f, k, a) { return intersect(f,k,a) }; + var peg$f45 = function(a) { return a.join('\\setminus ') }; + var peg$f46 = function(a) { return a.join('\\times ') }; + var peg$f47 = function(a) { return a.join('\\cup ') }; + var peg$f48 = function(a) { return a.join('\\cap ') }; + var peg$f49 = function(a) { return a.join('\\circ ') }; + var peg$f50 = function(k, a, f) { return union(f,k,a) }; + var peg$f51 = function(f, k, a) { return union(f,k,a) }; + var peg$f52 = function(f, k, a) { return summation(f,k,a) }; + var peg$f53 = function(k, a, f) { return intersect(f,k,a) }; var peg$f54 = function(f, k, a) { return intersect(f,k,a) }; - var peg$f55 = function(a, b) { return `\\binom{${nopar(a)}}{${nopar(b)}}` }; - var peg$f56 = function(a, b) { return texSum(a,b) }; - var peg$f57 = function(k, a, b, f) { return summation(f,k,a,b) }; + var peg$f55 = function(f, k, a) { return intersect(f,k,a) }; + var peg$f56 = function(a, b) { return `\\binom{${nopar(a)}}{${nopar(b)}}` }; + var peg$f57 = function(a, b) { return texSum(a,b) }; var peg$f58 = function(k, a, b, f) { return summation(f,k,a,b) }; - var peg$f59 = function(f, k, a, b) { return summation(f,k,a,b) }; + var peg$f59 = function(k, a, b, f) { return summation(f,k,a,b) }; var peg$f60 = function(f, k, a, b) { return summation(f,k,a,b) }; - var peg$f61 = function(a) { return texProduct(a) }; - var peg$f62 = function(a) { return '/'+a }; - var peg$f63 = function(a) { return '-'+a }; - var peg$f64 = function(a) { return a+'!' }; - var peg$f65 = function(a) { return `{${a}}'` }; - var peg$f66 = function(a, b) { return `\\left(${a},${b}\\right)` }; - var peg$f67 = function(a, b) { return `\\mathcal{${a}}\\left(${b}\\right)` }; - var peg$f68 = function(a, b) { return `\\left\\{\\,${a}:\\,${b}\\right\\}` }; - var peg$f69 = function(a) { return `\\left\\{\\,${a}\\,\\right\\}` }; - var peg$f70 = function(a) { return `\\left[${a}\\right]` }; - var peg$f71 = function(a, b) { return `\\left[${a}\\right]_{${b}}` }; - var peg$f72 = function(b) { return `\\left\\langle\\,${b}\\,\\right\\rangle` }; - var peg$f73 = function(a, b) { return texPrefix(a,b) }; - var peg$f74 = function(a, b) { return `{${a}}^{${nopar(b)}}` }; - var peg$f75 = function(a) { return texJoin('\\star ',a) }; - var peg$f76 = function(a) { return `\\left[\\begin{matrix}\n ${ + var peg$f61 = function(f, k, a, b) { return summation(f,k,a,b) }; + var peg$f62 = function(a) { return texProduct(a) }; + var peg$f63 = function(a) { return '/'+a }; + var peg$f64 = function(a) { return '-'+a }; + var peg$f65 = function(a) { return a+'!' }; + var peg$f66 = function(a) { return `{${a}}'` }; + var peg$f67 = function(a, b) { return `\\left(${a},${b}\\right)` }; + var peg$f68 = function(a, b) { return `\\mathcal{${a}}\\left(${b}\\right)` }; + var peg$f69 = function(a, b) { return `\\left\\{\\,${a}:\\,${b}\\right\\}` }; + var peg$f70 = function(a) { return `\\left\\{\\,${a}\\,\\right\\}` }; + var peg$f71 = function(a) { return `\\left[${a}\\right]` }; + var peg$f72 = function(a, b) { return `\\left[${a}\\right]_{${b}}` }; + var peg$f73 = function(b) { return `\\left\\langle\\,${b}\\,\\right\\rangle` }; + var peg$f74 = function(a, b) { return texPrefix(a,b) }; + var peg$f75 = function(a, b) { return `{${a}}^{${nopar(b)}}` }; + var peg$f76 = function(a) { return texJoin('\\star ',a) }; + var peg$f77 = function(a) { return `\\left[\\begin{matrix}\n ${ a.map( s => s.replace(/,/g, ' & ') .replace(/\\left\\langle{|}\\right\\rangle/g,'')) .join(' \\\\\n ')}\n\\end{matrix}\\right]` }; - var peg$f77 = function(a) { return `\\left\\langle{${a}}\\right\\rangle` }; var peg$f78 = function(a) { return `\\left\\langle{${a}}\\right\\rangle` }; - var peg$f79 = function(a, b) { return `\\left\\{\\,${a}:\\,${b}\\right\\}` }; - var peg$f80 = function(a) { return `\\left\\{\\,${a}\\,\\right\\}` }; - var peg$f81 = function(a) { return a }; - var peg$f82 = function(a) { + var peg$f79 = function(a) { return `\\left\\langle{${a}}\\right\\rangle` }; + var peg$f80 = function(a, b) { return `\\left\\{\\,${a}:\\,${b}\\right\\}` }; + var peg$f81 = function(a) { return `\\left\\{\\,${a}\\,\\right\\}` }; + var peg$f82 = function(a) { return a }; + var peg$f83 = function(a) { // we have to check for ~ as a special case (see above) return (a === '\\sim') ? a : `\\left(${a}\\right)` }; - var peg$f83 = function(a) { return texsymbol(a) }; - var peg$f84 = function(a) { let b = texsymbol(a[0]+a[1].join('')) + var peg$f84 = function(a) { return texsymbol(a) }; + var peg$f85 = function(a) { let b = texsymbol(a[0]+a[1].join('')) return (b.length>1 && !b.startsWith('\\')) ? `\\text{${b}}` : b }; - var peg$f85 = function() { return undefined }; + var peg$f86 = function() { return undefined }; var peg$currPos = 0; var peg$savedPos = 0; var peg$posDetailsCache = [{ line: 1, column: 1 }]; @@ -2028,7 +2029,7 @@ function peg$parse(input, options) { } function peg$parseGiven() { - var s0, s1; + var s0, s1, s2, s3, s4, s5, s6; var key = peg$currPos * 91 + 21; var cached = peg$resultsCache[key]; @@ -2042,10 +2043,67 @@ function peg$parse(input, options) { s0 = peg$currPos; s1 = peg$parseGivenLabel(); if (s1 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$f6(s1); + s2 = peg$parse_(); + s3 = peg$currPos; + s4 = []; + s5 = peg$parseExpression(); + while (s5 !== peg$FAILED) { + s4.push(s5); + s5 = peg$currPos; + s6 = peg$parsecomma(); + if (s6 !== peg$FAILED) { + s6 = peg$parseExpression(); + if (s6 === peg$FAILED) { + peg$currPos = s5; + s5 = peg$FAILED; + } else { + s5 = s6; + } + } else { + s5 = s6; + } + } + if (s4.length < 1) { + peg$currPos = s3; + s3 = peg$FAILED; + } else { + s3 = s4; + } + if (s3 !== peg$FAILED) { + s4 = peg$currPos; + peg$silentFails++; + s5 = peg$parsecomma(); + peg$silentFails--; + if (s5 === peg$FAILED) { + s4 = undefined; + } else { + peg$currPos = s4; + s4 = peg$FAILED; + } + if (s4 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f6(s1, s3); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + if (s0 === peg$FAILED) { + s0 = peg$currPos; + s1 = peg$parseGivenLabel(); + if (s1 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$f7(s1); + } + s0 = s1; } - s0 = s1; peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; @@ -2198,7 +2256,7 @@ function peg$parse(input, options) { } if (s3 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f7(s2); + s0 = peg$f8(s2); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -2243,7 +2301,7 @@ function peg$parse(input, options) { s3 = peg$parseDeclareSeq(); if (s3 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f8(s1, s3); + s0 = peg$f9(s1, s3); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -2316,7 +2374,7 @@ function peg$parse(input, options) { s11 = peg$parseExpression(); if (s11 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f9(s1, s7, s11); + s0 = peg$f10(s1, s7, s11); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -2390,7 +2448,7 @@ function peg$parse(input, options) { s7 = peg$parseSymbolSeq(); if (s7 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f10(s1, s7); + s0 = peg$f11(s1, s7); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -2466,7 +2524,7 @@ function peg$parse(input, options) { s7 = peg$parseExpression(); if (s7 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f11(s1, s3, s7); + s0 = peg$f12(s1, s3, s7); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -2544,7 +2602,7 @@ function peg$parse(input, options) { s11 = peg$parseExpression(); if (s11 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f12(s1, s3, s11); + s0 = peg$f13(s1, s3, s11); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -2628,7 +2686,7 @@ function peg$parse(input, options) { s9 = peg$parseExpression(); if (s9 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f13(s1, s3, s9); + s0 = peg$f14(s1, s3, s9); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -2680,7 +2738,7 @@ function peg$parse(input, options) { s3 = peg$parseSymbolSeq(); if (s3 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f14(s1, s3); + s0 = peg$f15(s1, s3); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -2772,7 +2830,7 @@ function peg$parse(input, options) { } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$f15(s1); + s1 = peg$f16(s1); } s0 = s1; @@ -2821,7 +2879,7 @@ function peg$parse(input, options) { } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$f16(s1); + s1 = peg$f17(s1); } s0 = s1; @@ -2856,7 +2914,7 @@ function peg$parse(input, options) { s3 = peg$parseBinding(); if (s3 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f17(s3); + s0 = peg$f18(s3); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -2884,7 +2942,7 @@ function peg$parse(input, options) { s3 = peg$parseBinding(); if (s3 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f18(s3); + s0 = peg$f19(s3); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -2912,7 +2970,7 @@ function peg$parse(input, options) { s3 = peg$parseBinding(); if (s3 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f19(s3); + s0 = peg$f20(s3); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -2954,7 +3012,7 @@ function peg$parse(input, options) { s4 = peg$parseExpression(); if (s4 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f20(s1, s4); + s0 = peg$f21(s1, s4); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -2985,7 +3043,7 @@ function peg$parse(input, options) { s5 = peg$parseExpression(); if (s5 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f21(s1, s5); + s0 = peg$f22(s1, s5); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -3076,7 +3134,7 @@ function peg$parse(input, options) { } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$f22(s1); + s1 = peg$f23(s1); } s0 = s1; @@ -3158,7 +3216,7 @@ function peg$parse(input, options) { } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$f23(s1); + s1 = peg$f24(s1); } s0 = s1; @@ -3243,7 +3301,7 @@ function peg$parse(input, options) { } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$f24(s1); + s1 = peg$f25(s1); } s0 = s1; @@ -3328,7 +3386,7 @@ function peg$parse(input, options) { } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$f25(s1); + s1 = peg$f26(s1); } s0 = s1; @@ -3364,7 +3422,7 @@ function peg$parse(input, options) { s4 = peg$parsePropArg(); if (s4 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f26(s4); + s0 = peg$f27(s4); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -3485,7 +3543,7 @@ function peg$parse(input, options) { s9 = peg$parseRelArg(); if (s9 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f27(s1, s5, s9); + s0 = peg$f28(s1, s5, s9); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -3581,7 +3639,7 @@ function peg$parse(input, options) { } if (s11 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f28(s1, s11); + s0 = peg$f29(s1, s11); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -3676,7 +3734,7 @@ function peg$parse(input, options) { } if (s11 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f29(s1, s11); + s0 = peg$f30(s1, s11); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -3775,7 +3833,7 @@ function peg$parse(input, options) { } if (s9 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f30(s1, s5, s9); + s0 = peg$f31(s1, s5, s9); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -3844,7 +3902,7 @@ function peg$parse(input, options) { } if (s9 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f31(s1, s5, s9); + s0 = peg$f32(s1, s5, s9); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -3950,7 +4008,7 @@ function peg$parse(input, options) { } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$f32(s1); + s1 = peg$f33(s1); } s0 = s1; @@ -3988,7 +4046,7 @@ function peg$parse(input, options) { s5 = peg$parseRelArg(); if (s5 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f33(s1, s5); + s0 = peg$f34(s1, s5); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -4040,7 +4098,7 @@ function peg$parse(input, options) { s5 = peg$parseRelArg(); if (s5 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f34(s1, s5); + s0 = peg$f35(s1, s5); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -4122,7 +4180,7 @@ function peg$parse(input, options) { s4 = peg$parseRelArg(); if (s4 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f35(s1, s4); + s0 = peg$f36(s1, s4); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -4202,7 +4260,7 @@ function peg$parse(input, options) { } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$f36(s1); + s1 = peg$f37(s1); } s0 = s1; @@ -4298,7 +4356,7 @@ function peg$parse(input, options) { } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$f37(s1); + s1 = peg$f38(s1); } s0 = s1; @@ -4345,7 +4403,7 @@ function peg$parse(input, options) { s5 = peg$parseRelArg(); if (s5 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f38(s1, s5); + s0 = peg$f39(s1, s5); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -4430,7 +4488,7 @@ function peg$parse(input, options) { } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$f39(s1); + s1 = peg$f40(s1); } s0 = s1; @@ -4501,7 +4559,7 @@ function peg$parse(input, options) { } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$f40(s1); + s1 = peg$f41(s1); } s0 = s1; @@ -4548,7 +4606,7 @@ function peg$parse(input, options) { s5 = peg$parseRelArg(); if (s5 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f41(s1, s3, s5); + s0 = peg$f42(s1, s3, s5); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -4609,7 +4667,7 @@ function peg$parse(input, options) { s5 = peg$parseRelArg(); if (s5 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f42(s1, s3, s5); + s0 = peg$f43(s1, s3, s5); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -4778,7 +4836,7 @@ function peg$parse(input, options) { s4 = peg$parseRelArg(); if (s4 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f43(s1, s3, s4); + s0 = peg$f44(s1, s3, s4); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -4858,7 +4916,7 @@ function peg$parse(input, options) { } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$f44(s1); + s1 = peg$f45(s1); } s0 = s1; @@ -4937,7 +4995,7 @@ function peg$parse(input, options) { } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$f45(s1); + s1 = peg$f46(s1); } s0 = s1; @@ -5016,7 +5074,7 @@ function peg$parse(input, options) { } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$f46(s1); + s1 = peg$f47(s1); } s0 = s1; @@ -5095,7 +5153,7 @@ function peg$parse(input, options) { } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$f47(s1); + s1 = peg$f48(s1); } s0 = s1; @@ -5174,7 +5232,7 @@ function peg$parse(input, options) { } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$f48(s1); + s1 = peg$f49(s1); } s0 = s1; @@ -5274,7 +5332,7 @@ function peg$parse(input, options) { s11 = peg$parseRelativeComp(); if (s11 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f49(s3, s7, s11); + s0 = peg$f50(s3, s7, s11); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -5379,7 +5437,7 @@ function peg$parse(input, options) { s12 = peg$parseRelativeComp(); if (s12 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f50(s4, s8, s12); + s0 = peg$f51(s4, s8, s12); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -5453,7 +5511,7 @@ function peg$parse(input, options) { } if (s10 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f51(s4, s6, s8); + s0 = peg$f52(s4, s6, s8); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -5585,7 +5643,7 @@ function peg$parse(input, options) { s11 = peg$parseRelativeComp(); if (s11 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f52(s3, s7, s11); + s0 = peg$f53(s3, s7, s11); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -5690,7 +5748,7 @@ function peg$parse(input, options) { s12 = peg$parseRelativeComp(); if (s12 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f53(s4, s8, s12); + s0 = peg$f54(s4, s8, s12); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -5764,7 +5822,7 @@ function peg$parse(input, options) { } if (s10 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f54(s4, s6, s8); + s0 = peg$f55(s4, s6, s8); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -5874,7 +5932,7 @@ function peg$parse(input, options) { } if (s5 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f55(s1, s5); + s0 = peg$f56(s1, s5); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -5978,7 +6036,7 @@ function peg$parse(input, options) { } if (s3 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f56(s1, s3); + s0 = peg$f57(s1, s3); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -6096,7 +6154,7 @@ function peg$parse(input, options) { s11 = peg$parseProduct(); if (s11 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f57(s3, s5, s8, s11); + s0 = peg$f58(s3, s5, s8, s11); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -6202,7 +6260,7 @@ function peg$parse(input, options) { s14 = peg$parseProduct(); if (s14 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f58(s3, s7, s11, s14); + s0 = peg$f59(s3, s7, s11, s14); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -6408,7 +6466,7 @@ function peg$parse(input, options) { s13 = peg$parseProduct(); if (s13 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f59(s4, s7, s10, s13); + s0 = peg$f60(s4, s7, s10, s13); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -6505,7 +6563,7 @@ function peg$parse(input, options) { } if (s11 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f60(s4, s6, s8, s9); + s0 = peg$f61(s4, s6, s8, s9); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -6658,7 +6716,7 @@ function peg$parse(input, options) { } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$f61(s1); + s1 = peg$f62(s1); } s0 = s1; @@ -6692,7 +6750,7 @@ function peg$parse(input, options) { s3 = peg$parseExpArgs(); if (s3 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f62(s3); + s0 = peg$f63(s3); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -6732,7 +6790,7 @@ function peg$parse(input, options) { s3 = peg$parseExpArgs(); if (s3 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f63(s3); + s0 = peg$f64(s3); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -6829,7 +6887,7 @@ function peg$parse(input, options) { } if (s4 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f64(s1); + s0 = peg$f65(s1); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -6899,7 +6957,7 @@ function peg$parse(input, options) { } if (s4 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f65(s1); + s0 = peg$f66(s1); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -6956,7 +7014,7 @@ function peg$parse(input, options) { } if (s7 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f66(s3, s5); + s0 = peg$f67(s3, s5); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -7080,7 +7138,7 @@ function peg$parse(input, options) { } if (s3 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f67(s2, s3); + s0 = peg$f68(s2, s3); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -7128,7 +7186,7 @@ function peg$parse(input, options) { } if (s9 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f68(s3, s7); + s0 = peg$f69(s3, s7); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -7171,7 +7229,7 @@ function peg$parse(input, options) { } if (s5 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f69(s3); + s0 = peg$f70(s3); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -7203,7 +7261,7 @@ function peg$parse(input, options) { } if (s5 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f70(s3); + s0 = peg$f71(s3); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -7242,7 +7300,7 @@ function peg$parse(input, options) { } if (s6 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f71(s3, s5); + s0 = peg$f72(s3, s5); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -7285,7 +7343,7 @@ function peg$parse(input, options) { } if (s5 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f72(s3); + s0 = peg$f73(s3); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -7394,7 +7452,7 @@ function peg$parse(input, options) { } if (s2 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f73(s1, s2); + s0 = peg$f74(s1, s2); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -7452,7 +7510,7 @@ function peg$parse(input, options) { } if (s5 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f74(s1, s5); + s0 = peg$f75(s1, s5); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -7551,7 +7609,7 @@ function peg$parse(input, options) { } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$f75(s1); + s1 = peg$f76(s1); } s0 = s1; @@ -7655,7 +7713,7 @@ function peg$parse(input, options) { } if (s6 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f76(s3); + s0 = peg$f77(s3); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -7718,7 +7776,7 @@ function peg$parse(input, options) { } if (s6 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f77(s3); + s0 = peg$f78(s3); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -7765,7 +7823,7 @@ function peg$parse(input, options) { } if (s6 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f78(s3); + s0 = peg$f79(s3); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -7835,7 +7893,7 @@ function peg$parse(input, options) { } if (s9 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f79(s3, s7); + s0 = peg$f80(s3, s7); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -7878,7 +7936,7 @@ function peg$parse(input, options) { } if (s5 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f80(s3); + s0 = peg$f81(s3); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -7934,7 +7992,7 @@ function peg$parse(input, options) { } if (s5 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f81(s3); + s0 = peg$f82(s3); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -7970,7 +8028,7 @@ function peg$parse(input, options) { } if (s5 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f82(s3); + s0 = peg$f83(s3); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -8209,7 +8267,7 @@ function peg$parse(input, options) { } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$f83(s1); + s1 = peg$f84(s1); } s0 = s1; if (s0 === peg$FAILED) { @@ -8271,7 +8329,7 @@ function peg$parse(input, options) { } if (s2 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f84(s2); + s0 = peg$f85(s2); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -8680,7 +8738,7 @@ function peg$parse(input, options) { if (s1 !== peg$FAILED) { s2 = peg$parse_(); peg$savedPos = s0; - s0 = peg$f85(); + s0 = peg$f86(); } else { peg$currPos = s0; s0 = peg$FAILED; diff --git a/lurchmath/parsers/lurch-to-tex.peggy b/lurchmath/parsers/lurch-to-tex.peggy index 61042f3e..a42679af 100644 --- a/lurchmath/parsers/lurch-to-tex.peggy +++ b/lurchmath/parsers/lurch-to-tex.peggy @@ -546,7 +546,9 @@ Shorthand = Equiv / a:(BIH / Ruleset / Rule / Thm / Proof / Cases / Subs / Comma // Given = a:GivenLabel b:Environment { // return (/^\s*:\s*$/.test(a)) ? b : `${txt(a)} ${b}` } / // a:GivenLabel b:Expression|1..,comma| { return `${txt(a)} ${sequence(b)}` } -Given = a:GivenLabel { return `${txt(a) }`} +Given = a:GivenLabel _ b:Expression|1..,comma| !comma + { return `${txt(a)} ${sequence(b)}` } / + a:GivenLabel { return `${txt(a) }`} GivenLabel = $':' / $(('assume'i / 'given'i / 'suppose'i / 'if'i / 'from'i / 'define'i ) !alphanum) @@ -684,7 +686,7 @@ Relations = Maps / Partition / Congruent / Subset / ElementOf / NotEltOf / // // We imitate Algebraic operator precendence as much as possible and rank from // lowest to highest: set difference < set product < ∪ and ∩ (tied) < -// composition , complement (tie) Thus, as for Prop we only need for Set to +// composition, complement (tie) Thus, as for Prop we only need for Set to // point to the first one. Algebraic bubbles up from Composition. Set = RelativeComp @@ -873,7 +875,8 @@ Prefix = // LDE EFA's first { return `\\left\\{\\,${a}\\,\\right\\}` } / // allow 'class' to be case insensitive (one or two args) 'class('i _ a:Expression _')' { return `\\left[${a}\\right]` } / - 'class('i _ a:Expression comma b:Expression')' { return `\\left[${a}\\right]_{${b}}` } / + 'class('i _ a:Expression comma b:Expression')' + { return `\\left[${a}\\right]_{${b}}` } / // allow 'tuple' to be case insensitive and format it appropriately 'tuple('i _ b:ExpressionSeq _ ')' { return `\\left\\langle\\,${b}\\,\\right\\rangle` } / diff --git a/lurchmath/syntax-theme.css b/lurchmath/syntax-theme.css index ed4a9148..60309b2c 100755 --- a/lurchmath/syntax-theme.css +++ b/lurchmath/syntax-theme.css @@ -258,7 +258,7 @@ body.shell-style-boxed { /* Shell titles */ - /* Add a shell title in the left margin */ + /* Add a shell title in the left margin except for subproofs */ [data-shell_title]::before { content: attr(data-shell_title); color: var(--margin-color);