Skip to content

Commit 32402e5

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

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

runtime/queries/properties/highlights.scm

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,16 @@
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+
; ASK: should "1." be considered `float`?
20+
(#match? @constant.numeric.float "^[+-]?(([0-9]*\.[0-9]+(e[0-9]+)?)|([0-9]+e[0-9]+))$"))
21+
22+
((value) @constant.numeric.integer
23+
; according to the Java spec, hex literals must represent a 64bit int;
24+
; overflow (too long) is considered an error.
25+
; however, since these are just strings,
26+
; a long hex-literal could represent a BigInt, so we allow it
27+
(#match? @constant.numeric.integer "^([+-]?[0-9]+)|(0[xX][0-9a-fA-F]+)$"))
2328

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

0 commit comments

Comments
 (0)