-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsource.yaml
59 lines (52 loc) · 1.38 KB
/
source.yaml
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
import:
regex: import (.+)$
tokens: [package]
doc: To include(import package)
vartype:
regex: (\w+):(\w+)
tokens: [var,type]
doc: Declare var name(var:type)
indent:
regex: ^(<xcase>):<ind>3<ent>
tokens: [main,statements,tab]
doc: Indentation instead of curly brackets
statements:
call: [indent]
eachline: <line>; # Auto semicolon
replace: # Unwanted semicolon
- [':;',':']
- ['{;','{']
- ['};','}']
- [;;,;]
outcolon:
regex: (extern <xsemicolon>+)$
tokens: [line]
doc: Auto semicolon outside indented statements
match:
regex: \bmatch\b(.+):<ind>3<ent>
tokens: [arg,statements,tab]
doc: For auto break in switch-case
define:
regex: <tab>(\w+)\s*\bas\b\s*(.+)$
tokens: [tab,replace,var]
doc: 'For #define preprocessor directive(name as content)'
elif:
regex: \belif\b
tokens: [main]
doc: Else if statement
autobracket:
regex: '((?:switch|if|else if)) (.+){'
tokens: [before,arg]
doc: Auto bracket for arguments in if,switch(if arg)
arg:
replace:
- [\bor\b,'|']
- [\band\b, '&&']
- [\bnot\b\s*,'!']
settings:
variables:
case: '(?:case|match|default).+:' # Match case and match statement
xcase: (?:(?!<case>).)+ # Exclude case in switch-case and match statement
xsemicolon: (?:(?!;).) # Excude semicolon
author: name
lang: C