Files
NapCatQQ/.pnpm-store/v3/files/1f/128bac2adba43dafadff21158bbc3abf56142860e695aef31bebf01ce6c19ab4190e5579a2d99744bfd5a351e347f40ae1c2af041ef170b490e6f70303bf28
T
TanTan e311ca3275
Build NapCat Artifacts / Type Check & Test (push) Waiting to run
docs: 仓库链接指向本镜像仓库
2026-11-13 09:25:58 +08:00

25 lines
795 B
Plaintext

/**
* Splits the `@prefix` from remaining `Spec.lines[].token.description` into the `tag` token,
* and populates `spec.tag`
*/
export default function tagTokenizer() {
return (spec) => {
const { tokens } = spec.source[0];
const match = tokens.description.match(/\s*(@(\S+))(\s*)/);
if (match === null) {
spec.problems.push({
code: 'spec:tag:prefix',
message: 'tag should start with "@" symbol',
line: spec.source[0].number,
critical: true,
});
return spec;
}
tokens.tag = match[1];
tokens.postTag = match[3];
tokens.description = tokens.description.slice(match[0].length);
spec.tag = match[2];
return spec;
};
}