micro/runtime/syntax/json.yaml
Jöran Karl cc195b6a96
syntax/json: Add comment support to the syntax highlighting (#3434)
* allow comments in json

* syntax/json: Add colon to `TODO` comments

---------

Co-authored-by: Sertonix <83883937+Sertonix@users.noreply.github.com>
2024-08-19 22:16:42 +02:00

40 lines
1 KiB
YAML

filetype: json
detect:
filename: "\\.json$"
header: "^\\{$"
rules:
- constant.number: "\\b[-+]?([1-9][0-9]*|0[0-7]*|0x[0-9a-fA-F]+)([uU][lL]?|[lL][uU]?)?\\b"
- constant.number: "\\b[-+]?([0-9]+\\.[0-9]*|[0-9]*\\.[0-9]+)([EePp][+-]?[0-9]+)?[fFlL]?"
- constant.number: "\\b[-+]?([0-9]+[EePp][+-]?[0-9]+)[fFlL]?"
- constant: "\\b(null)\\b"
- constant: "\\b(true|false)\\b"
- constant.string:
start: "\""
end: "\""
skip: "\\\\."
rules:
- constant.specialChar: "\\\\."
- constant.string:
start: "'"
end: "'"
skip: "\\\\."
rules:
- constant.specialChar: "\\\\."
- statement: "\\\"(\\\\\"|[^\"])*\\\"[[:space:]]*:\" \"'(\\'|[^'])*'[[:space:]]*:"
- constant: "\\\\u[0-9a-fA-F]{4}|\\\\[bfnrt'\"/\\\\]"
- comment:
start: "//"
end: "$"
rules:
- todo: "(TODO|XXX|FIXME):?"
- comment:
start: "/\\*"
end: "\\*/"
rules:
- todo: "(TODO|XXX|FIXME):?"