File: octave.yaml

package info (click to toggle)
micro 2.0.15-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 3,128 kB
  • sloc: sh: 265; makefile: 77; xml: 53
file content (83 lines) | stat: -rw-r--r-- 2,586 bytes parent folder | download | duplicates (4)
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
# References
# https://github.com/zyedidia/micro/blob/master/runtime/syntax/go.yaml
# https://github.com/vim-scripts/octave.vim--/blob/master/syntax/octave.vim
#
# TODO
# include only needed operators
# ... highlighting
# built-in function highlighting?
# highlight eps/pi/e etc. as functions when followed by ()
# what are skip and error fields in strings?
# multiline comments not working

filetype: octave

detect:
    filename: "\\.m$"

rules:
    # Statements https://www.gnu.org/software/octave/doc/v4.0.0/Statements.html
    - statement: "\\b(function|endfunction|return|end|global|persistent)\\b"
    - statement: "\\b(if|elseif|else|endif|switch|case|otherwise|endswitch)\\b"
    - statement: "\\b(while|endwhile|do|until|for|endfor|parfor|endparfor|break|continue)\\b"
    - statement: "\\b(unwind_protect|unwind_protect_cleanup|end_unwind_protect|try|catch|end_try_catch)\\b"

    # Operators
    - symbol.operator: "[-+/*=<>!~%&|^]|:="

    # Brackets
    - symbol.brackets: "(\\{|\\})"
    - symbol.brackets: "(\\(|\\))"
    - symbol.brackets: "(\\[|\\])"

    # Commas
    - symbol: ","

    # Numbers https://www.gnu.org/software/octave/doc/v4.0.1/Mathematical-Constants.html
    - constant.number: "\\b([0-9]+|0x[0-9a-fA-F]*)\\b|'.'"
    - constant.number: "\\b(pi|e|I|Inf|NaN|eps|realmax|realmin)\\b|"

    # Boolean
    - constant.bool: "\\b(true|false)\\b"

    # Strings https://www.gnu.org/software/octave/doc/v4.0.1/Strings.html
    - constant.string:
        start: "\""
        end: "\""
        skip: "\\\\."
        rules:
            - constant.specialChar: "%"
            - constant.specialChar: "\\\\[abfnrtv'\\\"\\\\]"
            - constant.specialChar: "\\\\([0-7]{3}|x[A-Fa-f0-9]{2}|u[A-Fa-f0-9]{4}|U[A-Fa-f0-9]{8})"

    - constant.string:
        start: "'"
        end: "'"
        skip: "\\\\."
        rules:
            - error: "..+"
            - constant.specialChar: "%"
            - constant.specialChar: "\\\\[abfnrtv'\\\"\\\\]"
            - constant.specialChar: "\\\\([0-7]{3}|x[A-Fa-f0-9]{2}|u[A-Fa-f0-9]{4}|U[A-Fa-f0-9]{8})"

    # Comments https://www.gnu.org/software/octave/doc/v4.2.1/Comments.html
    - comment:
        start: "%"
        end: "$"
        rules:
            - todo: "(TODO|XXX|FIXME):?"
    - comment:
        start: "#"
        end: "$"
        rules:
            - todo: "(TODO|XXX|FIXME):?"
    - comment:
        start: "%{"
        end: "%}"
        rules:
            - todo: "(TODO|XXX|FIXME):?"
    - comment:
        start: "#{"
        end: "#}"
        rules:
            - todo: "(TODO|XXX|FIXME):?"