shBrushErlang.js 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /**
  2. * SyntaxHighlighter
  3. * http://alexgorbatchev.com/
  4. *
  5. * SyntaxHighlighter is donationware. If you are using it, please donate.
  6. * http://alexgorbatchev.com/wiki/SyntaxHighlighter:Donate
  7. *
  8. * @version
  9. * 2.1.364 (October 15 2009)
  10. *
  11. * @copyright
  12. * Copyright (C) 2004-2009 Alex Gorbatchev.
  13. *
  14. * @license
  15. * This file is part of SyntaxHighlighter.
  16. *
  17. * SyntaxHighlighter is free software: you can redistribute it and/or modify
  18. * it under the terms of the GNU Lesser General Public License as published by
  19. * the Free Software Foundation, either version 3 of the License, or
  20. * (at your option) any later version.
  21. *
  22. * SyntaxHighlighter is distributed in the hope that it will be useful,
  23. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  24. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  25. * GNU General Public License for more details.
  26. *
  27. * You should have received a copy of the GNU General Public License
  28. * along with SyntaxHighlighter. If not, see <http://www.gnu.org/copyleft/lesser.html>.
  29. */
  30. SyntaxHighlighter.brushes.Erlang = function()
  31. {
  32. // Contributed by Jean-Lou Dupont
  33. // http://jldupont.blogspot.com/2009/06/erlang-syntax-highlighter.html
  34. // According to: http://erlang.org/doc/reference_manual/introduction.html#1.5
  35. var keywords = 'after and andalso band begin bnot bor bsl bsr bxor '+
  36. 'case catch cond div end fun if let not of or orelse '+
  37. 'query receive rem try when xor'+
  38. // additional
  39. ' module export import define';
  40. this.regexList = [
  41. { regex: new RegExp("[A-Z][A-Za-z0-9_]+", 'g'), css: 'constants' },
  42. { regex: new RegExp("\\%.+", 'gm'), css: 'comments' },
  43. { regex: new RegExp("\\?[A-Za-z0-9_]+", 'g'), css: 'preprocessor' },
  44. { regex: new RegExp("[a-z0-9_]+:[a-z0-9_]+", 'g'), css: 'functions' },
  45. { regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' },
  46. { regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' },
  47. { regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' }
  48. ];
  49. };
  50. SyntaxHighlighter.brushes.Erlang.prototype = new SyntaxHighlighter.Highlighter();
  51. SyntaxHighlighter.brushes.Erlang.aliases = ['erl', 'erlang'];