Skip to content

Commit b327891

Browse files
authored
Added textmate grammar support for property expressions (#95)
* Added textmate grammar support for property expressions Signed-off-by: Jessica He <jhe@redhat.com>
1 parent 3a4c712 commit b327891

File tree

1 file changed

+50
-6
lines changed

1 file changed

+50
-6
lines changed

language-support/properties-support/java-properties.tmLanguage.json

Lines changed: 50 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,17 @@
77
"scopeName": "source.java-properties",
88
"patterns": [
99
{
10+
"include": "#comments"
11+
},
12+
{
13+
"include": "#property-key"
14+
},
15+
{
16+
"include": "#property-value"
17+
}
18+
],
19+
"repository": {
20+
"comments":{
1021
"comment": "Matching for comments that start with #",
1122
"begin": "^([ \\t]+)?(?=#)",
1223
"beginCaptures": {
@@ -28,7 +39,7 @@
2839
}
2940
]
3041
},
31-
{
42+
"property-key":{
3243
"comment": "Matching for property keys",
3344
"captures": {
3445
"1": {
@@ -37,7 +48,7 @@
3748
},
3849
"match": "^\\s*([\\/a-zA-Z0-9%_.\\[\\]#-]+)\\s*(?=[=\\\\])"
3950
},
40-
{
51+
"property-value":{
4152
"comment": "Matching the equals sign and property value",
4253
"begin": "(=)",
4354
"beginCaptures": {
@@ -49,12 +60,13 @@
4960
"patterns": [
5061
{
5162
"include": "#numbers"
63+
},
64+
{
65+
"include": "#expression"
5266
}
5367
]
54-
}
55-
],
56-
"repository": {
57-
"numbers": {
68+
},
69+
"numbers": {
5870
"patterns": [
5971
{
6072
"match": "(?x)\n\\b(?<!\\$)\n0(x|X)\n(\n (?<!\\.)[0-9a-fA-F]([0-9a-fA-F_]*[0-9a-fA-F])?[Ll]?(?!\\.)\n |\n (\n [0-9a-fA-F]([0-9a-fA-F_]*[0-9a-fA-F])?\\.?\n |\n ([0-9a-fA-F]([0-9a-fA-F_]*[0-9a-fA-F])?)?\\.[0-9a-fA-F]([0-9a-fA-F_]*[0-9a-fA-F])?\n )\n [Pp][+-]?[0-9]([0-9_]*[0-9])?[FfDd]?\n)\n\\b(?!\\$)",
@@ -73,6 +85,38 @@
7385
"name": "constant.numeric.decimal.java-properties"
7486
}
7587
]
88+
},
89+
"expression":{
90+
"comment": "Matching for expression. Ex : ${expression:value} ${my.prop${compose}} ${my.prop}${my.prop}",
91+
"begin": "(\\$\\{)",
92+
"beginCaptures": {
93+
"1": {
94+
"name": "support.function.java-properties"
95+
}
96+
},
97+
"end": "(\\})",
98+
"endCaptures": {
99+
"1": {
100+
"name": "support.function.java-properties"
101+
}
102+
},
103+
"patterns": [
104+
{
105+
"match": "(?<=\\{)([a-zA-z.]+)",
106+
"name": "support.type.name.java-properties"
107+
},
108+
{
109+
"match": "(:)",
110+
"name": "keyword.operator.assign.value.java-properties"
111+
},
112+
{
113+
"match": "(?<=\\:)([a-zA-z0-9]+)",
114+
"name": "variable.other.value.java-properties"
115+
},
116+
{
117+
"include": "#expression"
118+
}
119+
]
76120
}
77121
}
78122
}

0 commit comments

Comments
 (0)