Benno Schulenberg | c7b0e54 | 2014-05-17 11:44:35 +0000 | [diff] [blame] | 1 | ## Syntax highlighting for JSON files. |
| 2 | |
| 3 | # See: http://www.json.org/ |
| 4 | # Original author: Aapo Rantalainen |
| 5 | # License: GPLv3 or newer |
| 6 | |
| 7 | syntax "json" "\.json$" |
Mike Scalora | 6a2032f | 2016-05-25 22:13:50 +0200 | [diff] [blame] | 8 | # No comments are permitted in JSON. |
| 9 | comment "" |
Benno Schulenberg | c7b0e54 | 2014-05-17 11:44:35 +0000 | [diff] [blame] | 10 | |
| 11 | # Numbers (used as value). |
| 12 | color green ":[[:space:]]*\-?(0|[1-9][0-9]*)(\.[0-9]+)?([Ee]?[-+]?[0-9]+)?" |
| 13 | # Values (well, any string). |
| 14 | color brightmagenta "\".+\"" |
| 15 | # Hex numbers (used as value). |
| 16 | color green ":[[:space:]]*\"#[0-9abcdefABCDEF]+\"" |
| 17 | # Escapes. |
| 18 | color green "\\\\" "\\\"" "\\[bfnrt]" "\\u[0-9abcdefABCDEF]{4})" |
| 19 | # Special words. |
| 20 | color green "(true|false|null)" |
| 21 | |
| 22 | # Names (very unlikely to contain a quote). |
| 23 | color brightblue "\"[^"]+\"[[:space:]]*:" |
| 24 | |
| 25 | # Brackets, braces, and separators. |
| 26 | color brightblue "\[" "\]" |
| 27 | color brightred "\{" "\}" |
| 28 | color brightred "," ":" |
| 29 | |
| 30 | # Comments. |
| 31 | color cyan "(^|[[:space:]]+)(//|#).*$" |
| 32 | |
| 33 | # Trailing whitespace. |
| 34 | color ,green "[[:space:]]+$" |