Skip to content

Commit 08b77a2

Browse files
authored
Sublime Text Syntax
1 parent d6f1996 commit 08b77a2

File tree

1 file changed

+57
-0
lines changed

1 file changed

+57
-0
lines changed

onion.sublime-synta

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
%YAML 1.2
2+
---
3+
file_extensions:
4+
- oni
5+
- onion
6+
scope: source.onion
7+
contexts:
8+
main:
9+
# Strings begin and end with quotes, and use backslashes as an escape
10+
# character
11+
- match: '"'
12+
scope: punctuation.definition.string.begin.example-c
13+
push: double_quoted_string
14+
15+
# Comments begin with a '//' and finish at the end of the line
16+
- match: '//'
17+
scope: punctuation.definition.comment.example-c
18+
push: line_comment
19+
20+
# Keywords are if, else for and while.
21+
# Note that blackslashes don't need to be escaped within single quoted
22+
# strings in YAML. When using single quoted strings, only single quotes
23+
# need to be escaped: this is done by using two single quotes next to each
24+
# other.
25+
- match: '\b(if|else|for|while|do|def|try|init|class|foreach|E|PI|GOLDEN_RATIO|key_press|eval|length)\b'
26+
scope: keyword.declaration.function.inline
27+
- match: '\b(sin|cos|new_dictionary|add|cmd|throw_new_exception|get_by_key|input|sleep|new_arr|get_arr|sout_element|new_stack|get_stack|split|append|get_by_index|)\b'
28+
scope: entity.name.function
29+
- match: '\b(use|import)\b'
30+
scope: keyword.control.import
31+
- match: '\b(return|to|sout|not|print|stop|continue)\b'
32+
scope: markup.bold
33+
- match: '\b(exit|n)\b'
34+
scope: constant
35+
- match: '\b(var|as_var|variable|to_import)\b'
36+
scope: variable
37+
- match: '\b(true|false|to_string|to_bool|NULL|to_int)\b'
38+
scope: constant.character.escape
39+
- match: '\b(math)\b'
40+
scope: constant.character
41+
42+
# Numbers
43+
- match: '\b(-)?[0-9<>:;]+\b'
44+
scope: constant.numeric.example-c
45+
46+
double_quoted_string:
47+
- meta_scope: string.quoted.double.example-c
48+
- match: ''
49+
scope: constant.character.escape.example-c
50+
- match: '"'
51+
scope: punctuation.definition.string.end.example-c
52+
pop: true
53+
54+
line_comment:
55+
- meta_scope: comment.line.example-c
56+
- match: '$'
57+
pop: true

0 commit comments

Comments
 (0)