source-parser.cjs.map 4.6 KB

1
  1. {"version":3,"sources":["source-parser.js"],"names":["Object","defineProperty","exports","value","primitives_js_1","require","util_js_1","getParser","startLine","markers","Markers","block","num","parseSource","source","rest","tokens","seedTokens","lineEnd","splitCR","start","splitSpace","startsWith","nostart","delimiter","slice","length","postDelimiter","isClosed","trimRight","endsWith","end","delim","trimmed","description","push","number","result","default"],"mappings":"AAAA;;AACAA,MAAM,CAACC,cAAP,CAAsBC,OAAtB,EAA+B,YAA/B,EAA6C;AAAEC,EAAAA,KAAK,EAAE;AAAT,CAA7C;;AACA,MAAMC,eAAe,GAAGC,OAAH,qBAArB;;AACA,MAAMC,SAAS,GAAGD,OAAH,eAAf;;AACA,SAASE,SAAT,CAAmB;AAAEC,EAAAA,SAAS,GAAG,CAAd;AAAiBC,EAAAA,OAAO,GAAGL,eAAe,CAACM;AAA3C,IAAwD,EAA3E,EAA+E;AAC3E,MAAIC,KAAK,GAAG,IAAZ;AACA,MAAIC,GAAG,GAAGJ,SAAV;AACA,SAAO,SAASK,WAAT,CAAqBC,MAArB,EAA6B;AAChC,QAAIC,IAAI,GAAGD,MAAX;AACA,UAAME,MAAM,GAAG,CAAC,GAAGV,SAAS,CAACW,UAAd,GAAf;AACA,KAACD,MAAM,CAACE,OAAR,EAAiBH,IAAjB,IAAyB,CAAC,GAAGT,SAAS,CAACa,OAAd,EAAuBJ,IAAvB,CAAzB;AACA,KAACC,MAAM,CAACI,KAAR,EAAeL,IAAf,IAAuB,CAAC,GAAGT,SAAS,CAACe,UAAd,EAA0BN,IAA1B,CAAvB;;AACA,QAAIJ,KAAK,KAAK,IAAV,IACAI,IAAI,CAACO,UAAL,CAAgBb,OAAO,CAACW,KAAxB,CADA,IAEA,CAACL,IAAI,CAACO,UAAL,CAAgBb,OAAO,CAACc,OAAxB,CAFL,EAEuC;AACnCZ,MAAAA,KAAK,GAAG,EAAR;AACAK,MAAAA,MAAM,CAACQ,SAAP,GAAmBT,IAAI,CAACU,KAAL,CAAW,CA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AACkB,WAAP,GAAqBnB,IAArB;AACAJ,IAAAA,KAAK,CAACwB,IAAN,CAAW;AAAEC,MAAAA,MAAM,EAAExB,GAAV;AAAeE,MAAAA,MAAf;AAAuBE,MAAAA;AAAvB,KAAX;AACAJ,IAAAA,GAAG;;AACH,QAAIgB,QAAJ,EAAc;AACV,YAAMS,MAAM,GAAG1B,KAAK,CAACc,KAAN,EAAf;AACAd,MAAAA,KAAK,GAAG,IAAR;AACA,aAAO0B,MAAP;AACH;;AACD,WAAO,IAAP;AACH,GAvCD;AAwCH;;AACDnC,OAAO,CAACoC,OAAR,GAAkB/B,SAAlB","sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst primitives_js_1 = require(\"../primitives.js\");\nconst util_js_1 = require(\"../util.js\");\nfunction getParser({ startLine = 0, markers = primitives_js_1.Markers, } = {}) {\n let block = null;\n let num = startLine;\n return function parseSource(source) {\n let rest = source;\n const tokens = (0, util_js_1.seedTokens)();\n [tokens.lineEnd, rest] = (0, util_js_1.splitCR)(rest);\n [tokens.start, rest] = (0, util_js_1.splitSpace)(rest);\n if (block === null &&\n rest.startsWith(markers.start) &&\n !rest.startsWith(markers.nostart)) {\n block = [];\n tokens.delimiter = rest.slice(0, markers.start.length);\n rest = rest.slice(markers.start.length);\n [tokens.postDelimiter, rest] = (0, util_js_1.splitSpace)(rest);\n }\n if (block === null) {\n num++;\n return null;\n }\n const isClosed = rest.trimRight().endsWith(markers.end);\n if (tokens.delimiter === '' &&\n rest.startsWith(markers.delim) &&\n !rest.startsWith(markers.end)) {\n tokens.delimiter = markers.delim;\n rest = rest.slice(markers.delim.length);\n [tokens.postDelimiter, rest] = (0, util_js_1.splitSpace)(rest);\n }\n if (isClosed) {\n const trimmed = rest.trimRight();\n tokens.end = rest.slice(trimmed.length - markers.end.length);\n rest = trimmed.slice(0, -markers.end.length);\n }\n tokens.description = rest;\n block.push({ number: num, source, tokens });\n num++;\n if (isClosed) {\n const result = block.slice();\n block = null;\n return result;\n }\n return null;\n };\n}\nexports.default = getParser;\n"],"file":"source-parser.cjs"}