File: rust.yaml

package info (click to toggle)
micro 2.0.15-1
  • links: PTS, VCS
  • area: main
  • in suites: forky
  • size: 2,828 kB
  • sloc: sh: 247; makefile: 77; xml: 53
file content (78 lines) | stat: -rw-r--r-- 2,156 bytes parent folder | download | duplicates (2)
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
filetype: rust

detect:
    filename: "\\.rs$"

rules:
    # function definition
    - identifier: "fn [a-z0-9_]+"
      # Reserved words
    - statement: "\\b(abstract|alignof|as|async|await|become|box|break|const|continue|crate|do|dyn|else|enum|extern|false|final|fn|for|gen|if|impl|in|let|loop|macro|match|mod|move|mut|offsetof|override|priv|pub|pure|ref|return|sizeof|static|self|struct|super|true|trait|type|typeof|try|union|unsafe|unsized|use|virtual|where|while|yield)\\b"
      # macros
    - special: "[a-z_]+!"
      # Constants
    - constant: "\\b[A-Z][A-Z_0-9]+\\b"
      # Numbers
    - constant.number: "\\b[0-9]+\\b"
      # Booleans
    - constant: "\\b(true|false)\\b"
      # Traits/Enums/Structs/Types/etc.
    - type: "\\b[A-Z]+[a-zA-Z_0-9]*[a-z]+[a-zA-Z_0-9]*\\b"
      # Builtin types that start with lowercase.
    - type: "\\b(bool|str|char|((i|u)(8|16|32|64|128|size))|f(16|32|64|128))\\b"

    - constant.string:
        start: "[bc]?\""
        end: "\""
        skip: '\\.'
        rules:
            - constant.specialChar: '\\.'

    - constant.string:
        start: "[bc]?r#\""
        end: "\"#"
        rules: []

    - constant.string:
        start: "[bc]?r##\""
        end: "\"##"
        rules: []

    - constant.string:
        start: "[bc]?r###\""
        end: "\"###"
        rules: []

    - constant.string:
        start: "[bc]?r####+\""
        end: "\"####+"
        rules: []

    # Character literals
    # NOTE: This is an ugly hack to work around the fact that rust uses
    # single quotes both for character literals and lifetimes.
    # Match all character literals.
    - constant.string: "'(\\\\.|.)'"
    # Match the '"' literal which would otherwise match
    # as a double quoted string and destroy the highlighting.
    - constant.string:
        start: "'\""
        end: "'"
        rules: []

    - comment:
        start: "//"
        end: "$"
        rules:
            - todo: "(TODO|XXX|FIXME):?"

    - comment:
        start: "/\\*"
        end: "\\*/"
        rules:
            - todo: "(TODO|XXX|FIXME):?"

    - special:
        start: "#!\\["
        end: "\\]"
        rules: []