Skip to content

Instantly share code, notes, and snippets.

@zaphar
Created May 22, 2009 00:51
Show Gist options
  • Save zaphar/115856 to your computer and use it in GitHub Desktop.
Save zaphar/115856 to your computer and use it in GitHub Desktop.
/**
* SyntaxHighlighter
* http://alexgorbatchev.com/
*
* Custom erlang SyntaxHighlighterBrush
*/
SyntaxHighlighter.brushes.Erlang = function()
{
// Contributed by David Simmons-Duffin and Marty Kube
var funcs =
'is_boolean is_integer is_float is_list is_binary spawn' +
'integer_to_list list_to_binary binary_to_list';
var keywords =
'if case throw error when end ';
this.regexList = [
{ regex: new RegExp('%[^!].*$', 'gm'), css: 'comments' },
{ regex: new RegExp('-\\w+', 'g'), css: 'preprocessor' },
{ regex: new RegExp('(?![^a-z\\?0-9])([A-Z]|_)\\w*', 'g'), css: 'variable' },
{ regex: new RegExp('\b(?![^A-Z\\?_])([a-z])\\w*', 'g'), css: 'constant' },
{ regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' },
{ regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'constant' },
{ regex: new RegExp(this.getKeywords(funcs), 'gmi'), css: 'functions' },
{ regex: new RegExp('\\w+:\\w+', 'g'), css: 'functions' },
{ regex: new RegExp('\\?\\w+', 'gm'), css: 'functions bold' },
{ regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' }
];
}
SyntaxHighlighter.brushes.Erlang.prototype = new SyntaxHighlighter.Highlighter();
SyntaxHighlighter.brushes.Erlang.aliases = ['erlang', 'Erlang', 'erl'];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment