aboutsummaryrefslogtreecommitdiffhomepage
path: root/misc/syntax/slul.lang
blob: 04bf41e34c5c1e8e637537344ef355333ad138a2 (plain)
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

# GNU source-highlight syntax definitions for SLUL
#
# Copyright © 2023-2024 Samuel Lidén Borell <samuel@kodafritt.se>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.

environment preproc start '^\\[[:alnum:]]+' begin
    include "url.lang"
end

environment comment delim '^#\{\{' '^#\}\}.*$' multiline nested begin
  include "url.lang"
  include "todo.lang"
end

environment comment start "#" begin
    include "url.lang"
    include "todo.lang"
end

label = '^[[:blank:]]*[[:alnum:]]+:[[:blank:]]*\z'

number = '\<[[:digit:]]+(\.[[:digit:]]+)?([eE][+-]?[[:digit:]]+)?|0x[[:xdigit:]]+|0b[01]+\>'

include "c_string.lang"

keyword = "func|type|data",
          "assert|if|else|for|in|while|do|switch",
          "case|default|subcase|loopend|loopempty",
          "break|continue|goto|return",
          "and|bitand|bitor|bitnot|bitxor|deref|not|or|ref_is|ref_is_not|refto|shl|shr",
          "lifetime|since|noreturn",
          "false|none|true|undef",
          "this"

type = "aliased|arena|byte|bool|closed|enum|fileoffs",
       "int|uint|wuint|int8|wuint8|int16|uint16|wuint16",
       "int32|uint32|wuint32|int64|uint64|wuint64",
       "own|ref|slot|funcref|ssize|usize|string|struct|threaded|var|writeonly"

usertype = '\<[A-Z][[:alnum:]]*\>'

symbol = "-","+","*","/","[+-/*!<>=]?=","<",">","->"

cbracket = "{|}"

# definitions of generic functions and methods:
# func Type<...>.function_name<...>(...)
(keyword,normal,function) = `(^func)([[:blank:]]+(?:[^#.]+\.])?)([[:alnum:]]+(?=[[:blank:]]*(?:<[^(]*>[[:blank:]]*)?\())`

# function calls
include "function.lang"