-
Notifications
You must be signed in to change notification settings - Fork 0
/
twig-object.sublime-syntax
91 lines (79 loc) · 2.2 KB
/
twig-object.sublime-syntax
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
%YAML 1.2
---
# http://www.sublimetext.com/docs/3/syntax.html
name: Twig Object
scope: meta.object.twig
hidden: true
contexts:
main:
- include: vars
- include: strings
- include: pipe
- include: tilde
- include: compare
- include: spread
- include: ternary
- include: functions
- include: constants
- include: named
vars:
- match: '(?:true|false|null|none|defined|empty|even|iterable|odd)[a-z]+'
scope: variable.other.twig
- match: '[0-9]+'
scope: constant.numeric.twig
- match: '\.'
scope: punctuation.separator.twig
pipe:
- match: '\s?(\|)\s?([a-z_-]+)'
captures:
1: keyword.operator.logical.pipe.twig
2: support.function.filter.twig
tilde:
- match: '\s(~)\s'
captures:
1: keyword.operator.logical.tilde.twig
compare:
- match: '\s(in|is)\s'
captures:
1: keyword.operator.logical.compare.twig
spread:
- match: '(\.\.)'
captures:
1: keyword.operator.logical.spread.twig
# there are issue here still...
ternary:
- match: '(\?).*(:)'
captures:
1: keyword.operator.logical.ternary.twig
2: keyword.operator.logical.ternary.twig
functions:
- match: '(attribute|block|constant|cycle|date|divisible by|dump|include|max|min|parent|random|range|source|template_from_string)'
captures:
1: support.function.twig
constants:
- match: '(true|false|null|none|defined|empty|even|iterable|odd)'
captures:
1: constant.language.twig
named:
- match: '(=)'
captures:
1: keyword.operator.assignment.twig
strings:
- match: "'"
scope: punctuation.definition.string.begin.twig
push:
- meta_scope: string.quoted.single.twig
- match: "(')|(\n)"
captures:
1: punctuation.definition.string.end.twig
2: invalid.illegal.newline.twig
pop: true
- match: '"'
scope: punctuation.definition.string.begin.twig
push:
- meta_scope: string.quoted.double.twig
- match: '(")|(\n)'
captures:
1: punctuation.definition.string.end.twig
2: invalid.illegal.newline.twig
pop: true