clove/pastebin
syntaxes/jpml.tmLanguage.json
{
"$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json",
"name": "JPML",
"scopeName": "source.jpml",
"fileTypes": ["jp"],
"patterns": [
{ "include": "#comment" },
{ "include": "#section" },
{ "include": "#entry" }
],
"repository": {
"comment": {
"match": "(#).*$",
"name": "comment.line.number-sign.jpml",
"captures": {
"1": { "name": "punctuation.definition.comment.jpml" }
}
},
"section": {
"comment": "A [header] opens a section. Only reachable at the top level: inside a value, '[' is an array.",
"name": "meta.section.jpml",
"begin": "^\\s*(\\[)",
"beginCaptures": {
"1": { "name": "punctuation.definition.section.begin.jpml" }
},
"end": "(\\])|(?=\\s*(?:#|$))",
"endCaptures": {
"1": { "name": "punctuation.definition.section.end.jpml" }
},
"patterns": [
{
"match": "\"(?:[^\"\\\\]|\\\\.)*\"|'(?:[^'\\\\]|\\\\.)*'",
"name": "entity.name.section.jpml string.quoted.jpml"
},
{
"match": "\\.",
"name": "punctuation.separator.section.jpml"
},
{
"match": "[^.\\]\"'#\\r\\n]+",
"name": "entity.name.section.jpml"
}
]
},
"entry": {
"comment": "key: value. The value must start on the key's line, and ends at a comma, a closing bracket or the end of the line.",
"name": "meta.entry.jpml",
"begin": "(\"(?:[^\"\\\\]|\\\\.)*\"|'(?:[^'\\\\]|\\\\.)*'|[^\\s:,{}\\[\\]\"'#][^:,{}\\[\\]\"'#\\r\\n]*?)\\s*(:)",
"beginCaptures": {
"1": { "name": "support.type.property-name.jpml" },
"2": { "name": "punctuation.separator.key-value.jpml" }
},
"end": "(?=\\s*(?:[,}\\]]|$))",
"patterns": [
{ "include": "#value" }
]
},
"value": {
"patterns": [
{ "include": "#comment" },
{ "include": "#object" },
{ "include": "#array" },
{ "include": "#string-double" },
{ "include": "#string-single" },
{ "include": "#number" },
{ "include": "#boolean" },
{ "include": "#null" },
{ "include": "#bare" }
]
},
"object": {
"name": "meta.structure.dictionary.jpml",
"begin": "\\{",
"beginCaptures": {
"0": { "name": "punctuation.definition.dictionary.begin.jpml" }
},
"end": "\\}",
"endCaptures": {
"0": { "name": "punctuation.definition.dictionary.end.jpml" }
},
"patterns": [
{ "include": "#comment" },
{ "include": "#entry" },
{
"match": ",",
"name": "punctuation.separator.dictionary.jpml"
}
]
},
"array": {
"name": "meta.structure.array.jpml",
"begin": "\\[",
"beginCaptures": {
"0": { "name": "punctuation.definition.array.begin.jpml" }
},
"end": "\\]",
"endCaptures": {
"0": { "name": "punctuation.definition.array.end.jpml" }
},
"patterns": [
{
"match": ",",
"name": "punctuation.separator.array.jpml"
},
{ "include": "#value" }
]
},
"string-double": {
"name": "string.quoted.double.jpml",
"begin": "\"",
"beginCaptures": {
"0": { "name": "punctuation.definition.string.begin.jpml" }
},
"end": "(\")|(?<![\\\\\\n])$",
"endCaptures": {
"1": { "name": "punctuation.definition.string.end.jpml" }
},
"patterns": [
{ "include": "#escape" }
]
},
"string-single": {
"name": "string.quoted.single.jpml",
"begin": "'",
"beginCaptures": {
"0": { "name": "punctuation.definition.string.begin.jpml" }
},
"end": "(')|(?<![\\\\\\n])$",
"endCaptures": {
"1": { "name": "punctuation.definition.string.end.jpml" }
},
"patterns": [
{ "include": "#escape" }
]
},
"escape": {
"patterns": [
{
"match": "\\\\(?:[\"'\\\\/0abefnrtv]|x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4}|U[0-9a-fA-F]{8}|$)",
"name": "constant.character.escape.jpml"
},
{
"match": "\\\\.",
"name": "invalid.illegal.unrecognized-string-escape.jpml"
}
]
},
"number": {
"match": "(?i)[+-]?(?:0x(?:_?[0-9a-f])+|0o(?:_?[0-7])+|0b(?:_?[01])+|(?:\\d+(?:_\\d+)*(?:\\.(?:\\d+(?:_\\d+)*)?)?|\\.\\d+(?:_\\d+)*)(?:e[+-]?\\d+(?:_\\d+)*)?|inf(?:inity)?|nan)(?=\\s*(?:[,}\\]#]|$))",
"name": "constant.numeric.jpml"
},
"boolean": {
"match": "(?i)(?:true|false)(?=\\s*(?:[,}\\]#]|$))",
"name": "constant.language.boolean.jpml"
},
"null": {
"match": "(?i)(?:null|none|nil)(?=\\s*(?:[,}\\]#]|$))",
"name": "constant.language.null.jpml"
},
"bare": {
"comment": "An unquoted string runs to the next comma, closing bracket, comment or line end.",
"match": "[^\\s,{}\\[\\]#\"'][^,}\\]#\\r\\n]*?(?=\\s*(?:[,}\\]#]|$))",
"name": "string.unquoted.jpml"
}
}
}