{
"name": "Smarty",
"scopeName": "text.html.smarty",
"patterns": [
{
"include": "text.html.basic"
}
],
"repository": {
"blocks": {
"patterns": [
{
"name": "meta.block.literal.smarty",
"begin": "(\\{)(literal)(\\})",
"end": "(\\{/)(literal)(\\})",
"patterns": [
{
"include": "text.html.basic"
}
],
"captures": {
"0": {
"name": "meta.embedded.line.tag.literal.smarty"
},
"1": {
"name": "punctuation.definition.tag.begin.smarty"
},
"2": {
"name": "support.function.built-in.smarty"
},
"3": {
"name": "punctuation.definition.tag.end.smarty"
}
}
},
{
"name": "meta.embedded.line.tag.smarty",
"contentName": "source.smarty",
"begin": "(\\{%?)",
"end": "(%?\\})",
"patterns": [
{
"include": "#strings"
},
{
"include": "#variables"
},
{
"include": "#lang"
}
],
"beginCaptures": {
"0": {
"name": "source.smarty"
},
"1": {
"name": "punctuation.section.embedded.begin.smarty"
}
},
"endCaptures": {
"0": {
"name": "source.smarty"
},
"1": {
"name": "punctuation.section.embedded.end.smarty"
}
}
}
]
},
"comments": {
"patterns": [
{
"name": "comment.block.smarty",
"begin": "(\\{%?)\\*",
"end": "\\*(%?\\})",
"beginCaptures": {
"1": {
"name": "punctuation.definition.comment.smarty"
}
}
}
]
},
"lang": {
"patterns": [
{
"name": "keyword.operator.smarty",
"match": "(!==|!=|!|\u003c=|\u003e=|\u003c|\u003e|===|==|%|\u0026\u0026|\\|\\|)|\\b(and|or|eq|neq|ne|gte|gt|ge|lte|lt|le|not|mod)\\b"
},
{
"name": "constant.language.smarty",
"match": "\\b(TRUE|FALSE|true|false)\\b"
},
{
"name": "keyword.control.smarty",
"match": "\\b(if|else|elseif|foreach|foreachelse|section|switch|case|break|default)\\b"
},
{
"name": "meta.attribute.smarty",
"match": "\\b([a-zA-Z]+)=",
"captures": {
"0": {
"name": "variable.parameter.smarty"
}
}
},
{
"name": "support.function.built-in.smarty",
"match": "\\b(capture|config_load|counter|cycle|debug|eval|fetch|include_php|include|insert|literal|math|strip|rdelim|ldelim|assign|constant|block|html_[a-z_]*)\\b"
},
{
"name": "support.function.variable-modifier.smarty",
"match": "\\|(capitalize|cat|count_characters|count_paragraphs|count_sentences|count_words|date_format|default|escape|indent|lower|nl2br|regex_replace|replace|spacify|string_format|strip_tags|strip|truncate|upper|wordwrap)"
}
]
},
"strings": {
"patterns": [
{
"name": "string.quoted.single.smarty",
"begin": "'",
"end": "'",
"patterns": [
{
"name": "constant.character.escape.smarty",
"match": "\\\\."
}
],
"beginCaptures": {
"0": {
"name": "punctuation.definition.string.begin.smarty"
}
},
"endCaptures": {
"0": {
"name": "punctuation.definition.string.end.smarty"
}
}
},
{
"name": "string.quoted.double.smarty",
"begin": "\"",
"end": "\"",
"patterns": [
{
"name": "constant.character.escape.smarty",
"match": "\\\\."
}
],
"beginCaptures": {
"0": {
"name": "punctuation.definition.string.begin.smarty"
}
},
"endCaptures": {
"0": {
"name": "punctuation.definition.string.end.smarty"
}
}
}
]
},
"variables": {
"patterns": [
{
"name": "variable.other.global.smarty",
"match": "\\b(\\$)Smarty\\.",
"captures": {
"1": {
"name": "punctuation.definition.variable.smarty"
}
}
},
{
"name": "variable.other.smarty",
"match": "(\\$)([a-zA-Z_][a-zA-Z0-9_]*)\\b",
"captures": {
"1": {
"name": "punctuation.definition.variable.smarty"
},
"2": {
"name": "variable.other.smarty"
}
}
},
{
"name": "variable.other.smarty",
"match": "(-\u003e)([a-zA-Z_][a-zA-Z0-9_]*)\\b",
"captures": {
"1": {
"name": "keyword.operator.smarty"
},
"2": {
"name": "variable.other.property.smarty"
}
}
},
{
"name": "variable.other.smarty",
"match": "(-\u003e)([a-zA-Z_][a-zA-Z0-9_]*)(\\().*?(\\))",
"captures": {
"1": {
"name": "keyword.operator.smarty"
},
"2": {
"name": "meta.function-call.object.smarty"
},
"3": {
"name": "punctuation.definition.variable.smarty"
},
"4": {
"name": "punctuation.definition.variable.smarty"
}
}
}
]
}
},
"injections": {
"text.html.smarty - (meta.embedded | meta.tag | comment.block | meta.block.literal), L:text.html.smarty meta.tag": {
"patterns": [
{
"include": "#comments"
},
{
"include": "#blocks"
}
]
}
}
}