Update YAML grammar (#221244)

This commit is contained in:
Alex Ross
2024-07-09 10:20:26 +02:00
committed by GitHub
parent 3db7016374
commit c2df206074
7 changed files with 327 additions and 2692 deletions

View File

@@ -4,7 +4,7 @@
"If you want to provide a fix or improvement, please create a pull request against the original repository.",
"Once accepted there, we are happy to receive an update request."
],
"version": "https://github.com/RedCMD/YAML-Syntax-Highlighter/commit/287c71aeb0773759497822b5e5ce4bdc4d5ef2aa",
"version": "https://github.com/RedCMD/YAML-Syntax-Highlighter/commit/60e2e6e24c63d5a703cb04577678a2e416edd956",
"name": "YAML 1.1",
"scopeName": "source.yaml.1.1",
"comment": "https://yaml.org/spec/1.1/",
@@ -182,7 +182,7 @@
"name": "invalid.illegal.character.uri.yaml"
},
{
"include": "#non-printable"
"include": "source.yaml#non-printable"
},
{
"match": "[^\\x{85 2028 2029}\r\n\t a-zA-Z0-9-#;/?:@&=+$,_.!~*'()\\[\\]]++",
@@ -348,7 +348,7 @@
"include": "#block-mapping"
},
{
"include": "#block-scalar"
"include": "source.yaml.1.2#block-scalar"
},
{
"include": "#anchor-property"
@@ -381,26 +381,26 @@
]
},
{
"begin": "(?=\\[|{)",
"while": "\\G",
"begin": "(?={)",
"end": "$",
"patterns": [
{
"include": "#block-mapping"
},
{
"begin": "(?!\\G)(?![\r\n\t ])",
"while": "\\G",
"patterns": [
{
"include": "#presentation-detail"
}
]
},
{
"include": "#flow-mapping"
},
{
"include": "#presentation-detail"
}
]
},
{
"begin": "(?=\\[)",
"end": "$",
"patterns": [
{
"include": "#flow-sequence"
},
{
"include": "#presentation-detail"
}
]
},
@@ -414,7 +414,7 @@
},
"block-mapping": {
"//": "The check for plain keys is expensive",
"begin": "(?=((?<=[-?:]) )?+)(?<![^\t ][\t ]*+:|---)\\G( *+)([\t ]*+)((?>[!&*][^\\x{85 2028 2029}\r\n\t ]*+[\t ]++)*+)(?=(?>(?#Double Quote)\"(?>[^\\\\\"]++|\\\\.)*+\"|(?#Single Quote)'(?>[^']++|'')*+'|(?#Plain)(?>[^-?:,\\[\\]{}#&*!|>'\"%@` \\p{Cntrl}\\p{Surrogate}\\x{FFFE FFFF}]|[?:-](?![\\x{85 2028 2029}\r\n\t ]))(?>[^:#]++|:(?![\\x{85 2028 2029}\r\n\t ])|(?<! |\t)#++)*+)?+(?#Map Value)[\t ]*+:[\\x{85 2028 2029}\r\n\t ]|(?#Explicit)\\?[\\x{85 2028 2029}\r\n\t ])|(?#Flow-Map/Seq)(?<=]|})([\t ]*+)(?=:)",
"begin": "(?=((?<=[-?:]) )?+)(?<![^\t ][\t ]*+:|---)\\G( *+)([\t ]*+)((?>[!&*][^\\x{85 2028 2029}\r\n\t ]*+[\t ]++)*+)(?=(?>(?#Double Quote)\"(?>[^\\\\\"]++|\\\\.)*+\"|(?#Single Quote)'(?>[^']++|'')*+'|(?#Flow-Map){(?>[^\\x{85 2028 2029}}]++|}[ \t]*+(?!:[\\x{85 2028 2029}\r\n\t ]))++}|(?#Flow-Seq)\\[(?>[^\\x{85 2028 2029}\\]]++|][ \t]*+(?!:[\\x{85 2028 2029}\r\n\t ]))++]|(?#Plain)(?>[^-?:,\\[\\]{}#&*!|>'\"%@` \\p{Cntrl}\\p{Surrogate}\\x{FFFE FFFF}]|[?:-](?![\\x{85 2028 2029}\r\n\t ]))(?>[^:#]++|:(?![\\x{85 2028 2029}\r\n\t ])|(?<! |\t)#++)*+)?+(?#Map Value)[\t ]*+:[\\x{85 2028 2029}\r\n\t ]|(?#Explicit)\\?[\\x{85 2028 2029}\r\n\t ])",
"while": "\\G(?>(\\1\\2)((?>[!&*][^\\x{85 2028 2029}\r\n\t ]*+[\t ]++)*+)((?>\t[\t ]*+)?+[^\\x{85 2028 2029}\r\n\t ?:\\-#!&*\"'\\[\\]{}0-9A-Za-z$()+./;<=\\\\^_~\\x{A0}-\\x{D7FF}\\x{E000}-\\x{FFFD}\\x{010000}-\\x{10FFFF}])?+|( *+)([\t ]*+[^\\x{85 2028 2029}\r\n#])?+)",
"beginCaptures": {
"2": {
@@ -439,9 +439,6 @@
"include": "#presentation-detail"
}
]
},
"5": {
"name": "punctuation.whitespace.separator.yaml"
}
},
"whileCaptures": {
@@ -478,73 +475,20 @@
"name": "meta.mapping.yaml",
"patterns": [
{
"comment": "https://yaml.org/spec/1.2.2/#double-quoted-style (BLOCK-KEY)",
"begin": "\\G\"",
"end": "\"",
"beginCaptures": {
"0": {
"name": "punctuation.definition.string.begin.yaml"
}
},
"endCaptures": {
"0": {
"name": "punctuation.definition.string.end.yaml"
}
},
"name": "meta.map.key.yaml string.quoted.double.yaml entity.name.tag.yaml",
"patterns": [
{
"match": ".[\t ]*+$",
"name": "invalid.illegal.multiline-key.yaml"
},
{
"match": "[^\t -\\x{10FFFF}]++",
"name": "invalid.illegal.character.yaml"
},
{
"include": "#double-escape"
}
]
"include": "#block-map-key-double"
},
{
"comment": "https://yaml.org/spec/1.2.2/#rule-c-single-quoted (BLOCK-KEY)",
"begin": "\\G'",
"end": "'(?!')",
"beginCaptures": {
"0": {
"name": "punctuation.definition.string.begin.yaml"
}
},
"endCaptures": {
"0": {
"name": "punctuation.definition.string.end.yaml"
}
},
"name": "meta.map.key.yaml string.quoted.single.yaml entity.name.tag.yaml",
"patterns": [
{
"match": ".[\t ]*+$",
"name": "invalid.illegal.multiline-key.yaml"
},
{
"match": "[^\t -\\x{10FFFF}]++",
"name": "invalid.illegal.character.yaml"
},
{
"match": "''",
"name": "constant.character.escape.single-quote.yaml"
}
]
"include": "source.yaml#block-map-key-single"
},
{
"include": "#block-key-plain"
"include": "#block-map-key-plain"
},
{
"include": "#block-map-key-explicit"
},
{
"include": "#block-map-value"
},
{
"include": "#block-map-explicit"
},
{
"include": "#flow-mapping"
},
@@ -589,10 +533,10 @@
}
]
},
"block-map-explicit": {
"block-map-key-explicit": {
"comment": "https://yaml.org/spec/1.2.2/#rule-c-l-block-map-explicit-key",
"begin": "(?=((?<=[-?:]) )?+)\\G( *+)(\\?)(?=[\\x{85 2028 2029}\r\n\t ])",
"while": "\\G(?>(\\1\\2)(?![?:0-9A-Za-z$()+./;<=\\\\^_~\\x{A0}-\\x{D7FF}\\x{E000}-\\x{FFFD}\\x{010000}-\\x{10FFFF}&&[^\\x{2028 2029 FEFF}]])((?>\t[\t ]*+)?+[^\\x{85 2028 2029}\r\n\t #\\-\\[\\]{}])?+|(?!\\1\\2)( *+)([\t ]*+[^\\x{85 2028 2029}\r\n#])?+)",
"while": "\\G(?>(\\1\\2)(?![?:0-9A-Za-z$()+./;<=\\\\^_~\\x{A0}-\\x{D7FF}\\x{E000}-\\x{FFFD}\\x{010000}-\\x{10FFFF}&&[^\\x{2028 2029}]])((?>\t[\t ]*+)?+[^\\x{85 2028 2029}\r\n\t #\\-\\[\\]{}])?+|(?!\\1\\2)( *+)([\t ]*+[^\\x{85 2028 2029}\r\n#])?+)",
"beginCaptures": {
"2": {
"name": "punctuation.whitespace.indentation.yaml"
@@ -624,7 +568,7 @@
"include": "#key-double"
},
{
"include": "#key-single"
"include": "source.yaml#key-single"
},
{
"include": "#flow-key-plain-out"
@@ -637,23 +581,36 @@
}
]
},
"block-map-value": {
"comment": "https://yaml.org/spec/1.2.2/#rule-c-l-block-map-implicit-value",
"begin": "(:)(?=[\\x{85 2028 2029}\r\n\t ])",
"while": "\\G(?![?:!\"'0-9A-Za-z$()+./;<=\\\\^_~\\[{\\x{A0}-\\x{D7FF}\\x{E000}-\\x{FFFD}\\x{010000}-\\x{10FFFF}&&[^\\x{2028 2029 FEFF}]]|-[^\\x{85 2028 2029}\r\n\t ])",
"block-map-key-double": {
"comment": "https://yaml.org/spec/1.2.2/#double-quoted-style (BLOCK-KEY)",
"begin": "\\G\"",
"end": "\"",
"beginCaptures": {
"1": {
"name": "punctuation.separator.map.value.yaml"
"0": {
"name": "punctuation.definition.string.begin.yaml"
}
},
"name": "meta.map.value.yaml",
"endCaptures": {
"0": {
"name": "punctuation.definition.string.end.yaml"
}
},
"name": "meta.map.key.yaml string.quoted.double.yaml entity.name.tag.yaml",
"patterns": [
{
"include": "#block-node"
"match": ".[\t ]*+$",
"name": "invalid.illegal.multiline-key.yaml"
},
{
"match": "[^\t -\\x{10FFFF}]++",
"name": "invalid.illegal.character.yaml"
},
{
"include": "#double-escape"
}
]
},
"block-key-plain": {
"block-map-key-plain": {
"comment": "https://yaml.org/spec/1.2.2/#rule-ns-plain-one-line (BLOCK-KEY)",
"begin": "\\G(?=[^-?:,\\[\\]{}#&*!|>'\"%@` \\p{Cntrl}\\p{Surrogate}\\x{FFFE FFFF}]|[?:-](?![\\x{85 2028 2029}\r\n\t ]))",
"end": "(?=[\t ]*+:[\\x{85 2028 2029}\r\n\t ]|(?>[\t ]++|\\G)#)",
@@ -678,175 +635,23 @@
"name": "punctuation.whitespace.separator.yaml"
},
{
"include": "#non-printable"
"include": "source.yaml#non-printable"
}
]
},
"block-scalar": {
"comment": "https://yaml.org/spec/1.2.2/#81-block-scalar-styles",
"block-map-value": {
"comment": "https://yaml.org/spec/1.2.2/#rule-c-l-block-map-implicit-value",
"begin": ":(?=[\\x{85 2028 2029}\r\n\t ])",
"while": "\\G(?![?:!\"'0-9A-Za-z$()+./;<=\\\\^_~\\[{\\x{A0}-\\x{D7FF}\\x{E000}-\\x{FFFD}\\x{010000}-\\x{10FFFF}&&[^\\x{2028 2029}]]|-[^\\x{85 2028 2029}\r\n\t ])",
"beginCaptures": {
"0": {
"name": "punctuation.separator.map.value.yaml"
}
},
"name": "meta.map.value.yaml",
"patterns": [
{
"comment": "https://yaml.org/spec/1.2.2/#8111-block-indentation-indicator",
"begin": "([\t ]*+)(?>(\\|)|(>))(?<chomp>[+-])?+((1)|(2)|(3)|(4)|(5)|(6)|(7)|(8)|(9))(?(<chomp>)|([+-]))?+",
"while": "\\G(?>(?>(?!\\6) |(?!\\7) {2}|(?!\\8) {3}|(?!\\9) {4}|(?!\\10) {5}|(?!\\11) {6}|(?!\\12) {7}|(?!\\13) {8}|(?!\\14) {9})| *+($|[^#]))",
"beginCaptures": {
"1": {
"name": "punctuation.whitespace.separator.yaml"
},
"2": {
"name": "keyword.control.flow.block-scalar.literal.yaml"
},
"3": {
"name": "keyword.control.flow.block-scalar.folded.yaml"
},
"4": {
"name": "storage.modifier.chomping-indicator.yaml"
},
"5": {
"name": "constant.numeric.indentation-indicator.yaml"
},
"15": {
"name": "storage.modifier.chomping-indicator.yaml"
}
},
"whileCaptures": {
"0": {
"name": "punctuation.whitespace.indentation.yaml"
},
"1": {
"name": "invalid.illegal.expected-indentation.yaml"
}
},
"name": "meta.scalar.yaml",
"patterns": [
{
"begin": "$",
"while": "\\G",
"contentName": "string.unquoted.block.yaml",
"patterns": [
{
"include": "#non-printable"
}
]
},
{
"begin": "\\G",
"end": "$",
"patterns": [
{
"include": "#presentation-detail"
}
]
}
]
},
{
"comment": "https://yaml.org/spec/1.2.2/#rule-c-b-block-header",
"//": "Soooooooo many edge cases",
"begin": "([\t ]*+)(?>(\\|)|(>))([+-]?+)",
"while": "\\G",
"beginCaptures": {
"1": {
"name": "punctuation.whitespace.separator.yaml"
},
"2": {
"name": "keyword.control.flow.block-scalar.literal.yaml"
},
"3": {
"name": "keyword.control.flow.block-scalar.folded.yaml"
},
"4": {
"name": "storage.modifier.chomping-indicator.yaml"
}
},
"name": "meta.scalar.yaml",
"patterns": [
{
"comment": "https://yaml.org/spec/1.2.2/#rule-l-literal-content",
"begin": "$",
"while": "\\G",
"patterns": [
{
"comment": "https://yaml.org/spec/1.2.2/#rule-l-nb-literal-text",
"//": "Find the highest indented line",
"begin": "\\G( ++)$",
"while": "\\G(?>(\\1)$|(?!\\1)( *+)($|.))",
"captures": {
"1": {
"name": "punctuation.whitespace.indentation.yaml"
},
"2": {
"name": "punctuation.whitespace.indentation.yaml"
},
"3": {
"name": "invalid.illegal.expected-indentation.yaml"
}
},
"contentName": "string.unquoted.block.yaml",
"patterns": [
{
"include": "#non-printable"
}
]
},
{
"comment": "https://yaml.org/spec/1.2.2/#rule-b-nb-literal-next",
"//": [
"Funky wrapper function",
"The `end` pattern clears the parent `\\G` anchor",
"Affectively forcing this rule to only match at most once",
"https://github.com/microsoft/vscode-textmate/issues/114"
],
"begin": "\\G(?!$)(?=( *+))",
"end": "\\G(?!\\1)(?=[\t ]*+#)",
"patterns": [
{
"comment": "https://yaml.org/spec/1.2.2/#rule-l-nb-literal-text",
"begin": "\\G( *+)",
"while": "\\G(?>(\\1)|( *+)($|[^\t#]|[\t ]++[^#]))",
"captures": {
"1": {
"name": "punctuation.whitespace.indentation.yaml"
},
"2": {
"name": "punctuation.whitespace.indentation.yaml"
},
"3": {
"name": "invalid.illegal.expected-indentation.yaml"
}
},
"contentName": "string.unquoted.block.yaml",
"patterns": [
{
"include": "#non-printable"
}
]
}
]
},
{
"comment": "https://yaml.org/spec/1.2.2/#rule-l-chomped-empty",
"begin": "(?!\\G)(?=[\t ]*+#)",
"while": "\\G",
"patterns": [
{
"include": "#presentation-detail"
}
]
}
]
},
{
"comment": "Header Comment",
"begin": "\\G",
"end": "$",
"patterns": [
{
"include": "#presentation-detail"
}
]
}
]
"include": "#block-node"
}
]
},
@@ -876,7 +681,7 @@
"name": "punctuation.whitespace.separator.yaml"
},
{
"include": "#non-printable"
"include": "source.yaml#non-printable"
}
]
},
@@ -989,7 +794,7 @@
]
},
{
"include": "#flow-map-key-mapping"
"include": "#flow-mapping-map-key"
},
{
"include": "#flow-map-value-yaml"
@@ -1038,7 +843,7 @@
]
},
{
"include": "#flow-map-key-sequence"
"include": "#flow-sequence-map-key"
},
{
"include": "#flow-map-value-yaml"
@@ -1051,7 +856,7 @@
}
]
},
"flow-map-key-mapping": {
"flow-mapping-map-key": {
"comment": "https://yaml.org/spec/1.2.2/#rule-ns-flow-map-entry (FLOW-IN)",
"patterns": [
{
@@ -1065,7 +870,7 @@
"name": "meta.flow.map.explicit.yaml",
"patterns": [
{
"include": "#flow-map-key-mapping"
"include": "#flow-mapping-map-key"
},
{
"include": "#flow-map-value-yaml"
@@ -1109,7 +914,7 @@
"include": "#key-double"
},
{
"include": "#key-single"
"include": "source.yaml#key-single"
},
{
"include": "#flow-map-value-json"
@@ -1121,7 +926,7 @@
}
]
},
"flow-map-key-sequence": {
"flow-sequence-map-key": {
"comment": "https://yaml.org/spec/1.2.2/#rule-ns-flow-map-entry (FLOW-IN)",
"patterns": [
{
@@ -1135,7 +940,7 @@
"name": "meta.flow.map.explicit.yaml",
"patterns": [
{
"include": "#flow-map-key-mapping"
"include": "#flow-mapping-map-key"
},
{
"include": "#flow-map-value-yaml"
@@ -1179,7 +984,7 @@
"include": "#key-double"
},
{
"include": "#key-single"
"include": "source.yaml#key-single"
},
{
"include": "#flow-map-value-json"
@@ -1245,7 +1050,7 @@
"name": "invalid.illegal.multiline-key.yaml"
},
{
"include": "#non-printable"
"include": "source.yaml#non-printable"
}
]
},
@@ -1267,7 +1072,7 @@
"name": "punctuation.whitespace.separator.yaml"
},
{
"include": "#non-printable"
"include": "source.yaml#non-printable"
}
]
},
@@ -1281,13 +1086,13 @@
"include": "#tag-implicit-plain-in"
},
{
"include": "#non-printable"
"include": "source.yaml#non-printable"
}
]
},
"key-double": {
"comment": "https://yaml.org/spec/1.2.2/#double-quoted-style",
"begin": "\\G\"",
"comment": "https://yaml.org/spec/1.2.2/#double-quoted-style (FLOW-OUT)",
"begin": "\"",
"end": "\"",
"beginCaptures": {
"0": {
@@ -1310,32 +1115,6 @@
}
]
},
"key-single": {
"comment": "https://yaml.org/spec/1.2.2/#rule-c-single-quoted (BLOCK-KEY)",
"begin": "\\G'",
"end": "'(?!')",
"beginCaptures": {
"0": {
"name": "punctuation.definition.string.begin.yaml"
}
},
"endCaptures": {
"0": {
"name": "punctuation.definition.string.end.yaml"
}
},
"name": "meta.map.key.yaml string.quoted.single.yaml entity.name.tag.yaml",
"patterns": [
{
"match": "[^\t -\\x{10FFFF}]++",
"name": "invalid.illegal.character.yaml"
},
{
"match": "''",
"name": "constant.character.escape.single-quote.yaml"
}
]
},
"double": {
"comment": "https://yaml.org/spec/1.2.2/#double-quoted-style",
"begin": "\"",
@@ -1601,7 +1380,7 @@
"name": "invalid.illegal.constant.character.escape.unicode.8-bit.yaml"
},
{
"include": "#non-printable"
"include": "source.yaml#non-printable"
},
{
"match": "[^\\x{85 2028 2029}\r\n\t a-zA-Z0-9-#;/?:@&=+$,_.!~*'()\\[\\]%>]++",
@@ -1646,7 +1425,7 @@
"name": "invalid.illegal.constant.character.escape.unicode.8-bit.yaml"
},
{
"include": "#non-printable"
"include": "source.yaml#non-printable"
},
{
"match": "[^\\x{85 2028 2029}\r\n\t a-zA-Z0-9-#;/?:@&=+$,_.~*'()\\[\\]%]++",
@@ -1741,7 +1520,7 @@
"name": "punctuation.separator.line-break.yaml"
},
{
"include": "#non-printable"
"include": "source.yaml#non-printable"
},
{
"include": "#comment"
@@ -1751,23 +1530,6 @@
}
]
},
"non-printable": {
"//": {
"85": "…",
"2028": "",
"2029": "",
"10000": "𐀀",
"A0": " ",
"D7FF": "퟿",
"E000": "",
"FFFD": "<22>",
"FEFF": "",
"FFFF": "￿",
"10FFFF": "􏿿"
},
"match": "[^\t\n\r -~\\x{85}\\x{A0}-\\x{D7FF}\\x{E000}-\\x{FFFD}\\x{010000}-\\x{10FFFF}]++",
"name": "invalid.illegal.non-printable.yaml"
},
"comment": {
"comment": "Comments must be separated from other tokens by white space characters. `space`, `newline` or `carriage-return`. `#(.*)` causes performance issues",
"begin": "(?<=^|[\\x{FEFF 85 2028 2029} ])#",
@@ -1780,13 +1542,13 @@
"name": "comment.line.number-sign.yaml",
"patterns": [
{
"include": "#non-printable"
"include": "source.yaml#non-printable"
}
]
},
"unknown": {
"match": ".[[^\\x{85}#\"':,\\[\\]{}]&&!-~\\x{A0}-\\x{D7FF}\\x{E000}-\\x{FFFD}\\x{010000}-\\x{10FFFF}]*+",
"name": "invalid.illegal.unrecognized.yaml markup.strikethrough"
"match": ".[[^\\x{85 2028 2029}#\"':,\\[\\]{}]&&!-~\\x{A0}-\\x{D7FF}\\x{E000}-\\x{FFFD}\\x{010000}-\\x{10FFFF}]*+",
"name": "invalid.illegal.unrecognized.yaml"
}
}
}