1 ## Syntax highlighting for OpenWrt ucode scripts.
3 syntax ucode "/ucode/|\.u[ct]$"
4 header "^#!.*\<ucode\>"
8 color green "\<(let|const|function|this)\>"
11 color green "(\<\w+\>|\([[:alnum:][:space:]_,.]*\))[[:space:]]*=>"
13 # Flow control and keywords
14 color brightyellow "\<(while|if|else|elif|switch|case|default|for|in|endif|endfor|endwhile|endfunction)\>"
15 color brightyellow "\<(export|import|try|catch|delete)\>"
18 color magenta "\<(break|continue|return)\>"
21 color cyan "\<([0-9]+\.[0-9]+([eE][+-]?[0-9]+)?|[0-9]+[eE][+-]?[0-9]+)\>"
22 color cyan "\<0[xX][[:xdigit:]]+(\.[[:xdigit:]]+)?\>"
23 color cyan "\<(0[oO][0-7]+|0[bB][01]+|[0-9]+)\>"
26 color cyan "\<(true|false|null|NaN|Infinity)\>"
29 color brightmagenta ""([^"\{%#}]|\\.|\{[^"\{%#]|[%#}][^"\}]|[{%#}]\\.)*[{%#}]?""
30 color brightmagenta "'([^'\{%#}]|\\.|\{[^'\{%#]|[%#}][^'\}]|[{%#}]\\.)*[{%#}]?'"
31 color brightmagenta "`([^`\{%#}]|\\.|\{[^`\{%#]|[%#}][^`\}]|[{%#}]\\.)*[{%#}]?`"
33 # Template string expressions
34 color normal start="\$\{" end="}"
37 color brightblue "(^|[[:blank:]])//.*"
38 color brightblue start="(^|[[:space:]])/\*" end="\*/"
39 color brightblue start="\{#" end="#\}"
41 # Trailing whitespace.
42 color ,green "[[:space:]]+$"
44 # Text outside template directives
45 color slate start="[}%#]\}" end="\{[{%#]"
46 color slate start="^#!" end="\{[{%#]"
47 color slate "^([^{%#}]|\{[^{%#]|[%#}][^}])+\{[{%#]"
50 color white "\{[{%][+-]?|-?[%}]\}"
51 color brightblue "\{#[+-]?|-?#\}"