summaryrefslogtreecommitdiff
path: root/dot_config/micro/syntax/rc.yaml
blob: 62b0c85d5cfcaa5c8d184b3fa7a959ec86f2ab1e (plain) (blame)
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
filetype: p9rc

# this is all buggy and shitty but it's better than nothing lmao

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

rules:
    # Flow control
    - statement: "\\b(if|else|while|for|in|switch|case|fn)\\b"

    # Logical operators
    - special: "(\\!|\\|\\||&&|~|\\^|=|`)"

    # Builtins
    - type: "\\b(\\.|break|builtin|cd|continue|echo|eval|exec|exit|flag|limit|newgrp|return|shift|umask|wait|whatis)\\b"

    # Variables
    - identifier: "\\$(\"|\\^)?[0-9A-Za-z_!@#$*?-]+(\\([^\\)]*\\))?"

    # String literals
    - constant.string:
        start: "'"
        end: "'"
        rules: []

    - comment:
        start: "(^|\\s)#"
        end: "$"
        rules:
            - todo: "(TODO|XXX|FIXME):?"