micro/runtime/syntax/csharp.yaml

53 lines
2.1 KiB
YAML
Raw Normal View History

filetype: csharp
2017-03-21 21:55:22 +03:00
detect:
2017-03-29 16:21:54 +03:00
filename: "\\.cs$"
2017-03-21 21:55:22 +03:00
rules:
# Class
2017-03-21 21:55:22 +03:00
- identifier.class: "class +[A-Za-z0-9]+ *((:) +[A-Za-z0-9.]+)?"
# Annotation
2017-03-21 21:55:22 +03:00
- identifier.var: "@[A-Za-z]+"
- preproc: "^[[:space:]]*#[[:space:]]*(define|elif|else|endif|endregion|error|if|line|nullable|pragma|region|undef|warning)"
- identifier: "([A-Za-z0-9_]*[[:space:]]*[()])"
- type: "\\b(bool|byte|sbyte|char|decimal|double|float|IntPtr|int|uint|long|ulong|managed|unmanaged|nint|nuint|object|short|ushort|string|base|this|var|void)\\b"
- statement: "\\b(alias|as|case|catch|checked|default|do|dynamic|else|finally|fixed|for|foreach|goto|if|is|lock|new|null|return|switch|throw|try|unchecked|when|while|with)\\b"
- statement: "\\b(abstract|add|and|args|async|await|class|const|delegate|enum|event|explicit|extern|file|get|global|implicit|in|init|internal|interface|nameof|namespace|not|notnull|operator|or|out|override|params|partial|private|protected|public|readonly|record|ref|remove|required|scoped|sealed|set|sizeof|stackalloc|static|struct|typeof|unsafe|using|value|virtual|volatile|yield)\\b"
# LINQ-only keywords (ones that cannot be used outside of a LINQ query - lots others can)
2017-03-21 21:55:22 +03:00
- statement: "\\b(from|where|select|group|info|orderby|join|let|in|on|equals|by|ascending|descending)\\b"
- special: "\\b(break|continue)\\b"
- constant.bool: "\\b(true|false)\\b"
- symbol.operator: "[\\-+/*=<>?:!~%&|]"
- constant.number: "\\b([0-9._]+|0x[A-Fa-f0-9_]+|0b[0-1_]+)[FL]?\\b"
- constant.string:
start: "\""
end: "\""
2017-03-29 16:45:16 +03:00
skip: "\\\\."
rules:
- constant.specialChar: "\\\\([btnfr]|'|\\\"|\\\\)"
- constant.specialChar: "\\\\u[A-Fa-f0-9]{4}"
- constant.string:
start: "'"
end: "'"
2017-03-29 16:45:16 +03:00
skip: "\\\\."
rules:
- constant.specialChar: "\\\\([btnfr]|'|\\\"|\\\\)"
- constant.specialChar: "\\\\u[A-Fa-f0-9]{4}"
- comment:
start: "//"
end: "$"
rules:
- todo: "(TODO|XXX|FIXME):?"
2017-03-21 21:55:22 +03:00
- comment:
start: "/\\*"
end: "\\*/"
rules:
- todo: "(TODO|XXX|FIXME):?"