| 1 |
filetype: toml |
| 2 |
|
| 3 |
detect: |
| 4 |
filename: "\\.toml" |
| 5 |
|
| 6 |
rules: |
| 7 |
# Punctuation |
| 8 |
- symbol: '[=,\.]' |
| 9 |
- symbol.brackets: '[{\[\]}]' |
| 10 |
# Strings |
| 11 |
- constant.string: |
| 12 |
start: '"""' |
| 13 |
end: '\"{3,5}' |
| 14 |
skip: '\\.' |
| 15 |
rules: |
| 16 |
- constant.specialChar: '\\u[[:xdigit:]]{4}' |
| 17 |
- constant.specialChar: '\\U[[:xdigit:]]{8}' |
| 18 |
- constant.specialChar: '\\[btnfr"\\]' |
| 19 |
- constant.string: |
| 20 |
start: '"' |
| 21 |
end: '"' |
| 22 |
skip: '\\.' |
| 23 |
rules: |
| 24 |
- constant.specialChar: '\\u[[:xdigit:]]{4}' |
| 25 |
- constant.specialChar: '\\U[[:xdigit:]]{8}' |
| 26 |
- constant.specialChar: '\\[btnfr"\\]' |
| 27 |
- constant.string: |
| 28 |
start: "'''" |
| 29 |
end: "'{3,5}" |
| 30 |
rules: [] |
| 31 |
- constant.string: |
| 32 |
start: "'" |
| 33 |
end: "'" |
| 34 |
rules: [] |
| 35 |
# Integer |
| 36 |
- constant.number: '[+-]?(\d+_)*\d+\b' |
| 37 |
- constant.number: '(0x([[:xdigit:]]+_)*[[:xdigit:]]+|0o([0-7]_)*[0-7]+|0b([01]+_)*[01]+)' |
| 38 |
# Float |
| 39 |
- constant.number: '[+-]?(\d+_)*\d+\.(\d+_)*\d+' |
| 40 |
- constant.number: '[+-]?(\d+_)*\d+(\.(\d+_)*\d+)?[Ee][+-]?(\d+_)*\d+' |
| 41 |
- constant.number: '(\+|-)(inf|nan)' |
| 42 |
# Bare key, keys starting with a digit or dash are ambiguous with numbers and are skipped |
| 43 |
- identifier: '\b[A-Za-z_][A-Za-z0-9_-]*\b' |
| 44 |
# Boolean and inf, nan without sign |
| 45 |
- constant.bool.true: '\btrue\b' |
| 46 |
- constant.bool.false: '\bfalse\b' |
| 47 |
- constant.number: '\b(inf|nan)\b' |
| 48 |
# Date and Time |
| 49 |
- constant: '\d+-\d{2}-\d{2}([T ]\d{2}:\d{2}:\d{2}(\.\d+)?([+-]\d{2}:\d{2}|Z)?)?' |
| 50 |
- constant: '\d{2}:\d{2}:\d{2}(\.\d+)?' |
| 51 |
# Comments |
| 52 |
- comment: |
| 53 |
start: "#" |
| 54 |
end: "$" |
| 55 |
rules: |
| 56 |
- todo: "(TODO|XXX|FIXME):?" |