aboutsummaryrefslogtreecommitdiff
path: root/utils/nano/files/ucode.nanorc
blob: 96c7848e21d0d7fd48a11dfd85a71c4e92c41e38 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
## Syntax highlighting for OpenWrt ucode scripts.

syntax ucode "/ucode/|\.u[ct]$"
header "^#!.*\<ucode\>"
comment "//"

# Declarations
color green "\<(let|const|function|this)\>"

# Arrow functions
color green "(\<\w+\>|\([[:alnum:][:space:]_,.]*\))[[:space:]]*=>"

# Flow control and keywords
color brightyellow "\<(while|if|else|elif|switch|case|default|for|in|endif|endfor|endwhile|endfunction)\>"
color brightyellow "\<(export|import|try|catch|delete)\>"

# Exit points
color magenta "\<(break|continue|return)\>"

# Numeric literals
color cyan "\<([0-9]+\.[0-9]+([eE][+-]?[0-9]+)?|[0-9]+[eE][+-]?[0-9]+)\>"
color cyan "\<0[xX][[:xdigit:]]+(\.[[:xdigit:]]+)?\>"
color cyan "\<(0[oO][0-7]+|0[bB][01]+|[0-9]+)\>"

# Special values
color cyan "\<(true|false|null|NaN|Infinity)\>"

# Strings
color brightmagenta ""([^"\{%#}]|\\.|\{[^"\{%#]|[%#}][^"\}]|[{%#}]\\.)*[{%#}]?""
color brightmagenta "'([^'\{%#}]|\\.|\{[^'\{%#]|[%#}][^'\}]|[{%#}]\\.)*[{%#}]?'"
color brightmagenta "`([^`\{%#}]|\\.|\{[^`\{%#]|[%#}][^`\}]|[{%#}]\\.)*[{%#}]?`"

# Template string expressions
color normal start="\$\{" end="}"

# Comments
color brightblue "(^|[[:blank:]])//.*"
color brightblue start="(^|[[:space:]])/\*" end="\*/"
color brightblue start="\{#" end="#\}"

# Trailing whitespace.
color ,green "[[:space:]]+$"

# Text outside template directives
color slate start="[}%#]\}" end="\{[{%#]"
color slate start="^#!" end="\{[{%#]"
color slate "^([^{%#}]|\{[^{%#]|[%#}][^}])+\{[{%#]"

# Template tags
color white "\{[{%][+-]?|-?[%}]\}"
color brightblue "\{#[+-]?|-?#\}"