Files
vscode-eftl-language/syntaxes/eftl.tmLanguage.json
T

357 lines
11 KiB
JSON

{
"$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json",
"name": "EFTL",
"scopeName": "source.eftl",
"patterns": [
{ "include": "#comments" },
{ "include": "#eftl-block" },
{ "include": "#expressions" },
{ "include": "#tags" },
{ "include": "#control-structures" },
{ "include": "#variables" },
{ "include": "#functions" },
{ "include": "#strings" }
],
"repository": {
"comments": {
"patterns": [
{
"name": "comment.block.eftl",
"begin": "\\[!--",
"end": "--\\]",
"captures": {
"0": { "name": "punctuation.definition.comment.eftl" }
}
}
]
},
"eftl-block": {
"patterns": [
{
"name": "meta.block.eftl",
"begin": "(\\[EFTL\\])",
"end": "(\\[/EFTL\\])",
"beginCaptures": {
"1": { "name": "keyword.control.eftl.begin" }
},
"endCaptures": {
"1": { "name": "keyword.control.eftl.end" }
},
"patterns": [
{ "include": "#comments" },
{ "include": "#expressions" },
{ "include": "#tags" },
{ "include": "#control-structures" },
{ "include": "#variables" },
{ "include": "#functions" },
{ "include": "#header" },
{ "include": "#strings" }
]
}
]
},
"expressions": {
"patterns": [
{
"name": "meta.expression.output.eftl",
"begin": "\\[%=",
"end": "%\\]",
"beginCaptures": {
"0": { "name": "punctuation.section.expression.begin.eftl" }
},
"endCaptures": {
"0": { "name": "punctuation.section.expression.end.eftl" }
},
"patterns": [
{ "include": "#expression-content" }
]
},
{
"name": "meta.expression.eftl",
"begin": "\\[%",
"end": "%\\]",
"beginCaptures": {
"0": { "name": "punctuation.section.expression.begin.eftl" }
},
"endCaptures": {
"0": { "name": "punctuation.section.expression.end.eftl" }
},
"patterns": [
{ "include": "#expression-content" }
]
}
]
},
"expression-content": {
"patterns": [
{
"name": "constant.numeric.eftl",
"match": "\\b[0-9]+\\.?[0-9]*\\b"
},
{
"name": "keyword.operator.assignment.eftl",
"match": "="
},
{
"name": "keyword.operator.arithmetic.eftl",
"match": "([+\\-*%]|/(?!\\]))"
},
{
"name": "keyword.operator.comparison.eftl",
"match": "(!=|==|<=|>=|<|>)"
},
{
"name": "keyword.operator.logical.eftl",
"match": "(&&|\\|\\|)"
},
{
"name": "constant.language.boolean.eftl",
"match": "\\b(true|false)\\b"
},
{
"name": "variable.other.eftl",
"match": "\\b[a-zA-Z_][a-zA-Z0-9_]*\\b"
},
{
"name": "string.quoted.double.eftl",
"begin": "\"",
"end": "\"",
"patterns": [
{
"name": "constant.character.escape.eftl",
"match": "\\\\."
}
]
},
{
"name": "punctuation.terminator.statement.eftl",
"match": ";"
}
]
},
"attributes": {
"patterns": [
{
"comment": "name attribute",
"match": "\\b(name)\\b\\s*(=)\\s*(\"(.*?)\")",
"captures": {
"1": { "name": "entity.other.attribute-name.eftl" },
"2": { "name": "punctuation.separator.key-value.eftl" },
"3": { "name": "string.quoted.double.eftl" },
"4": { "name": "variable.other.eftl" }
}
},
{
"comment": "type attribute",
"match": "\\b(type)\\b\\s*(=)\\s*(\"(string|boolean|number|date|object|iterable)\")",
"captures": {
"1": { "name": "entity.other.attribute-name.eftl" },
"2": { "name": "punctuation.separator.key-value.eftl" },
"3": { "name": "string.quoted.double.eftl" },
"4": { "name": "support.type.primitive.eftl" }
}
},
{
"comment": "generic attribute",
"match": "\\b([a-zA-Z_][a-zA-Z0-9_-]*)\\b\\s*(=)\\s*(\"(.*?)\")",
"captures": {
"1": { "name": "entity.other.attribute-name.eftl" },
"2": { "name": "punctuation.separator.key-value.eftl" },
"3": { "name": "string.quoted.double.eftl" }
}
}
]
},
"tag-open-context": {
"patterns": [
{ "include": "#attributes" },
{ "include": "#expressions" },
{ "include": "#functions" },
{ "include": "#tags" }
]
},
"tags": {
"patterns": [
{
"name": "meta.tag.block.eftl",
"begin": "(\\[)(TAG)(?:\\s+[^\\x00]*?)?(?<!/)(\\])",
"end": "(\\[/)(TAG)(\\])",
"beginCaptures": {
"1": { "name": "entity.name.tag.eftl" },
"2": { "name": "entity.name.tag.eftl" },
"3": { "name": "entity.name.tag.eftl" }
},
"endCaptures": {
"1": { "name": "entity.name.tag.eftl" },
"2": { "name": "entity.name.tag.eftl" },
"3": { "name": "entity.name.tag.eftl" }
},
"patterns": [
{ "include": "#expressions" },
{ "include": "#tags" },
{ "include": "#functions" },
{ "include": "#control-structures" },
{ "include": "#variables" }
]
},
{
"name": "meta.tag.eftl",
"begin": "(\\[)(TAG)\\b",
"end": "(/\\s*\\]|(?<!/)\\])",
"beginCaptures": {
"1": { "name": "entity.name.tag.eftl" },
"2": { "name": "entity.name.tag.eftl" }
},
"endCaptures": {
"0": { "name": "entity.name.tag.eftl" }
},
"patterns": [
{ "include": "#tag-open-context" }
]
}
]
},
"header": {
"patterns": [
{
"name": "meta.header.eftl",
"begin": "(\\[)(HEADER)\\b",
"end": "(/\\s*\\]|(?<!/)\\])",
"beginCaptures": {
"1": { "name": "keyword.other.header.eftl" },
"2": { "name": "keyword.other.header.eftl" }
},
"endCaptures": {
"0": { "name": "keyword.other.header.eftl" }
},
"patterns": [
{ "include": "#tag-open-context" }
]
}
]
},
"control-structures": {
"patterns": [
{
"name": "keyword.control.conditional.eftl",
"match": "\\[(IF|ELSE IF|ELSE|/IF|CONDITION|/CONDITION|THEN|/THEN|/ELSE IF|/ELSE)\\]"
},
{
"name": "meta.control.loop.eftl",
"begin": "(\\[)(WHILE)\\b",
"end": "(\\])",
"beginCaptures": {
"1": { "name": "keyword.control.loop.eftl" },
"2": { "name": "keyword.control.loop.eftl" }
},
"endCaptures": {
"1": { "name": "keyword.control.loop.eftl" }
},
"patterns": [
{ "include": "#attributes" }
]
},
{
"name": "keyword.control.loop.eftl",
"match": "\\[(/WHILE|DO|/DO)\\]"
}
]
},
"variables": {
"patterns": [
{
"name": "meta.variable.block.eftl",
"begin": "(\\[)(VAR)(?:\\s+[^\\x00]*?)?(?<!/)(\\])",
"end": "(\\[/)(VAR)(\\])",
"beginCaptures": {
"1": { "name": "storage.type.variable.eftl" },
"2": { "name": "storage.type.variable.eftl" },
"3": { "name": "storage.type.variable.eftl" }
},
"endCaptures": {
"1": { "name": "storage.type.variable.eftl" },
"2": { "name": "storage.type.variable.eftl" },
"3": { "name": "storage.type.variable.eftl" }
},
"patterns": [
{ "include": "#expressions" },
{ "include": "#functions" },
{ "include": "#tags" },
{ "include": "#control-structures" }
]
},
{
"name": "meta.variable.declaration.eftl",
"begin": "(\\[)(VAR)\\b",
"end": "(/\\s*\\]|(?<!/)\\])",
"beginCaptures": {
"1": { "name": "storage.type.variable.eftl" },
"2": { "name": "storage.type.variable.eftl" }
},
"endCaptures": {
"0": { "name": "storage.type.variable.eftl" }
},
"patterns": [
{ "include": "#tag-open-context" }
]
}
]
},
"functions": {
"patterns": [
{
"name": "meta.function.block.eftl",
"begin": "(\\[)(VALUE_OF|SIZE_OF|SPLIT|FORMAT|CONTAINS|TRIM)(?:\\s+[^\\x00]*?)?(?<!/)(\\])",
"end": "(\\[/)(VALUE_OF|SIZE_OF|SPLIT|FORMAT|CONTAINS|TRIM)(\\])",
"beginCaptures": {
"1": { "name": "support.function.eftl" },
"2": { "name": "support.function.eftl" },
"3": { "name": "support.function.eftl" }
},
"endCaptures": {
"1": { "name": "support.function.eftl" },
"2": { "name": "support.function.eftl" },
"3": { "name": "support.function.eftl" }
},
"patterns": [
{ "include": "#expressions" },
{ "include": "#functions" },
{ "include": "#tags" },
{ "include": "#control-structures" }
]
},
{
"name": "meta.function.eftl",
"begin": "(\\[)(VALUE_OF|SIZE_OF|SPLIT|FORMAT|CONTAINS|TRIM)\\b",
"end": "(/\\s*\\]|(?<!/)\\])",
"beginCaptures": {
"1": { "name": "support.function.eftl" },
"2": { "name": "support.function.eftl" }
},
"endCaptures": {
"0": { "name": "support.function.eftl" }
},
"patterns": [
{ "include": "#tag-open-context" }
]
}
]
},
"strings": {
"patterns": [
{
"name": "string.quoted.double.eftl",
"begin": "\"",
"end": "\"",
"patterns": [
{
"name": "constant.character.escape.eftl",
"match": "\\\\."
}
]
}
]
}
}
}