chroma icon indicating copy to clipboard operation
chroma copied to clipboard

YAML values like `.inf` and `.nan` should be highlighted as number

Open silverwind opened this issue 1 year ago • 0 comments

Describe the bug

YAML's infinity .inf is currently highlighted like a string, while it is technically a number so should be highlighted as such. See this and this for all possible "float" types of YAML, which could all be highlighted as number. The second page also lists this regexp:

 [-+]?([0-9][0-9_]*)?\.[0-9.]*([eE][-+][0-9]+)? (base 10)
|[-+]?[0-9][0-9_]*(:[0-5]?[0-9])+\.[0-9_]* (base 60)
|[-+]?\.(inf|Inf|INF) # (infinity)
|\.(nan|NaN|NAN) # (not a number)

To Reproduce

https://swapoff.org/chroma/playground/#eyJsYW5ndWFnZSI6IllBTUwiLCJzdHlsZSI6ImRyYWN1bGEiLCJ0ZXh0IjoiYTogc3RyaW5nXG5iOiAxXG5jOiAtMVxuZDogLmluZlxuZTogLS5pbmZcblxuIiwiY2xhc3NlcyI6ZmFsc2V9

image

silverwind avatar Mar 09 '23 15:03 silverwind