File: swift.yaml

package info (click to toggle)
micro 2.0.15-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,828 kB
  • sloc: sh: 247; makefile: 77; xml: 53
file content (103 lines) | stat: -rw-r--r-- 4,437 bytes parent folder | download
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
filetype: swift

detect:
    filename: "\\.swift$"
    header: "^#!.*bin/(env +)?swift( |$)"

rules:

    # Patterns
    - type: \b(_)\b

    # Operators
    - symbol.operator: ([.:;,+*|=!?\\%]|<|>|/|-|&)

    # Declaration Keywords
    - statement.declaration: \b(associatedtype|class|deinit|enum|extension|fileprivate|func|import|init)\b
    - statement.declaration: \b(inout|internal|let|open|operator|private|protocol|public|static|struct|subscript|typealias|var)\b

    # Statements Keywords
    - statement: \b(break|case|continue|default|defer|do|else|fallthrough|for|guard)\b
    - statement: \b(if|inif|repeat|return|switch|where|while)\b

    # keyword.reserved
    - statement.reserved: \b(associativity|convenience|dynamic|didSet|final|get|infix|indirect|lazy|left|mutating)\b
    - statement.reserved: \b(none|nonmutating|override|postfix|precedence|prefix|Protocol|required)\b
    - statement.reserved: \b(right|set|Type|unowned|weak|willSet)\b

    # Expression and types
    - type: \b(as|Any|catch|is|rethrows|super|self|throw|throws|try)\b

    - statement.built_in: \b(abs|advance|alignof|alignofValue|anyGenerator|assert|assertionFailure|bridgeFromObjectiveC)\b
    - statement.built_in: \b(bridgeFromObjectiveCUnconditional|bridgeToObjectiveC|bridgeToObjectiveCUnconditional|contains)\b
    - statement.built_in: \b(count|countElements|countLeadingZeros|debugPrint|debugPrintln|distance|dropFirst|dropLast|dump|encodeBitsAsWords)\b
    - statement.built_in: \b(enumerate|equal|fatalError|filter|find|getBridgedObjectiveCType|getVaList|indices|insertionSort)\b
    - statement.built_in: \b(isBridgedToObjectiveC|isBridgedVerbatimToObjectiveC|isUniquelyReferenced|isUniquelyReferencedNonObjC)\b
    - statement.built_in: \b(join|lexicographicalCompare|map|max|maxElement|min|minElement|numericCast|overlaps|partition|posix)\b
    - statement.built_in: \b(precondition|preconditionFailure|print|println|quickSort|readLine|reduce|reflect)\b
    - statement.built_in: \b(reinterpretCast!reverse|roundUpToAlignment|sizeof|sizeofValue|sort|split|startsWith|stride)\b
    - statement.built_in: \b(strideof|strideofValue|swap|toString|transcode|underestimateCount|unsafeAddressOf|unsafeBitCast)\b
    - statement.built_in: \b(unsafeDowncast|unsafeUnwrap|unsafeReflect|withExtendedLifetime|withObjectAtPlusZero|withUnsafePointer)\b
    - statement.built_in: \b(withUnsafePointerToObject|withUnsafeMutablePointer|withUnsafeMutablePointers|withUnsafePointer)\b
    - statement.built_in: \b(withUnsafePointers|withVaList|zip)\b

    # Meta
    - statement.meta: \@\b(autoclosure|available|convention|exported|IBAction|IBDesignable|IBOutlet|IBInspectable|infix)\b
    - statement.meta: \@\b(lazy|noreturn|noescape|nonobjc|NSApplicationMain|NSCopying|NSManaged|objc|prefix|postfix)\b
    - statement.meta: \@\b(required|testable|warn_unused_result|UIApplicationMain)\b

    #preprocessor
    - preproc: ^[[:space:]]*#[[:space:]]*(define|else|elseif|endif|if|selector)\b
    - preproc.DebugIdentifier: \b(__COLUMN__|__FILE__|__FUNCTION__|__LINE__)\b
    - preproc.DebugIdentifier: ^[[:space:]]*#[[:space:]]*(column|file|function|line)\b

    # Constant
    - constant: \b(true|false|nil)
    - constant.number: ([0-9]+)

    # Storage Types
    - type.storage: \b((U)?Int(8|16|32|64))\b
    - type.storage: \b(Int|UInt|String|Bit|Bool|Character|Double|Optional|Float|Range)\b
    - type.storage: \b(AnyObject)\b

    # Collections
    - type.collections: \b(Array|Dictionary|Set)\b

    # Ctypes
    - type.ctypes: \b(CBool|CChar|CUnsignedChar|CShort|CUnsignedShort|CInt|CUnsignedInt|CLong|CUnsignedLong|CLongLong|CUnsignedLongLong|CWideChar|CChar16|CChar32|CFloat|CDouble)\b

    # String
    - constant.string:
        start: \"
        end: \"
        skip: \\.
        rules:
            - constant.specialChar: (\\0|\\\\|\\t|\\n|\\r|\\"|\\')
            - constant.interpolation: \\\([[:graph:]]*\)
            - constant.unicode: \\u\{[[:xdigit:]]+}

    # Shebang Line
    - comment.shebang: ^(#!).*

    # Doc Comment
    - comment.doc: (///).*

    # Line Comment
    - comment.line: "//.*"

    # Block Comment
    - comment.block:
        start: "/\\*"
        end: "\\*/"
        rules:
            - todo: "(TODO|XXX|FIXME):?"

    # Doc Block Comment
    - comment.block:
        start: "/\\*\\*"
        end: "\\*/"
        rules:
            - todo: "(TODO|XXX|FIXME):?"

    # Todo
    - todo: "(TODO|XXX|FIXME):?"