@retorquere/bibtex-parser 9.0.21 → 9.0.24

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (81) hide show
  1. package/README.md +1 -1
  2. package/dist/cjs/crossref.js +209 -0
  3. package/dist/cjs/crossref.js.map +7 -0
  4. package/dist/cjs/fields.js +6961 -0
  5. package/dist/cjs/fields.js.map +7 -0
  6. package/dist/cjs/index.js +1072 -0
  7. package/dist/cjs/index.js.map +7 -0
  8. package/dist/cjs/jabref.js +111 -0
  9. package/dist/cjs/jabref.js.map +7 -0
  10. package/dist/cjs/merge.js +37 -0
  11. package/dist/cjs/merge.js.map +7 -0
  12. package/dist/cjs/prepositions.js +111 -0
  13. package/dist/cjs/prepositions.js.map +7 -0
  14. package/dist/cjs/sentence-case.js +98 -0
  15. package/dist/cjs/sentence-case.js.map +7 -0
  16. package/dist/cjs/tokenizer.js +194 -0
  17. package/dist/cjs/tokenizer.js.map +7 -0
  18. package/dist/cjs/verbatim.js +403 -0
  19. package/dist/cjs/verbatim.js.map +7 -0
  20. package/dist/cjs/yield.js +26 -0
  21. package/dist/cjs/yield.js.map +7 -0
  22. package/{crossref.json → dist/data/crossref.json} +1 -1
  23. package/{fields.json → dist/data/fields.json} +1 -1
  24. package/dist/esm/crossref.js +190 -0
  25. package/dist/esm/crossref.js.map +7 -0
  26. package/dist/esm/fields.js +6942 -0
  27. package/dist/esm/fields.js.map +7 -0
  28. package/dist/esm/index.js +1044 -0
  29. package/dist/esm/index.js.map +7 -0
  30. package/dist/esm/jabref.js +92 -0
  31. package/dist/esm/jabref.js.map +7 -0
  32. package/dist/esm/merge.js +8 -0
  33. package/dist/esm/merge.js.map +7 -0
  34. package/dist/esm/prepositions.js +92 -0
  35. package/dist/esm/prepositions.js.map +7 -0
  36. package/dist/esm/sentence-case.js +79 -0
  37. package/dist/esm/sentence-case.js.map +7 -0
  38. package/dist/esm/tokenizer.js +170 -0
  39. package/dist/esm/tokenizer.js.map +7 -0
  40. package/dist/esm/verbatim.js +387 -0
  41. package/dist/esm/verbatim.js.map +7 -0
  42. package/dist/esm/yield.js +7 -0
  43. package/dist/esm/yield.js.map +7 -0
  44. package/dist/types/crossref.d.ts +188 -0
  45. package/dist/types/crossref.d.ts.map +1 -0
  46. package/dist/types/fields.d.ts +55 -0
  47. package/dist/types/fields.d.ts.map +1 -0
  48. package/{index.d.ts → dist/types/index.d.ts} +8 -7
  49. package/dist/types/index.d.ts.map +1 -0
  50. package/dist/types/jabref.d.ts.map +1 -0
  51. package/dist/types/merge.d.ts.map +1 -0
  52. package/dist/types/prepositions.d.ts +3 -0
  53. package/dist/types/prepositions.d.ts.map +1 -0
  54. package/dist/types/sentence-case.d.ts.map +1 -0
  55. package/dist/types/tokenizer.d.ts.map +1 -0
  56. package/dist/types/verbatim.d.ts.map +1 -0
  57. package/dist/types/yield.d.ts.map +1 -0
  58. package/package.json +38 -47
  59. package/index.js +0 -1191
  60. package/index.js.map +0 -1
  61. package/jabref.js +0 -110
  62. package/jabref.js.map +0 -1
  63. package/merge.js +0 -11
  64. package/merge.js.map +0 -1
  65. package/sentence-case.js +0 -110
  66. package/sentence-case.js.map +0 -1
  67. package/tokenizer.js +0 -167
  68. package/tokenizer.js.map +0 -1
  69. package/verbatim.js +0 -430
  70. package/verbatim.js.map +0 -1
  71. package/yield.js +0 -7
  72. package/yield.js.map +0 -1
  73. /package/{prepositions.json → dist/data/prepositions.json} +0 -0
  74. /package/{strings.bib → dist/data/strings.bib} +0 -0
  75. /package/{unabbrev.json → dist/data/unabbrev.json} +0 -0
  76. /package/{jabref.d.ts → dist/types/jabref.d.ts} +0 -0
  77. /package/{merge.d.ts → dist/types/merge.d.ts} +0 -0
  78. /package/{sentence-case.d.ts → dist/types/sentence-case.d.ts} +0 -0
  79. /package/{tokenizer.d.ts → dist/types/tokenizer.d.ts} +0 -0
  80. /package/{verbatim.d.ts → dist/types/verbatim.d.ts} +0 -0
  81. /package/{yield.d.ts → dist/types/yield.d.ts} +0 -0
@@ -0,0 +1,194 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
24
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
+ mod
26
+ ));
27
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
+ var tokenizer_exports = {};
29
+ __export(tokenizer_exports, {
30
+ tokenize: () => tokenize
31
+ });
32
+ module.exports = __toCommonJS(tokenizer_exports);
33
+ var import_moo = __toESM(require("moo"), 1);
34
+ var import_prepositions = __toESM(require("./prepositions.js"), 1);
35
+ const RE = new class {
36
+ Acronym;
37
+ Word;
38
+ Contraction;
39
+ Whitespace = /[ \t\n\r\u00A0]+/u;
40
+ Ordinal;
41
+ Email;
42
+ Handle;
43
+ IntOrVersion;
44
+ Domain;
45
+ Website;
46
+ Preposition;
47
+ ComplexPreposition = /^([^ \t\n\r\u00A0]+)([ \t\n\r\u00A0]+)([^ \t\n\r\u00A0]+)(?:([ \t\n\r\u00A0]+)([^ \t\n\r\u00A0]+))?$/u;
48
+ P = new RegExp("\\p{P}", "u");
49
+ constructor() {
50
+ const B = "(?=(?:[^\\p{L}\\p{N}\\p{M}\\u00AD\\u2060]|$))";
51
+ const LNM = "[\\p{L}\\p{N}\\p{M}\xAD\u2060]";
52
+ const W = `${LNM}*?\\p{L}${LNM}*`;
53
+ this.Acronym = new RegExp(`(?:(?:(?:[\\p{Lu}\\p{Lt}][.]){2,}${B})|(?:(?:vs?[.])(?=[
54
+ \r\xA0])))`, "u");
55
+ this.Word = new RegExp(`${W}${B}`, "u");
56
+ this.Contraction = new RegExp(`${W}['\u2019]${W}${B}`, "u");
57
+ this.Ordinal = new RegExp(`\\d+(?:st|nd|rd|th)${B}`, "u");
58
+ this.Email = new RegExp(`[A-Za-z0-9._%+-]+@[A-Za-z0-9-]+(?:[.][A-Za-z0-9-]+)+${B}`, "u");
59
+ this.Handle = new RegExp(`@[A-Za-z0-9-]{2,}${B}`, "u");
60
+ this.IntOrVersion = new RegExp(`v?\\d+(?:\\.\\d+)*${B}`, "u");
61
+ this.Domain = new RegExp(`${W}(?:[.]${W})+${B}`, "u");
62
+ this.Website = new RegExp(`https?://${W}(?:[.]${W})+(?:[^.!?
63
+ \r\xA0]+|[.!?]${LNM})+`, "u");
64
+ const ci = (s) => s.replace(/[a-z]/ig, (match) => `[${match.toUpperCase()}${match.toLowerCase()}]`).replace(" ", this.Whitespace.source);
65
+ this.Preposition = new RegExp(`(?:${import_prepositions.default.sort().reverse().map(ci).join("|")})${B}`, "u");
66
+ }
67
+ }();
68
+ const lexer = import_moo.default.compile({
69
+ "word-preposition": RE.Preposition,
70
+ "word-acronym": RE.Acronym,
71
+ "word-contraction": RE.Contraction,
72
+ "word-ordinal": RE.Ordinal,
73
+ email: RE.Email,
74
+ handle: RE.Handle,
75
+ website: RE.Website,
76
+ domain: RE.Domain,
77
+ word: RE.Word,
78
+ number: RE.IntOrVersion,
79
+ // eslint-disable-line id-blacklist
80
+ "punctuation-end": /[?.!](?=[ \t\n\r\u00A0]|$)/u,
81
+ "punctuation-colon": /:(?=[ \t\n\r\u00A0])/u,
82
+ "punctuation-ellipsis": /[.][.][.]/u,
83
+ punctuation: RE.P,
84
+ whitespace: { match: /[ \t\n\r\u00A0]/u, lineBreaks: true },
85
+ other: { match: /[\s\S]/u, lineBreaks: true }
86
+ });
87
+ const Shape = new class {
88
+ shapes = {};
89
+ re = {
90
+ X: /[\p{Lu}\p{Lt}]/u,
91
+ x: /[\p{Ll}\p{Lm}\p{Lo}]/u,
92
+ d: new RegExp("\\p{N}", "u")
93
+ };
94
+ match(c) {
95
+ if (c.match(this.re.d)) return "d";
96
+ if (c.toLowerCase() === c.toUpperCase()) return c;
97
+ if (c.match(this.re.X)) return "X";
98
+ if (c.match(this.re.x)) return "x";
99
+ if (c === "\u2019") return "'";
100
+ if (c === "\u2013") return "-";
101
+ if (c === "\u2060" || c === "\xAD") return "";
102
+ return c;
103
+ }
104
+ fetch(c) {
105
+ if (typeof this.shapes[c] === "undefined") this.shapes[c] = this.match(c);
106
+ return this.shapes[c];
107
+ }
108
+ shape(t) {
109
+ if (!this.shapes[t]) this.shapes[t] = Array.from(t).map((c) => this.fetch(c)).join("");
110
+ return this.shapes[t];
111
+ }
112
+ }();
113
+ function combine(tokens) {
114
+ const combined = { ...tokens[0] };
115
+ for (const t of tokens.slice(1)) {
116
+ combined.text += t.text;
117
+ combined.end = t.end;
118
+ combined.shape += t.shape;
119
+ }
120
+ return combined;
121
+ }
122
+ function hyphenate(t) {
123
+ if (t.type === "word") return "w";
124
+ if (t.text === "-" || t.text === "\u2013") return "-";
125
+ return " ";
126
+ }
127
+ function tokenize(title, markup) {
128
+ if (markup) title = title.replace(markup, (match) => "\u2060".repeat(match.length));
129
+ lexer.reset(title);
130
+ const tokens = [];
131
+ let sentenceStart = true;
132
+ let subSentenceStart = false;
133
+ for (const token of lexer) {
134
+ const [type, subtype] = (token.type.includes("-") ? token.type : `${token.type}-`).split("-");
135
+ tokens.push({
136
+ type,
137
+ subtype,
138
+ text: token.text,
139
+ start: token.offset,
140
+ end: token.offset + token.text.length - 1,
141
+ shape: Shape.shape(token.text),
142
+ sentenceStart: type === "word" && sentenceStart,
143
+ subSentenceStart: type === "word" && subSentenceStart
144
+ });
145
+ switch (token.type) {
146
+ case "punctuation-end":
147
+ sentenceStart = true;
148
+ break;
149
+ case "punctuation-colon":
150
+ subSentenceStart = true;
151
+ break;
152
+ default:
153
+ if (type.match(/word|number|handle|domain|website/)) {
154
+ sentenceStart = false;
155
+ subSentenceStart = false;
156
+ }
157
+ break;
158
+ }
159
+ }
160
+ const stack = tokens.splice(0);
161
+ let cpt;
162
+ let cps;
163
+ while (stack.length) {
164
+ if (stack[0].subtype === "preposition" && (cpt = stack[0].text.match(RE.ComplexPreposition)) && (cps = stack[0].shape.match(RE.ComplexPreposition))) {
165
+ const complex = stack.shift();
166
+ let start = complex.start;
167
+ let end;
168
+ for (const i of Array.from({ length: 5 }, (_, n) => n + 1)) {
169
+ if (!cpt[i]) break;
170
+ end = start + cps[i].length - 1;
171
+ tokens.push({
172
+ ...complex,
173
+ text: cpt[i],
174
+ shape: cps[i],
175
+ start,
176
+ end,
177
+ type: i % 2 ? complex.type : "whitespace",
178
+ subtype: i % 2 ? complex.type : ""
179
+ });
180
+ start = end + 1;
181
+ }
182
+ continue;
183
+ }
184
+ const pat = stack.map((t) => hyphenate(t)).join("");
185
+ if (cpt = pat.match(/^w(-w)+(?= |$)/)) {
186
+ const hyphenated = stack.splice(0, cpt[0].length);
187
+ tokens.push({ ...combine(hyphenated), hyphenated });
188
+ continue;
189
+ }
190
+ tokens.push(stack.shift());
191
+ }
192
+ return markup ? tokens.map((token) => ({ ...token, text: title.substring(token.start, token.end + 1) })) : tokens;
193
+ }
194
+ //# sourceMappingURL=tokenizer.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../tokenizer.ts"],
4
+ "sourcesContent": ["import moo from 'moo'\n\nimport prepositions from './prepositions.js'\n\n// const show = (obj: any): string => JSON.stringify(obj, null, 2).replace(/[\\u007F-\\uFFFF]/g, chr => `\\\\u${(`0000${chr.charCodeAt(0).toString(16)}`).substr(-4)}`)\n\nconst RE = new class {\n public Acronym: RegExp\n public Word: RegExp\n public Contraction: RegExp\n public Whitespace = /[ \\t\\n\\r\\u00A0]+/u\n public Ordinal: RegExp\n public Email: RegExp\n public Handle: RegExp\n public IntOrVersion: RegExp\n public Domain: RegExp\n public Website: RegExp\n public Preposition: RegExp\n public ComplexPreposition = /^([^ \\t\\n\\r\\u00A0]+)([ \\t\\n\\r\\u00A0]+)([^ \\t\\n\\r\\u00A0]+)(?:([ \\t\\n\\r\\u00A0]+)([^ \\t\\n\\r\\u00A0]+))?$/u\n public P = /\\p{P}/u\n\n constructor() {\n const B = '(?=(?:[^\\\\p{L}\\\\p{N}\\\\p{M}\\\\u00AD\\\\u2060]|$))'\n const LNM = '[\\\\p{L}\\\\p{N}\\\\p{M}\\u00AD\\u2060]'\n const W = `${LNM}*?\\\\p{L}${LNM}*`\n\n this.Acronym = new RegExp(`(?:(?:(?:[\\\\p{Lu}\\\\p{Lt}][.]){2,}${B})|(?:(?:vs?[.])(?=[ \\t\\n\\r\\u00A0])))`, 'u')\n this.Word = new RegExp(`${W}${B}`, 'u')\n\n this.Contraction = new RegExp(`${W}['\u2019]${W}${B}`, 'u')\n this.Ordinal = new RegExp(`\\\\d+(?:st|nd|rd|th)${B}`, 'u')\n this.Email = new RegExp(`[A-Za-z0-9._%+-]+@[A-Za-z0-9-]+(?:[.][A-Za-z0-9-]+)+${B}`, 'u')\n this.Handle = new RegExp(`@[A-Za-z0-9-]{2,}${B}`, 'u')\n this.IntOrVersion = new RegExp(`v?\\\\d+(?:\\\\.\\\\d+)*${B}`, 'u')\n this.Domain = new RegExp(`${W}(?:[.]${W})+${B}`, 'u')\n this.Website = new RegExp(`https?://${W}(?:[.]${W})+(?:[^.!? \\t\\n\\r\\u00A0]+|[.!?]${LNM})+`, 'u')\n\n const ci = (s: string): string =>\n s\n .replace(/[a-z]/ig, match => `[${match.toUpperCase()}${match.toLowerCase()}]`)\n .replace(' ', this.Whitespace.source)\n\n this.Preposition = new RegExp(`(?:${prepositions.sort().reverse().map(ci).join('|')})${B}`, 'u')\n }\n}()\n\nconst lexer = moo.compile({\n 'word-preposition': RE.Preposition,\n 'word-acronym': RE.Acronym,\n 'word-contraction': RE.Contraction,\n 'word-ordinal': RE.Ordinal,\n email: RE.Email,\n handle: RE.Handle,\n website: RE.Website,\n domain: RE.Domain,\n word: RE.Word,\n number: RE.IntOrVersion, // eslint-disable-line id-blacklist\n 'punctuation-end': /[?.!](?=[ \\t\\n\\r\\u00A0]|$)/u,\n 'punctuation-colon': /:(?=[ \\t\\n\\r\\u00A0])/u,\n 'punctuation-ellipsis': /[.][.][.]/u,\n punctuation: RE.P,\n whitespace: { match: /[ \\t\\n\\r\\u00A0]/u, lineBreaks: true },\n other: { match: /[\\s\\S]/u, lineBreaks: true },\n})\n\nconst Shape = new class {\n private shapes: Record<string, string> = {}\n private re: Record<string, RegExp> = {\n X: /[\\p{Lu}\\p{Lt}]/u,\n x: /[\\p{Ll}\\p{Lm}\\p{Lo}]/u,\n d: /\\p{N}/u,\n }\n\n private match(c: string): string {\n if (c.match(this.re.d)) return 'd'\n if (c.toLowerCase() === c.toUpperCase()) return c\n if (c.match(this.re.X)) return 'X'\n if (c.match(this.re.x)) return 'x'\n if (c === '\u2019') return \"'\"\n if (c === '\u2013') return '-'\n if (c === '\\u2060' || c === '\\u00AD') return ''\n return c\n }\n\n private fetch(c: string): string {\n if (typeof this.shapes[c] === 'undefined') this.shapes[c] = this.match(c)\n return this.shapes[c]\n }\n\n shape(t: string) {\n if (!this.shapes[t]) this.shapes[t] = Array.from(t).map(c => this.fetch(c)).join('')\n return this.shapes[t]\n }\n}()\n\nexport type Token = {\n type: 'word' | 'domain' | 'whitespace'\n subtype: '' | 'preposition' | 'acronym' | 'whitespace' | 'word' | 'domain'\n text: string\n start: number\n end: number\n shape: string\n sentenceStart: boolean\n subSentenceStart: boolean\n hyphenated?: Token[]\n}\n\nfunction combine(tokens: Token[]) {\n const combined = { ...tokens[0] }\n for (const t of tokens.slice(1)) {\n combined.text += t.text\n combined.end = t.end\n combined.shape += t.shape\n }\n return combined\n}\n\nfunction hyphenate(t: Token) {\n if (t.type === 'word') return 'w'\n if (t.text === '-' || t.text === '\u2013') return '-'\n return ' '\n}\n\nexport function tokenize(title: string, markup?: RegExp): Token[] {\n if (markup) title = title.replace(markup, match => '\\u2060'.repeat(match.length))\n\n lexer.reset(title)\n const tokens: Token[] = []\n let sentenceStart = true\n let subSentenceStart = false\n for (const token of lexer) {\n const [type, subtype] = (token.type.includes('-') ? token.type : `${token.type}-`).split('-')\n\n tokens.push({\n type,\n subtype,\n text: token.text,\n start: token.offset,\n end: token.offset + token.text.length - 1,\n shape: Shape.shape(<string> token.text),\n sentenceStart: type === 'word' && sentenceStart,\n subSentenceStart: type === 'word' && subSentenceStart,\n })\n\n switch (token.type) {\n case 'punctuation-end':\n sentenceStart = true\n break\n case 'punctuation-colon':\n subSentenceStart = true\n break\n default:\n if (type.match(/word|number|handle|domain|website/)) {\n sentenceStart = false\n subSentenceStart = false\n }\n break\n }\n }\n\n const stack = tokens.splice(0)\n\n let cpt: RegExpMatchArray\n let cps: RegExpMatchArray\n while (stack.length) {\n if (stack[0].subtype === 'preposition' && (cpt = stack[0].text.match(RE.ComplexPreposition)) && (cps = stack[0].shape.match(RE.ComplexPreposition))) {\n const complex = stack.shift()\n\n let start = complex.start\n let end\n for (const i of Array.from({ length: 5 }, (_, n) => n + 1)) {\n if (!cpt[i]) break\n\n end = start + cps[i].length - 1\n tokens.push({\n ...complex,\n text: cpt[i],\n shape: cps[i],\n start,\n end,\n type: i % 2 ? complex.type : 'whitespace',\n subtype: i % 2 ? complex.type : '',\n })\n start = end + 1\n }\n continue\n }\n\n // hyphenated words\n const pat = stack.map(t => hyphenate(t)).join('')\n if (cpt = pat.match(/^w(-w)+(?= |$)/)) {\n const hyphenated = stack.splice(0, cpt[0].length)\n tokens.push({ ...combine(hyphenated), hyphenated })\n continue\n }\n\n tokens.push(stack.shift())\n }\n\n return markup ? tokens.map(token => ({ ...token, text: title.substring(token.start, token.end + 1) })) : tokens\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,iBAAgB;AAEhB,0BAAyB;AAIzB,MAAM,KAAK,IAAI,MAAM;AAAA,EACZ;AAAA,EACA;AAAA,EACA;AAAA,EACA,aAAa;AAAA,EACb;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,qBAAqB;AAAA,EACrB,IAAI,WAAC,UAAM,GAAC;AAAA,EAEnB,cAAc;AACZ,UAAM,IAAI;AACV,UAAM,MAAM;AACZ,UAAM,IAAI,GAAG,GAAG,WAAW,GAAG;AAE9B,SAAK,UAAU,IAAI,OAAO,oCAAoC,CAAC;AAAA,aAAwC,GAAG;AAC1G,SAAK,OAAO,IAAI,OAAO,GAAG,CAAC,GAAG,CAAC,IAAI,GAAG;AAEtC,SAAK,cAAc,IAAI,OAAO,GAAG,CAAC,YAAO,CAAC,GAAG,CAAC,IAAI,GAAG;AACrD,SAAK,UAAU,IAAI,OAAO,sBAAsB,CAAC,IAAI,GAAG;AACxD,SAAK,QAAQ,IAAI,OAAO,uDAAuD,CAAC,IAAI,GAAG;AACvF,SAAK,SAAS,IAAI,OAAO,oBAAoB,CAAC,IAAI,GAAG;AACrD,SAAK,eAAe,IAAI,OAAO,qBAAqB,CAAC,IAAI,GAAG;AAC5D,SAAK,SAAS,IAAI,OAAO,GAAG,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,GAAG;AACpD,SAAK,UAAU,IAAI,OAAO,YAAY,CAAC,SAAS,CAAC;AAAA,g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UAAU,CAAC,CAAC,EAAE,KAAK,EAAE;AAChD,QAAI,MAAM,IAAI,MAAM,gBAAgB,GAAG;AACrC,YAAM,aAAa,MAAM,OAAO,GAAG,IAAI,CAAC,EAAE,MAAM;AAChD,aAAO,KAAK,EAAE,GAAG,QAAQ,UAAU,GAAG,WAAW,CAAC;AAClD;AAAA,IACF;AAEA,WAAO,KAAK,MAAM,MAAM,CAAC;AAAA,EAC3B;AAEA,SAAO,SAAS,OAAO,IAAI,YAAU,EAAE,GAAG,OAAO,MAAM,MAAM,UAAU,MAAM,OAAO,MAAM,MAAM,CAAC,EAAE,EAAE,IAAI;AAC3G;",
6
+ "names": ["prepositions", "moo"]
7
+ }
@@ -0,0 +1,403 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+ var verbatim_exports = {};
19
+ __export(verbatim_exports, {
20
+ Library: () => Library,
21
+ parse: () => parse,
22
+ promises: () => promises
23
+ });
24
+ module.exports = __toCommonJS(verbatim_exports);
25
+ var import_yield = require("./yield.js");
26
+ class ParsingError extends Error {
27
+ source;
28
+ constructor(message, parser) {
29
+ message += ` at ${parser.location()}`;
30
+ if (parser.parsing) message += ` in ${JSON.stringify(parser.parsing)}`;
31
+ super(message);
32
+ this.name = "ParsingError";
33
+ }
34
+ }
35
+ const letter = /[\p{Lu}\p{Lt}\p{Ll}\p{Lm}\p{Lo}]/u;
36
+ class Library {
37
+ parsing;
38
+ entries = [];
39
+ strings = {};
40
+ comments = [];
41
+ errors = [];
42
+ preambles = [];
43
+ default_strings = {
44
+ JAN: "01",
45
+ JANUARY: "01",
46
+ FEB: "02",
47
+ FEBRUARY: "02",
48
+ MAR: "03",
49
+ MARCH: "03",
50
+ APR: "04",
51
+ APRIL: "04",
52
+ MAY: "05",
53
+ JUN: "06",
54
+ JUNE: "06",
55
+ JUL: "07",
56
+ JULY: "07",
57
+ AUG: "08",
58
+ AUGUST: "08",
59
+ SEP: "09",
60
+ SEPTEMBER: "09",
61
+ OCT: "10",
62
+ OCTOBER: "10",
63
+ NOV: "11",
64
+ NOVEMBER: "11",
65
+ DEC: "12",
66
+ DECEMBER: "12",
67
+ ACMCS: "ACM Computing Surveys",
68
+ ACTA: "Acta Informatica",
69
+ CACM: "Communications of the ACM",
70
+ IBMJRD: "IBM Journal of Research and Development",
71
+ IBMSJ: "IBM Systems Journal",
72
+ IEEESE: "IEEE Transactions on Software Engineering",
73
+ IEEETC: "IEEE Transactions on Computers",
74
+ IEEETCAD: "IEEE Transactions on Computer-Aided Design of Integrated Circuits",
75
+ IPL: "Information Processing Letters",
76
+ JACM: "Journal of the ACM",
77
+ JCSS: "Journal of Computer and System Sciences",
78
+ SCP: "Science of Computer Programming",
79
+ SICOMP: "SIAM Journal on Computing",
80
+ TOCS: "ACM Transactions on Computer Systems",
81
+ TODS: "ACM Transactions on Database Systems",
82
+ TOG: "ACM Transactions on Graphics",
83
+ TOMS: "ACM Transactions on Mathematical Software",
84
+ TOOIS: "ACM Transactions on Office Information Systems",
85
+ TOPLAS: "ACM Transactions on Programming Languages and Systems",
86
+ TCS: "Theoretical Computer Science"
87
+ };
88
+ pos = 0;
89
+ linebreaks = [];
90
+ input;
91
+ max_entries;
92
+ constructor(input, options = {}) {
93
+ this.max_entries = options.max_entries || 0;
94
+ this.input = input;
95
+ this.parsing = null;
96
+ if (typeof options.strings === "string") {
97
+ this.input = options.strings + "\n" + input;
98
+ } else if (options.strings) {
99
+ for (const [k, v] of Object.entries(options.strings)) {
100
+ this.default_strings[k.toUpperCase()] = v;
101
+ }
102
+ }
103
+ let pos = input.indexOf("\n");
104
+ while (pos !== -1) {
105
+ this.linebreaks.push(pos);
106
+ pos = input.indexOf("\n", pos + 1);
107
+ }
108
+ }
109
+ parse() {
110
+ this.bibtex();
111
+ this.entries.reverse();
112
+ }
113
+ async parseAsync() {
114
+ await this.bibtexAsync();
115
+ this.entries.reverse();
116
+ }
117
+ isWhitespace(s, horizontalOnly = false) {
118
+ return s === " " || s === " " || !horizontalOnly && (s === "\r" || s === "\n");
119
+ }
120
+ match(s, sws = true) {
121
+ this.skipWhitespace();
122
+ if (this.input.substr(this.pos, s.length) !== s) {
123
+ throw new ParsingError(`Token mismatch, expected ${JSON.stringify(s)}, found ${JSON.stringify(this.input.substr(this.pos, 20))}...`, this);
124
+ }
125
+ this.pos += s.length;
126
+ if (sws) this.skipWhitespace();
127
+ }
128
+ tryMatch(s, consume = false) {
129
+ this.skipWhitespace();
130
+ const match = this.input.substr(this.pos, s.length) === s;
131
+ if (match && consume) this.pos += s.length;
132
+ return match;
133
+ }
134
+ skipWhitespace() {
135
+ while (this.pos < this.input.length && this.input[this.pos].match(/[ \t\r\n%]/)) {
136
+ if (this.input[this.pos] === "%") {
137
+ while (this.pos < this.input.length && this.input[this.pos] !== "\n") this.pos++;
138
+ } else {
139
+ this.pos++;
140
+ }
141
+ }
142
+ }
143
+ /*
144
+ private fix_path() {
145
+ // workaround for https://github.com/siefkenj/unified-latex/issues/94
146
+ const path = '\\path|'
147
+ const verb = path.replace('path', 'verb')
148
+ if (this.input.substring(this.pos).startsWith(path)) {
149
+ // eslint-disable-next-line prefer-template
150
+ this.input = this.input.substring(0, this.pos) + verb + this.input.substring(this.pos + path.length)
151
+ }
152
+ }
153
+ */
154
+ value_braces() {
155
+ let bracecount = 0;
156
+ this.match("{", false);
157
+ const start = this.pos;
158
+ let math = false;
159
+ while (true) {
160
+ switch (this.input[this.pos]) {
161
+ case "\\":
162
+ this.pos += 1;
163
+ break;
164
+ case "{":
165
+ bracecount++;
166
+ break;
167
+ case "}":
168
+ if (bracecount === 0) {
169
+ if (math) throw new ParsingError("Unclosed math section", this);
170
+ this.pos++;
171
+ return this.input.substring(start, this.pos - 1);
172
+ }
173
+ bracecount--;
174
+ break;
175
+ case "$":
176
+ math = !math;
177
+ break;
178
+ }
179
+ this.pos++;
180
+ if (this.pos >= this.input.length) {
181
+ throw new ParsingError(`Unterminated brace-value ${JSON.stringify(this.input.substr(start, 20))}`, this);
182
+ }
183
+ }
184
+ }
185
+ value_quotes() {
186
+ this.match('"', false);
187
+ const start = this.pos;
188
+ let bracecount = 0;
189
+ while (true) {
190
+ switch (this.input[this.pos]) {
191
+ case "\\":
192
+ this.pos += 1;
193
+ break;
194
+ case "{":
195
+ bracecount++;
196
+ break;
197
+ case "}":
198
+ bracecount--;
199
+ break;
200
+ case '"':
201
+ if (bracecount <= 0) {
202
+ this.pos++;
203
+ return this.input.substring(start, this.pos - 1);
204
+ }
205
+ }
206
+ this.pos++;
207
+ if (this.pos >= this.input.length) {
208
+ throw new ParsingError(`Unterminated quote-value ${JSON.stringify(this.input.substr(start, 20))}`, this);
209
+ }
210
+ }
211
+ }
212
+ single_value() {
213
+ if (this.tryMatch("{")) {
214
+ return this.value_braces();
215
+ } else if (this.tryMatch('"')) {
216
+ return this.value_quotes();
217
+ } else {
218
+ const bare = this.key();
219
+ if (bare.match(/^\d+$/)) return bare;
220
+ const u_bare = bare.toUpperCase();
221
+ const resolved = this.strings[u_bare] || this.default_strings[u_bare];
222
+ if (typeof resolved === "undefined") {
223
+ this.error({
224
+ error: `Unresolved @string reference ${JSON.stringify(bare)}`,
225
+ input: ""
226
+ });
227
+ }
228
+ return resolved || `{{${bare}}}`;
229
+ }
230
+ }
231
+ location() {
232
+ const lines = this.input.substring(0, this.pos).split("\n");
233
+ return `line ${lines.length}, column ${lines[lines.length - 1].length + 1}`;
234
+ }
235
+ error(err) {
236
+ if (this.errors.find((e) => e.error === err.error)) return;
237
+ this.errors.push(err);
238
+ }
239
+ value() {
240
+ const values = [];
241
+ values.push(this.single_value());
242
+ while (this.tryMatch("#")) {
243
+ this.match("#");
244
+ values.push(this.single_value());
245
+ }
246
+ return values.join("");
247
+ }
248
+ key(allow = "") {
249
+ const start = this.pos;
250
+ while (true) {
251
+ if (this.pos === this.input.length) {
252
+ throw new ParsingError("Runaway key", this);
253
+ }
254
+ if (this.input[this.pos].match(/[+'a-zA-Z0-9&;_:\\./-]/) || this.input[this.pos].match(letter) || allow.includes(this.input[this.pos])) {
255
+ this.pos++;
256
+ } else {
257
+ return this.input.substring(start, this.pos);
258
+ }
259
+ }
260
+ }
261
+ key_equals_value(key) {
262
+ key = key || this.key();
263
+ if (!key) return;
264
+ if (!this.tryMatch("=")) {
265
+ throw new ParsingError(`${key} = value expected, equals sign missing: ${JSON.stringify(this.input.substr(this.pos, 20))}...`, this);
266
+ }
267
+ this.match("=");
268
+ const val = this.value();
269
+ if (this.parsing === "string") {
270
+ this.strings[key.toUpperCase()] = val;
271
+ } else {
272
+ const bare = key.toLowerCase();
273
+ let postfix = 0;
274
+ while (typeof this.entries[0].fields[key = postfix ? `${bare}+duplicate-${postfix}` : bare] === "string") {
275
+ postfix++;
276
+ }
277
+ this.entries[0].fields[key] = val;
278
+ }
279
+ }
280
+ entry(d, guard) {
281
+ if (this.tryMatch(guard)) return;
282
+ let key;
283
+ if (this.tryMatch(",")) {
284
+ key = "";
285
+ } else {
286
+ key = this.key('[]*"');
287
+ }
288
+ if (this.tryMatch("=")) {
289
+ this.key_equals_value(key);
290
+ } else {
291
+ this.entries[0].key = key;
292
+ }
293
+ this.tryMatch(",", true);
294
+ if (this.tryMatch(guard)) return;
295
+ this.key_equals_value();
296
+ while (this.tryMatch(",", true)) {
297
+ if (this.tryMatch(guard)) return;
298
+ this.key_equals_value();
299
+ }
300
+ }
301
+ directive() {
302
+ this.match("@");
303
+ return this.key().toLowerCase();
304
+ }
305
+ string() {
306
+ this.key_equals_value();
307
+ }
308
+ preamble() {
309
+ this.preambles.push(this.value());
310
+ }
311
+ comment() {
312
+ while (this.isWhitespace(this.input[this.pos], true)) this.pos++;
313
+ if (this.input[this.pos] === "{") {
314
+ this.comments.push(this.value_braces());
315
+ } else {
316
+ const start = this.pos;
317
+ while (this.input[this.pos] !== "\n" && this.pos < this.input.length) this.pos++;
318
+ this.comments.push(this.input.substring(start, this.pos));
319
+ }
320
+ }
321
+ hasMore() {
322
+ if (this.max_entries && this.entries.length >= this.max_entries) return false;
323
+ return this.pos < this.input.length;
324
+ }
325
+ bibtex() {
326
+ while (this.hasMore()) {
327
+ this.parseNext();
328
+ }
329
+ }
330
+ async bibtexAsync() {
331
+ let n = 1;
332
+ while (this.hasMore()) {
333
+ this.parseNext();
334
+ if (n++ % 1e3 === 0) await (0, import_yield.playnice)();
335
+ }
336
+ }
337
+ matchGuard() {
338
+ for (const guard of ["{}", "()"]) {
339
+ if (this.tryMatch(guard[0])) {
340
+ this.match(guard[0]);
341
+ return guard[1];
342
+ }
343
+ }
344
+ throw new ParsingError(`Token mismatch, expected '{' or '(', found ${JSON.stringify(this.input.substr(this.pos, 20))}...`, this);
345
+ }
346
+ parseNext() {
347
+ this.skipWhitespace();
348
+ while (this.pos < this.input.length && this.input[this.pos] !== "@") {
349
+ if (this.input[this.pos] === "%") {
350
+ while (this.pos < this.input.length && this.input[this.pos] !== "\n") this.pos++;
351
+ } else {
352
+ this.pos++;
353
+ }
354
+ }
355
+ if (this.pos >= this.input.length) return;
356
+ let guard = "";
357
+ const start = this.pos;
358
+ try {
359
+ const d = this.parsing = this.directive();
360
+ switch (d) {
361
+ case "string":
362
+ guard = this.matchGuard();
363
+ this.string();
364
+ this.match(guard);
365
+ break;
366
+ case "preamble":
367
+ this.preamble();
368
+ break;
369
+ case "comment":
370
+ this.comment();
371
+ break;
372
+ default:
373
+ guard = this.matchGuard();
374
+ this.entries.unshift({ input: "", type: d, key: "", fields: {} });
375
+ this.entry(d, guard);
376
+ this.match(guard);
377
+ this.entries[0].input = this.input.substring(start, this.pos).trim();
378
+ break;
379
+ }
380
+ } catch (err) {
381
+ if (err.name !== "ParsingError") throw err;
382
+ this.pos = start + 1;
383
+ while (this.pos < this.input.length && this.input[this.pos] !== "@") this.pos++;
384
+ this.error({
385
+ error: err.message,
386
+ input: this.input.substring(start, this.pos)
387
+ });
388
+ }
389
+ }
390
+ }
391
+ function parse(input, options = {}) {
392
+ const parser = new Library(input, options);
393
+ parser.parse();
394
+ return parser;
395
+ }
396
+ const promises = {
397
+ async parse(input, options = {}) {
398
+ const parser = new Library(input, options);
399
+ await parser.parseAsync();
400
+ return parser;
401
+ }
402
+ };
403
+ //# sourceMappingURL=verbatim.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../verbatim.ts"],
4
+ "sourcesContent": ["/* eslint-disable @typescript-eslint/no-unsafe-argument */\n// Original work by Henrik Muehe (c) 2010\n//\n// CommonJS port by Mikola Lysenko 2013\n//\n// error recovery and unicode handling by Emiliano Heyns (c) 2017-2024\n\nimport { playnice } from './yield.js'\n\nclass ParsingError extends Error {\n public source: string\n\n constructor(message, parser) {\n message += ` at ${parser.location()}`\n if (parser.parsing) message += ` in ${JSON.stringify(parser.parsing)}`\n super(message)\n this.name = 'ParsingError'\n }\n}\n\nconst letter = /[\\p{Lu}\\p{Lt}\\p{Ll}\\p{Lm}\\p{Lo}]/u\n\nexport type Entry = {\n input: string\n type: string\n key: string\n fields: Record<string, string>\n}\n\nexport interface ParseError {\n error: string\n input?: string\n}\n\nexport interface ParserOptions {\n /**\n * stop parsing after `max_entries` entries have been found. Useful for quick detection if a text file is in fact a bibtex file\n */\n max_entries?: number\n\n /**\n * preload these strings\n */\n strings?: string | Record<string, string>\n}\n\nexport class Library {\n public parsing: string\n\n public entries: Entry[] = []\n public strings: Record<string, string> = {}\n public comments: string[] = []\n public errors: ParseError[] = []\n public preambles: string[] = []\n\n private default_strings: Record<string, string> = {\n JAN: '01',\n JANUARY: '01',\n FEB: '02',\n FEBRUARY: '02',\n MAR: '03',\n MARCH: '03',\n APR: '04',\n APRIL: '04',\n MAY: '05',\n JUN: '06',\n JUNE: '06',\n JUL: '07',\n JULY: '07',\n AUG: '08',\n AUGUST: '08',\n SEP: '09',\n SEPTEMBER: '09',\n OCT: '10',\n OCTOBER: '10',\n NOV: '11',\n NOVEMBER: '11',\n DEC: '12',\n DECEMBER: '12',\n ACMCS: 'ACM Computing Surveys',\n ACTA: 'Acta Informatica',\n CACM: 'Communications of the ACM',\n IBMJRD: 'IBM Journal of Research and Development',\n IBMSJ: 'IBM Systems Journal',\n IEEESE: 'IEEE Transactions on Software Engineering',\n IEEETC: 'IEEE Transactions on Computers',\n IEEETCAD: 'IEEE Transactions on Computer-Aided Design of Integrated Circuits',\n IPL: 'Information Processing Letters',\n JACM: 'Journal of the ACM',\n JCSS: 'Journal of Computer and System Sciences',\n SCP: 'Science of Computer Programming',\n SICOMP: 'SIAM Journal on Computing',\n TOCS: 'ACM Transactions on Computer Systems',\n TODS: 'ACM Transactions on Database Systems',\n TOG: 'ACM Transactions on Graphics',\n TOMS: 'ACM Transactions on Mathematical Software',\n TOOIS: 'ACM Transactions on Office Information Systems',\n TOPLAS: 'ACM Transactions on Programming Languages and Systems',\n TCS: 'Theoretical Computer Science',\n }\n\n private pos = 0\n private linebreaks: number[] = []\n private input: string\n\n private max_entries: number\n\n constructor(input: string, options: ParserOptions = {}) {\n this.max_entries = options.max_entries || 0\n this.input = input\n this.parsing = null\n\n if (typeof options.strings === 'string') {\n this.input = options.strings + '\\n' + input // eslint-disable-line prefer-template\n }\n else if (options.strings) {\n for (const [k, v] of Object.entries(options.strings)) {\n this.default_strings[k.toUpperCase()] = v\n }\n }\n\n let pos = input.indexOf('\\n')\n while (pos !== -1) {\n this.linebreaks.push(pos)\n pos = input.indexOf('\\n', pos + 1)\n }\n }\n\n public parse(): void {\n this.bibtex()\n this.entries.reverse()\n }\n\n public async parseAsync(): Promise<void> {\n await this.bibtexAsync()\n this.entries.reverse()\n }\n\n private isWhitespace(s, horizontalOnly = false) {\n return (s === ' ' || s === '\\t' || (!horizontalOnly && (s === '\\r' || s === '\\n')))\n }\n\n private match(s, sws = true) {\n this.skipWhitespace()\n if (this.input.substr(this.pos, s.length) !== s) {\n throw new ParsingError(`Token mismatch, expected ${JSON.stringify(s)}, found ${JSON.stringify(this.input.substr(this.pos, 20))}...`, this)\n }\n\n this.pos += s.length\n if (sws) this.skipWhitespace()\n }\n\n private tryMatch(s, consume = false) {\n this.skipWhitespace()\n const match = this.input.substr(this.pos, s.length) === s\n if (match && consume) this.pos += s.length\n return match\n // this.skipWhitespace()\n }\n\n private skipWhitespace() {\n while (this.pos < this.input.length && this.input[this.pos].match(/[ \\t\\r\\n%]/)) {\n // test for '%' is shady\n if (this.input[this.pos] === '%') {\n while (this.pos < this.input.length && this.input[this.pos] !== '\\n') this.pos++\n }\n else {\n this.pos++\n }\n }\n }\n\n /*\n private fix_path() {\n // workaround for https://github.com/siefkenj/unified-latex/issues/94\n const path = '\\\\path|'\n const verb = path.replace('path', 'verb')\n if (this.input.substring(this.pos).startsWith(path)) {\n // eslint-disable-next-line prefer-template\n this.input = this.input.substring(0, this.pos) + verb + this.input.substring(this.pos + path.length)\n }\n }\n */\n\n private value_braces() {\n let bracecount = 0\n this.match('{', false)\n const start = this.pos\n let math = false\n\n while (true) {\n // this.fix_path()\n\n switch (this.input[this.pos]) {\n case '\\\\':\n this.pos += 1\n break\n\n case '{':\n bracecount++\n break\n\n case '}':\n if (bracecount === 0) {\n if (math) throw new ParsingError('Unclosed math section', this)\n this.pos++\n return this.input.substring(start, this.pos - 1)\n }\n bracecount--\n break\n\n case '$':\n math = !math\n break\n }\n\n this.pos++\n\n if (this.pos >= this.input.length) {\n throw new ParsingError(`Unterminated brace-value ${JSON.stringify(this.input.substr(start, 20))}`, this)\n }\n }\n }\n\n private value_quotes() {\n this.match('\"', false)\n const start = this.pos\n let bracecount = 0\n while (true) {\n // this.fix_path()\n\n switch (this.input[this.pos]) {\n case '\\\\':\n this.pos += 1\n break\n\n case '{':\n bracecount++\n break\n\n case '}':\n bracecount--\n break\n\n case '\"':\n if (bracecount <= 0) {\n this.pos++\n return this.input.substring(start, this.pos - 1)\n }\n }\n\n this.pos++\n\n if (this.pos >= this.input.length) {\n throw new ParsingError(`Unterminated quote-value ${JSON.stringify(this.input.substr(start, 20))}`, this)\n }\n }\n }\n\n private single_value() {\n if (this.tryMatch('{')) {\n return this.value_braces()\n }\n else if (this.tryMatch('\"')) {\n return this.value_quotes()\n }\n else {\n const bare = this.key()\n if (bare.match(/^\\d+$/)) return bare\n\n const u_bare = bare.toUpperCase()\n const resolved = this.strings[u_bare] || this.default_strings[u_bare]\n if (typeof resolved === 'undefined') {\n this.error({\n error: `Unresolved @string reference ${JSON.stringify(bare)}`,\n input: '',\n })\n }\n return resolved || `{{${bare}}}`\n }\n }\n\n location(): string {\n const lines = this.input.substring(0, this.pos).split('\\n')\n return `line ${lines.length}, column ${lines[lines.length - 1].length + 1}`\n }\n\n error(err: ParseError): void {\n if (this.errors.find(e => e.error === err.error)) return\n this.errors.push(err)\n }\n\n private value() {\n const values = []\n values.push(this.single_value())\n while (this.tryMatch('#')) {\n this.match('#')\n values.push(this.single_value())\n }\n return values.join('')\n }\n\n private key(allow = ''): string {\n const start = this.pos\n while (true) {\n if (this.pos === this.input.length) {\n throw new ParsingError('Runaway key', this)\n }\n\n if (this.input[this.pos].match(/[+'a-zA-Z0-9&;_:\\\\./-]/) || this.input[this.pos].match(letter) || allow.includes(this.input[this.pos])) {\n this.pos++\n }\n else {\n return this.input.substring(start, this.pos)\n }\n }\n }\n\n private key_equals_value(key?: string) {\n key = key || this.key()\n if (!key) return // no key found, stray comma\n\n if (!this.tryMatch('=')) {\n throw new ParsingError(`${key} = value expected, equals sign missing: ${JSON.stringify(this.input.substr(this.pos, 20))}...`, this)\n }\n\n this.match('=')\n const val = this.value()\n\n if (this.parsing === 'string') {\n this.strings[key.toUpperCase()] = val\n }\n else {\n const bare = key.toLowerCase()\n let postfix = 0\n while (typeof this.entries[0].fields[key = postfix ? `${bare}+duplicate-${postfix}` : bare] === 'string') {\n postfix++\n }\n this.entries[0].fields[key] = val\n }\n }\n\n private entry(d: string, guard: string) {\n if (this.tryMatch(guard)) return // empty entry\n\n let key: string\n // mendeley end endnote can output entries without key... sure...\n if (this.tryMatch(',')) {\n // mendeley absurdity which outputs keyless entries, but at least have the decency to put a comma there\n key = ''\n }\n else {\n // so maybe a real key?\n key = this.key('[]*\"')\n }\n\n if (this.tryMatch('=')) {\n // nope; endnote just skips the comma; we can infer we're in this moronic situation because we've been dumped into field-parsing\n this.key_equals_value(key)\n }\n else {\n // so we did find the real key earlier\n this.entries[0].key = key\n }\n this.tryMatch(',', true)\n if (this.tryMatch(guard)) return // no fields\n\n this.key_equals_value()\n while (this.tryMatch(',', true)) {\n // fixes problems with commas at the end of a list\n if (this.tryMatch(guard)) return\n\n this.key_equals_value()\n }\n }\n\n private directive() {\n this.match('@')\n return this.key().toLowerCase()\n }\n\n private string() { // eslint-disable-line id-blacklist\n this.key_equals_value()\n }\n\n private preamble() {\n this.preambles.push(this.value())\n }\n\n private comment() {\n while (this.isWhitespace(this.input[this.pos], true)) this.pos++\n\n if (this.input[this.pos] === '{') {\n this.comments.push(this.value_braces())\n }\n else {\n const start = this.pos\n while (this.input[this.pos] !== '\\n' && this.pos < this.input.length) this.pos++\n this.comments.push(this.input.substring(start, this.pos))\n }\n }\n\n private hasMore() {\n if (this.max_entries && this.entries.length >= this.max_entries) return false\n return (this.pos < this.input.length)\n }\n\n private bibtex() {\n while (this.hasMore()) {\n this.parseNext()\n }\n }\n\n private async bibtexAsync() {\n let n = 1\n while (this.hasMore()) {\n this.parseNext()\n if ((n++ % 1000) === 0) await playnice()\n }\n }\n\n private matchGuard() {\n for (const guard of ['{}', '()']) {\n if (this.tryMatch(guard[0])) {\n this.match(guard[0])\n return guard[1]\n }\n }\n\n throw new ParsingError(`Token mismatch, expected '{' or '(', found ${JSON.stringify(this.input.substr(this.pos, 20))}...`, this)\n }\n\n private parseNext() {\n this.skipWhitespace()\n\n while (this.pos < this.input.length && this.input[this.pos] !== '@') {\n if (this.input[this.pos] === '%') {\n while (this.pos < this.input.length && this.input[this.pos] !== '\\n') this.pos++\n }\n else {\n this.pos++\n }\n }\n if (this.pos >= this.input.length) return\n\n let guard = ''\n const start = this.pos\n try {\n const d = this.parsing = this.directive()\n switch (d) {\n case 'string':\n guard = this.matchGuard()\n this.string()\n this.match(guard)\n break\n\n case 'preamble':\n this.preamble()\n break\n\n case 'comment':\n this.comment()\n break\n\n default:\n guard = this.matchGuard()\n this.entries.unshift({ input: '', type: d, key: '', fields: {} })\n this.entry(d, guard)\n this.match(guard)\n this.entries[0].input = this.input.substring(start, this.pos).trim()\n break\n }\n }\n catch (err) {\n if (err.name !== 'ParsingError') throw err\n // skip ahead to the next @ and try again\n this.pos = start + 1\n while (this.pos < this.input.length && this.input[this.pos] !== '@') this.pos++\n this.error({\n error: err.message,\n input: this.input.substring(start, this.pos),\n })\n }\n }\n}\n\n/**\n * Parses a bibtex source in verbatim mode. Good for detection of bibtex and for later LaTeX-reparsing.\n */\nexport function parse(input: string, options: ParserOptions = {}): Library {\n const parser = new Library(input, options)\n parser.parse()\n return parser\n}\n\nexport const promises = {\n async parse(input: string, options: ParserOptions = {}): Promise<Library> {\n const parser = new Library(input, options)\n await parser.parseAsync()\n return parser\n },\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAOA,mBAAyB;AAEzB,MAAM,qBAAqB,MAAM;AAAA,EACxB;AAAA,EAEP,YAAY,SAAS,QAAQ;AAC3B,eAAW,OAAO,OAAO,SAAS,CAAC;AACnC,QAAI,OAAO,QAAS,YAAW,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