Skip to content

Commit 6d6f1f0

Browse files
committed
fix(queries:properties): proper numeric values
1 parent 066dded commit 6d6f1f0

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

runtime/queries/properties/highlights.scm

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,15 @@
1515
((value) @constant.builtin.boolean
1616
(#any-of? @constant.builtin.boolean "true" "false" "enabled" "disabled"))
1717

18-
((value) @constant.numeric.integer
19-
(#match? @constant.numeric.integer "^-?[0-9]+$"))
20-
2118
((value) @constant.numeric.float
22-
(#match? @constant.numeric.float "^-?[0-9]+\.[0-9]$"))
19+
(#match? @constant.numeric.float "^[+-]?(([0-9]*\.[0-9]+(e[0-9]+)?)|([0-9]+e[0-9]+))$"))
20+
21+
((value) @constant.numeric.integer
22+
; according to the Java spec, hex literals must represent a 64bit int;
23+
; overflow (too long) is considered an error.
24+
; however, since these are just strings,
25+
; a long hex-literal could represent a BigInt, so we allow it
26+
(#match? @constant.numeric.integer "^([+-]?[0-9]+)|(0[xX][0-9a-fA-F]+)$"))
2327

2428
((value) @string.special.path
2529
(#match? @string.special.path "^(\.{1,2})?/"))

0 commit comments

Comments
 (0)