mirror of
https://github.com/zyedidia/micro
synced 2024-09-30 13:14:00 +00:00
cc9dd00948
This commit adds the string group (constant.string) to valid strings in all the syntax files that support colorschemes (see the readme in the runtime/syntax directory). Fixes #178
92 lines
3.6 KiB
Plaintext
92 lines
3.6 KiB
Plaintext
## D syntax highlighting for GNU nano
|
|
##
|
|
## Author: Andrei Vinokurov
|
|
## Based on D lexer specification (http://dlang.org/lex)
|
|
|
|
syntax "D" "\.(d(i|d)?)$"
|
|
|
|
## Operators and punctuation
|
|
color statement "(\*|/|%|\+|-|>>|<<|>>>|&|\^(\^)?|\||~)?="
|
|
color statement "\.\.(\.)?|!|\*|&|~|\(|\)|\[|\]|\\|/|\+|-|%|<|>|\?|:|;"
|
|
|
|
## Octal integer literals are deprecated
|
|
color error "(0[0-7_]*)(L[uU]?|[uU]L?)?"
|
|
|
|
## Decimal integer literals
|
|
color constant "([0-9]|[1-9][0-9_]*)(L[uU]?|[uU]L?)?"
|
|
|
|
## Binary integer literals
|
|
color constant "(0[bB][01_]*)(L[uU]?|[uU]L?)?"
|
|
|
|
## Decimal float literals
|
|
color constant "[0-9][0-9_]*\.([0-9][0-9_]*)([eE][+-]?([0-9][0-9_]*))?[fFL]?i?"
|
|
color constant "[0-9][0-9_]*([eE][+-]?([0-9][0-9_]*))[fFL]?i?"
|
|
color constant "[^.]\.([0-9][0-9_]*)([eE][+-]?([0-9][0-9_]*))?[fFL]?i?"
|
|
color constant "[0-9][0-9_]*([fFL]?i|[fF])"
|
|
|
|
## Hexadecimal integer literals
|
|
color constant "(0[xX]([0-9a-fA-F][0-9a-fA-F_]*|[0-9a-fA-F_]*[0-9a-fA-F]))(L[uU]?|[uU]L?)?"
|
|
|
|
## Hexadecimal float literals
|
|
color constant "0[xX]([0-9a-fA-F][0-9a-fA-F_]*|[0-9a-fA-F_]*[0-9a-fA-F])(\.[0-9a-fA-F][0-9a-fA-F_]*|[0-9a-fA-F_]*[0-9a-fA-F])?[pP][+-]?([0-9][0-9_]*)[fFL]?i?"
|
|
color constant "0[xX]\.([0-9a-fA-F][0-9a-fA-F_]*|[0-9a-fA-F_]*[0-9a-fA-F])[pP][+-]?([0-9][0-9_]*)[fFL]?i?"
|
|
|
|
|
|
## Character literals
|
|
color constant "'([^\']|\\(['"?\abfnrtv]|x[[:xdigit:]]{2}|[0-7]{1,3}|u[[:xdigit:]]{4}|U[[:xdigit:]]{8}|&.*;))'"
|
|
|
|
## Keywords
|
|
## a-e
|
|
color statement "\b(abstract|alias|align|asm|assert|auto|body|break|case|cast|catch|class|const|continue|debug|default|delegate|do|else|enum|export|extern)\b"
|
|
## f-l
|
|
color statement "\b(false|final|finally|for|foreach|foreach_reverse|function|goto|if|immutable|import|in|inout|interface|invariant|is|lazy)\b"
|
|
## m-r
|
|
color statement "\b(macro|mixin|module|new|nothrow|null|out|override|package|pragma|private|protected|public|pure|ref|return)\b"
|
|
## s-w
|
|
color statement "\b(scope|shared|static|struct|super|switch|synchronized|template|this|throw|true|try|typeid|typeof|union|unittest|version|while|with)\b"
|
|
## __
|
|
color statement "\b(__FILE__|__MODULE__|__LINE__|__FUNCTION__|__PRETTY_FUNCTION__|__gshared|__traits|__vector|__parameters)\b"
|
|
|
|
## Deprecated keywords
|
|
color error "\b(delete|deprecated|typedef|volatile)\b"
|
|
|
|
## Primitive types
|
|
color type "\b(bool|byte|cdouble|cent|cfloat|char|creal|dchar|double|float|idouble|ifloat|int|ireal|long|real|short|ubyte|ucent|uint|ulong|ushort|void|wchar)\b"
|
|
|
|
## Globally defined symbols
|
|
color type "\b(string|wstring|dstring|size_t|ptrdiff_t)\b"
|
|
|
|
## Special tokens
|
|
color constant "\b(__DATE__|__EOF__|__TIME__|__TIMESTAMP__|__VENDOR__|__VERSION__)\b"
|
|
|
|
## String literals
|
|
## TODO: multiline backtick and doublequote string. (Unlikely possible at all with nano.)
|
|
### DoubleQuotedString
|
|
color constant.string ""(\\.|[^"])*""
|
|
|
|
### WysiwygString
|
|
color constant.string start="r"" end="""
|
|
color constant.string "`[^`]*`"
|
|
|
|
### HexString
|
|
color constant.string "x"([[:space:]]*[[:xdigit:]][[:space:]]*[[:xdigit:]])*[[:space:]]*""
|
|
|
|
### DelimitedString
|
|
color constant.string "q"\(.*\)""
|
|
color constant.string "q"\{.*\}""
|
|
color constant.string "q"\[.*\]""
|
|
color constant.string "q"<.*>""
|
|
color constant.string start="q"[^({[<"][^"]*$" end="^[^"]+""
|
|
color constant.string "q"([^({[<"]).*""
|
|
|
|
### TokenString
|
|
### True token strings require nesting, so, again, they can't be implemented accurately here.
|
|
### At the same time, the intended purpose of token strings makes it questionable to highlight them as strings at all.
|
|
## color ,magenta start="q\{" end="\}"
|
|
|
|
## Comments
|
|
## NB: true nested brightblacks are impossible to implement with plain regex
|
|
color comment "//.*"
|
|
color comment start="/\*" end="\*/"
|
|
color comment start="/\+" end="\+/"
|