UNPKG

comment-parser

Version:
1 lines 2.25 kB
{"version":3,"file":"tag.cjs","names":["Object","defineProperty","exports","value","default","tagTokenizer","spec","tokens","source","match","description","problems","push","code","message","line","number","critical","includes","tag","postTag","slice","length"],"sources":["tag.js"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.default = tagTokenizer;\n/**\n * Splits the `@prefix` from remaining `Spec.lines[].token.description` into the `tag` token,\n * and populates `spec.tag`\n */\nfunction tagTokenizer() {\n return (spec) => {\n const { tokens } = spec.source[0];\n const match = tokens.description.match(/\\s*(@(\\S+))(\\s*)/);\n if (match === null) {\n spec.problems.push({\n code: 'spec:tag:prefix',\n message: 'tag should start with \"@\" symbol',\n line: spec.source[0].number,\n critical: true,\n });\n return spec;\n }\n if (match[1].includes('/')) {\n return spec;\n }\n tokens.tag = match[1];\n tokens.postTag = match[3];\n tokens.description = tokens.description.slice(match[0].length);\n spec.tag = match[2];\n return spec;\n };\n}\n"],"mappings":"AAAA,YAAY;;AACZA,MAAM,CAACC,cAAc,CAACC,OAAO,EAAE,YAAY,EAAE;EAAEC,KAAK,EAAE;AAAK,CAAC,CAAC;AAC7DD,OAAO,CAACE,OAAO,GAAGC,YAAY;AAC9B;AACA;AACA;AACA;AACA,SAASA,YAAYA,CAAA,EAAG;EACpB,OAAQC,IAAI,IAAK;IACb,MAAM;MAAEC;IAAO,CAAC,GAAGD,IAAI,CAACE,MAAM,CAAC,CAAC,CAAC;IACjC,MAAMC,KAAK,GAAGF,MAAM,CAACG,WAAW,CAACD,KAAK,CAAC,kBAAkB,CAAC;IAC1D,IAAIA,KAAK,KAAK,IAAI,EAAE;MAChBH,IAAI,CAACK,QAAQ,CAACC,IAAI,CAAC;QACfC,IAAI,EAAE,iBAAiB;QACvBC,OAAO,EAAE,kCAAkC;QAC3CC,IAAI,EAAET,IAAI,CAACE,MAAM,CAAC,CAAC,CAAC,CAACQ,MAAM;QAC3BC,QAAQ,EAAE;MACd,CAAC,CAAC;MACF,OAAOX,IAAI;IACf;IACA,IAAIG,KAAK,CAAC,CAAC,CAAC,CAACS,QAAQ,CAAC,GAAG,CAAC,EAAE;MACxB,OAAOZ,IAAI;IACf;IACAC,MAAM,CAACY,GAAG,GAAGV,KAAK,CAAC,CAAC,CAAC;IACrBF,MAAM,CAACa,OAAO,GAAGX,KAAK,CAAC,CAAC,CAAC;IACzBF,MAAM,CAACG,WAAW,GAAGH,MAAM,CAACG,WAAW,CAACW,KAAK,CAACZ,KAAK,CAAC,CAAC,CAAC,CAACa,MAAM,CAAC;IAC9DhB,IAAI,CAACa,GAAG,GAAGV,KAAK,CAAC,CAAC,CAAC;IACnB,OAAOH,IAAI;EACf,CAAC;AACL","ignoreList":[]}