this repo has no description
2
fork

Configure Feed

Select the types of activity you want to include in your feed.

update: filter/done parsing

+1384 -103
+1292
mast-react-vite/src/lib/command_js.js
··· 1 + // @generated by Peggy 4.2.0. 2 + // 3 + // https://peggyjs.org/ 4 + 5 + 6 + function peg$subclass(child, parent) { 7 + function C() { this.constructor = child; } 8 + C.prototype = parent.prototype; 9 + child.prototype = new C(); 10 + } 11 + 12 + function peg$SyntaxError(message, expected, found, location) { 13 + var self = Error.call(this, message); 14 + // istanbul ignore next Check is a necessary evil to support older environments 15 + if (Object.setPrototypeOf) { 16 + Object.setPrototypeOf(self, peg$SyntaxError.prototype); 17 + } 18 + self.expected = expected; 19 + self.found = found; 20 + self.location = location; 21 + self.name = "SyntaxError"; 22 + return self; 23 + } 24 + 25 + peg$subclass(peg$SyntaxError, Error); 26 + 27 + function peg$padEnd(str, targetLength, padString) { 28 + padString = padString || " "; 29 + if (str.length > targetLength) { return str; } 30 + targetLength -= str.length; 31 + padString += padString.repeat(targetLength); 32 + return str + padString.slice(0, targetLength); 33 + } 34 + 35 + peg$SyntaxError.prototype.format = function(sources) { 36 + var str = "Error: " + this.message; 37 + if (this.location) { 38 + var src = null; 39 + var k; 40 + for (k = 0; k < sources.length; k++) { 41 + if (sources[k].source === this.location.source) { 42 + src = sources[k].text.split(/\r\n|\n|\r/g); 43 + break; 44 + } 45 + } 46 + var s = this.location.start; 47 + var offset_s = (this.location.source && (typeof this.location.source.offset === "function")) 48 + ? this.location.source.offset(s) 49 + : s; 50 + var loc = this.location.source + ":" + offset_s.line + ":" + offset_s.column; 51 + if (src) { 52 + var e = this.location.end; 53 + var filler = peg$padEnd("", offset_s.line.toString().length, ' '); 54 + var line = src[s.line - 1]; 55 + var last = s.line === e.line ? e.column : line.length + 1; 56 + var hatLen = (last - s.column) || 1; 57 + str += "\n --> " + loc + "\n" 58 + + filler + " |\n" 59 + + offset_s.line + " | " + line + "\n" 60 + + filler + " | " + peg$padEnd("", s.column - 1, ' ') 61 + + peg$padEnd("", hatLen, "^"); 62 + } else { 63 + str += "\n at " + loc; 64 + } 65 + } 66 + return str; 67 + }; 68 + 69 + peg$SyntaxError.buildMessage = function(expected, found) { 70 + var DESCRIBE_EXPECTATION_FNS = { 71 + literal: function(expectation) { 72 + return "\"" + literalEscape(expectation.text) + "\""; 73 + }, 74 + 75 + class: function(expectation) { 76 + var escapedParts = expectation.parts.map(function(part) { 77 + return Array.isArray(part) 78 + ? classEscape(part[0]) + "-" + classEscape(part[1]) 79 + : classEscape(part); 80 + }); 81 + 82 + return "[" + (expectation.inverted ? "^" : "") + escapedParts.join("") + "]"; 83 + }, 84 + 85 + any: function() { 86 + return "any character"; 87 + }, 88 + 89 + end: function() { 90 + return "end of input"; 91 + }, 92 + 93 + other: function(expectation) { 94 + return expectation.description; 95 + } 96 + }; 97 + 98 + function hex(ch) { 99 + return ch.charCodeAt(0).toString(16).toUpperCase(); 100 + } 101 + 102 + function literalEscape(s) { 103 + return s 104 + .replace(/\\/g, "\\\\") 105 + .replace(/"/g, "\\\"") 106 + .replace(/\0/g, "\\0") 107 + .replace(/\t/g, "\\t") 108 + .replace(/\n/g, "\\n") 109 + .replace(/\r/g, "\\r") 110 + .replace(/[\x00-\x0F]/g, function(ch) { return "\\x0" + hex(ch); }) 111 + .replace(/[\x10-\x1F\x7F-\x9F]/g, function(ch) { return "\\x" + hex(ch); }); 112 + } 113 + 114 + function classEscape(s) { 115 + return s 116 + .replace(/\\/g, "\\\\") 117 + .replace(/\]/g, "\\]") 118 + .replace(/\^/g, "\\^") 119 + .replace(/-/g, "\\-") 120 + .replace(/\0/g, "\\0") 121 + .replace(/\t/g, "\\t") 122 + .replace(/\n/g, "\\n") 123 + .replace(/\r/g, "\\r") 124 + .replace(/[\x00-\x0F]/g, function(ch) { return "\\x0" + hex(ch); }) 125 + .replace(/[\x10-\x1F\x7F-\x9F]/g, function(ch) { return "\\x" + hex(ch); }); 126 + } 127 + 128 + function describeExpectation(expectation) { 129 + return DESCRIBE_EXPECTATION_FNS[expectation.type](expectation); 130 + } 131 + 132 + function describeExpected(expected) { 133 + var descriptions = expected.map(describeExpectation); 134 + var i, j; 135 + 136 + descriptions.sort(); 137 + 138 + if (descriptions.length > 0) { 139 + for (i = 1, j = 1; i < descriptions.length; i++) { 140 + if (descriptions[i - 1] !== descriptions[i]) { 141 + descriptions[j] = descriptions[i]; 142 + j++; 143 + } 144 + } 145 + descriptions.length = j; 146 + } 147 + 148 + switch (descriptions.length) { 149 + case 1: 150 + return descriptions[0]; 151 + 152 + case 2: 153 + return descriptions[0] + " or " + descriptions[1]; 154 + 155 + default: 156 + return descriptions.slice(0, -1).join(", ") 157 + + ", or " 158 + + descriptions[descriptions.length - 1]; 159 + } 160 + } 161 + 162 + function describeFound(found) { 163 + return found ? "\"" + literalEscape(found) + "\"" : "end of input"; 164 + } 165 + 166 + return "Expected " + describeExpected(expected) + " but " + describeFound(found) + " found."; 167 + }; 168 + 169 + function peg$parse(input, options) { 170 + options = options !== undefined ? options : {}; 171 + 172 + var peg$FAILED = {}; 173 + var peg$source = options.grammarSource; 174 + 175 + var peg$startRuleFunctions = { Start: peg$parseStart }; 176 + var peg$startRuleFunction = peg$parseStart; 177 + 178 + var peg$c0 = "add"; 179 + var peg$c1 = "done"; 180 + var peg$c2 = "filter"; 181 + var peg$c3 = "-"; 182 + var peg$c4 = ","; 183 + var peg$c5 = "@"; 184 + var peg$c6 = "pro:"; 185 + var peg$c7 = "project:"; 186 + var peg$c8 = "+"; 187 + var peg$c9 = "priority:"; 188 + var peg$c10 = "#"; 189 + var peg$c11 = "am"; 190 + var peg$c12 = "pm"; 191 + 192 + var peg$r0 = /^[HML]/; 193 + var peg$r1 = /^[0-9]/; 194 + var peg$r2 = /^[0-9:]/; 195 + var peg$r3 = /^[a-zA-Z0-9_\-]/; 196 + var peg$r4 = /^[ \t]/; 197 + 198 + var peg$e0 = peg$literalExpectation("add", false); 199 + var peg$e1 = peg$literalExpectation("done", false); 200 + var peg$e2 = peg$anyExpectation(); 201 + var peg$e3 = peg$literalExpectation("filter", false); 202 + var peg$e4 = peg$literalExpectation("-", false); 203 + var peg$e5 = peg$literalExpectation(",", false); 204 + var peg$e6 = peg$literalExpectation("@", false); 205 + var peg$e7 = peg$literalExpectation("pro:", false); 206 + var peg$e8 = peg$literalExpectation("project:", false); 207 + var peg$e9 = peg$literalExpectation("+", false); 208 + var peg$e10 = peg$literalExpectation("priority:", false); 209 + var peg$e11 = peg$classExpectation(["H", "M", "L"], false, false); 210 + var peg$e12 = peg$literalExpectation("#", false); 211 + var peg$e13 = peg$classExpectation([["0", "9"]], false, false); 212 + var peg$e14 = peg$classExpectation([["0", "9"], ":"], false, false); 213 + var peg$e15 = peg$literalExpectation("am", false); 214 + var peg$e16 = peg$literalExpectation("pm", false); 215 + var peg$e17 = peg$classExpectation([["a", "z"], ["A", "Z"], ["0", "9"], "_", "-"], false, false); 216 + var peg$e18 = peg$classExpectation([" ", "\t"], false, false); 217 + 218 + var peg$f0 = function(parts) { 219 + return makeCommand('add', null, parts.filter(p => p !== null)); 220 + }; 221 + var peg$f1 = function() { 222 + return makeCommand('done', null, null); 223 + }; 224 + var peg$f2 = function(moreFilters) { 225 + return makeCommand('filter', null, moreFilters); 226 + }; 227 + var peg$f3 = function(filters) { 228 + return makeCommand('filter', filters, null); 229 + }; 230 + var peg$f4 = function(first, rest) { 231 + return [first, ...rest.map(r => r[1])]; 232 + }; 233 + var peg$f5 = function(start, end) { 234 + const ids = []; 235 + for (let i = start; i <= end; i++) { 236 + ids.push(i); 237 + } 238 + return ids; 239 + }; 240 + var peg$f6 = function(id) { 241 + return [id]; 242 + }; 243 + var peg$f7 = function(first, rest, trailing) { 244 + const ids = [first, ...rest.map(r => r[1])].flat(); 245 + return { 246 + type: 'id', 247 + ids: ids, 248 + reconstruct: function() { return this.ids.join(','); } 249 + }; 250 + }; 251 + var peg$f8 = function(chars) { 252 + return { 253 + type: "text", 254 + value: chars, 255 + reconstruct: function() { return this.value; } 256 + }; 257 + }; 258 + var peg$f9 = function(value) { 259 + return { 260 + type: "due", 261 + value: value, 262 + reconstruct: function() { return `@${this.value}`; } 263 + }; 264 + }; 265 + var peg$f10 = function(value) { 266 + return { 267 + type: "project", 268 + value: value, 269 + reconstruct: function() { return `+${this.value}`; } 270 + }; 271 + }; 272 + var peg$f11 = function(value) { 273 + return { 274 + type: "priority", 275 + value: value, 276 + reconstruct: function() { return `priority:${this.value}`; } 277 + }; 278 + }; 279 + var peg$f12 = function(value) { 280 + return { 281 + type: "tag", 282 + value: value, 283 + reconstruct: function() { return `#${this.value}`; } 284 + }; 285 + }; 286 + var peg$f13 = function(digits) { 287 + return parseInt(digits.join(''), 10); 288 + }; 289 + var peg$f14 = function(chars) { 290 + return chars.join('') + (text() || ''); 291 + }; 292 + var peg$f15 = function(chars) { 293 + return chars.join(''); 294 + }; 295 + var peg$f16 = function() { 296 + return null; 297 + }; 298 + var peg$currPos = options.peg$currPos | 0; 299 + var peg$savedPos = peg$currPos; 300 + var peg$posDetailsCache = [{ line: 1, column: 1 }]; 301 + var peg$maxFailPos = peg$currPos; 302 + var peg$maxFailExpected = options.peg$maxFailExpected || []; 303 + var peg$silentFails = options.peg$silentFails | 0; 304 + 305 + var peg$result; 306 + 307 + if (options.startRule) { 308 + if (!(options.startRule in peg$startRuleFunctions)) { 309 + throw new Error("Can't start parsing from rule \"" + options.startRule + "\"."); 310 + } 311 + 312 + peg$startRuleFunction = peg$startRuleFunctions[options.startRule]; 313 + } 314 + 315 + function text() { 316 + return input.substring(peg$savedPos, peg$currPos); 317 + } 318 + 319 + function offset() { 320 + return peg$savedPos; 321 + } 322 + 323 + function range() { 324 + return { 325 + source: peg$source, 326 + start: peg$savedPos, 327 + end: peg$currPos 328 + }; 329 + } 330 + 331 + function location() { 332 + return peg$computeLocation(peg$savedPos, peg$currPos); 333 + } 334 + 335 + function expected(description, location) { 336 + location = location !== undefined 337 + ? location 338 + : peg$computeLocation(peg$savedPos, peg$currPos); 339 + 340 + throw peg$buildStructuredError( 341 + [peg$otherExpectation(description)], 342 + input.substring(peg$savedPos, peg$currPos), 343 + location 344 + ); 345 + } 346 + 347 + function error(message, location) { 348 + location = location !== undefined 349 + ? location 350 + : peg$computeLocation(peg$savedPos, peg$currPos); 351 + 352 + throw peg$buildSimpleError(message, location); 353 + } 354 + 355 + function peg$literalExpectation(text, ignoreCase) { 356 + return { type: "literal", text: text, ignoreCase: ignoreCase }; 357 + } 358 + 359 + function peg$classExpectation(parts, inverted, ignoreCase) { 360 + return { type: "class", parts: parts, inverted: inverted, ignoreCase: ignoreCase }; 361 + } 362 + 363 + function peg$anyExpectation() { 364 + return { type: "any" }; 365 + } 366 + 367 + function peg$endExpectation() { 368 + return { type: "end" }; 369 + } 370 + 371 + function peg$otherExpectation(description) { 372 + return { type: "other", description: description }; 373 + } 374 + 375 + function peg$computePosDetails(pos) { 376 + var details = peg$posDetailsCache[pos]; 377 + var p; 378 + 379 + if (details) { 380 + return details; 381 + } else { 382 + if (pos >= peg$posDetailsCache.length) { 383 + p = peg$posDetailsCache.length - 1; 384 + } else { 385 + p = pos; 386 + while (!peg$posDetailsCache[--p]) {} 387 + } 388 + 389 + details = peg$posDetailsCache[p]; 390 + details = { 391 + line: details.line, 392 + column: details.column 393 + }; 394 + 395 + while (p < pos) { 396 + if (input.charCodeAt(p) === 10) { 397 + details.line++; 398 + details.column = 1; 399 + } else { 400 + details.column++; 401 + } 402 + 403 + p++; 404 + } 405 + 406 + peg$posDetailsCache[pos] = details; 407 + 408 + return details; 409 + } 410 + } 411 + 412 + function peg$computeLocation(startPos, endPos, offset) { 413 + var startPosDetails = peg$computePosDetails(startPos); 414 + var endPosDetails = peg$computePosDetails(endPos); 415 + 416 + var res = { 417 + source: peg$source, 418 + start: { 419 + offset: startPos, 420 + line: startPosDetails.line, 421 + column: startPosDetails.column 422 + }, 423 + end: { 424 + offset: endPos, 425 + line: endPosDetails.line, 426 + column: endPosDetails.column 427 + } 428 + }; 429 + if (offset && peg$source && (typeof peg$source.offset === "function")) { 430 + res.start = peg$source.offset(res.start); 431 + res.end = peg$source.offset(res.end); 432 + } 433 + return res; 434 + } 435 + 436 + function peg$fail(expected) { 437 + if (peg$currPos < peg$maxFailPos) { return; } 438 + 439 + if (peg$currPos > peg$maxFailPos) { 440 + peg$maxFailPos = peg$currPos; 441 + peg$maxFailExpected = []; 442 + } 443 + 444 + peg$maxFailExpected.push(expected); 445 + } 446 + 447 + function peg$buildSimpleError(message, location) { 448 + return new peg$SyntaxError(message, null, null, location); 449 + } 450 + 451 + function peg$buildStructuredError(expected, found, location) { 452 + return new peg$SyntaxError( 453 + peg$SyntaxError.buildMessage(expected, found), 454 + expected, 455 + found, 456 + location 457 + ); 458 + } 459 + 460 + function peg$parseStart() { 461 + var s0; 462 + 463 + s0 = peg$parseAddCommand(); 464 + if (s0 === peg$FAILED) { 465 + s0 = peg$parseDoneCommand(); 466 + if (s0 === peg$FAILED) { 467 + s0 = peg$parseExplicitFilterCommand(); 468 + if (s0 === peg$FAILED) { 469 + s0 = peg$parseImplicitFilterCommand(); 470 + } 471 + } 472 + } 473 + 474 + return s0; 475 + } 476 + 477 + function peg$parseAddCommand() { 478 + var s0, s1, s2, s3, s4; 479 + 480 + s0 = peg$currPos; 481 + if (input.substr(peg$currPos, 3) === peg$c0) { 482 + s1 = peg$c0; 483 + peg$currPos += 3; 484 + } else { 485 + s1 = peg$FAILED; 486 + if (peg$silentFails === 0) { peg$fail(peg$e0); } 487 + } 488 + if (s1 !== peg$FAILED) { 489 + s2 = peg$parse_(); 490 + if (s2 !== peg$FAILED) { 491 + s3 = []; 492 + s4 = peg$parsePart(); 493 + if (s4 === peg$FAILED) { 494 + s4 = peg$parse_(); 495 + } 496 + if (s4 !== peg$FAILED) { 497 + while (s4 !== peg$FAILED) { 498 + s3.push(s4); 499 + s4 = peg$parsePart(); 500 + if (s4 === peg$FAILED) { 501 + s4 = peg$parse_(); 502 + } 503 + } 504 + } else { 505 + s3 = peg$FAILED; 506 + } 507 + if (s3 !== peg$FAILED) { 508 + s4 = peg$parseEOF(); 509 + if (s4 !== peg$FAILED) { 510 + peg$savedPos = s0; 511 + s0 = peg$f0(s3); 512 + } else { 513 + peg$currPos = s0; 514 + s0 = peg$FAILED; 515 + } 516 + } else { 517 + peg$currPos = s0; 518 + s0 = peg$FAILED; 519 + } 520 + } else { 521 + peg$currPos = s0; 522 + s0 = peg$FAILED; 523 + } 524 + } else { 525 + peg$currPos = s0; 526 + s0 = peg$FAILED; 527 + } 528 + 529 + return s0; 530 + } 531 + 532 + function peg$parseDoneCommand() { 533 + var s0, s1, s2, s3; 534 + 535 + s0 = peg$currPos; 536 + if (input.substr(peg$currPos, 4) === peg$c1) { 537 + s1 = peg$c1; 538 + peg$currPos += 4; 539 + } else { 540 + s1 = peg$FAILED; 541 + if (peg$silentFails === 0) { peg$fail(peg$e1); } 542 + } 543 + if (s1 !== peg$FAILED) { 544 + s2 = []; 545 + if (input.length > peg$currPos) { 546 + s3 = input.charAt(peg$currPos); 547 + peg$currPos++; 548 + } else { 549 + s3 = peg$FAILED; 550 + if (peg$silentFails === 0) { peg$fail(peg$e2); } 551 + } 552 + while (s3 !== peg$FAILED) { 553 + s2.push(s3); 554 + if (input.length > peg$currPos) { 555 + s3 = input.charAt(peg$currPos); 556 + peg$currPos++; 557 + } else { 558 + s3 = peg$FAILED; 559 + if (peg$silentFails === 0) { peg$fail(peg$e2); } 560 + } 561 + } 562 + s3 = peg$parseEOF(); 563 + if (s3 !== peg$FAILED) { 564 + peg$savedPos = s0; 565 + s0 = peg$f1(); 566 + } else { 567 + peg$currPos = s0; 568 + s0 = peg$FAILED; 569 + } 570 + } else { 571 + peg$currPos = s0; 572 + s0 = peg$FAILED; 573 + } 574 + 575 + return s0; 576 + } 577 + 578 + function peg$parseExplicitFilterCommand() { 579 + var s0, s1, s2, s3, s4; 580 + 581 + s0 = peg$currPos; 582 + if (input.substr(peg$currPos, 6) === peg$c2) { 583 + s1 = peg$c2; 584 + peg$currPos += 6; 585 + } else { 586 + s1 = peg$FAILED; 587 + if (peg$silentFails === 0) { peg$fail(peg$e3); } 588 + } 589 + if (s1 !== peg$FAILED) { 590 + s2 = []; 591 + s3 = peg$parse_(); 592 + while (s3 !== peg$FAILED) { 593 + s2.push(s3); 594 + s3 = peg$parse_(); 595 + } 596 + s3 = peg$parseFilters(); 597 + if (s3 !== peg$FAILED) { 598 + s4 = peg$parseEOF(); 599 + if (s4 !== peg$FAILED) { 600 + peg$savedPos = s0; 601 + s0 = peg$f2(s3); 602 + } else { 603 + peg$currPos = s0; 604 + s0 = peg$FAILED; 605 + } 606 + } else { 607 + peg$currPos = s0; 608 + s0 = peg$FAILED; 609 + } 610 + } else { 611 + peg$currPos = s0; 612 + s0 = peg$FAILED; 613 + } 614 + 615 + return s0; 616 + } 617 + 618 + function peg$parseImplicitFilterCommand() { 619 + var s0, s1, s2; 620 + 621 + s0 = peg$currPos; 622 + s1 = []; 623 + s2 = peg$parseFilters(); 624 + if (s2 !== peg$FAILED) { 625 + while (s2 !== peg$FAILED) { 626 + s1.push(s2); 627 + s2 = peg$parseFilters(); 628 + } 629 + } else { 630 + s1 = peg$FAILED; 631 + } 632 + if (s1 !== peg$FAILED) { 633 + s2 = peg$parseEOF(); 634 + if (s2 !== peg$FAILED) { 635 + peg$savedPos = s0; 636 + s0 = peg$f3(s1); 637 + } else { 638 + peg$currPos = s0; 639 + s0 = peg$FAILED; 640 + } 641 + } else { 642 + peg$currPos = s0; 643 + s0 = peg$FAILED; 644 + } 645 + 646 + return s0; 647 + } 648 + 649 + function peg$parseFilters() { 650 + var s0, s1, s2, s3, s4, s5; 651 + 652 + s0 = peg$currPos; 653 + s1 = peg$parseFilter(); 654 + if (s1 !== peg$FAILED) { 655 + s2 = []; 656 + s3 = peg$currPos; 657 + s4 = peg$parse_(); 658 + if (s4 !== peg$FAILED) { 659 + s5 = peg$parseFilter(); 660 + if (s5 !== peg$FAILED) { 661 + s4 = [s4, s5]; 662 + s3 = s4; 663 + } else { 664 + peg$currPos = s3; 665 + s3 = peg$FAILED; 666 + } 667 + } else { 668 + peg$currPos = s3; 669 + s3 = peg$FAILED; 670 + } 671 + while (s3 !== peg$FAILED) { 672 + s2.push(s3); 673 + s3 = peg$currPos; 674 + s4 = peg$parse_(); 675 + if (s4 !== peg$FAILED) { 676 + s5 = peg$parseFilter(); 677 + if (s5 !== peg$FAILED) { 678 + s4 = [s4, s5]; 679 + s3 = s4; 680 + } else { 681 + peg$currPos = s3; 682 + s3 = peg$FAILED; 683 + } 684 + } else { 685 + peg$currPos = s3; 686 + s3 = peg$FAILED; 687 + } 688 + } 689 + peg$savedPos = s0; 690 + s0 = peg$f4(s1, s2); 691 + } else { 692 + peg$currPos = s0; 693 + s0 = peg$FAILED; 694 + } 695 + 696 + return s0; 697 + } 698 + 699 + function peg$parseIdRange() { 700 + var s0, s1, s2, s3; 701 + 702 + s0 = peg$currPos; 703 + s1 = peg$parseInteger(); 704 + if (s1 !== peg$FAILED) { 705 + if (input.charCodeAt(peg$currPos) === 45) { 706 + s2 = peg$c3; 707 + peg$currPos++; 708 + } else { 709 + s2 = peg$FAILED; 710 + if (peg$silentFails === 0) { peg$fail(peg$e4); } 711 + } 712 + if (s2 !== peg$FAILED) { 713 + s3 = peg$parseInteger(); 714 + if (s3 !== peg$FAILED) { 715 + peg$savedPos = s0; 716 + s0 = peg$f5(s1, s3); 717 + } else { 718 + peg$currPos = s0; 719 + s0 = peg$FAILED; 720 + } 721 + } else { 722 + peg$currPos = s0; 723 + s0 = peg$FAILED; 724 + } 725 + } else { 726 + peg$currPos = s0; 727 + s0 = peg$FAILED; 728 + } 729 + 730 + return s0; 731 + } 732 + 733 + function peg$parseSingleId() { 734 + var s0, s1; 735 + 736 + s0 = peg$currPos; 737 + s1 = peg$parseInteger(); 738 + if (s1 !== peg$FAILED) { 739 + peg$savedPos = s0; 740 + s1 = peg$f6(s1); 741 + } 742 + s0 = s1; 743 + 744 + return s0; 745 + } 746 + 747 + function peg$parseFilter() { 748 + var s0; 749 + 750 + s0 = peg$parseIdFilter(); 751 + if (s0 === peg$FAILED) { 752 + s0 = peg$parseAttribute(); 753 + if (s0 === peg$FAILED) { 754 + s0 = peg$parsePart(); 755 + } 756 + } 757 + 758 + return s0; 759 + } 760 + 761 + function peg$parseIdFilter() { 762 + var s0, s1, s2, s3, s4, s5; 763 + 764 + s0 = peg$currPos; 765 + s1 = peg$parseIdRange(); 766 + if (s1 === peg$FAILED) { 767 + s1 = peg$parseSingleId(); 768 + } 769 + if (s1 !== peg$FAILED) { 770 + s2 = []; 771 + s3 = peg$currPos; 772 + if (input.charCodeAt(peg$currPos) === 44) { 773 + s4 = peg$c4; 774 + peg$currPos++; 775 + } else { 776 + s4 = peg$FAILED; 777 + if (peg$silentFails === 0) { peg$fail(peg$e5); } 778 + } 779 + if (s4 !== peg$FAILED) { 780 + s5 = peg$parseIdRange(); 781 + if (s5 === peg$FAILED) { 782 + s5 = peg$parseSingleId(); 783 + } 784 + if (s5 !== peg$FAILED) { 785 + s4 = [s4, s5]; 786 + s3 = s4; 787 + } else { 788 + peg$currPos = s3; 789 + s3 = peg$FAILED; 790 + } 791 + } else { 792 + peg$currPos = s3; 793 + s3 = peg$FAILED; 794 + } 795 + while (s3 !== peg$FAILED) { 796 + s2.push(s3); 797 + s3 = peg$currPos; 798 + if (input.charCodeAt(peg$currPos) === 44) { 799 + s4 = peg$c4; 800 + peg$currPos++; 801 + } else { 802 + s4 = peg$FAILED; 803 + if (peg$silentFails === 0) { peg$fail(peg$e5); } 804 + } 805 + if (s4 !== peg$FAILED) { 806 + s5 = peg$parseIdRange(); 807 + if (s5 === peg$FAILED) { 808 + s5 = peg$parseSingleId(); 809 + } 810 + if (s5 !== peg$FAILED) { 811 + s4 = [s4, s5]; 812 + s3 = s4; 813 + } else { 814 + peg$currPos = s3; 815 + s3 = peg$FAILED; 816 + } 817 + } else { 818 + peg$currPos = s3; 819 + s3 = peg$FAILED; 820 + } 821 + } 822 + if (input.charCodeAt(peg$currPos) === 44) { 823 + s3 = peg$c4; 824 + peg$currPos++; 825 + } else { 826 + s3 = peg$FAILED; 827 + if (peg$silentFails === 0) { peg$fail(peg$e5); } 828 + } 829 + if (s3 === peg$FAILED) { 830 + s3 = null; 831 + } 832 + peg$savedPos = s0; 833 + s0 = peg$f7(s1, s2, s3); 834 + } else { 835 + peg$currPos = s0; 836 + s0 = peg$FAILED; 837 + } 838 + 839 + return s0; 840 + } 841 + 842 + function peg$parsePart() { 843 + var s0; 844 + 845 + s0 = peg$parseAttribute(); 846 + if (s0 === peg$FAILED) { 847 + s0 = peg$parseTextPart(); 848 + } 849 + 850 + return s0; 851 + } 852 + 853 + function peg$parseTextPart() { 854 + var s0, s1; 855 + 856 + s0 = peg$currPos; 857 + s1 = peg$parseWord(); 858 + if (s1 !== peg$FAILED) { 859 + peg$savedPos = s0; 860 + s1 = peg$f8(s1); 861 + } 862 + s0 = s1; 863 + 864 + return s0; 865 + } 866 + 867 + function peg$parseAttribute() { 868 + var s0; 869 + 870 + s0 = peg$parseDue(); 871 + if (s0 === peg$FAILED) { 872 + s0 = peg$parseTag(); 873 + if (s0 === peg$FAILED) { 874 + s0 = peg$parseProject(); 875 + if (s0 === peg$FAILED) { 876 + s0 = peg$parsePriority(); 877 + } 878 + } 879 + } 880 + 881 + return s0; 882 + } 883 + 884 + function peg$parseDue() { 885 + var s0, s1, s2; 886 + 887 + s0 = peg$currPos; 888 + if (input.charCodeAt(peg$currPos) === 64) { 889 + s1 = peg$c5; 890 + peg$currPos++; 891 + } else { 892 + s1 = peg$FAILED; 893 + if (peg$silentFails === 0) { peg$fail(peg$e6); } 894 + } 895 + if (s1 !== peg$FAILED) { 896 + s2 = peg$parseTimeValue(); 897 + if (s2 !== peg$FAILED) { 898 + peg$savedPos = s0; 899 + s0 = peg$f9(s2); 900 + } else { 901 + peg$currPos = s0; 902 + s0 = peg$FAILED; 903 + } 904 + } else { 905 + peg$currPos = s0; 906 + s0 = peg$FAILED; 907 + } 908 + 909 + return s0; 910 + } 911 + 912 + function peg$parseProject() { 913 + var s0, s1, s2; 914 + 915 + s0 = peg$currPos; 916 + if (input.substr(peg$currPos, 4) === peg$c6) { 917 + s1 = peg$c6; 918 + peg$currPos += 4; 919 + } else { 920 + s1 = peg$FAILED; 921 + if (peg$silentFails === 0) { peg$fail(peg$e7); } 922 + } 923 + if (s1 === peg$FAILED) { 924 + if (input.substr(peg$currPos, 8) === peg$c7) { 925 + s1 = peg$c7; 926 + peg$currPos += 8; 927 + } else { 928 + s1 = peg$FAILED; 929 + if (peg$silentFails === 0) { peg$fail(peg$e8); } 930 + } 931 + if (s1 === peg$FAILED) { 932 + if (input.charCodeAt(peg$currPos) === 43) { 933 + s1 = peg$c8; 934 + peg$currPos++; 935 + } else { 936 + s1 = peg$FAILED; 937 + if (peg$silentFails === 0) { peg$fail(peg$e9); } 938 + } 939 + } 940 + } 941 + if (s1 !== peg$FAILED) { 942 + s2 = peg$parseWord(); 943 + if (s2 !== peg$FAILED) { 944 + peg$savedPos = s0; 945 + s0 = peg$f10(s2); 946 + } else { 947 + peg$currPos = s0; 948 + s0 = peg$FAILED; 949 + } 950 + } else { 951 + peg$currPos = s0; 952 + s0 = peg$FAILED; 953 + } 954 + 955 + return s0; 956 + } 957 + 958 + function peg$parsePriority() { 959 + var s0, s1, s2; 960 + 961 + s0 = peg$currPos; 962 + if (input.substr(peg$currPos, 9) === peg$c9) { 963 + s1 = peg$c9; 964 + peg$currPos += 9; 965 + } else { 966 + s1 = peg$FAILED; 967 + if (peg$silentFails === 0) { peg$fail(peg$e10); } 968 + } 969 + if (s1 !== peg$FAILED) { 970 + s2 = input.charAt(peg$currPos); 971 + if (peg$r0.test(s2)) { 972 + peg$currPos++; 973 + } else { 974 + s2 = peg$FAILED; 975 + if (peg$silentFails === 0) { peg$fail(peg$e11); } 976 + } 977 + if (s2 !== peg$FAILED) { 978 + peg$savedPos = s0; 979 + s0 = peg$f11(s2); 980 + } else { 981 + peg$currPos = s0; 982 + s0 = peg$FAILED; 983 + } 984 + } else { 985 + peg$currPos = s0; 986 + s0 = peg$FAILED; 987 + } 988 + 989 + return s0; 990 + } 991 + 992 + function peg$parseTag() { 993 + var s0, s1, s2; 994 + 995 + s0 = peg$currPos; 996 + if (input.charCodeAt(peg$currPos) === 35) { 997 + s1 = peg$c10; 998 + peg$currPos++; 999 + } else { 1000 + s1 = peg$FAILED; 1001 + if (peg$silentFails === 0) { peg$fail(peg$e12); } 1002 + } 1003 + if (s1 !== peg$FAILED) { 1004 + s2 = peg$parseWord(); 1005 + if (s2 !== peg$FAILED) { 1006 + peg$savedPos = s0; 1007 + s0 = peg$f12(s2); 1008 + } else { 1009 + peg$currPos = s0; 1010 + s0 = peg$FAILED; 1011 + } 1012 + } else { 1013 + peg$currPos = s0; 1014 + s0 = peg$FAILED; 1015 + } 1016 + 1017 + return s0; 1018 + } 1019 + 1020 + function peg$parseInteger() { 1021 + var s0, s1, s2; 1022 + 1023 + s0 = peg$currPos; 1024 + s1 = []; 1025 + s2 = input.charAt(peg$currPos); 1026 + if (peg$r1.test(s2)) { 1027 + peg$currPos++; 1028 + } else { 1029 + s2 = peg$FAILED; 1030 + if (peg$silentFails === 0) { peg$fail(peg$e13); } 1031 + } 1032 + if (s2 !== peg$FAILED) { 1033 + while (s2 !== peg$FAILED) { 1034 + s1.push(s2); 1035 + s2 = input.charAt(peg$currPos); 1036 + if (peg$r1.test(s2)) { 1037 + peg$currPos++; 1038 + } else { 1039 + s2 = peg$FAILED; 1040 + if (peg$silentFails === 0) { peg$fail(peg$e13); } 1041 + } 1042 + } 1043 + } else { 1044 + s1 = peg$FAILED; 1045 + } 1046 + if (s1 !== peg$FAILED) { 1047 + peg$savedPos = s0; 1048 + s1 = peg$f13(s1); 1049 + } 1050 + s0 = s1; 1051 + 1052 + return s0; 1053 + } 1054 + 1055 + function peg$parseTimeValue() { 1056 + var s0, s1, s2; 1057 + 1058 + s0 = peg$currPos; 1059 + s1 = []; 1060 + s2 = input.charAt(peg$currPos); 1061 + if (peg$r2.test(s2)) { 1062 + peg$currPos++; 1063 + } else { 1064 + s2 = peg$FAILED; 1065 + if (peg$silentFails === 0) { peg$fail(peg$e14); } 1066 + } 1067 + if (s2 !== peg$FAILED) { 1068 + while (s2 !== peg$FAILED) { 1069 + s1.push(s2); 1070 + s2 = input.charAt(peg$currPos); 1071 + if (peg$r2.test(s2)) { 1072 + peg$currPos++; 1073 + } else { 1074 + s2 = peg$FAILED; 1075 + if (peg$silentFails === 0) { peg$fail(peg$e14); } 1076 + } 1077 + } 1078 + } else { 1079 + s1 = peg$FAILED; 1080 + } 1081 + if (s1 !== peg$FAILED) { 1082 + if (input.substr(peg$currPos, 2) === peg$c11) { 1083 + s2 = peg$c11; 1084 + peg$currPos += 2; 1085 + } else { 1086 + s2 = peg$FAILED; 1087 + if (peg$silentFails === 0) { peg$fail(peg$e15); } 1088 + } 1089 + if (s2 === peg$FAILED) { 1090 + if (input.substr(peg$currPos, 2) === peg$c12) { 1091 + s2 = peg$c12; 1092 + peg$currPos += 2; 1093 + } else { 1094 + s2 = peg$FAILED; 1095 + if (peg$silentFails === 0) { peg$fail(peg$e16); } 1096 + } 1097 + } 1098 + if (s2 === peg$FAILED) { 1099 + s2 = null; 1100 + } 1101 + peg$savedPos = s0; 1102 + s0 = peg$f14(s1); 1103 + } else { 1104 + peg$currPos = s0; 1105 + s0 = peg$FAILED; 1106 + } 1107 + 1108 + return s0; 1109 + } 1110 + 1111 + function peg$parseWord() { 1112 + var s0, s1, s2; 1113 + 1114 + s0 = peg$currPos; 1115 + s1 = []; 1116 + s2 = input.charAt(peg$currPos); 1117 + if (peg$r3.test(s2)) { 1118 + peg$currPos++; 1119 + } else { 1120 + s2 = peg$FAILED; 1121 + if (peg$silentFails === 0) { peg$fail(peg$e17); } 1122 + } 1123 + if (s2 !== peg$FAILED) { 1124 + while (s2 !== peg$FAILED) { 1125 + s1.push(s2); 1126 + s2 = input.charAt(peg$currPos); 1127 + if (peg$r3.test(s2)) { 1128 + peg$currPos++; 1129 + } else { 1130 + s2 = peg$FAILED; 1131 + if (peg$silentFails === 0) { peg$fail(peg$e17); } 1132 + } 1133 + } 1134 + } else { 1135 + s1 = peg$FAILED; 1136 + } 1137 + if (s1 !== peg$FAILED) { 1138 + peg$savedPos = s0; 1139 + s1 = peg$f15(s1); 1140 + } 1141 + s0 = s1; 1142 + 1143 + return s0; 1144 + } 1145 + 1146 + function peg$parse_() { 1147 + var s0, s1, s2; 1148 + 1149 + s0 = peg$currPos; 1150 + s1 = []; 1151 + s2 = input.charAt(peg$currPos); 1152 + if (peg$r4.test(s2)) { 1153 + peg$currPos++; 1154 + } else { 1155 + s2 = peg$FAILED; 1156 + if (peg$silentFails === 0) { peg$fail(peg$e18); } 1157 + } 1158 + if (s2 !== peg$FAILED) { 1159 + while (s2 !== peg$FAILED) { 1160 + s1.push(s2); 1161 + s2 = input.charAt(peg$currPos); 1162 + if (peg$r4.test(s2)) { 1163 + peg$currPos++; 1164 + } else { 1165 + s2 = peg$FAILED; 1166 + if (peg$silentFails === 0) { peg$fail(peg$e18); } 1167 + } 1168 + } 1169 + } else { 1170 + s1 = peg$FAILED; 1171 + } 1172 + if (s1 !== peg$FAILED) { 1173 + peg$savedPos = s0; 1174 + s1 = peg$f16(); 1175 + } 1176 + s0 = s1; 1177 + 1178 + return s0; 1179 + } 1180 + 1181 + function peg$parseEOF() { 1182 + var s0, s1; 1183 + 1184 + s0 = peg$currPos; 1185 + peg$silentFails++; 1186 + if (input.length > peg$currPos) { 1187 + s1 = input.charAt(peg$currPos); 1188 + peg$currPos++; 1189 + } else { 1190 + s1 = peg$FAILED; 1191 + if (peg$silentFails === 0) { peg$fail(peg$e2); } 1192 + } 1193 + peg$silentFails--; 1194 + if (s1 === peg$FAILED) { 1195 + s0 = undefined; 1196 + } else { 1197 + peg$currPos = s0; 1198 + s0 = peg$FAILED; 1199 + } 1200 + 1201 + return s0; 1202 + } 1203 + 1204 + 1205 + function makeCommand(type, filters, parts) { 1206 + 1207 + const validParts = parts || []; 1208 + // Extract pure description (without attributes) 1209 + const description = validParts 1210 + .filter(part => part.type === 'text') 1211 + .map(part => part.value) 1212 + .join(' ') 1213 + .trim(); 1214 + 1215 + // Collect all attributes 1216 + const attributes = validParts 1217 + .filter(part => part.type !== 'text') 1218 + .filter(part => part !== null); 1219 + 1220 + const project = validParts 1221 + .filter(part => part.type === 'project') 1222 + .map(part => part.value) 1223 + .join('') 1224 + .trim(); 1225 + 1226 + const tags = validParts 1227 + .filter(part => part.type === 'tag') 1228 + .map(part => part.value); 1229 + 1230 + 1231 + // Store original parts for reconstruction 1232 + const originalParts = validParts.filter(part => part !== null); 1233 + let validFilters; 1234 + if (!!filters) { 1235 + validFilters = filters.flat(); 1236 + } else { 1237 + validFilters = []; 1238 + } 1239 + 1240 + return { 1241 + type: type, 1242 + description: description || [], 1243 + attributes: attributes || [], 1244 + filters: validFilters, 1245 + project: project, 1246 + tags: JSON.stringify(tags), 1247 + parts: parts || [], 1248 + reconstruct: function() { 1249 + const filterStr = this.filters.map(f => f.reconstruct()).join(','); 1250 + const partsStr = this.parts.map(p => p.reconstruct()).join(' '); 1251 + return [filterStr, this.type, partsStr].filter(Boolean).join(' '); 1252 + } 1253 + }; 1254 + } 1255 + 1256 + peg$result = peg$startRuleFunction(); 1257 + 1258 + if (options.peg$library) { 1259 + return /** @type {any} */ ({ 1260 + peg$result, 1261 + peg$currPos, 1262 + peg$FAILED, 1263 + peg$maxFailExpected, 1264 + peg$maxFailPos 1265 + }); 1266 + } 1267 + if (peg$result !== peg$FAILED && peg$currPos === input.length) { 1268 + return peg$result; 1269 + } else { 1270 + if (peg$result !== peg$FAILED && peg$currPos < input.length) { 1271 + peg$fail(peg$endExpectation()); 1272 + } 1273 + 1274 + throw peg$buildStructuredError( 1275 + peg$maxFailExpected, 1276 + peg$maxFailPos < input.length ? input.charAt(peg$maxFailPos) : null, 1277 + peg$maxFailPos < input.length 1278 + ? peg$computeLocation(peg$maxFailPos, peg$maxFailPos + 1) 1279 + : peg$computeLocation(peg$maxFailPos, peg$maxFailPos) 1280 + ); 1281 + } 1282 + } 1283 + 1284 + const peg$allowedStartRules = [ 1285 + "Start" 1286 + ]; 1287 + 1288 + export { 1289 + peg$allowedStartRules as StartRules, 1290 + peg$SyntaxError as SyntaxError, 1291 + peg$parse as parse 1292 + };
+86 -98
mast-react-vite/src/lib/command_parser.js parser/command_js.js
··· 197 197 198 198 var peg$e0 = peg$literalExpectation("add", false); 199 199 var peg$e1 = peg$literalExpectation("done", false); 200 - var peg$e2 = peg$literalExpectation("filter", false); 201 - var peg$e3 = peg$literalExpectation("-", false); 202 - var peg$e4 = peg$literalExpectation(",", false); 203 - var peg$e5 = peg$literalExpectation("@", false); 204 - var peg$e6 = peg$literalExpectation("pro:", false); 205 - var peg$e7 = peg$literalExpectation("project:", false); 206 - var peg$e8 = peg$literalExpectation("+", false); 207 - var peg$e9 = peg$literalExpectation("priority:", false); 208 - var peg$e10 = peg$classExpectation(["H", "M", "L"], false, false); 209 - var peg$e11 = peg$literalExpectation("#", false); 210 - var peg$e12 = peg$classExpectation([["0", "9"]], false, false); 211 - var peg$e13 = peg$classExpectation([["0", "9"], ":"], false, false); 212 - var peg$e14 = peg$literalExpectation("am", false); 213 - var peg$e15 = peg$literalExpectation("pm", false); 214 - var peg$e16 = peg$classExpectation([["a", "z"], ["A", "Z"], ["0", "9"], "_", "-"], false, false); 215 - var peg$e17 = peg$classExpectation([" ", "\t"], false, false); 216 - var peg$e18 = peg$anyExpectation(); 200 + var peg$e2 = peg$anyExpectation(); 201 + var peg$e3 = peg$literalExpectation("filter", false); 202 + var peg$e4 = peg$literalExpectation("-", false); 203 + var peg$e5 = peg$literalExpectation(",", false); 204 + var peg$e6 = peg$literalExpectation("@", false); 205 + var peg$e7 = peg$literalExpectation("pro:", false); 206 + var peg$e8 = peg$literalExpectation("project:", false); 207 + var peg$e9 = peg$literalExpectation("+", false); 208 + var peg$e10 = peg$literalExpectation("priority:", false); 209 + var peg$e11 = peg$classExpectation(["H", "M", "L"], false, false); 210 + var peg$e12 = peg$literalExpectation("#", false); 211 + var peg$e13 = peg$classExpectation([["0", "9"]], false, false); 212 + var peg$e14 = peg$classExpectation([["0", "9"], ":"], false, false); 213 + var peg$e15 = peg$literalExpectation("am", false); 214 + var peg$e16 = peg$literalExpectation("pm", false); 215 + var peg$e17 = peg$classExpectation([["a", "z"], ["A", "Z"], ["0", "9"], "_", "-"], false, false); 216 + var peg$e18 = peg$classExpectation([" ", "\t"], false, false); 217 217 218 218 var peg$f0 = function(parts) { 219 219 return makeCommand('add', null, parts.filter(p => p !== null)); 220 220 }; 221 - var peg$f1 = function(filters) { 222 - return makeCommand('done', filters, null); 221 + var peg$f1 = function() { 222 + return makeCommand('done', null, null); 223 223 }; 224 - var peg$f2 = function(filters, moreFilters) { 225 - return makeCommand('filter', [...filters, ...moreFilters], null); 224 + var peg$f2 = function(moreFilters) { 225 + return makeCommand('filter', null, moreFilters); 226 226 }; 227 227 var peg$f3 = function(filters) { 228 228 return makeCommand('filter', filters, null); ··· 530 530 } 531 531 532 532 function peg$parseDoneCommand() { 533 - var s0, s1, s2, s3, s4; 533 + var s0, s1, s2, s3; 534 534 535 535 s0 = peg$currPos; 536 536 if (input.substr(peg$currPos, 4) === peg$c1) { ··· 541 541 if (peg$silentFails === 0) { peg$fail(peg$e1); } 542 542 } 543 543 if (s1 !== peg$FAILED) { 544 - s2 = peg$parse_(); 545 - if (s2 !== peg$FAILED) { 546 - s3 = peg$parseFilters(); 547 - if (s3 !== peg$FAILED) { 548 - s4 = peg$parseEOF(); 549 - if (s4 !== peg$FAILED) { 550 - peg$savedPos = s0; 551 - s0 = peg$f1(s3); 552 - } else { 553 - peg$currPos = s0; 554 - s0 = peg$FAILED; 555 - } 544 + s2 = []; 545 + if (input.length > peg$currPos) { 546 + s3 = input.charAt(peg$currPos); 547 + peg$currPos++; 548 + } else { 549 + s3 = peg$FAILED; 550 + if (peg$silentFails === 0) { peg$fail(peg$e2); } 551 + } 552 + while (s3 !== peg$FAILED) { 553 + s2.push(s3); 554 + if (input.length > peg$currPos) { 555 + s3 = input.charAt(peg$currPos); 556 + peg$currPos++; 556 557 } else { 557 - peg$currPos = s0; 558 - s0 = peg$FAILED; 558 + s3 = peg$FAILED; 559 + if (peg$silentFails === 0) { peg$fail(peg$e2); } 559 560 } 561 + } 562 + s3 = peg$parseEOF(); 563 + if (s3 !== peg$FAILED) { 564 + peg$savedPos = s0; 565 + s0 = peg$f1(); 560 566 } else { 561 567 peg$currPos = s0; 562 568 s0 = peg$FAILED; ··· 570 576 } 571 577 572 578 function peg$parseExplicitFilterCommand() { 573 - var s0, s1, s2, s3, s4, s5, s6; 579 + var s0, s1, s2, s3, s4; 574 580 575 581 s0 = peg$currPos; 576 - s1 = peg$parseFilters(); 582 + if (input.substr(peg$currPos, 6) === peg$c2) { 583 + s1 = peg$c2; 584 + peg$currPos += 6; 585 + } else { 586 + s1 = peg$FAILED; 587 + if (peg$silentFails === 0) { peg$fail(peg$e3); } 588 + } 577 589 if (s1 !== peg$FAILED) { 578 - s2 = peg$parse_(); 579 - if (s2 !== peg$FAILED) { 580 - if (input.substr(peg$currPos, 6) === peg$c2) { 581 - s3 = peg$c2; 582 - peg$currPos += 6; 583 - } else { 584 - s3 = peg$FAILED; 585 - if (peg$silentFails === 0) { peg$fail(peg$e2); } 586 - } 587 - if (s3 !== peg$FAILED) { 588 - s4 = []; 589 - s5 = peg$parse_(); 590 - while (s5 !== peg$FAILED) { 591 - s4.push(s5); 592 - s5 = peg$parse_(); 593 - } 594 - s5 = []; 595 - s6 = peg$parseFilters(); 596 - while (s6 !== peg$FAILED) { 597 - s5.push(s6); 598 - s6 = peg$parseFilters(); 599 - } 600 - s6 = peg$parseEOF(); 601 - if (s6 !== peg$FAILED) { 602 - peg$savedPos = s0; 603 - s0 = peg$f2(s1, s5); 604 - } else { 605 - peg$currPos = s0; 606 - s0 = peg$FAILED; 607 - } 590 + s2 = []; 591 + s3 = peg$parse_(); 592 + while (s3 !== peg$FAILED) { 593 + s2.push(s3); 594 + s3 = peg$parse_(); 595 + } 596 + s3 = peg$parseFilters(); 597 + if (s3 !== peg$FAILED) { 598 + s4 = peg$parseEOF(); 599 + if (s4 !== peg$FAILED) { 600 + peg$savedPos = s0; 601 + s0 = peg$f2(s3); 608 602 } else { 609 603 peg$currPos = s0; 610 604 s0 = peg$FAILED; ··· 713 707 peg$currPos++; 714 708 } else { 715 709 s2 = peg$FAILED; 716 - if (peg$silentFails === 0) { peg$fail(peg$e3); } 710 + if (peg$silentFails === 0) { peg$fail(peg$e4); } 717 711 } 718 712 if (s2 !== peg$FAILED) { 719 713 s3 = peg$parseInteger(); ··· 755 749 756 750 s0 = peg$parseIdFilter(); 757 751 if (s0 === peg$FAILED) { 758 - s0 = peg$parseTag(); 752 + s0 = peg$parseAttribute(); 759 753 if (s0 === peg$FAILED) { 760 - s0 = peg$parseProject(); 761 - if (s0 === peg$FAILED) { 762 - s0 = peg$parsePriority(); 763 - if (s0 === peg$FAILED) { 764 - s0 = peg$parseDue(); 765 - } 766 - } 754 + s0 = peg$parsePart(); 767 755 } 768 756 } 769 757 ··· 786 774 peg$currPos++; 787 775 } else { 788 776 s4 = peg$FAILED; 789 - if (peg$silentFails === 0) { peg$fail(peg$e4); } 777 + if (peg$silentFails === 0) { peg$fail(peg$e5); } 790 778 } 791 779 if (s4 !== peg$FAILED) { 792 780 s5 = peg$parseIdRange(); ··· 812 800 peg$currPos++; 813 801 } else { 814 802 s4 = peg$FAILED; 815 - if (peg$silentFails === 0) { peg$fail(peg$e4); } 803 + if (peg$silentFails === 0) { peg$fail(peg$e5); } 816 804 } 817 805 if (s4 !== peg$FAILED) { 818 806 s5 = peg$parseIdRange(); ··· 836 824 peg$currPos++; 837 825 } else { 838 826 s3 = peg$FAILED; 839 - if (peg$silentFails === 0) { peg$fail(peg$e4); } 827 + if (peg$silentFails === 0) { peg$fail(peg$e5); } 840 828 } 841 829 if (s3 === peg$FAILED) { 842 830 s3 = null; ··· 902 890 peg$currPos++; 903 891 } else { 904 892 s1 = peg$FAILED; 905 - if (peg$silentFails === 0) { peg$fail(peg$e5); } 893 + if (peg$silentFails === 0) { peg$fail(peg$e6); } 906 894 } 907 895 if (s1 !== peg$FAILED) { 908 896 s2 = peg$parseTimeValue(); ··· 930 918 peg$currPos += 4; 931 919 } else { 932 920 s1 = peg$FAILED; 933 - if (peg$silentFails === 0) { peg$fail(peg$e6); } 921 + if (peg$silentFails === 0) { peg$fail(peg$e7); } 934 922 } 935 923 if (s1 === peg$FAILED) { 936 924 if (input.substr(peg$currPos, 8) === peg$c7) { ··· 938 926 peg$currPos += 8; 939 927 } else { 940 928 s1 = peg$FAILED; 941 - if (peg$silentFails === 0) { peg$fail(peg$e7); } 929 + if (peg$silentFails === 0) { peg$fail(peg$e8); } 942 930 } 943 931 if (s1 === peg$FAILED) { 944 932 if (input.charCodeAt(peg$currPos) === 43) { ··· 946 934 peg$currPos++; 947 935 } else { 948 936 s1 = peg$FAILED; 949 - if (peg$silentFails === 0) { peg$fail(peg$e8); } 937 + if (peg$silentFails === 0) { peg$fail(peg$e9); } 950 938 } 951 939 } 952 940 } ··· 976 964 peg$currPos += 9; 977 965 } else { 978 966 s1 = peg$FAILED; 979 - if (peg$silentFails === 0) { peg$fail(peg$e9); } 967 + if (peg$silentFails === 0) { peg$fail(peg$e10); } 980 968 } 981 969 if (s1 !== peg$FAILED) { 982 970 s2 = input.charAt(peg$currPos); ··· 984 972 peg$currPos++; 985 973 } else { 986 974 s2 = peg$FAILED; 987 - if (peg$silentFails === 0) { peg$fail(peg$e10); } 975 + if (peg$silentFails === 0) { peg$fail(peg$e11); } 988 976 } 989 977 if (s2 !== peg$FAILED) { 990 978 peg$savedPos = s0; ··· 1010 998 peg$currPos++; 1011 999 } else { 1012 1000 s1 = peg$FAILED; 1013 - if (peg$silentFails === 0) { peg$fail(peg$e11); } 1001 + if (peg$silentFails === 0) { peg$fail(peg$e12); } 1014 1002 } 1015 1003 if (s1 !== peg$FAILED) { 1016 1004 s2 = peg$parseWord(); ··· 1039 1027 peg$currPos++; 1040 1028 } else { 1041 1029 s2 = peg$FAILED; 1042 - if (peg$silentFails === 0) { peg$fail(peg$e12); } 1030 + if (peg$silentFails === 0) { peg$fail(peg$e13); } 1043 1031 } 1044 1032 if (s2 !== peg$FAILED) { 1045 1033 while (s2 !== peg$FAILED) { ··· 1049 1037 peg$currPos++; 1050 1038 } else { 1051 1039 s2 = peg$FAILED; 1052 - if (peg$silentFails === 0) { peg$fail(peg$e12); } 1040 + if (peg$silentFails === 0) { peg$fail(peg$e13); } 1053 1041 } 1054 1042 } 1055 1043 } else { ··· 1074 1062 peg$currPos++; 1075 1063 } else { 1076 1064 s2 = peg$FAILED; 1077 - if (peg$silentFails === 0) { peg$fail(peg$e13); } 1065 + if (peg$silentFails === 0) { peg$fail(peg$e14); } 1078 1066 } 1079 1067 if (s2 !== peg$FAILED) { 1080 1068 while (s2 !== peg$FAILED) { ··· 1084 1072 peg$currPos++; 1085 1073 } else { 1086 1074 s2 = peg$FAILED; 1087 - if (peg$silentFails === 0) { peg$fail(peg$e13); } 1075 + if (peg$silentFails === 0) { peg$fail(peg$e14); } 1088 1076 } 1089 1077 } 1090 1078 } else { ··· 1096 1084 peg$currPos += 2; 1097 1085 } else { 1098 1086 s2 = peg$FAILED; 1099 - if (peg$silentFails === 0) { peg$fail(peg$e14); } 1087 + if (peg$silentFails === 0) { peg$fail(peg$e15); } 1100 1088 } 1101 1089 if (s2 === peg$FAILED) { 1102 1090 if (input.substr(peg$currPos, 2) === peg$c12) { ··· 1104 1092 peg$currPos += 2; 1105 1093 } else { 1106 1094 s2 = peg$FAILED; 1107 - if (peg$silentFails === 0) { peg$fail(peg$e15); } 1095 + if (peg$silentFails === 0) { peg$fail(peg$e16); } 1108 1096 } 1109 1097 } 1110 1098 if (s2 === peg$FAILED) { ··· 1130 1118 peg$currPos++; 1131 1119 } else { 1132 1120 s2 = peg$FAILED; 1133 - if (peg$silentFails === 0) { peg$fail(peg$e16); } 1121 + if (peg$silentFails === 0) { peg$fail(peg$e17); } 1134 1122 } 1135 1123 if (s2 !== peg$FAILED) { 1136 1124 while (s2 !== peg$FAILED) { ··· 1140 1128 peg$currPos++; 1141 1129 } else { 1142 1130 s2 = peg$FAILED; 1143 - if (peg$silentFails === 0) { peg$fail(peg$e16); } 1131 + if (peg$silentFails === 0) { peg$fail(peg$e17); } 1144 1132 } 1145 1133 } 1146 1134 } else { ··· 1165 1153 peg$currPos++; 1166 1154 } else { 1167 1155 s2 = peg$FAILED; 1168 - if (peg$silentFails === 0) { peg$fail(peg$e17); } 1156 + if (peg$silentFails === 0) { peg$fail(peg$e18); } 1169 1157 } 1170 1158 if (s2 !== peg$FAILED) { 1171 1159 while (s2 !== peg$FAILED) { ··· 1175 1163 peg$currPos++; 1176 1164 } else { 1177 1165 s2 = peg$FAILED; 1178 - if (peg$silentFails === 0) { peg$fail(peg$e17); } 1166 + if (peg$silentFails === 0) { peg$fail(peg$e18); } 1179 1167 } 1180 1168 } 1181 1169 } else { ··· 1200 1188 peg$currPos++; 1201 1189 } else { 1202 1190 s1 = peg$FAILED; 1203 - if (peg$silentFails === 0) { peg$fail(peg$e18); } 1191 + if (peg$silentFails === 0) { peg$fail(peg$e2); } 1204 1192 } 1205 1193 peg$silentFails--; 1206 1194 if (s1 === peg$FAILED) {
+6 -5
parser/command_js.peg
··· 59 59 } 60 60 61 61 // DONE COMMAND 62 - DoneCommand = "done" _ filters:Filters EOF { 63 - return makeCommand('done', filters, null); 62 + DoneCommand = "done" .* EOF { 63 + return makeCommand('done', null, null); 64 64 } 65 65 66 - ExplicitFilterCommand = filters:Filters _ "filter" _* moreFilters:Filters* EOF { 67 - return makeCommand('filter', [...filters, ...moreFilters], null); 66 + ExplicitFilterCommand = "filter" _* moreFilters:Filters EOF { 67 + return makeCommand('filter', null, moreFilters); 68 68 } 69 69 70 70 ImplicitFilterCommand = filters:Filters+ EOF { ··· 88 88 return [id]; 89 89 } 90 90 91 - Filter = IdFilter / Tag / Project / Priority / Due 91 + Filter = IdFilter / Attribute / Part 92 92 93 93 IdFilter = first:(IdRange / SingleId) rest:("," (IdRange / SingleId))* trailing:"," ? { 94 94 const ids = [first, ...rest.map(r => r[1])].flat(); ··· 160 160 } 161 161 162 162 EOF = !. 163 +