-
Notifications
You must be signed in to change notification settings - Fork 25
/
Copy pathConsole.sublime-syntax
107 lines (101 loc) · 3.43 KB
/
Console.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
%YAML 1.2
---
name: Console
scope: source.console
contexts:
main:
- match: '^(▍)'
scope: constant.character.escape.console
push:
- match: '\[([^\]]+)\]\(([^#]+)#L(\d+)\):'
captures:
1: entity.name.component.console
2: entity.name.file.console
3: constant.numeric.line.console
- match: '\[INFO\]'
scope: support.type.info.console
- match: '\[DEBUG\]'
scope: support.type.debug.console
- match: '\[ERROR\]'
scope: constant.character.escape.console
- match: '\[WARNING\]'
scope: constant.character.escape.console
- match: '\[STATUS\]'
scope: constant.character.escape.console
- match: '(Command|Fixed command|Args):\s*[\[{]'
push: command_arguments
- match: 'Extended commands:\s*\['
push: extended_arguments
- match: '(Syntax|syntax|UID|uid|method):\s*([^\s\(\)]+)'
captures:
2: string.console
- match: '(Mode|Scope|Target):\s*(.+)'
captures:
2: string.console
# Matches paths on Windows, MacOS, and Linux
- match: '([a-zA-Z]:\\[^*|"<>?\n\r]*|\/[^*|"<>?\n\r]*)'
scope: string.path.console
# Match content inside quote ""
- match: '"([^"]+)"'
captures:
1: string.console
- match: '\n'
pop: true
# Match traceback logs with the 'Traceback' header
- match: '^Traceback \(most recent call last\):'
scope: keyword.control.exception.console
push: traceback
# Match traceback logs without the 'Traceback' header
- match: '^\s*File "([^"]+)", line (\d+), in ([^\n]+)'
captures:
1: string.path.console # File path
2: constant.numeric.line.console # Line number
3: entity.name.function.console # Function name
push: traceback
- match: '^(={87})$'
scope: constant.character.escape.console
push:
# Match numbers, excluding those preceded or followed by '%'
- match: '(?<!%)\b\d+\b(?!%)'
scope: constant.character.escape.console
# Matches a sequence of ^^^ and ~~~ and ××× signs
- match: '[\^~×⚠⚡]+'
scope: constant.character.escape.console
# Matches a sequence of !!! and >>> signs
- match: '[\!>]+'
scope: keyword.console
- match: '^(={87})$'
scope: constant.character.escape.console
pop: true
- match: '[^\n]+'
scope: text.console
command_arguments:
- match: '\]'
pop: true
- match: "'([^']*)'"
captures:
1: keyword.console
- match: ','
scope: punctuation.separator.console
extended_arguments:
- match: '\]'
pop: true
- match: '\['
push: command_arguments
traceback:
- match: '^\s*File "([^"]+)", line (\d+), in ([^\n]+)'
captures:
1: string.path.console # File path
2: constant.numeric.line.console # Line number
3: entity.name.function.console # Function name
# Match the 'raise ErrorType' pattern
- match: '\s+raise\s+([A-Za-z_]\w*)'
captures:
1: support.class.exception.console
# Match the 'ErrorType:' at the end of the traceback
- match: '^([A-Za-z_]\w*):'
captures:
1: support.class.exception.console
# Exit traceback context when there is no more indentation
- match: '^\S'
pop: true