forked from PrismJS/prism
-
Notifications
You must be signed in to change notification settings - Fork 0
/
prism-javastacktrace.js
93 lines (88 loc) · 2.41 KB
/
prism-javastacktrace.js
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
Prism.languages.javastacktrace = {
// java.sql.SQLException: Violation of unique constraint MY_ENTITY_UK_1: duplicate value(s) for column(s) MY_COLUMN in statement [...]
// Caused by: java.sql.SQLException: Violation of unique constraint MY_ENTITY_UK_1: duplicate value(s) for column(s) MY_COLUMN in statement [...]
// Caused by: com.example.myproject.MyProjectServletException
// Caused by: MidLevelException: LowLevelException
// Suppressed: Resource$CloseFailException: Resource ID = 0
'summary': {
pattern: /^[\t ]*(?:(?:Caused by:|Suppressed:|Exception in thread "[^"]*")[\t ]+)?[\w$.]+(?:\:.*)?$/m,
inside: {
'keyword': {
pattern: /^(\s*)(?:(?:Caused by|Suppressed)(?=:)|Exception in thread)/m,
lookbehind: true
},
// the current thread if the summary starts with 'Exception in thread'
'string': {
pattern: /^(\s*)"[^"]*"/,
lookbehind: true
},
'exceptions': {
pattern: /^(:?\s*)[\w$.]+(?=:|$)/,
lookbehind: true,
inside: {
'class-name': /[\w$]+(?=$|:)/,
'namespace': /[a-z]\w*/,
'punctuation': /[.:]/
}
},
'message': {
pattern: /(:\s*)\S.*/,
lookbehind: true,
alias: 'string'
},
'punctuation': /[:]/
}
},
// at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1166)
// at org.hsqldb.jdbc.Util.throwError(Unknown Source) here could be some notes
// at Util.<init>(Unknown Source)
'stack-frame': {
pattern: /^[\t ]*at [\w$.]+(?:<init>)?\([^()]*\)/m,
inside: {
'keyword': {
pattern: /^(\s*)at/,
lookbehind: true
},
'source': [
// (Main.java:15)
// (Main.scala:15)
{
pattern: /(\()\w+.\w+:\d+(?=\))/,
lookbehind: true,
inside: {
'file': /^\w+\.\w+/,
'punctuation': /:/,
'line-number': {
pattern: /\d+/,
alias: 'number'
}
}
},
// (Unknown Source)
// (Native Method)
// (...something...)
{
pattern: /(\()[^()]*(?=\))/,
lookbehind: true,
inside: {
'keyword': /^(?:Unknown Source|Native Method)$/
}
}
],
'class-name': /[\w$]+(?=\.(?:<init>|[\w$]+)\()/,
'function': /(?:<init>|[\w$]+)(?=\()/,
'namespace': /[a-z]\w*/,
'punctuation': /[.()]/
}
},
// ... 32 more
// ... 32 common frames omitted
'more': {
pattern: /^[\t ]*\.{3} \d+ [a-z]+(?: [a-z]+)*/m,
inside: {
'punctuation': /\.{3}/,
'number': /\d+/,
'keyword': /\b[a-z]+(?: [a-z]+)*\b/
}
}
};