56 lines
2.5 KiB
YAML
56 lines
2.5 KiB
YAML
|
filetype: twig
|
||
|
|
||
|
detect:
|
||
|
filename: "\\.twig$"
|
||
|
|
||
|
rules:
|
||
|
- include: "html"
|
||
|
- symbol.tag:
|
||
|
start: "\\{\\{[[:space:]]"
|
||
|
end: "[[:space:]]\\}\\}"
|
||
|
rules:
|
||
|
- identifier: "\\b(abs|batch|capitalize|convert|encoding|date(_modify)?|default|escape|first|format|join|json_encode|keys|last|length|lower|merge|nl2br|number_format|raw|replace|reverse|round|slice|sort|split|striptags|title|trim|upper|url_encode)\\b"
|
||
|
- identifier.class: "\\b(attribute|block|constant|cycle|date|dump|include|max|min|parent|random|range|source|template_from_string)\\b"
|
||
|
- type.keyword: "\\b(and|as|constant|defined|divisibleby|empty|even|false|in|is|iterable|not|null|odd|or|same(as)?|true|with)\\b"
|
||
|
- symbol.operator: "[.:;,+*?|=!\\%]|<|>|/|-|&"
|
||
|
- symbol.brackets: "[(){}]|\\[|\\]"
|
||
|
- constant.number: "\\b[0-9]+\\b|\\b0x[0-9A-Fa-f]+\\b"
|
||
|
- constant.string:
|
||
|
start: "\""
|
||
|
end: "\""
|
||
|
skip: "\\\\"
|
||
|
rules:
|
||
|
- constant.specialChar: "\\\\."
|
||
|
- constant.string:
|
||
|
start: "'"
|
||
|
end: "'"
|
||
|
skip: "\\\\"
|
||
|
rules:
|
||
|
- constant.specialChar: "\\\\."
|
||
|
- symbol.tag:
|
||
|
start: "\\{%[[:space:]]"
|
||
|
end: "[[:space:]]%\\}"
|
||
|
rules:
|
||
|
- identifier: "\\b(abs|batch|capitalize|convert|encoding|date(_modify)?|default|escape|first|format|join|json_encode|keys|last|length|lower|merge|nl2br|number_format|raw|replace|reverse|round|slice|sort|split|striptags|title|trim|upper|url_encode)\\b"
|
||
|
- identifier.class: "\\b(attribute|block|constant|cycle|date|dump|include|max|min|parent|random|range|source|template_from_string)\\b"
|
||
|
- type.keyword: "\\b(and|as|constant|defined|divisibleby|empty|even|false|in|is|iterable|not|null|odd|or|same(as)?|true|with)\\b"
|
||
|
- symbol.operator: "[.:;,+*?|=!\\%]|<|>|/|-|&"
|
||
|
- symbol.brackets: "[(){}]|\\[|\\]"
|
||
|
- constant.number: "\\b[0-9]+\\b|\\b0x[0-9A-Fa-f]+\\b"
|
||
|
- constant.string:
|
||
|
start: "\""
|
||
|
end: "\""
|
||
|
skip: "\\\\"
|
||
|
rules:
|
||
|
- constant.specialChar: "\\\\."
|
||
|
- constant.string:
|
||
|
start: "'"
|
||
|
end: "'"
|
||
|
skip: "\\\\"
|
||
|
rules:
|
||
|
- constant.specialChar: "\\\\."
|
||
|
- comment:
|
||
|
start: "\\{#"
|
||
|
end: "#\\}"
|
||
|
rules: []
|