ruby.js 1.1 KB

1234567891011121314151617181920212223242526
  1. /*
  2. * CodePress regular expressions for Perl syntax highlighting
  3. */
  4. // Ruby
  5. Language.syntax = [
  6. { input : /\"(.*?)(\"|<br>|<\/P>)/g, output : '<s>"$1$2</s>' }, // strings double quote
  7. { input : /\'(.*?)(\'|<br>|<\/P>)/g, output : '<s>\'$1$2</s>' }, // strings single quote
  8. { input : /([\$\@\%]+)([\w\.]*)/g, output : '<a>$1$2</a>' }, // vars
  9. { input : /(def\s+)([\w\.]*)/g, output : '$1<em>$2</em>' }, // functions
  10. { input : /\b(alias|and|BEGIN|begin|break|case|class|def|defined|do|else|elsif|END|end|ensure|false|for|if|in|module|next|nil|not|or|redo|rescue|retry|return|self|super|then|true|undef|unless|until|when|while|yield)\b/g, output : '<b>$1</b>' }, // reserved words
  11. { input : /([\(\){}])/g, output : '<u>$1</u>' }, // special chars
  12. { input : /#(.*?)(<br>|<\/P>)/g, output : '<i>#$1</i>$2' } // comments
  13. ];
  14. Language.snippets = []
  15. Language.complete = [
  16. { input : '\'',output : '\'$0\'' },
  17. { input : '"', output : '"$0"' },
  18. { input : '(', output : '\($0\)' },
  19. { input : '[', output : '\[$0\]' },
  20. { input : '{', output : '{\n\t$0\n}' }
  21. ]
  22. Language.shortcuts = []