Debian Codegraph @

runtime/syntax/octave.yaml

raw
1 # References
2 # https://github.com/zyedidia/micro/blob/master/runtime/syntax/go.yaml
3 # https://github.com/vim-scripts/octave.vim--/blob/master/syntax/octave.vim
4 #
5 # TODO
6 # include only needed operators
7 # ... highlighting
8 # built-in function highlighting?
9 # highlight eps/pi/e etc. as functions when followed by ()
10 # what are skip and error fields in strings?
11 # multiline comments not working
12
13 filetype: octave
14
15 detect:
16 filename: "\\.m$"
17
18 rules:
19 # Statements https://www.gnu.org/software/octave/doc/v4.0.0/Statements.html
20 - statement: "\\b(function|endfunction|return|end|global|persistent)\\b"
21 - statement: "\\b(if|elseif|else|endif|switch|case|otherwise|endswitch)\\b"
22 - statement: "\\b(while|endwhile|do|until|for|endfor|parfor|endparfor|break|continue)\\b"
23 - statement: "\\b(unwind_protect|unwind_protect_cleanup|end_unwind_protect|try|catch|end_try_catch)\\b"
24
25 # Operators
26 - symbol.operator: "[-+/*=<>!~%&|^]|:="
27
28 # Brackets
29 - symbol.brackets: "(\\{|\\})"
30 - symbol.brackets: "(\\(|\\))"
31 - symbol.brackets: "(\\[|\\])"
32
33 # Commas
34 - symbol: ","
35
36 # Numbers https://www.gnu.org/software/octave/doc/v4.0.1/Mathematical-Constants.html
37 - constant.number: "\\b([0-9]+|0x[0-9a-fA-F]*)\\b|'.'"
38 - constant.number: "\\b(pi|e|I|Inf|NaN|eps|realmax|realmin)\\b|"
39
40 # Boolean
41 - constant.bool: "\\b(true|false)\\b"
42
43 # Strings https://www.gnu.org/software/octave/doc/v4.0.1/Strings.html
44 - constant.string:
45 start: "\""
46 end: "\""
47 skip: "\\\\."
48 rules:
49 - constant.specialChar: "%"
50 - constant.specialChar: "\\\\[abfnrtv'\\\"\\\\]"
51 - constant.specialChar: "\\\\([0-7]{3}|x[A-Fa-f0-9]{2}|u[A-Fa-f0-9]{4}|U[A-Fa-f0-9]{8})"
52
53 - constant.string:
54 start: "'"
55 end: "'"
56 skip: "\\\\."
57 rules:
58 - error: "..+"
59 - constant.specialChar: "%"
60 - constant.specialChar: "\\\\[abfnrtv'\\\"\\\\]"
61 - constant.specialChar: "\\\\([0-7]{3}|x[A-Fa-f0-9]{2}|u[A-Fa-f0-9]{4}|U[A-Fa-f0-9]{8})"
62
63 # Comments https://www.gnu.org/software/octave/doc/v4.2.1/Comments.html
64 - comment:
65 start: "%"
66 end: "$"
67 rules:
68 - todo: "(TODO|XXX|FIXME):?"
69 - comment:
70 start: "#"
71 end: "$"
72 rules:
73 - todo: "(TODO|XXX|FIXME):?"
74 - comment:
75 start: "%{"
76 end: "%}"
77 rules:
78 - todo: "(TODO|XXX|FIXME):?"
79 - comment:
80 start: "#{"
81 end: "#}"
82 rules:
83 - todo: "(TODO|XXX|FIXME):?"