forked from PrismJS/prism
-
Notifications
You must be signed in to change notification settings - Fork 0
/
prism-jsstacktrace.js
48 lines (40 loc) · 975 Bytes
/
prism-jsstacktrace.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
Prism.languages.jsstacktrace = {
'error-message': {
pattern: /^\S.*/m,
alias: 'string'
},
'stack-frame': {
pattern: /^[ \t]+at[ \t]+.*/m,
inside: {
'not-my-code': {
pattern: /[ \t]+at[ \t]+(?:node\.js|\<unknown\>|.*(?:node_modules|\(\<anonymous\>\)|\(\<unknown\>|\<anonymous\>$|\(internal\/|\(node\.js)).*/m,
alias: 'comment'
},
'filename': {
pattern: /(\bat\s+|\()(?:[a-zA-Z]:)?[^():]+(?=:)/,
lookbehind: true,
alias: 'url'
},
'function': {
pattern: /(at\s+(?:new\s+)?)[_$a-zA-Z\xA0-\uFFFF<][.$\w\xA0-\uFFFF<>]*/,
lookbehind: true,
inside: {
'punctuation': /\./
}
},
'punctuation': /[()]/,
'keyword': /\b(?:at|new)\b/,
'alias': {
pattern: /\[(?:as\s+)?[_$a-zA-Z\xA0-\uFFFF][$\w\xA0-\uFFFF]*\]/,
alias: 'variable'
},
'line-number': {
pattern: /:[0-9]+(?::[0-9]+)?\b/,
alias: 'number',
inside: {
'punctuation': /:/
}
},
}
}
}