prism-jsstacktrace.js 982 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. Prism.languages.jsstacktrace = {
  2. 'error-message': {
  3. pattern: /^\S.*/m,
  4. alias: 'string'
  5. },
  6. 'stack-frame': {
  7. pattern: /(^[ \t]+)at[ \t].*/m,
  8. lookbehind: true,
  9. inside: {
  10. 'not-my-code': {
  11. pattern: /^at[ \t]+(?!\s)(?:node\.js|<unknown>|.*(?:node_modules|\(<anonymous>\)|\(<unknown>|<anonymous>$|\(internal\/|\(node\.js)).*/m,
  12. alias: 'comment'
  13. },
  14. 'filename': {
  15. pattern: /(\bat\s+(?!\s)|\()(?:[a-zA-Z]:)?[^():]+(?=:)/,
  16. lookbehind: true,
  17. alias: 'url'
  18. },
  19. 'function': {
  20. pattern: /(\bat\s+(?:new\s+)?)(?!\s)[_$a-zA-Z\xA0-\uFFFF<][.$\w\xA0-\uFFFF<>]*/,
  21. lookbehind: true,
  22. inside: {
  23. 'punctuation': /\./
  24. }
  25. },
  26. 'punctuation': /[()]/,
  27. 'keyword': /\b(?:at|new)\b/,
  28. 'alias': {
  29. pattern: /\[(?:as\s+)?(?!\s)[_$a-zA-Z\xA0-\uFFFF][$\w\xA0-\uFFFF]*\]/,
  30. alias: 'variable'
  31. },
  32. 'line-number': {
  33. pattern: /:\d+(?::\d+)?\b/,
  34. alias: 'number',
  35. inside: {
  36. 'punctuation': /:/
  37. }
  38. },
  39. }
  40. }
  41. };