-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathr.sublime-syntax
58 lines (50 loc) · 1.53 KB
/
r.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
%YAML 1.2
---
name: RNB
file_extensions:
- [r R]
scope: RNBscheme
variables:
ident: '[A-Za-z_][A-Za-z_0-9]*'
contexts:
prototype:
- include: comments
comments:
# Block comments begin with {= and ends with =}
- match: '{='
scope: punctuation.definition.comment.c
push:
- meta_scope: comment.block.c
- match: '=}'
pop: true
# Inline comments begin with a '==' and finish at the end of the line.
- match: '=='
scope: punctuation.definition.comment.c
push:
# This is an anonymous context push for brevity.
- meta_scope: comment.line.double-slash.c
- match: $\n?
pop: true
main:
- match: '\b(if|else|loop|end|elseif|case|ref|const|valres|res|while|create|exit|exiton|local|do|until|for|foreach|continue|return|proc|func|is| and| or| not)\b'
scope: constant.language
- match: '\b(int|real|char|string|bool|Array)\b'
scope: storage.type
- match: '\b{{ident}}\b'
scope: entity.name.function
# Strings begin and end with quotes, and use backslashes as an escape
# character
- match: '"'
scope: punctuation.definition.string.begin.example-c
push: double_quoted_string
# Comments begin with a '==' and finish at the end of the line
# Numbers
- match: '\b(-)?[0-9.]+\b'
scope: constant.numeric
double_quoted_string:
- meta_scope: entity.name.tag
- match: '\\.'
scope: entity.name.tag
- match: '"'
scope: punctuation.definition.string.end
pop: true