Debian Codegraph @

inst/lib/prism-code-editor/prism/languages/yaml.js

raw
1 import { l as languages } from "../../index-C1_GGQ8y.js";
2 import { a as replace, r as re } from "../../shared-Sq5P6lf6.js";
3 var anchorOrAlias = /[*&][^\s[\]{},]+/;
4 var tag = /!(?:<[\w%#;/?:@&=$,.!~*'()[\]+-]+>|(?:[a-zA-Z\d-]*!)?[\w%#;/?:@&=$.~*'()+-]+)?/;
5 var properties = `(?:${tag.source}(?:[ ]+${anchorOrAlias.source})?|${anchorOrAlias.source}(?:[ ]+${tag.source})?)`;
6 var plainKey = replace(
7 "(?:[^\\s\0-\\x08\\x0e-\\x1f!\"#%&'*,:>?@[\\]{}`|\\x7f-\\x84\\x86-\\x9f\\ud800-\\udfff\\ufffe\\uffff-]|[?:-]<0>)(?:[ ]*(?:(?![#:])<0>|:<0>))*",
8 ["[^\\s\0-\\x08\\x0e-\\x1f,[\\]{}\\x7f-\\x84\\x86-\\x9f\\ud800-\\udfff\\ufffe\\uffff]"]
9 );
10 var string = `"(?:\\\\.|[^\\\\
11 "])*"|'(?:\\\\.|[^\\\\
12 '])*'`;
13 var createValuePattern = (value, flags) => re(
14 "([:,[{-]\\s*(?:\\s<0>[ ]+)?)<1>(?=[ ]*(?:$|,|\\]|\\}|(?:\n\\s*)?#))",
15 [properties, value],
16 flags
17 );
18 languages.yml = languages.yaml = {
19 "scalar": {
20 pattern: re("([:-]\\s*(?:\\s<0>[ ]+)?[|>])[ ]*(?:(\n[ ]+)\\S.*(?:\\2.+)*)", [properties]),
21 lookbehind: true,
22 alias: "string"
23 },
24 "comment": /#.*/,
25 "key": {
26 pattern: re(
27 "((?:^|[:,[{\n?-])[ ]*(?:<0>[ ]+)?)<1>(?=\\s*:\\s)",
28 [properties, "(?:" + plainKey + "|" + string + ")"],
29 "g"
30 ),
31 lookbehind: true,
32 greedy: true,
33 alias: "atrule"
34 },
35 "directive": {
36 pattern: /(^[ ]*)%.+/m,
37 lookbehind: true,
38 alias: "important"
39 },
40 "datetime": {
41 pattern: createValuePattern("\\d{4}-\\d\\d?-\\d\\d?(?:[tT]|[ ]+)\\d\\d?:\\d\\d:\\d\\d(?:\\.\\d*)?(?:[ ]*(?:Z|[+-]\\d\\d?(?::\\d\\d)?))?|\\d{4}-\\d\\d-\\d\\d|\\d\\d?:\\d\\d(?::\\d\\d(?:\\.\\d*)?)?", "m"),
42 lookbehind: true,
43 alias: "number"
44 },
45 "boolean": {
46 pattern: createValuePattern("false|true", "im"),
47 lookbehind: true,
48 alias: "important"
49 },
50 "null": {
51 pattern: createValuePattern("null|~", "im"),
52 lookbehind: true,
53 alias: "important"
54 },
55 "string": {
56 pattern: createValuePattern(string, "mg"),
57 lookbehind: true,
58 greedy: true
59 },
60 "number": {
61 pattern: createValuePattern("[+-]?(?:0x[a-f\\d]+|0o[0-7]+|(?:\\d+(?:\\.\\d*)?|\\.\\d+)(?:e[+-]?\\d+)?|\\.inf|\\.nan)", "im"),
62 lookbehind: true
63 },
64 "tag": tag,
65 "important": anchorOrAlias,
66 "punctuation": /---|[:[\]{},|>?-]|\.{3}/
67 };
68 //# sourceMappingURL=yaml.js.map