-
Notifications
You must be signed in to change notification settings - Fork 5
/
Oz.sublime-syntax
113 lines (93 loc) · 2.74 KB
/
Oz.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
112
113
%YAML 1.2
---
name: Oz
file_extensions: [oz]
scope: source.oz
contexts:
main:
# Double-quoted String
- match: '"'
scope: punctuation.definition.string.begin.oz
push: double_quoted_string
# Multi-line Comment
- match: '/\*'
scope: comment.block.documentation.oz
push: multiline_comment
# Line Comment
- match: '%'
scope: punctuation.definition.comment.oz
push: line_comment
# Import Declarations
- match: '\bimport\b'
scope: keyword.control.oz
push: import_block
# Proc Declarations
- match: '\b(fun|proc)\b\s+\{([\$\w]+)((?:\s\w+)*)\}'
name: meta.function.oz
captures:
1: keyword.control.proc.oz
2: entity.name.function.oz
3: variable.parameter.function.oz
# Proc Applications
- match: '\{'
push: proc_application
# Keywords
- match: '\b(andthen|at|attr|case|catch|class|choice|cond|declare|define|do|dis|else|elsecase|elseif|end|export|feat|finally|for|from|fun|functor|if|in|import|lex|local|lock|meth|mode|not|of|or|orelse|parser|prepare|proc|prod|prop|raise|require|scanner|skip|suchthat|syn|then|thread|token|try)\b'
scope: keyword.control.oz
# Language Constants
- match: '\b(nil|true|false)\b'
scope: keyword.constant.oz
# Numbers
- match: '\b[+-]?\d+(\.\d+)?\b'
scope: constant.numeric.oz
# Read-write Cells
- match: '(@)[A-Z]\w*'
name: variable.other.readwrite.cell.oz
# Assignment Operator
- match: '=|:='
scope: keyword.operator.assignement.oz
# Comparison Operators
- match: '<|=<|==|\\=|>=|>'
scope: keyword.operator.comparison.oz
# Math Operators
- match: '(\*|\+|\-|/|~)|\b(div|mod)\b'
scope: keyword.operator.arithmetic.oz
# Virtual String Operator
- match: '#'
scope: keyword.operator.string.virtual.oz
# Cons Operator
- match: '\b\|\b'
scope: keyword.operator.list.oz
# Array Brackets
- match: '\[|\]'
name: punctuation.section.array.oz
double_quoted_string:
- meta_scope: string.quoted.double.oz
- match: '\\.'
scope: constant.character.escape.oz
- match: '"'
scope: punctuation.definition.string.end.oz
pop: true
multiline_comment:
- meta_scope: comment.multiline.oz
- match: '\*/'
pop: true
line_comment:
- meta_scope: comment.line.oz
- match: '$\n?'
pop: true
proc_application:
- meta_scope: meta.function.oz
- match: '\w+\.'
scope: entity.name.section.oz
- match: '\w+'
scope: entity.name.function.oz
pop: true
- match: '.*'
pop: true
import_block:
- match: '\bdefine\b'
scope: keyword.control.oz
pop: true
- match: '\w+'
scope: entity.name.section.oz