-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathambients.sublime-syntax
72 lines (64 loc) · 1.7 KB
/
ambients.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
%YAML 1.2
---
# See http://www.sublimetext.com/docs/3/syntax.html
name: Ambients (ambicobjs ascii syntax)
file_extensions:
- amb
- ambient
scope: source
contexts:
main:
# Scope naming rules:
# https://www.sublimetext.com/docs/3/scope_naming.html
# Strings
- match: '"'
scope: punctuation.definition.string.begin
push: double_quoted_string
# Comments (not part of the ambient ascii syntax)
- match: '//'
scope: punctuation.definition.comment
push: line_comment
# Ambient Calculus Keywords
- match: '\b(in|in_|out|out_|open|open_|nu|rec)\b'
scope: keyword.operator
# Ambients Protocol Primitives
- match: '\b(func|arg|call|return)\b'
scope: constant.numeric
# Primitives - types
- match: '\b(address)\b'
scope: string.quoted.single
- match: '\b(string|int|bool)\b'
scope: string.quoted.single
# Pipe
- match: '\b\s|\||\s\b'
scope: keyword.operator
# Brackets
- match: '\b\s|\]|\s\b'
scope: entity.name.class
- match: '\b\[|\s\b'
scope: entity.name.class
# Parenthesis
- match: '\b\s|\)|\s\b'
scope: entity.name.class
- match: '\b\s|\(|\s\b'
scope: entity.name.class
# Dot
- match: '\b\.\b'
scope: entity.name.class
# Recursion start/end
- match: '[A-Z]\b'
scope: entity.name.class
# Numbers
- match: '\b(-)?[0-9]+\b'
scope: constant.numeric
double_quoted_string:
- meta_scope: string.quoted.double
- match: '\\.'
scope: constant.character.escape
- match: '"'
scope: punctuation.definition.string.end
pop: true
line_comment:
- meta_scope: comment.line
- match: $
pop: true