Skip to content

Commit 6d145a5

Browse files
committed
Constants
1 parent f26ee0e commit 6d145a5

File tree

1 file changed

+72
-2
lines changed

1 file changed

+72
-2
lines changed

lib/java.tmLanguage.json

Lines changed: 72 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,13 @@
4444
]
4545
},
4646
{
47-
"match": "\\bthrow|return|break|continue|default|do|while|switch|if|else|const|goto\\b",
47+
"match": "\\bthrow|return|break|continue|default|do|while|switch|case|if|else|const|goto\\b",
4848
"name": "keyword.java"
4949
},
50+
{
51+
"match": "\\bprivate|public|protected|static|final|default",
52+
"name": "storage.modifier.java"
53+
},
5054
{
5155
"match": "\\b(instanceof)\\s+((\\w+\\.)*\\w+)",
5256
"captures": {
@@ -56,7 +60,11 @@
5660
"2": {
5761
"name": "entity.name.class.java"
5862
}
59-
}
63+
},
64+
"name": "meta.instanceof.java"
65+
},
66+
{
67+
"include": "#constants"
6068
},
6169
{
6270
"include": "#comments"
@@ -106,6 +114,68 @@
106114
]
107115
}
108116
]
117+
},
118+
"constants": {
119+
"patterns": [
120+
{
121+
"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(?!\\$)",
122+
"name": "constant.numeric.hex.java"
123+
},
124+
{
125+
"match": "\\b(?<!\\$)0(b|B)[01]([01_]*[01])?[Ll]?\\b(?!\\$)",
126+
"name": "constant.numeric.binary.java"
127+
},
128+
{
129+
"match": "\\b(?<!\\$)0[0-7]([0-7_]*[0-7])?[Ll]?\\b(?!\\$)",
130+
"name": "constant.numeric.octal.java"
131+
},
132+
{
133+
"match": "(?x)\n(?<!\\$)\n(\n \\b[0-9]([0-9_]*[0-9])?\\.\\B(?!\\.)\n |\n \\b[0-9]([0-9_]*[0-9])?\\.([Ee][+-]?[0-9]([0-9_]*[0-9])?)[FfDd]?\\b\n |\n \\b[0-9]([0-9_]*[0-9])?\\.([Ee][+-]?[0-9]([0-9_]*[0-9])?)?[FfDd]\\b\n |\n \\b[0-9]([0-9_]*[0-9])?\\.([0-9]([0-9_]*[0-9])?)([Ee][+-]?[0-9]([0-9_]*[0-9])?)?[FfDd]?\\b\n |\n (?<!\\.)\\B\\.[0-9]([0-9_]*[0-9])?([Ee][+-]?[0-9]([0-9_]*[0-9])?)?[FfDd]?\\b\n |\n \\b[0-9]([0-9_]*[0-9])?([Ee][+-]?[0-9]([0-9_]*[0-9])?)[FfDd]?\\b\n |\n \\b[0-9]([0-9_]*[0-9])?([Ee][+-]?[0-9]([0-9_]*[0-9])?)?[FfDd]\\b\n |\n \\b(0|[1-9]([0-9_]*[0-9])?)(?!\\.)[Ll]?\\b\n)\n(?!\\$)",
134+
"name": "constant.numeric.decimal.java"
135+
},
136+
{
137+
"begin": "\"",
138+
"beginCaptures": {
139+
"0": {
140+
"name": "punctuation.definition.string.begin.java"
141+
}
142+
},
143+
"end": "\"",
144+
"endCaptures": {
145+
"0": {
146+
"name": "punctuation.definition.string.end.java"
147+
}
148+
},
149+
"name": "string.quoted.double.java",
150+
"patterns": [
151+
{
152+
"match": "\\\\.",
153+
"name": "constant.character.escape.java"
154+
}
155+
]
156+
},
157+
{
158+
"begin": "'",
159+
"beginCaptures": {
160+
"0": {
161+
"name": "punctuation.definition.string.begin.java"
162+
}
163+
},
164+
"end": "'",
165+
"endCaptures": {
166+
"0": {
167+
"name": "punctuation.definition.string.end.java"
168+
}
169+
},
170+
"name": "string.quoted.single.java",
171+
"patterns": [
172+
{
173+
"match": "\\\\.",
174+
"name": "constant.character.escape.java"
175+
}
176+
]
177+
}
178+
]
109179
}
110180
}
111181
}

0 commit comments

Comments
 (0)