dotfiles

My personal dotfiles 💠️

idris.sublime-syntax (4914B)

      1 %YAML 1.2
      2 ---
      3 # See https://www.sublimetext.com/docs/3/syntax.html
      4 # See https://www.sublimetext.com/docs/3/scope_naming.html
      5 name: Idris
      6 file_extensions:
      7   - idr
      8 scope: source.idris
      9 
     10 contexts:
     11   # The prototype context is prepended to all contexts but those setting
     12   # meta_include_prototype: false.
     13   prototype:
     14     - include: comments
     15 
     16   main:
     17     # The main context is the initial starting point of our syntax.
     18     # Include other contexts from here (or specify them directly).
     19     - include: keywords
     20     - include: numbers
     21     - include: strings
     22     - include: function_signature
     23     - include: type
     24 
     25   keywords:
     26     # Keywords are if, else for and while.
     27     # Note that blackslashes don't need to be escaped within single quoted
     28     # strings in YAML. When using single quoted strings, only single quotes
     29     # need to be escaped: this is done by using two single quotes next to each
     30     # other.
     31     - match: \b(if|then|else|do|let|in|codata|record|dsl)\b
     32       scope: keyword.control.idris
     33     - match: \b(impossible|case|of|total|partial|mutual|infix|infixl|infixr)\b
     34       scope: keyword.control.idris
     35     - match: \b(where|with|syntax|proof|postulate|using|namespace|class|instance|interface|implementation|record|rewrite)\b
     36       scope: keyword.control.idris
     37     - match: \b(public|private|export|implicit)\b
     38       scope: keyword.control.idris
     39     - match: ^(module)\b
     40       scope: keyword.other.idris
     41     - match: \b(data)\b
     42       scope: keyword.other.idris
     43     - match: ^(import)\b
     44       scope: keyword.control.import
     45 
     46   numbers:
     47     - match: \b(S|Z)\b
     48       scope: constant.numeric.idris
     49     - match: \b([0-9]+|0([xX][0-9a-fA-F]+|[oO][0-7]+))\b
     50       scope: constant.numeric.idris
     51     - match: \b([0-9]+\.[0-9]+([eE][+-]?[0-9]+)?|[0-9]+[eE][+-]?[0-9]+)\b
     52       scope: constant.numeric.float.idris
     53 
     54   strings:
     55     - match: '"'
     56       scope: punctuation.definition.string.begin.idris
     57       push:
     58         - meta_include_prototype: false
     59         - meta_scope: string.quoted.double.idris
     60         - match: '\\(NUL|SOH|STX|ETX|EOT|ENQ|ACK|BEL|BS|HT|LF|VT|FF|CR|SO|SI|DLE|DC1|DC2|DC3|DC4|NAK|SYN|ETB|CAN|EM|SUB|ESC|FS|GS|RS|US|SP|DEL|[abfnrtv\\\"''\&])'
     61           scope: constant.character.escape.ascii.idris
     62         - match: \\o[0-7]+|\\x[0-9A-Fa-f]+|\\[0-9]+
     63           scope: constant.character.escape.octal.idris
     64         - match: \^[A-Z@\[\]\\\^_]
     65           scope: constant.character.escape.control.idris
     66         - match: '"'
     67           scope: punctuation.definition.string.end.idris
     68           pop: true
     69       
     70     - match: \'
     71       scope: constant.character.escape.control.idris
     72       push:
     73         - meta_include_prototype: false
     74         - meta_scope: string.quoted.single.idris
     75         - match: '\\(NUL|SOH|STX|ETX|EOT|ENQ|ACK|BEL|BS|HT|LF|VT|FF|CR|SO|SI|DLE|DC1|DC2|DC3|DC4|NAK|SYN|ETB|CAN|EM|SUB|ESC|FS|GS|RS|US|SP|DEL|[abfnrtv\\\"''\&])'
     76           scope: constant.character.escape.ascii.idris
     77         - match: \\o[0-7]+|\\x[0-9A-Fa-f]+|\\[0-9]+
     78           scope: constant.character.escape.octal.idris
     79         - match: \^[A-Z@\[\]\\\^_]
     80           scope: constant.character.escape.control.idris
     81         - match: \'
     82           scope: punctuation.definition.string.end.idris
     83           pop: true
     84 
     85   comments:
     86     - match: --
     87       scope: punctuation.definition.comment.idris
     88       push:
     89         - meta_scope: comment.line.idris
     90         - match: $\n?
     91           pop: true
     92     - match: '{-'
     93       scope: punctuation.definition.comment.idris
     94       push:
     95         - meta_scope: comment.block.idris
     96         - match: '-}'
     97           pop: true
     98     - match: \|\|\|
     99       scope: punctuation.definition.comment.idris
    100       push:
    101         - meta_scope: comment.block.documentation.idris
    102         - match: $\n?
    103           pop: true
    104 
    105   function_declarations:
    106     - include: function_signature
    107 
    108   function_signature:
    109     - match: '^(\s*)(?!--)(?:(\(\W\)|[\w'']+)|[\(\[])(?=[\s\[\]\(\)]*(?:\s*)((?::)|\u2237))'
    110       captures:
    111         2: entity.name.function.idris
    112       push:
    113         - meta_scope: meta.declaration.function.idris
    114         - match: '^(?!\1\s)|(?=})'
    115           pop: true
    116         - match: (?=.*((:)|\u2237))
    117           captures:
    118             1: keyword.name.function.idris
    119           push:
    120             - meta_scope: meta.declaration.function.names.idris
    121             - match: ((:)|\u2237)
    122               captures:
    123                 1: keyword.other.colon.idris
    124               pop: true
    125             - match: '([a-z_][\w'']*|\(\W+\))'
    126               scope: entity.name.function.idris
    127         - include: type
    128         - match: '\b[A-Z][\w'']*'
    129           scope: entity.name.type.idris
    130 
    131   type:
    132     - match: \b(Type|Int|Nat|Integer|Float|Char|String|Ptr|Bits8|Bits16|Bits32|Bits64|Bool)\b
    133       scope: storage.type.idris
    134     - match: \(\)
    135       scope: constant.language.idris
    136     - match: \s*(->|\u2192)\s*
    137       scope: keyword.operator.arrow.idris
    138     - match: \s*(=>|\u21D2)\s*
    139       scope: keyword.operator.big-arrow.idris