\\s*$)",
					"captures": {
						"2": {
							"name": "invalid.illegal.end.tag.pug"
						},
						"4": {
							"name": "invalid.illegal.end.tag.pug"
						}
					}
				},
				{
					"include": "#printed_expression"
				},
				{
					"include": "#tag_text"
				}
			]
		},
		"tag_name": {
			"begin": "([#!]\\{(?=.*?\\}))|(\\w(([\\w:-]+[\\w-])|([\\w-]*)))",
			"end": "(\\G(?<!\\5[^\\w-]))|\\}|$",
			"name": "meta.tag.other entity.name.tag.pug",
			"patterns": [
				{
					"begin": "\\G(?<=\\{)",
					"end": "(?=\\})",
					"name": "meta.tag.other entity.name.tag.pug",
					"patterns": [
						{
							"match": "{",
							"name": "invalid.illegal.tag.pug"
						},
						{
							"include": "source.js"
						}
					]
				}
			]
		},
		"tag_id": {
			"match": "#[\\w-]+",
			"name": "entity.other.attribute-name.id.pug"
		},
		"tag_classes": {
			"match": "\\.([^\\w-])?[\\w-]*",
			"captures": {
				"1": {
					"name": "invalid.illegal.tag.pug"
				}
			},
			"name": "entity.other.attribute-name.class.pug"
		},
		"tag_attributes": {
			"begin": "(\\(\\s*)",
			"captures": {
				"1": {
					"name": "constant.name.attribute.tag.pug"
				}
			},
			"end": "(\\))",
			"name": "meta.tag.other",
			"patterns": [
				{
					"include": "#tag_attribute_name_paren"
				},
				{
					"include": "#tag_attribute_name"
				},
				{
					"match": "!(?!=)",
					"name": "invalid.illegal.tag.pug"
				},
				{
					"begin": "=\\s*",
					"end": "$|(?=,|(?:\\s+[^!%&*-+~|<>:?/])|\\))",
					"name": "attribute_value",
					"patterns": [
						{
							"include": "#string"
						},
						{
							"include": "#js_parens"
						},
						{
							"include": "#js_brackets"
						},
						{
							"include": "#js_braces"
						},
						{
							"include": "source.js"
						}
					]
				},
				{
					"begin": "(?<=[%&*-+~|<>:?/])\\s+",
					"end": "$|(?=,|(?:\\s+[^!%&*-+~|<>:?/])|\\))",
					"name": "attribute_value2",
					"patterns": [
						{
							"include": "#string"
						},
						{
							"include": "#js_parens"
						},
						{
							"include": "#js_brackets"
						},
						{
							"include": "#js_braces"
						},
						{
							"include": "source.js"
						}
					]
				}
			]
		},
		"tag_attribute_name": {
			"match": "([^\\s(),=/!]+)\\s*",
			"captures": {
				"1": {
					"name": "entity.other.attribute-name.tag.pug"
				}
			}
		},
		"tag_attribute_name_paren": {
			"begin": "\\(\\s*",
			"end": "\\)",
			"name": "entity.other.attribute-name.tag.pug",
			"patterns": [
				{
					"include": "#tag_attribute_name_paren"
				},
				{
					"include": "#tag_attribute_name"
				}
			]
		},
		"tag_mixin_attributes": {
			"begin": "(&attributes\\()",
			"captures": {
				"1": {
					"name": "entity.name.function.pug"
				}
			},
			"end": "(\\))",
			"name": "meta.tag.other",
			"patterns": [
				{
					"match": "attributes(?=\\))",
					"name": "storage.type.keyword.pug"
				},
				{
					"include": "source.js"
				}
			]
		},
		"tag_text": {
			"begin": "(?=.)",
			"end": "$",
			"patterns": [
				{
					"include": "#inline_pug"
				},
				{
					"include": "#embedded_html"
				},
				{
					"include": "#html_entity"
				},
				{
					"include": "#interpolated_value"
				},
				{
					"include": "#interpolated_error"
				}
			]
		},
		"inline_pug_text": {
			"begin": "",
			"end": "(?=\\])",
			"patterns": [
				{
					"begin": "\\[",
					"end": "\\]",
					"patterns": [
						{
							"include": "#inline_pug_text"
						}
					]
				},
				{
					"include": "#inline_pug"
				},
				{
					"include": "#embedded_html"
				},
				{
					"include": "#html_entity"
				},
				{
					"include": "#interpolated_value"
				},
				{
					"include": "#interpolated_error"
				}
			]
		},
		"inline_pug": {
			"begin": "(?<!\\\\)(#\\[)",
			"captures": {
				"1": {
					"name": "entity.name.function.pug"
				},
				"2": {
					"name": "entity.name.function.pug"
				}
			},
			"end": "(\\])",
			"name": "inline.pug",
			"patterns": [
				{
					"include": "#inline_pug"
				},
				{
					"include": "#mixin_call"
				},
				{
					"begin": "(?<!\\])(?=[\\w.#])|(:\\s*)",
					"end": "(?=\\]|(:.)|=|\\s)",
					"name": "tag.inline.pug",
					"patterns": [
						{
							"include": "#tag_name"
						},
						{
							"include": "#tag_id"
						},
						{
							"include": "#tag_classes"
						},
						{
							"include": "#tag_attributes"
						},
						{
							"include": "#tag_mixin_attributes"
						},
						{
							"include": "#inline_pug"
						},
						{
							"match": "\\[",
							"name": "invalid.illegal.tag.pug"
						}
					]
				},
				{
					"include": "#unbuffered_code"
				},
				{
					"include": "#printed_expression"
				},
				{
					"match": "\\[",
					"name": "invalid.illegal.tag.pug"
				},
				{
					"include": "#inline_pug_text"
				}
			]
		},
		"html_entity": {
			"patterns": [
				{
					"match": "(&)([a-zA-Z0-9]+|#[0-9]+|#x[0-9a-fA-F]+)(;)",
					"name": "constant.character.entity.html.text.pug"
				},
				{
					"match": "[<>&]",
					"name": "invalid.illegal.html_entity.text.pug"
				}
			]
		},
		"interpolated_value": {
			"begin": "(?<!\\\\)[#!]\\{(?=.*?\\})",
			"end": "\\}",
			"name": "string.interpolated.pug",
			"patterns": [
				{
					"match": "{",
					"name": "invalid.illegal.tag.pug"
				},
				{
					"include": "source.js"
				}
			]
		},
		"interpolated_error": {
			"match": "(?<!\\\\)[#!]\\{(?=[^}]*$)",
			"name": "invalid.illegal.tag.pug"
		},
		"printed_expression": {
			"begin": "(!?\\=)\\s*",
			"captures": {
				"1": {
					"name": "constant"
				}
			},
			"end": "(?=\\])|$",
			"name": "source.js",
			"patterns": [
				{
					"include": "#js_brackets"
				},
				{
					"include": "source.js"
				}
			]
		},
		"string": {
			"begin": "(['\"])",
			"end": "(?<!\\\\)\\1",
			"name": "string.quoted.pug",
			"patterns": [
				{
					"match": "\\\\((x[0-9a-fA-F]{2})|(u[0-9]{4})|.)",
					"name": "constant.character.quoted.pug"
				},
				{
					"include": "#interpolated_value"
				},
				{
					"include": "#interpolated_error"
				}
			]
		},
		"embedded_html": {
			"begin": "(?=<[^>]*>)",
			"end": "$|(?=>)",
			"name": "html",
			"patterns": [
				{
					"include": "text.html.basic"
				},
				{
					"include": "#interpolated_value"
				},
				{
					"include": "#interpolated_error"
				}
			]
		},
		"js_parens": {
			"begin": "\\(",
			"end": "\\)",
			"patterns": [
				{
					"include": "#js_parens"
				},
				{
					"include": "source.js"
				}
			]
		},
		"js_brackets": {
			"begin": "\\[",
			"end": "\\]",
			"patterns": [
				{
					"include": "#js_brackets"
				},
				{
					"include": "source.js"
				}
			]
		},
		"js_braces": {
			"begin": "\\{",
			"end": "\\}",
			"patterns": [
				{
					"include": "#js_braces"
				},
				{
					"include": "source.js"
				}
			]
		},
		"babel_parens": {
			"begin": "\\(",
			"end": "\\)|(({\\s*)?$)",
			"patterns": [
				{
					"include": "#babel_parens"
				},
				{
					"include": "source.js"
				}
			]
		}
	}
}