prism-erlang.js 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. Prism.languages.erlang = {
  2. 'comment': /%.+/,
  3. 'string': {
  4. pattern: /"(?:\\.|[^\\"\r\n])*"/,
  5. greedy: true
  6. },
  7. 'quoted-function': {
  8. pattern: /'(?:\\.|[^\\'\r\n])+'(?=\()/,
  9. alias: 'function'
  10. },
  11. 'quoted-atom': {
  12. pattern: /'(?:\\.|[^\\'\r\n])+'/,
  13. alias: 'atom'
  14. },
  15. 'boolean': /\b(?:false|true)\b/,
  16. 'keyword': /\b(?:after|begin|case|catch|end|fun|if|of|receive|try|when)\b/,
  17. 'number': [
  18. /\$\\?./,
  19. /\b\d+#[a-z0-9]+/i,
  20. /(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i
  21. ],
  22. 'function': /\b[a-z][\w@]*(?=\()/,
  23. 'variable': {
  24. // Look-behind is used to prevent wrong highlighting of atoms containing "@"
  25. pattern: /(^|[^@])(?:\b|\?)[A-Z_][\w@]*/,
  26. lookbehind: true
  27. },
  28. 'operator': [
  29. /[=\/<>:]=|=[:\/]=|\+\+?|--?|[=*\/!]|\b(?:and|andalso|band|bnot|bor|bsl|bsr|bxor|div|not|or|orelse|rem|xor)\b/,
  30. {
  31. // We don't want to match <<
  32. pattern: /(^|[^<])<(?!<)/,
  33. lookbehind: true
  34. },
  35. {
  36. // We don't want to match >>
  37. pattern: /(^|[^>])>(?!>)/,
  38. lookbehind: true
  39. }
  40. ],
  41. 'atom': /\b[a-z][\w@]*/,
  42. 'punctuation': /[()[\]{}:;,.#|]|<<|>>/
  43. };