Skip to content

Commit c448265

Browse files
committed
Update string matching rules
1 parent 9d21876 commit c448265

File tree

1 file changed

+20
-3
lines changed

1 file changed

+20
-3
lines changed

template/issues.js

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ async function get() {
9292
throw new Error(`Error loading <${url}>: ${response.status}`);
9393
}
9494
db = await response.json();
95+
db.pulls ??= [];
9596
db.pulls.forEach(pr => pr.pr = true);
9697
subset = db.all = db.issues.concat(db.pulls);
9798
db.labels = db.labels.reduce((all, l) => {
@@ -316,9 +317,25 @@ class Parser {
316317

317318
parseString() {
318319
let end = -1;
320+
this.skipws();
321+
322+
let bs = false;
323+
let quot = this.next === '"' || this.next === '\'';
324+
let quotchar = this.next;
325+
if (quot) { this.jump(1); }
326+
319327
for (let i = 0; i < this.str.length; ++i) {
320328
let v = this.str.charAt(i);
321-
if (v === ')' || v === ',') {
329+
if (bs) {
330+
bs = false;
331+
continue;
332+
}
333+
if (v === '\\') {
334+
bs = true;
335+
continue;
336+
}
337+
if ((quot && v === quotchar) ||
338+
(!quot && (v === ')' || v === ','))) {
322339
end = i;
323340
break;
324341
}
@@ -327,8 +344,8 @@ class Parser {
327344
throw new Error(`Unterminated string`);
328345
}
329346
let s = this.str.slice(0, end).trim();
330-
this.jump(end);
331-
return s;
347+
this.jump(end + (quot ? 1 : 0));
348+
return s.replace(/\\([\\"'])/g, '$1');
332349
}
333350

334351
parseDate() {

0 commit comments

Comments
 (0)