// FIXME: Bug in symbol matching (matches :bar in FOO::bar as well).
// FIXME: Bug in method matching (doesn't match method in def method).
// TODO: Matching concats (#{foo}) would be nice ...
CodeHighlighter.addStyle("ruby",{
    brackets : {
        exp : /[\(\)\[\]\{\}]/
    },
    comment : {
        exp : /#[^\n]+/
    },
    constant : {
        exp : /\b([A-Z][\w]*|__FILE__|__END__)\b/
    },
    keywords : {
        exp : /\b(and|or|do|end|self|class|def|if|module|yield|then|else|for|until|unless|while|elsif|case|when|break|retry|redo|rescue|require|raise)\b/
    },
    method : {
        exp : /(\.)([a-z][\w]*[\?!]?)|(def(<\/span>)? )([a-z][\w]*[\?!]?)/,
        replacement: "$1<span class=\"$0\">$2</span>"
    },
    string : {
        exp : /'[^']*'|"[^"]*"|`[^`]+`/
    },
    symbol : {
        // NB: This also matches block arguments.
        exp : /(:[a-z]\w+|\|\w\|)/
    }
});
