-
Notifications
You must be signed in to change notification settings - Fork 0
/
qlang.sublime-syntax
112 lines (90 loc) · 3.05 KB
/
qlang.sublime-syntax
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
%YAML 1.2
---
# See http://www.sublimetext.com/docs/3/syntax.html
# scope http://stackoverflow.com/questions/10834765/where-to-find-a-list-of-scopes-for-sublime2-or-textmate
# author: DamonChen
# date: 2016-05-20
name: qlang
file_extensions:
- ql
- qlang
scope: source.qlang
contexts:
main:
# Strings begin and end with quotes, and use backslashes as an escape
# character
- match: '"'
scope: punctuation.definition.string.begin.qlang
push: double_quoted_string
- match: '`'
scope: punctuation.definition.string.triple.qlang
push: triple_quoted_string
# Comments begin with a '//' and finish at the end of the line
- match: '//'
scope: punctuation.definition.comment.qlang
push: line_comment
# Keywords are if, else for and while.
# Note that blackslashes don't need to be escaped within single quoted
# strings in YAML. When using single quoted strings, only single quotes
# need to be escaped: this is done by using two single quotes next to each
# other.
- match: '\b(break|case|chan|const|continue|default|defer|else|elif|fallthrough|for|go|goto|if|import|export|map|include|import|range|return|select|switch|type|new)\b'
scope: keyword.control.qlang
- match: '\b(this)\b'
scope: variable.language.qlang
# type
- match: '\b(bool|byte|float|int|int8|int16|int32|int64|uint|uint8|uint16|uint32|uint64|string|class|fn)\b'
scope: storage.type.qlang
# builtin method
- match: '\b(append|copy|delete|get|len|cap|mkmap|mapFrom|mapOf|panic|panic|printf|println|fprintln|set|mkslice|slice|sliceFrom|sliceOf|sub|type|min|max|main|_init)\b'
scope: support.function.qlang
# predeclared
- match: '\b(undefined|false|true|iota|nil)\b'
scope: constant.language.qlang
# support
- match: '\b(bufio|builtin|bytes|chan|compress|crypto|encoding|errors|io|math|meta|net|os|path|reflect|runtime|strconv|^strings$|sync|fmt|http)\b'
scope: 'support.class.qlang'
# Numbers
- match: '\b(-)?[0-9.]+\b'
scope: constant.numeric.qlang
- match: \(
push: brackets
- match: \)
scope: invalid.illegal.stray-bracket-end
- match: \[
push: square_brackets
- match: \]
scope: invalid.illegal.stray-bracket-end
- match: \{
push: braces
- match: \}
scope: invalid.illegal.stray-bracket-end
double_quoted_string:
- meta_scope: string.quoted.double.qlang
- match: '\\.'
scope: constant.character.escape.qlang
- match: '"'
scope: punctuation.definition.string.end.qlang
pop: true
- meta_include_prototype: false
triple_quoted_string:
- meta_scope: string.quoted.triple.qlang
- match: '`'
scope: punctuation.definition.triple.end.qlang
pop: true
line_comment:
- meta_scope: comment.line.qlang
- match: $
pop: true
- meta_include_prototype: false
brackets:
- match: \)
pop: true
- include: main
square_brackets:
- match: \]
pop: true
braces:
- match: \}
pop: true
- include: main