this repo has no description
2
fork

Configure Feed

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

feat: modify command works like tw

+372 -202
+66 -12
mast-react-vite/src/App.tsx
··· 102 102 const conditions = []; 103 103 const params = []; 104 104 105 - if (filterContext.filterDescription && filterContext.filterDescription.length > 0) { 105 + if ( 106 + filterContext.filterDescription && 107 + filterContext.filterDescription.length > 0 108 + ) { 106 109 conditions.push("description LIKE ?"); 107 110 params.push(`%${filterContext.filterDescription}%`); 108 111 } ··· 119 122 )`); 120 123 params.push(...filterContext.filterTags); 121 124 } 122 - console.log("conditions: " + conditions); 123 - console.log("params: " + params); 124 125 125 126 const todos = useQuery( 126 127 ctx, ··· 216 217 [parsed.description, parsed.tags, parsed.project], 217 218 ); 218 219 break; 219 - case "edit": 220 + case "modify": 221 + const editConditions = []; 222 + const editParams = []; 223 + const selectionParams = []; 224 + const updates = []; 225 + 226 + // Handle new values for SET clause 227 + if (parsed.description && parsed.description.length > 0) { 228 + updates.push("description = ?"); 229 + editParams.push(parsed.description); 230 + } 231 + if (parsed.project && parsed.project.length > 0) { 232 + updates.push("project = ?"); 233 + editParams.push(parsed.project); 234 + } 235 + if (parsed.tags && parsed.tags.length > 0) { 236 + updates.push(`tags = ( 237 + SELECT json_group_array(value) 238 + FROM ( 239 + SELECT DISTINCT value 240 + FROM ( 241 + SELECT value FROM json_each(tags) 242 + UNION 243 + SELECT value FROM json_each(json(?)) 244 + ) 245 + ) 246 + )`); 247 + editParams.push(JSON.stringify(parsed.tags)); 248 + } 249 + 250 + // Build WHERE clause using only selection conditions 251 + parsed.selection.forEach((sel) => { 252 + if (sel.type === "id") { 253 + editConditions.push(`id IN ( 254 + SELECT id 255 + FROM active_todos 256 + WHERE working_id IN (${sel.ids.map(() => "?").join(",")}) 257 + )`); 258 + selectionParams.push(...sel.ids); 259 + } else if (sel.type === "tag") { 260 + editConditions.push(`tags LIKE ?`); 261 + selectionParams.push(`%${sel.value}%`); 262 + } else if (sel.type === "project") { 263 + editConditions.push(`project = ?`); 264 + selectionParams.push(sel.value); 265 + } 266 + }); 267 + 268 + if (editConditions.length > 0 && updates.length > 0) { 269 + const sqlQuery = ` 270 + UPDATE todos 271 + SET ${updates.join(", ")} 272 + WHERE ${editConditions.join(" OR ")} 273 + `; 274 + console.log(sqlQuery); 275 + console.log(editParams); 276 + console.log(selectionParams); 277 + // Execute with editParams for SET clause, followed by selectionParams for WHERE clause 278 + ctx.db.exec(sqlQuery, [...editParams, ...selectionParams]); 279 + clearSelection(); 280 + } 220 281 break; 221 282 case "filter": 222 283 setFilterContext({ 223 284 // I think reconstruct is broken 224 285 // filterText: parsed.reconstruct(), 225 - filterTags: JSON.parse(parsed.tags), 226 - filterProject: parsed.project, 227 - filterDescription: parsed.description, 228 - }); 229 - console.log({ 230 - // I think reconstruct is broken 231 - // filterText: parsed.reconstruct(), 232 - filterTags: JSON.parse(parsed.tags), 286 + filterTags: parsed.tags, 233 287 filterProject: parsed.project, 234 288 filterDescription: parsed.description, 235 289 });
+150 -94
mast-react-vite/src/lib/command_js.js
··· 178 178 var peg$c0 = "add"; 179 179 var peg$c1 = "done"; 180 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"; 181 + var peg$c3 = "modify"; 182 + var peg$c4 = "-"; 183 + var peg$c5 = ","; 184 + var peg$c6 = "@"; 185 + var peg$c7 = "pro:"; 186 + var peg$c8 = "project:"; 187 + var peg$c9 = "+"; 188 + var peg$c10 = "priority:"; 189 + var peg$c11 = "#"; 190 + var peg$c12 = "am"; 191 + var peg$c13 = "pm"; 191 192 192 193 var peg$r0 = /^[HML]/; 193 194 var peg$r1 = /^[0-9]/; ··· 198 199 var peg$e0 = peg$literalExpectation("add", false); 199 200 var peg$e1 = peg$literalExpectation("done", false); 200 201 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(); 202 + var peg$e3 = peg$literalExpectation("modify", false); 203 + var peg$e4 = peg$literalExpectation("-", false); 204 + var peg$e5 = peg$literalExpectation(",", false); 205 + var peg$e6 = peg$literalExpectation("@", false); 206 + var peg$e7 = peg$literalExpectation("pro:", false); 207 + var peg$e8 = peg$literalExpectation("project:", false); 208 + var peg$e9 = peg$literalExpectation("+", false); 209 + var peg$e10 = peg$literalExpectation("priority:", false); 210 + var peg$e11 = peg$classExpectation(["H", "M", "L"], false, false); 211 + var peg$e12 = peg$literalExpectation("#", false); 212 + var peg$e13 = peg$classExpectation([["0", "9"]], false, false); 213 + var peg$e14 = peg$classExpectation([["0", "9"], ":"], false, false); 214 + var peg$e15 = peg$literalExpectation("am", false); 215 + var peg$e16 = peg$literalExpectation("pm", false); 216 + var peg$e17 = peg$classExpectation([["a", "z"], ["A", "Z"], ["0", "9"], "_", "-"], false, false); 217 + var peg$e18 = peg$classExpectation([" ", "\t"], false, false); 218 + var peg$e19 = peg$anyExpectation(); 217 219 218 220 var peg$f0 = function(selection, parts) { 219 221 return makeCommand('add', selection, parts.filter(p => p !== null)); ··· 224 226 var peg$f2 = function(selection, moreFilters) { 225 227 return makeCommand('filter', selection, moreFilters); 226 228 }; 227 - var peg$f3 = function(first, rest) { 229 + var peg$f3 = function(selection, moreFilters) { 230 + return makeCommand('modify', selection, moreFilters); 231 + }; 232 + var peg$f4 = function(first, rest) { 228 233 return [first, ...rest.map(r => r[1])]; 229 234 }; 230 - var peg$f4 = function(start, end) { 235 + var peg$f5 = function(start, end) { 231 236 const ids = []; 232 237 for (let i = start; i <= end; i++) { 233 238 ids.push(i); 234 239 } 235 240 return ids; 236 241 }; 237 - var peg$f5 = function(id) { 242 + var peg$f6 = function(id) { 238 243 return [id]; 239 244 }; 240 - var peg$f6 = function(first, rest) { 245 + var peg$f7 = function(first, rest) { 241 246 return [first, ...rest.map(r => r[1])]; 242 247 }; 243 - var peg$f7 = function(first, rest, trailing) { 248 + var peg$f8 = function(first, rest, trailing) { 244 249 const ids = [first, ...rest.map(r => r[1])].flat(); 245 250 return { 246 251 type: 'id', ··· 248 253 reconstruct: function() { return this.ids.join(','); } 249 254 }; 250 255 }; 251 - var peg$f8 = function(chars) { 256 + var peg$f9 = function(chars) { 252 257 return { 253 258 type: "text", 254 259 value: chars, 255 260 reconstruct: function() { return this.value; } 256 261 }; 257 262 }; 258 - var peg$f9 = function(value) { 263 + var peg$f10 = function(value) { 259 264 return { 260 265 type: "due", 261 266 value: value, 262 267 reconstruct: function() { return `@${this.value}`; } 263 268 }; 264 269 }; 265 - var peg$f10 = function(value) { 270 + var peg$f11 = function(value) { 266 271 return { 267 272 type: "project", 268 273 value: value, 269 274 reconstruct: function() { return `+${this.value}`; } 270 275 }; 271 276 }; 272 - var peg$f11 = function(value) { 277 + var peg$f12 = function(value) { 273 278 return { 274 279 type: "priority", 275 280 value: value, 276 281 reconstruct: function() { return `priority:${this.value}`; } 277 282 }; 278 283 }; 279 - var peg$f12 = function(value) { 284 + var peg$f13 = function(value) { 280 285 return { 281 286 type: "tag", 282 287 value: value, 283 288 reconstruct: function() { return `#${this.value}`; } 284 289 }; 285 290 }; 286 - var peg$f13 = function(digits) { 291 + var peg$f14 = function(digits) { 287 292 return parseInt(digits.join(''), 10); 288 293 }; 289 - var peg$f14 = function(chars) { 294 + var peg$f15 = function(chars) { 290 295 return chars.join('') + (text() || ''); 291 296 }; 292 - var peg$f15 = function(chars) { 297 + var peg$f16 = function(chars) { 293 298 return chars.join(''); 294 299 }; 295 - var peg$f16 = function() { 300 + var peg$f17 = function() { 296 301 return null; 297 302 }; 298 303 var peg$currPos = options.peg$currPos | 0; ··· 465 470 s0 = peg$parseDoneCommand(); 466 471 if (s0 === peg$FAILED) { 467 472 s0 = peg$parseExplicitFilterCommand(); 473 + if (s0 === peg$FAILED) { 474 + s0 = peg$parseModifyCommand(); 475 + } 468 476 } 469 477 } 470 478 ··· 629 637 return s0; 630 638 } 631 639 640 + function peg$parseModifyCommand() { 641 + var s0, s1, s2, s3, s4, s5, s6; 642 + 643 + s0 = peg$currPos; 644 + s1 = peg$parseSelections(); 645 + if (s1 === peg$FAILED) { 646 + s1 = null; 647 + } 648 + s2 = peg$parse_(); 649 + if (s2 === peg$FAILED) { 650 + s2 = null; 651 + } 652 + if (input.substr(peg$currPos, 6) === peg$c3) { 653 + s3 = peg$c3; 654 + peg$currPos += 6; 655 + } else { 656 + s3 = peg$FAILED; 657 + if (peg$silentFails === 0) { peg$fail(peg$e3); } 658 + } 659 + if (s3 !== peg$FAILED) { 660 + s4 = []; 661 + s5 = peg$parse_(); 662 + while (s5 !== peg$FAILED) { 663 + s4.push(s5); 664 + s5 = peg$parse_(); 665 + } 666 + s5 = peg$parseFilters(); 667 + if (s5 !== peg$FAILED) { 668 + s6 = peg$parseEOF(); 669 + if (s6 !== peg$FAILED) { 670 + peg$savedPos = s0; 671 + s0 = peg$f3(s1, s5); 672 + } else { 673 + peg$currPos = s0; 674 + s0 = peg$FAILED; 675 + } 676 + } else { 677 + peg$currPos = s0; 678 + s0 = peg$FAILED; 679 + } 680 + } else { 681 + peg$currPos = s0; 682 + s0 = peg$FAILED; 683 + } 684 + 685 + return s0; 686 + } 687 + 632 688 function peg$parseFilters() { 633 689 var s0, s1, s2, s3, s4, s5; 634 690 ··· 670 726 } 671 727 } 672 728 peg$savedPos = s0; 673 - s0 = peg$f3(s1, s2); 729 + s0 = peg$f4(s1, s2); 674 730 } else { 675 731 peg$currPos = s0; 676 732 s0 = peg$FAILED; ··· 686 742 s1 = peg$parseInteger(); 687 743 if (s1 !== peg$FAILED) { 688 744 if (input.charCodeAt(peg$currPos) === 45) { 689 - s2 = peg$c3; 745 + s2 = peg$c4; 690 746 peg$currPos++; 691 747 } else { 692 748 s2 = peg$FAILED; 693 - if (peg$silentFails === 0) { peg$fail(peg$e3); } 749 + if (peg$silentFails === 0) { peg$fail(peg$e4); } 694 750 } 695 751 if (s2 !== peg$FAILED) { 696 752 s3 = peg$parseInteger(); 697 753 if (s3 !== peg$FAILED) { 698 754 peg$savedPos = s0; 699 - s0 = peg$f4(s1, s3); 755 + s0 = peg$f5(s1, s3); 700 756 } else { 701 757 peg$currPos = s0; 702 758 s0 = peg$FAILED; ··· 720 776 s1 = peg$parseInteger(); 721 777 if (s1 !== peg$FAILED) { 722 778 peg$savedPos = s0; 723 - s1 = peg$f5(s1); 779 + s1 = peg$f6(s1); 724 780 } 725 781 s0 = s1; 726 782 ··· 768 824 } 769 825 } 770 826 peg$savedPos = s0; 771 - s0 = peg$f6(s1, s2); 827 + s0 = peg$f7(s1, s2); 772 828 } else { 773 829 peg$currPos = s0; 774 830 s0 = peg$FAILED; ··· 800 856 s2 = []; 801 857 s3 = peg$currPos; 802 858 if (input.charCodeAt(peg$currPos) === 44) { 803 - s4 = peg$c4; 859 + s4 = peg$c5; 804 860 peg$currPos++; 805 861 } else { 806 862 s4 = peg$FAILED; 807 - if (peg$silentFails === 0) { peg$fail(peg$e4); } 863 + if (peg$silentFails === 0) { peg$fail(peg$e5); } 808 864 } 809 865 if (s4 !== peg$FAILED) { 810 866 s5 = peg$parseIdRange(); ··· 826 882 s2.push(s3); 827 883 s3 = peg$currPos; 828 884 if (input.charCodeAt(peg$currPos) === 44) { 829 - s4 = peg$c4; 885 + s4 = peg$c5; 830 886 peg$currPos++; 831 887 } else { 832 888 s4 = peg$FAILED; 833 - if (peg$silentFails === 0) { peg$fail(peg$e4); } 889 + if (peg$silentFails === 0) { peg$fail(peg$e5); } 834 890 } 835 891 if (s4 !== peg$FAILED) { 836 892 s5 = peg$parseIdRange(); ··· 850 906 } 851 907 } 852 908 if (input.charCodeAt(peg$currPos) === 44) { 853 - s3 = peg$c4; 909 + s3 = peg$c5; 854 910 peg$currPos++; 855 911 } else { 856 912 s3 = peg$FAILED; 857 - if (peg$silentFails === 0) { peg$fail(peg$e4); } 913 + if (peg$silentFails === 0) { peg$fail(peg$e5); } 858 914 } 859 915 if (s3 === peg$FAILED) { 860 916 s3 = null; 861 917 } 862 918 peg$savedPos = s0; 863 - s0 = peg$f7(s1, s2, s3); 919 + s0 = peg$f8(s1, s2, s3); 864 920 } else { 865 921 peg$currPos = s0; 866 922 s0 = peg$FAILED; ··· 887 943 s1 = peg$parseWord(); 888 944 if (s1 !== peg$FAILED) { 889 945 peg$savedPos = s0; 890 - s1 = peg$f8(s1); 946 + s1 = peg$f9(s1); 891 947 } 892 948 s0 = s1; 893 949 ··· 916 972 917 973 s0 = peg$currPos; 918 974 if (input.charCodeAt(peg$currPos) === 64) { 919 - s1 = peg$c5; 975 + s1 = peg$c6; 920 976 peg$currPos++; 921 977 } else { 922 978 s1 = peg$FAILED; 923 - if (peg$silentFails === 0) { peg$fail(peg$e5); } 979 + if (peg$silentFails === 0) { peg$fail(peg$e6); } 924 980 } 925 981 if (s1 !== peg$FAILED) { 926 982 s2 = peg$parseTimeValue(); 927 983 if (s2 !== peg$FAILED) { 928 984 peg$savedPos = s0; 929 - s0 = peg$f9(s2); 985 + s0 = peg$f10(s2); 930 986 } else { 931 987 peg$currPos = s0; 932 988 s0 = peg$FAILED; ··· 943 999 var s0, s1, s2; 944 1000 945 1001 s0 = peg$currPos; 946 - if (input.substr(peg$currPos, 4) === peg$c6) { 947 - s1 = peg$c6; 1002 + if (input.substr(peg$currPos, 4) === peg$c7) { 1003 + s1 = peg$c7; 948 1004 peg$currPos += 4; 949 1005 } else { 950 1006 s1 = peg$FAILED; 951 - if (peg$silentFails === 0) { peg$fail(peg$e6); } 1007 + if (peg$silentFails === 0) { peg$fail(peg$e7); } 952 1008 } 953 1009 if (s1 === peg$FAILED) { 954 - if (input.substr(peg$currPos, 8) === peg$c7) { 955 - s1 = peg$c7; 1010 + if (input.substr(peg$currPos, 8) === peg$c8) { 1011 + s1 = peg$c8; 956 1012 peg$currPos += 8; 957 1013 } else { 958 1014 s1 = peg$FAILED; 959 - if (peg$silentFails === 0) { peg$fail(peg$e7); } 1015 + if (peg$silentFails === 0) { peg$fail(peg$e8); } 960 1016 } 961 1017 if (s1 === peg$FAILED) { 962 1018 if (input.charCodeAt(peg$currPos) === 43) { 963 - s1 = peg$c8; 1019 + s1 = peg$c9; 964 1020 peg$currPos++; 965 1021 } else { 966 1022 s1 = peg$FAILED; 967 - if (peg$silentFails === 0) { peg$fail(peg$e8); } 1023 + if (peg$silentFails === 0) { peg$fail(peg$e9); } 968 1024 } 969 1025 } 970 1026 } ··· 972 1028 s2 = peg$parseWord(); 973 1029 if (s2 !== peg$FAILED) { 974 1030 peg$savedPos = s0; 975 - s0 = peg$f10(s2); 1031 + s0 = peg$f11(s2); 976 1032 } else { 977 1033 peg$currPos = s0; 978 1034 s0 = peg$FAILED; ··· 989 1045 var s0, s1, s2; 990 1046 991 1047 s0 = peg$currPos; 992 - if (input.substr(peg$currPos, 9) === peg$c9) { 993 - s1 = peg$c9; 1048 + if (input.substr(peg$currPos, 9) === peg$c10) { 1049 + s1 = peg$c10; 994 1050 peg$currPos += 9; 995 1051 } else { 996 1052 s1 = peg$FAILED; 997 - if (peg$silentFails === 0) { peg$fail(peg$e9); } 1053 + if (peg$silentFails === 0) { peg$fail(peg$e10); } 998 1054 } 999 1055 if (s1 !== peg$FAILED) { 1000 1056 s2 = input.charAt(peg$currPos); ··· 1002 1058 peg$currPos++; 1003 1059 } else { 1004 1060 s2 = peg$FAILED; 1005 - if (peg$silentFails === 0) { peg$fail(peg$e10); } 1061 + if (peg$silentFails === 0) { peg$fail(peg$e11); } 1006 1062 } 1007 1063 if (s2 !== peg$FAILED) { 1008 1064 peg$savedPos = s0; 1009 - s0 = peg$f11(s2); 1065 + s0 = peg$f12(s2); 1010 1066 } else { 1011 1067 peg$currPos = s0; 1012 1068 s0 = peg$FAILED; ··· 1024 1080 1025 1081 s0 = peg$currPos; 1026 1082 if (input.charCodeAt(peg$currPos) === 35) { 1027 - s1 = peg$c10; 1083 + s1 = peg$c11; 1028 1084 peg$currPos++; 1029 1085 } else { 1030 1086 s1 = peg$FAILED; 1031 - if (peg$silentFails === 0) { peg$fail(peg$e11); } 1087 + if (peg$silentFails === 0) { peg$fail(peg$e12); } 1032 1088 } 1033 1089 if (s1 !== peg$FAILED) { 1034 1090 s2 = peg$parseWord(); 1035 1091 if (s2 !== peg$FAILED) { 1036 1092 peg$savedPos = s0; 1037 - s0 = peg$f12(s2); 1093 + s0 = peg$f13(s2); 1038 1094 } else { 1039 1095 peg$currPos = s0; 1040 1096 s0 = peg$FAILED; ··· 1057 1113 peg$currPos++; 1058 1114 } else { 1059 1115 s2 = peg$FAILED; 1060 - if (peg$silentFails === 0) { peg$fail(peg$e12); } 1116 + if (peg$silentFails === 0) { peg$fail(peg$e13); } 1061 1117 } 1062 1118 if (s2 !== peg$FAILED) { 1063 1119 while (s2 !== peg$FAILED) { ··· 1067 1123 peg$currPos++; 1068 1124 } else { 1069 1125 s2 = peg$FAILED; 1070 - if (peg$silentFails === 0) { peg$fail(peg$e12); } 1126 + if (peg$silentFails === 0) { peg$fail(peg$e13); } 1071 1127 } 1072 1128 } 1073 1129 } else { ··· 1075 1131 } 1076 1132 if (s1 !== peg$FAILED) { 1077 1133 peg$savedPos = s0; 1078 - s1 = peg$f13(s1); 1134 + s1 = peg$f14(s1); 1079 1135 } 1080 1136 s0 = s1; 1081 1137 ··· 1092 1148 peg$currPos++; 1093 1149 } else { 1094 1150 s2 = peg$FAILED; 1095 - if (peg$silentFails === 0) { peg$fail(peg$e13); } 1151 + if (peg$silentFails === 0) { peg$fail(peg$e14); } 1096 1152 } 1097 1153 if (s2 !== peg$FAILED) { 1098 1154 while (s2 !== peg$FAILED) { ··· 1102 1158 peg$currPos++; 1103 1159 } else { 1104 1160 s2 = peg$FAILED; 1105 - if (peg$silentFails === 0) { peg$fail(peg$e13); } 1161 + if (peg$silentFails === 0) { peg$fail(peg$e14); } 1106 1162 } 1107 1163 } 1108 1164 } else { 1109 1165 s1 = peg$FAILED; 1110 1166 } 1111 1167 if (s1 !== peg$FAILED) { 1112 - if (input.substr(peg$currPos, 2) === peg$c11) { 1113 - s2 = peg$c11; 1168 + if (input.substr(peg$currPos, 2) === peg$c12) { 1169 + s2 = peg$c12; 1114 1170 peg$currPos += 2; 1115 1171 } else { 1116 1172 s2 = peg$FAILED; 1117 - if (peg$silentFails === 0) { peg$fail(peg$e14); } 1173 + if (peg$silentFails === 0) { peg$fail(peg$e15); } 1118 1174 } 1119 1175 if (s2 === peg$FAILED) { 1120 - if (input.substr(peg$currPos, 2) === peg$c12) { 1121 - s2 = peg$c12; 1176 + if (input.substr(peg$currPos, 2) === peg$c13) { 1177 + s2 = peg$c13; 1122 1178 peg$currPos += 2; 1123 1179 } else { 1124 1180 s2 = peg$FAILED; 1125 - if (peg$silentFails === 0) { peg$fail(peg$e15); } 1181 + if (peg$silentFails === 0) { peg$fail(peg$e16); } 1126 1182 } 1127 1183 } 1128 1184 if (s2 === peg$FAILED) { 1129 1185 s2 = null; 1130 1186 } 1131 1187 peg$savedPos = s0; 1132 - s0 = peg$f14(s1); 1188 + s0 = peg$f15(s1); 1133 1189 } else { 1134 1190 peg$currPos = s0; 1135 1191 s0 = peg$FAILED; ··· 1148 1204 peg$currPos++; 1149 1205 } else { 1150 1206 s2 = peg$FAILED; 1151 - if (peg$silentFails === 0) { peg$fail(peg$e16); } 1207 + if (peg$silentFails === 0) { peg$fail(peg$e17); } 1152 1208 } 1153 1209 if (s2 !== peg$FAILED) { 1154 1210 while (s2 !== peg$FAILED) { ··· 1158 1214 peg$currPos++; 1159 1215 } else { 1160 1216 s2 = peg$FAILED; 1161 - if (peg$silentFails === 0) { peg$fail(peg$e16); } 1217 + if (peg$silentFails === 0) { peg$fail(peg$e17); } 1162 1218 } 1163 1219 } 1164 1220 } else { ··· 1166 1222 } 1167 1223 if (s1 !== peg$FAILED) { 1168 1224 peg$savedPos = s0; 1169 - s1 = peg$f15(s1); 1225 + s1 = peg$f16(s1); 1170 1226 } 1171 1227 s0 = s1; 1172 1228 ··· 1183 1239 peg$currPos++; 1184 1240 } else { 1185 1241 s2 = peg$FAILED; 1186 - if (peg$silentFails === 0) { peg$fail(peg$e17); } 1242 + if (peg$silentFails === 0) { peg$fail(peg$e18); } 1187 1243 } 1188 1244 if (s2 !== peg$FAILED) { 1189 1245 while (s2 !== peg$FAILED) { ··· 1193 1249 peg$currPos++; 1194 1250 } else { 1195 1251 s2 = peg$FAILED; 1196 - if (peg$silentFails === 0) { peg$fail(peg$e17); } 1252 + if (peg$silentFails === 0) { peg$fail(peg$e18); } 1197 1253 } 1198 1254 } 1199 1255 } else { ··· 1201 1257 } 1202 1258 if (s1 !== peg$FAILED) { 1203 1259 peg$savedPos = s0; 1204 - s1 = peg$f16(); 1260 + s1 = peg$f17(); 1205 1261 } 1206 1262 s0 = s1; 1207 1263 ··· 1218 1274 peg$currPos++; 1219 1275 } else { 1220 1276 s1 = peg$FAILED; 1221 - if (peg$silentFails === 0) { peg$fail(peg$e18); } 1277 + if (peg$silentFails === 0) { peg$fail(peg$e19); } 1222 1278 } 1223 1279 peg$silentFails--; 1224 1280 if (s1 === peg$FAILED) { ··· 1265 1321 description: description || [], 1266 1322 attributes: attributes || [], 1267 1323 project: project, 1268 - tags: JSON.stringify(tags), 1324 + tags: tags, 1269 1325 parts: parts || [], 1270 1326 reconstruct: function() { 1271 1327 const filterStr = this.filters.map(f => f.reconstruct()).join(',');
+150 -94
parser/command_js.js
··· 178 178 var peg$c0 = "add"; 179 179 var peg$c1 = "done"; 180 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"; 181 + var peg$c3 = "modify"; 182 + var peg$c4 = "-"; 183 + var peg$c5 = ","; 184 + var peg$c6 = "@"; 185 + var peg$c7 = "pro:"; 186 + var peg$c8 = "project:"; 187 + var peg$c9 = "+"; 188 + var peg$c10 = "priority:"; 189 + var peg$c11 = "#"; 190 + var peg$c12 = "am"; 191 + var peg$c13 = "pm"; 191 192 192 193 var peg$r0 = /^[HML]/; 193 194 var peg$r1 = /^[0-9]/; ··· 198 199 var peg$e0 = peg$literalExpectation("add", false); 199 200 var peg$e1 = peg$literalExpectation("done", false); 200 201 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(); 202 + var peg$e3 = peg$literalExpectation("modify", false); 203 + var peg$e4 = peg$literalExpectation("-", false); 204 + var peg$e5 = peg$literalExpectation(",", false); 205 + var peg$e6 = peg$literalExpectation("@", false); 206 + var peg$e7 = peg$literalExpectation("pro:", false); 207 + var peg$e8 = peg$literalExpectation("project:", false); 208 + var peg$e9 = peg$literalExpectation("+", false); 209 + var peg$e10 = peg$literalExpectation("priority:", false); 210 + var peg$e11 = peg$classExpectation(["H", "M", "L"], false, false); 211 + var peg$e12 = peg$literalExpectation("#", false); 212 + var peg$e13 = peg$classExpectation([["0", "9"]], false, false); 213 + var peg$e14 = peg$classExpectation([["0", "9"], ":"], false, false); 214 + var peg$e15 = peg$literalExpectation("am", false); 215 + var peg$e16 = peg$literalExpectation("pm", false); 216 + var peg$e17 = peg$classExpectation([["a", "z"], ["A", "Z"], ["0", "9"], "_", "-"], false, false); 217 + var peg$e18 = peg$classExpectation([" ", "\t"], false, false); 218 + var peg$e19 = peg$anyExpectation(); 217 219 218 220 var peg$f0 = function(selection, parts) { 219 221 return makeCommand('add', selection, parts.filter(p => p !== null)); ··· 224 226 var peg$f2 = function(selection, moreFilters) { 225 227 return makeCommand('filter', selection, moreFilters); 226 228 }; 227 - var peg$f3 = function(first, rest) { 229 + var peg$f3 = function(selection, moreFilters) { 230 + return makeCommand('modify', selection, moreFilters); 231 + }; 232 + var peg$f4 = function(first, rest) { 228 233 return [first, ...rest.map(r => r[1])]; 229 234 }; 230 - var peg$f4 = function(start, end) { 235 + var peg$f5 = function(start, end) { 231 236 const ids = []; 232 237 for (let i = start; i <= end; i++) { 233 238 ids.push(i); 234 239 } 235 240 return ids; 236 241 }; 237 - var peg$f5 = function(id) { 242 + var peg$f6 = function(id) { 238 243 return [id]; 239 244 }; 240 - var peg$f6 = function(first, rest) { 245 + var peg$f7 = function(first, rest) { 241 246 return [first, ...rest.map(r => r[1])]; 242 247 }; 243 - var peg$f7 = function(first, rest, trailing) { 248 + var peg$f8 = function(first, rest, trailing) { 244 249 const ids = [first, ...rest.map(r => r[1])].flat(); 245 250 return { 246 251 type: 'id', ··· 248 253 reconstruct: function() { return this.ids.join(','); } 249 254 }; 250 255 }; 251 - var peg$f8 = function(chars) { 256 + var peg$f9 = function(chars) { 252 257 return { 253 258 type: "text", 254 259 value: chars, 255 260 reconstruct: function() { return this.value; } 256 261 }; 257 262 }; 258 - var peg$f9 = function(value) { 263 + var peg$f10 = function(value) { 259 264 return { 260 265 type: "due", 261 266 value: value, 262 267 reconstruct: function() { return `@${this.value}`; } 263 268 }; 264 269 }; 265 - var peg$f10 = function(value) { 270 + var peg$f11 = function(value) { 266 271 return { 267 272 type: "project", 268 273 value: value, 269 274 reconstruct: function() { return `+${this.value}`; } 270 275 }; 271 276 }; 272 - var peg$f11 = function(value) { 277 + var peg$f12 = function(value) { 273 278 return { 274 279 type: "priority", 275 280 value: value, 276 281 reconstruct: function() { return `priority:${this.value}`; } 277 282 }; 278 283 }; 279 - var peg$f12 = function(value) { 284 + var peg$f13 = function(value) { 280 285 return { 281 286 type: "tag", 282 287 value: value, 283 288 reconstruct: function() { return `#${this.value}`; } 284 289 }; 285 290 }; 286 - var peg$f13 = function(digits) { 291 + var peg$f14 = function(digits) { 287 292 return parseInt(digits.join(''), 10); 288 293 }; 289 - var peg$f14 = function(chars) { 294 + var peg$f15 = function(chars) { 290 295 return chars.join('') + (text() || ''); 291 296 }; 292 - var peg$f15 = function(chars) { 297 + var peg$f16 = function(chars) { 293 298 return chars.join(''); 294 299 }; 295 - var peg$f16 = function() { 300 + var peg$f17 = function() { 296 301 return null; 297 302 }; 298 303 var peg$currPos = options.peg$currPos | 0; ··· 465 470 s0 = peg$parseDoneCommand(); 466 471 if (s0 === peg$FAILED) { 467 472 s0 = peg$parseExplicitFilterCommand(); 473 + if (s0 === peg$FAILED) { 474 + s0 = peg$parseModifyCommand(); 475 + } 468 476 } 469 477 } 470 478 ··· 629 637 return s0; 630 638 } 631 639 640 + function peg$parseModifyCommand() { 641 + var s0, s1, s2, s3, s4, s5, s6; 642 + 643 + s0 = peg$currPos; 644 + s1 = peg$parseSelections(); 645 + if (s1 === peg$FAILED) { 646 + s1 = null; 647 + } 648 + s2 = peg$parse_(); 649 + if (s2 === peg$FAILED) { 650 + s2 = null; 651 + } 652 + if (input.substr(peg$currPos, 6) === peg$c3) { 653 + s3 = peg$c3; 654 + peg$currPos += 6; 655 + } else { 656 + s3 = peg$FAILED; 657 + if (peg$silentFails === 0) { peg$fail(peg$e3); } 658 + } 659 + if (s3 !== peg$FAILED) { 660 + s4 = []; 661 + s5 = peg$parse_(); 662 + while (s5 !== peg$FAILED) { 663 + s4.push(s5); 664 + s5 = peg$parse_(); 665 + } 666 + s5 = peg$parseFilters(); 667 + if (s5 !== peg$FAILED) { 668 + s6 = peg$parseEOF(); 669 + if (s6 !== peg$FAILED) { 670 + peg$savedPos = s0; 671 + s0 = peg$f3(s1, s5); 672 + } else { 673 + peg$currPos = s0; 674 + s0 = peg$FAILED; 675 + } 676 + } else { 677 + peg$currPos = s0; 678 + s0 = peg$FAILED; 679 + } 680 + } else { 681 + peg$currPos = s0; 682 + s0 = peg$FAILED; 683 + } 684 + 685 + return s0; 686 + } 687 + 632 688 function peg$parseFilters() { 633 689 var s0, s1, s2, s3, s4, s5; 634 690 ··· 670 726 } 671 727 } 672 728 peg$savedPos = s0; 673 - s0 = peg$f3(s1, s2); 729 + s0 = peg$f4(s1, s2); 674 730 } else { 675 731 peg$currPos = s0; 676 732 s0 = peg$FAILED; ··· 686 742 s1 = peg$parseInteger(); 687 743 if (s1 !== peg$FAILED) { 688 744 if (input.charCodeAt(peg$currPos) === 45) { 689 - s2 = peg$c3; 745 + s2 = peg$c4; 690 746 peg$currPos++; 691 747 } else { 692 748 s2 = peg$FAILED; 693 - if (peg$silentFails === 0) { peg$fail(peg$e3); } 749 + if (peg$silentFails === 0) { peg$fail(peg$e4); } 694 750 } 695 751 if (s2 !== peg$FAILED) { 696 752 s3 = peg$parseInteger(); 697 753 if (s3 !== peg$FAILED) { 698 754 peg$savedPos = s0; 699 - s0 = peg$f4(s1, s3); 755 + s0 = peg$f5(s1, s3); 700 756 } else { 701 757 peg$currPos = s0; 702 758 s0 = peg$FAILED; ··· 720 776 s1 = peg$parseInteger(); 721 777 if (s1 !== peg$FAILED) { 722 778 peg$savedPos = s0; 723 - s1 = peg$f5(s1); 779 + s1 = peg$f6(s1); 724 780 } 725 781 s0 = s1; 726 782 ··· 768 824 } 769 825 } 770 826 peg$savedPos = s0; 771 - s0 = peg$f6(s1, s2); 827 + s0 = peg$f7(s1, s2); 772 828 } else { 773 829 peg$currPos = s0; 774 830 s0 = peg$FAILED; ··· 800 856 s2 = []; 801 857 s3 = peg$currPos; 802 858 if (input.charCodeAt(peg$currPos) === 44) { 803 - s4 = peg$c4; 859 + s4 = peg$c5; 804 860 peg$currPos++; 805 861 } else { 806 862 s4 = peg$FAILED; 807 - if (peg$silentFails === 0) { peg$fail(peg$e4); } 863 + if (peg$silentFails === 0) { peg$fail(peg$e5); } 808 864 } 809 865 if (s4 !== peg$FAILED) { 810 866 s5 = peg$parseIdRange(); ··· 826 882 s2.push(s3); 827 883 s3 = peg$currPos; 828 884 if (input.charCodeAt(peg$currPos) === 44) { 829 - s4 = peg$c4; 885 + s4 = peg$c5; 830 886 peg$currPos++; 831 887 } else { 832 888 s4 = peg$FAILED; 833 - if (peg$silentFails === 0) { peg$fail(peg$e4); } 889 + if (peg$silentFails === 0) { peg$fail(peg$e5); } 834 890 } 835 891 if (s4 !== peg$FAILED) { 836 892 s5 = peg$parseIdRange(); ··· 850 906 } 851 907 } 852 908 if (input.charCodeAt(peg$currPos) === 44) { 853 - s3 = peg$c4; 909 + s3 = peg$c5; 854 910 peg$currPos++; 855 911 } else { 856 912 s3 = peg$FAILED; 857 - if (peg$silentFails === 0) { peg$fail(peg$e4); } 913 + if (peg$silentFails === 0) { peg$fail(peg$e5); } 858 914 } 859 915 if (s3 === peg$FAILED) { 860 916 s3 = null; 861 917 } 862 918 peg$savedPos = s0; 863 - s0 = peg$f7(s1, s2, s3); 919 + s0 = peg$f8(s1, s2, s3); 864 920 } else { 865 921 peg$currPos = s0; 866 922 s0 = peg$FAILED; ··· 887 943 s1 = peg$parseWord(); 888 944 if (s1 !== peg$FAILED) { 889 945 peg$savedPos = s0; 890 - s1 = peg$f8(s1); 946 + s1 = peg$f9(s1); 891 947 } 892 948 s0 = s1; 893 949 ··· 916 972 917 973 s0 = peg$currPos; 918 974 if (input.charCodeAt(peg$currPos) === 64) { 919 - s1 = peg$c5; 975 + s1 = peg$c6; 920 976 peg$currPos++; 921 977 } else { 922 978 s1 = peg$FAILED; 923 - if (peg$silentFails === 0) { peg$fail(peg$e5); } 979 + if (peg$silentFails === 0) { peg$fail(peg$e6); } 924 980 } 925 981 if (s1 !== peg$FAILED) { 926 982 s2 = peg$parseTimeValue(); 927 983 if (s2 !== peg$FAILED) { 928 984 peg$savedPos = s0; 929 - s0 = peg$f9(s2); 985 + s0 = peg$f10(s2); 930 986 } else { 931 987 peg$currPos = s0; 932 988 s0 = peg$FAILED; ··· 943 999 var s0, s1, s2; 944 1000 945 1001 s0 = peg$currPos; 946 - if (input.substr(peg$currPos, 4) === peg$c6) { 947 - s1 = peg$c6; 1002 + if (input.substr(peg$currPos, 4) === peg$c7) { 1003 + s1 = peg$c7; 948 1004 peg$currPos += 4; 949 1005 } else { 950 1006 s1 = peg$FAILED; 951 - if (peg$silentFails === 0) { peg$fail(peg$e6); } 1007 + if (peg$silentFails === 0) { peg$fail(peg$e7); } 952 1008 } 953 1009 if (s1 === peg$FAILED) { 954 - if (input.substr(peg$currPos, 8) === peg$c7) { 955 - s1 = peg$c7; 1010 + if (input.substr(peg$currPos, 8) === peg$c8) { 1011 + s1 = peg$c8; 956 1012 peg$currPos += 8; 957 1013 } else { 958 1014 s1 = peg$FAILED; 959 - if (peg$silentFails === 0) { peg$fail(peg$e7); } 1015 + if (peg$silentFails === 0) { peg$fail(peg$e8); } 960 1016 } 961 1017 if (s1 === peg$FAILED) { 962 1018 if (input.charCodeAt(peg$currPos) === 43) { 963 - s1 = peg$c8; 1019 + s1 = peg$c9; 964 1020 peg$currPos++; 965 1021 } else { 966 1022 s1 = peg$FAILED; 967 - if (peg$silentFails === 0) { peg$fail(peg$e8); } 1023 + if (peg$silentFails === 0) { peg$fail(peg$e9); } 968 1024 } 969 1025 } 970 1026 } ··· 972 1028 s2 = peg$parseWord(); 973 1029 if (s2 !== peg$FAILED) { 974 1030 peg$savedPos = s0; 975 - s0 = peg$f10(s2); 1031 + s0 = peg$f11(s2); 976 1032 } else { 977 1033 peg$currPos = s0; 978 1034 s0 = peg$FAILED; ··· 989 1045 var s0, s1, s2; 990 1046 991 1047 s0 = peg$currPos; 992 - if (input.substr(peg$currPos, 9) === peg$c9) { 993 - s1 = peg$c9; 1048 + if (input.substr(peg$currPos, 9) === peg$c10) { 1049 + s1 = peg$c10; 994 1050 peg$currPos += 9; 995 1051 } else { 996 1052 s1 = peg$FAILED; 997 - if (peg$silentFails === 0) { peg$fail(peg$e9); } 1053 + if (peg$silentFails === 0) { peg$fail(peg$e10); } 998 1054 } 999 1055 if (s1 !== peg$FAILED) { 1000 1056 s2 = input.charAt(peg$currPos); ··· 1002 1058 peg$currPos++; 1003 1059 } else { 1004 1060 s2 = peg$FAILED; 1005 - if (peg$silentFails === 0) { peg$fail(peg$e10); } 1061 + if (peg$silentFails === 0) { peg$fail(peg$e11); } 1006 1062 } 1007 1063 if (s2 !== peg$FAILED) { 1008 1064 peg$savedPos = s0; 1009 - s0 = peg$f11(s2); 1065 + s0 = peg$f12(s2); 1010 1066 } else { 1011 1067 peg$currPos = s0; 1012 1068 s0 = peg$FAILED; ··· 1024 1080 1025 1081 s0 = peg$currPos; 1026 1082 if (input.charCodeAt(peg$currPos) === 35) { 1027 - s1 = peg$c10; 1083 + s1 = peg$c11; 1028 1084 peg$currPos++; 1029 1085 } else { 1030 1086 s1 = peg$FAILED; 1031 - if (peg$silentFails === 0) { peg$fail(peg$e11); } 1087 + if (peg$silentFails === 0) { peg$fail(peg$e12); } 1032 1088 } 1033 1089 if (s1 !== peg$FAILED) { 1034 1090 s2 = peg$parseWord(); 1035 1091 if (s2 !== peg$FAILED) { 1036 1092 peg$savedPos = s0; 1037 - s0 = peg$f12(s2); 1093 + s0 = peg$f13(s2); 1038 1094 } else { 1039 1095 peg$currPos = s0; 1040 1096 s0 = peg$FAILED; ··· 1057 1113 peg$currPos++; 1058 1114 } else { 1059 1115 s2 = peg$FAILED; 1060 - if (peg$silentFails === 0) { peg$fail(peg$e12); } 1116 + if (peg$silentFails === 0) { peg$fail(peg$e13); } 1061 1117 } 1062 1118 if (s2 !== peg$FAILED) { 1063 1119 while (s2 !== peg$FAILED) { ··· 1067 1123 peg$currPos++; 1068 1124 } else { 1069 1125 s2 = peg$FAILED; 1070 - if (peg$silentFails === 0) { peg$fail(peg$e12); } 1126 + if (peg$silentFails === 0) { peg$fail(peg$e13); } 1071 1127 } 1072 1128 } 1073 1129 } else { ··· 1075 1131 } 1076 1132 if (s1 !== peg$FAILED) { 1077 1133 peg$savedPos = s0; 1078 - s1 = peg$f13(s1); 1134 + s1 = peg$f14(s1); 1079 1135 } 1080 1136 s0 = s1; 1081 1137 ··· 1092 1148 peg$currPos++; 1093 1149 } else { 1094 1150 s2 = peg$FAILED; 1095 - if (peg$silentFails === 0) { peg$fail(peg$e13); } 1151 + if (peg$silentFails === 0) { peg$fail(peg$e14); } 1096 1152 } 1097 1153 if (s2 !== peg$FAILED) { 1098 1154 while (s2 !== peg$FAILED) { ··· 1102 1158 peg$currPos++; 1103 1159 } else { 1104 1160 s2 = peg$FAILED; 1105 - if (peg$silentFails === 0) { peg$fail(peg$e13); } 1161 + if (peg$silentFails === 0) { peg$fail(peg$e14); } 1106 1162 } 1107 1163 } 1108 1164 } else { 1109 1165 s1 = peg$FAILED; 1110 1166 } 1111 1167 if (s1 !== peg$FAILED) { 1112 - if (input.substr(peg$currPos, 2) === peg$c11) { 1113 - s2 = peg$c11; 1168 + if (input.substr(peg$currPos, 2) === peg$c12) { 1169 + s2 = peg$c12; 1114 1170 peg$currPos += 2; 1115 1171 } else { 1116 1172 s2 = peg$FAILED; 1117 - if (peg$silentFails === 0) { peg$fail(peg$e14); } 1173 + if (peg$silentFails === 0) { peg$fail(peg$e15); } 1118 1174 } 1119 1175 if (s2 === peg$FAILED) { 1120 - if (input.substr(peg$currPos, 2) === peg$c12) { 1121 - s2 = peg$c12; 1176 + if (input.substr(peg$currPos, 2) === peg$c13) { 1177 + s2 = peg$c13; 1122 1178 peg$currPos += 2; 1123 1179 } else { 1124 1180 s2 = peg$FAILED; 1125 - if (peg$silentFails === 0) { peg$fail(peg$e15); } 1181 + if (peg$silentFails === 0) { peg$fail(peg$e16); } 1126 1182 } 1127 1183 } 1128 1184 if (s2 === peg$FAILED) { 1129 1185 s2 = null; 1130 1186 } 1131 1187 peg$savedPos = s0; 1132 - s0 = peg$f14(s1); 1188 + s0 = peg$f15(s1); 1133 1189 } else { 1134 1190 peg$currPos = s0; 1135 1191 s0 = peg$FAILED; ··· 1148 1204 peg$currPos++; 1149 1205 } else { 1150 1206 s2 = peg$FAILED; 1151 - if (peg$silentFails === 0) { peg$fail(peg$e16); } 1207 + if (peg$silentFails === 0) { peg$fail(peg$e17); } 1152 1208 } 1153 1209 if (s2 !== peg$FAILED) { 1154 1210 while (s2 !== peg$FAILED) { ··· 1158 1214 peg$currPos++; 1159 1215 } else { 1160 1216 s2 = peg$FAILED; 1161 - if (peg$silentFails === 0) { peg$fail(peg$e16); } 1217 + if (peg$silentFails === 0) { peg$fail(peg$e17); } 1162 1218 } 1163 1219 } 1164 1220 } else { ··· 1166 1222 } 1167 1223 if (s1 !== peg$FAILED) { 1168 1224 peg$savedPos = s0; 1169 - s1 = peg$f15(s1); 1225 + s1 = peg$f16(s1); 1170 1226 } 1171 1227 s0 = s1; 1172 1228 ··· 1183 1239 peg$currPos++; 1184 1240 } else { 1185 1241 s2 = peg$FAILED; 1186 - if (peg$silentFails === 0) { peg$fail(peg$e17); } 1242 + if (peg$silentFails === 0) { peg$fail(peg$e18); } 1187 1243 } 1188 1244 if (s2 !== peg$FAILED) { 1189 1245 while (s2 !== peg$FAILED) { ··· 1193 1249 peg$currPos++; 1194 1250 } else { 1195 1251 s2 = peg$FAILED; 1196 - if (peg$silentFails === 0) { peg$fail(peg$e17); } 1252 + if (peg$silentFails === 0) { peg$fail(peg$e18); } 1197 1253 } 1198 1254 } 1199 1255 } else { ··· 1201 1257 } 1202 1258 if (s1 !== peg$FAILED) { 1203 1259 peg$savedPos = s0; 1204 - s1 = peg$f16(); 1260 + s1 = peg$f17(); 1205 1261 } 1206 1262 s0 = s1; 1207 1263 ··· 1218 1274 peg$currPos++; 1219 1275 } else { 1220 1276 s1 = peg$FAILED; 1221 - if (peg$silentFails === 0) { peg$fail(peg$e18); } 1277 + if (peg$silentFails === 0) { peg$fail(peg$e19); } 1222 1278 } 1223 1279 peg$silentFails--; 1224 1280 if (s1 === peg$FAILED) { ··· 1265 1321 description: description || [], 1266 1322 attributes: attributes || [], 1267 1323 project: project, 1268 - tags: JSON.stringify(tags), 1324 + tags: tags, 1269 1325 parts: parts || [], 1270 1326 reconstruct: function() { 1271 1327 const filterStr = this.filters.map(f => f.reconstruct()).join(',');
+6 -2
parser/command_js.peg
··· 32 32 description: description || [], 33 33 attributes: attributes || [], 34 34 project: project, 35 - tags: JSON.stringify(tags), 35 + tags: tags, 36 36 parts: parts || [], 37 37 reconstruct: function() { 38 38 const filterStr = this.filters.map(f => f.reconstruct()).join(','); ··· 43 43 } 44 44 } 45 45 46 - Start = AddCommand / DoneCommand / ExplicitFilterCommand 46 + Start = AddCommand / DoneCommand / ExplicitFilterCommand / ModifyCommand 47 47 48 48 // ADD COMMAND 49 49 AddCommand = selection:Selections? _? "add" _ parts:(Part / _)+ EOF { ··· 57 57 58 58 ExplicitFilterCommand = selection:Selections? _? "filter" _* moreFilters:Filters EOF { 59 59 return makeCommand('filter', selection, moreFilters); 60 + } 61 + 62 + ModifyCommand = selection:Selections? _? "modify" _* moreFilters:Filters EOF { 63 + return makeCommand('modify', selection, moreFilters); 60 64 } 61 65 62 66 Filters = first:Part rest:(_ Part)* {