recital / packages / vscode-syntax / syntaxes / recital.tmLanguage.json
recital.tmLanguage.json
Raw
{
	"$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json",
	"name": "Recital",
	"patterns": [
		{
			"include": "#comment"
		},
		{
			"include": "#scene"
		},
		{
			"include": "#fragment"
		}
	],
	"repository": {
		"comment": {
			"begin": "(?:^|\\G)\\s*(=)",
			"end": "(?=$)",
			"contentName": "comment.line.recital",
			"name": "comment.line.recital",
			"patterns": []
		},
		"fragment": {
			"patterns": [
				{
					"include": "#startFragment"
				},
				{
					"include": "#endFragment"
				},
				{
					"include": "#meta"
				},
				{
					"include": "#heading"
				},
				{
					"include": "#@shorthand"
				},
				{
					"include": "#$command"
				},
				{
					"include": "#blockquote"
				},
				{
					"include": "#lists"
				},
				{
					"include": "#link-def"
				},
				{
					"include": "#separator"
				},
				{
					"include": "#html"
				},
				{
					"include": "#paragraph"
				}
			],
			"repository": {
				"meta": {
					"begin": "\\<\\! ?\\S+",
					"name": "comment.other.recital",
					"end": " ?\\>"
				},
				"heading": {
					"begin": "(?:^|\\G)\\s*(#{1,6})[ ]*\\S+(?=[\\S[^#]])",
					"captures": {
						"1": {
							"name": "punctuation.definition.heading.recital"
						}
					},
					"contentName": "entity.name.section.recital",
					"end": "\\s*(#{1,6})?$\\n?",
					"name": "markup.heading.recital",
					"patterns": [
						{
							"include": "#inline"
						}
					]
				},
				"html": {
					"patterns": [
						{
							"begin": "(^|\\G)\\s*(<!--)",
							"captures": {
								"1": {
									"name": "punctuation.definition.comment.html"
								},
								"2": {
									"name": "punctuation.definition.comment.html"
								}
							},
							"end": "(-->)",
							"name": "comment.block.html"
						},
						{
							"begin": "(^|\\G)\\s*(?=<(script|style|pre)(\\s|$|>)(?!.*?</(script|style|pre)>))",
							"end": "(?=.*</(script|style|pre)>)",
							"patterns": [
								{
									"begin": "(\\s*|$)",
									"patterns": [
										{
											"include": "text.html.basic"
										}
									],
									"while": "^(?!.*</(script|style|pre)>)"
								}
							]
						},
						{
							"begin": "(^|\\G)\\s*(?=</?(address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h1|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul)(\\s|$|/?>))",
							"patterns": [
								{
									"include": "text.html.basic"
								}
							],
							"while": "^(?!\\s*$)"
						},
						{
							"begin": "(^|\\G)\\s*(?=(<[a-zA-Z0-9\\-](/?>|\\s.*?>)|</[a-zA-Z0-9\\-]>)\\s*$)",
							"patterns": [
								{
									"include": "text.html.basic"
								}
							],
							"while": "^(?!\\s*$)"
						}
					]
				},
				"link-def": {
					"captures": {
						"1": {
							"name": "punctuation.definition.constant.recital"
						},
						"2": {
							"name": "constant.other.reference.link.recital"
						},
						"3": {
							"name": "punctuation.definition.constant.recital"
						},
						"4": {
							"name": "punctuation.separator.key-value.recital"
						},
						"5": {
							"name": "punctuation.definition.link.recital"
						},
						"6": {
							"name": "markup.underline.link.recital"
						},
						"7": {
							"name": "punctuation.definition.link.recital"
						},
						"8": {
							"name": "string.other.link.description.title.recital"
						},
						"9": {
							"name": "punctuation.definition.string.begin.recital"
						},
						"10": {
							"name": "punctuation.definition.string.end.recital"
						},
						"11": {
							"name": "string.other.link.description.title.recital"
						},
						"12": {
							"name": "punctuation.definition.string.begin.recital"
						},
						"13": {
							"name": "punctuation.definition.string.end.recital"
						}
					},
					"match": "(?x)\n  \\s*            # Leading whitespace\n  (\\[)(.+?)(\\])(:)    # Reference name\n  [ \\t]*          # Optional whitespace\n  (<?)(\\S+?)(>?)      # The url\n  [ \\t]*          # Optional whitespace\n  (?:\n      ((\\().+?(\\)))    # Match title in quotes…\n    | ((\").+?(\"))    # or in parens.\n  )?            # Title is optional\n  \\s*            # Optional whitespace\n  $\n",
					"name": "meta.link.reference.def.recital"
				},
				"list_paragraph": {
					"begin": "(^|\\G)(?=\\S)(?![*+->]\\s|[0-9]+\\.\\s)",
					"name": "meta.paragraph.recital",
					"patterns": [
						{
							"include": "#inline"
						},
						{
							"include": "text.html.basic"
						},
						{
							"include": "#heading-setext"
						}
					],
					"while": "(^|\\G)(?!\\s*$|#|[ ]{0,3}([-*_>][ ]{2,}){3,}[ \\t]*$\\n?|[ ]{0,3}[*+->]|[ ]{0,3}[0-9]+\\.)"
				},
				"lists": {
					"patterns": [
						{
							"begin": "(^|\\G)([ ]{0,3})([*+-])([ ]{1,3}|\\t)",
							"beginCaptures": {
								"3": {
									"name": "beginning.punctuation.definition.list.recital"
								}
							},
							"comment": "Currently does not support un-indented second lines.",
							"name": "markup.list.unnumbered.recital",
							"patterns": [
								{
									"include": "#fragment"
								},
								{
									"include": "#list_paragraph"
								}
							],
							"while": "((^|\\G)([ ]{4}|\\t))|(^[ \\t]*$)"
						},
						{
							"begin": "(^|\\G)([ ]{0,3})([0-9]+\\.)([ ]{1,3}|\\t)",
							"beginCaptures": {
								"3": {
									"name": "beginning.punctuation.definition.list.recital"
								}
							},
							"name": "markup.list.numbered.recital",
							"patterns": [
								{
									"include": "#fragment"
								},
								{
									"include": "#list_paragraph"
								}
							],
							"while": "((^|\\G)([ ]{4}|\\t))|(^[ \\t]*$)"
						}
					]
				},
				"paragraph": {
					"begin": "(^|\\G)\\s*(?=\\S)",
					"name": "meta.paragraph.recital",
					"patterns": [
						{
							"include": "#inline"
						},
						{
							"include": "text.html.basic"
						}
					],
					"while": "(^|\\G)((?=\\s*[-=]{3,}\\s*$)|[ ]{4,}(?=\\S))"
				},
				"blockquote": {
					"begin": "(^|\\G)\\s*(>) ?",
					"captures": {
						"2": {
							"name": "beginning.punctuation.definition.quote.recital"
						}
					},
					"name": "markup.quote.recital",
					"patterns": [
						{
							"include": "#fragment"
						}
					],
					"while": "(^|\\G)\\s*(>) ?"
				},
				"separator": {
					"match": "(^|\\G)\\s*([*-_])([ ]{0,2}\\2){2,}[ \\t]*$\\n?",
					"name": "meta.separator.recital",
					"patterns": []
				}
			}
		},
		"scene": {
			"begin": "(?:^|\\G)\\s*(#$)|(#:)",
			"end": "^\\s*$",
			"captures": {
				"0": {
					"name": "entity.name.function.recital"
				},
				"1": {
					"name": "entity.name.function.recital"
				}
			},
			"contentName": "entity.name.function.recital",
			"patterns": [
				{
					"include": "#frontmatter"
				},
				{
					"include": "#tomlfrontmatter"
				},
				{
					"include": "#string"
				}
			]
		},
		"frontmatter": {
			"begin": "(^|\\G)-{3}\\s$",
			"end": "(^|\\G)(-{3}|\\.{3})\\s$",
			"contentName": "meta.embedded.block.frontmatter",
			"patterns": [
				{
					"include": "source.toml"
				}
			]
		},
		"tomlfrontmatter": {
			"begin": "(^|\\G)\\+{3}\\s$",
			"end": "(^|\\G)(\\+{3}|\\.{3})\\s$",
			"contentName": "meta.embedded.block.frontmatter",
			"patterns": [
				{
					"include": "source.toml"
				}
			]
		},
		"inline": {
			"patterns": [
				{
					"include": "#raw"
				},
				{
					"include": "#bold"
				},
				{
					"include": "#italic"
				},
				{
					"include": "#wikilink-left"
				},
				{
					"include": "#wikilink-right"
				},
				{
					"include": "#wikilink"
				},
				{
					"include": "#link-inet"
				},
				{
					"include": "#link-inline"
				},
				{
					"include": "#link-ref"
				},
				{
					"include": "#link-ref-literal"
				}
			],
			"repository": {
				"bold": {
					"begin": "(?x)\n ((?<!\\w)\\*\\*\\b|\\b__)(?=\\S)                # Open\n (?=\n   (\n     <[^>]*+>              # HTML tags\n     | (?<raw>`+)([^`]|(?!(?<!`)\\k<raw>(?!`))`)*+\\k<raw>\n                       # Raw\n     | \\\\[\\\\`*_{}\\[\\]()#.!+\\->]?+      # Escapes\n     | \\[\n     (\n         (?<square>          # Named group\n           [^\\[\\]\\\\]        # Match most chars\n           | \\\\.            # Escaped chars\n           | \\[ \\g<square>*+ \\]    # Nested brackets\n         )*+\n       \\]\n       (\n         (              # Reference Link\n           [ ]?          # Optional space\n           \\[[^\\]]*+\\]        # Ref name\n         )\n         | (              # Inline Link\n           \\(            # Opening paren\n             [ \\t]*+        # Optional whitespace\n             <?(.*?)>?      # URL\n             [ \\t]*+        # Optional whitespace\n             (          # Optional Title\n               (?<title>['\"])\n               (.*?)\n               \\k<title>\n             )?\n           \\)\n         )\n       )\n     )\n     | (?!(?<=\\S)\\1).            # Everything besides\n                       # style closer\n   )++\n   (?<=\\S)\\1                # Close\n )\n",
					"captures": {
						"1": {
							"name": "punctuation.definition.bold.recital"
						}
					},
					"end": "(?<=\\S)(\\1)",
					"name": "markup.bold.recital",
					"patterns": [
						{
							"applyEndPatternLast": 1,
							"begin": "(?=<[^>]*?>)",
							"end": "(?<=>)",
							"patterns": [
								{
									"include": "text.html.basic"
								}
							]
						},
						{
							"include": "#escape"
						},
						{
							"include": "#ampersand"
						},
						{
							"include": "#bracket"
						},
						{
							"include": "#raw"
						},
						{
							"include": "#bold"
						},
						{
							"include": "#italfic"
						},
						{
							"include": "#image-inline"
						},
						{
							"include": "#link-inline"
						},
						{
							"include": "#link-inet"
						},
						{
							"include": "#link-email"
						},
						{
							"include": "#image-ref"
						},
						{
							"include": "#link-ref-literal"
						},
						{
							"include": "#link-ref"
						}
					]
				},
				"italic": {
					"begin": "(?x) (\\*\\b|\\b_)(?=\\S)                # Open\n  (?=\n    (\n      <[^>]*+>              # HTML tags\n      | (?<raw>`+)([^`]|(?!(?<!`)\\k<raw>(?!`))`)*+\\k<raw>\n                        # Raw\n      | \\\\[\\\\`*_{}\\[\\]()#.!+\\->]?+      # Escapes\n      | \\[\n      (\n          (?<square>          # Named group\n            [^\\[\\]\\\\]        # Match most chars\n            | \\\\.            # Escaped chars\n            | \\[ \\g<square>*+ \\]    # Nested brackets\n          )*+\n        \\]\n        (\n          (              # Reference Link\n            [ ]?          # Optional space\n            \\[[^\\]]*+\\]        # Ref name\n          )\n          | (              # Inline Link\n            \\(            # Opening paren\n              [ \\t]*+        # Optional whtiespace\n              <?(.*?)>?      # URL\n              [ \\t]*+        # Optional whtiespace\n              (          # Optional Title\n                (?<title>['\"])\n                (.*?)\n                \\k<title>\n              )?\n            \\)\n          )\n        )\n      )\n      | \\1\\1                # Must be bold closer\n      | (?!(?<=\\S)\\1).            # Everything besides\n                        # style closer\n    )++\n    (?<=\\S)\\1                # Close\n  )\n",
					"captures": {
						"1": {
							"name": "punctuation.definition.italic.recital"
						}
					},
					"end": "(?<=\\S)(\\1)((?!\\1)|(?=\\1\\1))",
					"name": "markup.italic.recital",
					"patterns": [
						{
							"applyEndPatternLast": 1,
							"begin": "(?=<[^>]*?>)",
							"end": "(?<=>)",
							"patterns": [
								{
									"include": "text.html.basic"
								}
							]
						},
						{
							"include": "#escape"
						},
						{
							"include": "#ampersand"
						},
						{
							"include": "#bracket"
						},
						{
							"include": "#raw"
						},
						{
							"include": "#bold"
						},
						{
							"include": "#image-inline"
						},
						{
							"include": "#link-inline"
						},
						{
							"include": "#link-inet"
						},
						{
							"include": "#link-email"
						},
						{
							"include": "#image-ref"
						},
						{
							"include": "#link-ref-literal"
						},
						{
							"include": "#link-ref"
						}
					]
				},
				"wikilink": {
					"captures": {
						"1": {
							"name": "punctuation.definition.constant.begin.recital"
						},
						"2": {
							"name": "markup.underline.link.recital"
						},
						"3": {
							"name": "punctuation.definition.constant.end.recital"
						}
					},
					"match": "(\\[\\[)(.+)(\\]\\])"
				},
				"wikilink-left": {
					"captures": {
						"1": {
							"name": "punctuation.definition.constant.begin.recital"
						},
						"2": {
							"name": "markup.underline.link.recital"
						},
						"4": {
							"name": "string.other.link.title.recital"
						},
						"5": {
							"name": "punctuation.definition.constant.end.recital"
						}
					},
					"match": "(\\[\\[)(.+)(<-)([A-z0-9\\s]+)(\\]\\])"
				},
				"wikilink-right": {
					"captures": {
						"1": {
							"name": "punctuation.definition.constant.begin.recital"
						},
						"2": {
							"name": "string.other.link.title.recital"
						},
						"4": {
							"name": "markup.underline.link.recital"
						},
						"5": {
							"name": "punctuation.definition.constant.end.recital"
						}
					},
					"match": "(\\[\\[)(.+)(->)([A-z0-9\\s]+)(\\]\\])"
				},
				"link-email": {
					"captures": {
						"1": {
							"name": "punctuation.definition.link.recital"
						},
						"2": {
							"name": "markup.underline.link.recital"
						},
						"4": {
							"name": "punctuation.definition.link.recital"
						}
					},
					"match": "(<)((?:mailto:)?[-.\\w]+@[-a-z0-9]+(\\.[-a-z0-9]+)*\\.[a-z]+)(>)",
					"name": "meta.link.email.lt-gt.recital"
				},
				"link-inet": {
					"captures": {
						"1": {
							"name": "punctuation.definition.link.recital"
						},
						"2": {
							"name": "markup.underline.link.recital"
						},
						"3": {
							"name": "punctuation.definition.link.recital"
						}
					},
					"match": "(<)((?:https?|ftp)://.*?)(>)",
					"name": "meta.link.inet.recital"
				},
				"link-inline": {
					"captures": {
						"1": {
							"name": "punctuation.definition.string.begin.recital"
						},
						"2": {
							"name": "string.other.link.title.recital"
						},
						"4": {
							"name": "punctuation.definition.string.end.recital"
						},
						"5": {
							"name": "punctuation.definition.metadata.recital"
						},
						"6": {
							"name": "punctuation.definition.link.recital"
						},
						"7": {
							"name": "markup.underline.link.recital"
						},
						"8": {
							"name": "punctuation.definition.link.recital"
						},
						"9": {
							"name": "string.other.link.description.title.recital"
						},
						"10": {
							"name": "punctuation.definition.string.begin.recital"
						},
						"11": {
							"name": "punctuation.definition.string.end.recital"
						},
						"12": {
							"name": "string.other.link.description.title.recital"
						},
						"13": {
							"name": "punctuation.definition.string.begin.recital"
						},
						"14": {
							"name": "punctuation.definition.string.end.recital"
						},
						"15": {
							"name": "punctuation.definition.metadata.recital"
						}
					},
					"match": "(?x)\n  (\\[)((?<square>[^\\[\\]\\\\]|\\\\.|\\[\\g<square>*+\\])*+)(\\])\n                # Match the link text.\n  (\\()            # Opening paren for url\n    (<?)(.*?)(>?)      # The url\n    [ \\t]*          # Optional whitespace\n    (?:\n        ((\\().+?(\\)))    # Match title in parens…\n      | ((\").+?(\"))    # or in quotes.\n    )?            # Title is optional\n    \\s*            # Optional whitespace\n  (\\))\n",
					"name": "meta.link.inline.recital"
				},
				"link-ref": {
					"captures": {
						"1": {
							"name": "punctuation.definition.string.begin.recital"
						},
						"2": {
							"name": "string.other.link.title.recital"
						},
						"4": {
							"name": "punctuation.definition.string.end.recital"
						},
						"5": {
							"name": "punctuation.definition.constant.begin.recital"
						},
						"6": {
							"name": "constant.other.reference.link.recital"
						},
						"7": {
							"name": "punctuation.definition.constant.end.recital"
						}
					},
					"match": "(\\[)((?<square>[^\\[\\]\\\\]|\\\\.|\\[\\g<square>*+\\])*+)(\\])(\\[)([^\\]]*+)(\\])",
					"name": "meta.link.reference.recital"
				},
				"link-ref-literal": {
					"captures": {
						"1": {
							"name": "punctuation.definition.string.begin.recital"
						},
						"2": {
							"name": "string.other.link.title.recital"
						},
						"4": {
							"name": "punctuation.definition.string.end.recital"
						},
						"5": {
							"name": "punctuation.definition.constant.begin.recital"
						},
						"6": {
							"name": "punctuation.definition.constant.end.recital"
						}
					},
					"match": "(\\[)((?<square>[^\\[\\]\\\\]|\\\\.|\\[\\g<square>*+\\])*+)(\\])[ ]?(\\[)(\\])",
					"name": "meta.link.reference.literal.recital"
				},
				"raw": {
					"captures": {
						"1": {
							"name": "punctuation.definition.raw.recital"
						},
						"3": {
							"name": "punctuation.definition.raw.recital"
						}
					},
					"match": "(`+)([^`]|(?!(?<!`)\\1(?!`))`)*+(\\1)",
					"name": "markup.inline.raw.string.recital"
				}
			}
		},
		"@shorthand": {
			"begin": "(?:^|\\G)\\s*(@)",
			"end": "\\s",
			"contentName": "entity.name.section.recital",
			"name": "keyword.control.recital",
			"patterns": []
		},
		"$command": {
			"begin": "(?:^|\\G)\\s*(\\$\\S+)",
			"contentName": "entity.name.section.recital",
			"end": "\\s*$",
			"name": "keyword.control.recital",
			"patterns": [
				{
					"include": "#@shorthand"
				},
				{
					"include": "#string"
				}
			]
		},
		"startFragment": {
			"begin": "(?:^|\\G)\\s*(\\<\\>)",
			"captures": {
				"0": {
					"name": "entity.name.type.recital"
				}
			},
			"contentName": "entity.name.section.recital",
			"end": "^\\s*$",
			"patterns": [
				{
					"include": "#frontmatter"
				},
				{
					"include": "#tomlfrontmatter"
				},
				{
					"include": "#string"
				},
				{
					"include": "#@shorthand"
				}
			]
		},
		"endFragment": {
			"match": "\\s*\\<\\/\\>",
			"name": "entity.name.type.recital",
			"patterns": [
				{
					"include": "#@shorthand"
				},
				{
					"include": "#string"
				}
			]
		},
		"string": {
			"patterns": [
				{
					"include": "#qstring-single"
				},
				{
					"include": "#qstring-double"
				}
			],
			"repository": {
				"qstring-single": {
					"name": "string.quoted.single.recital",
					"begin": "'",
					"beginCaptures": {
						"0": {
							"name": "punctuation.definition.string.begin.recital"
						}
					},
					"end": "(\\')|((?:[^\\\\\\n])$)",
					"endCaptures": {
						"1": {
							"name": "punctuation.definition.string.end.recital"
						},
						"2": {
							"name": "invalid.illegal.newline.recital"
						}
					},
					"patterns": [
						{
							"include": "#comment"
						}
					]
				},
				"qstring-double": {
					"name": "string.quoted.double.recital",
					"begin": "\"",
					"beginCaptures": {
						"0": {
							"name": "punctuation.definition.string.begin.recital"
						}
					},
					"end": "(\")|((?:[^\\\\\\n])$)",
					"endCaptures": {
						"1": {
							"name": "punctuation.definition.string.end.recital"
						},
						"2": {
							"name": "invalid.illegal.newline.recital"
						}
					},
					"patterns": [
						{
							"include": "#comment"
						}
					]
				}
			}
		}
	},
	"scopeName": "source.recital"
}