shBrushPerl.js 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. /**
  2. * SyntaxHighlighter
  3. * http://alexgorbatchev.com/SyntaxHighlighter
  4. *
  5. * SyntaxHighlighter is donationware. If you are using it, please donate.
  6. * http://alexgorbatchev.com/SyntaxHighlighter/donate.html
  7. *
  8. * @version
  9. * 3.0.83 (July 02 2010)
  10. *
  11. * @copyright
  12. * Copyright (C) 2004-2010 Alex Gorbatchev.
  13. *
  14. * @license
  15. * Dual licensed under the MIT and GPL licenses.
  16. */
  17. ;(function()
  18. {
  19. // CommonJS
  20. typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null;
  21. function Brush()
  22. {
  23. // Contributed by David Simmons-Duffin and Marty Kube
  24. var funcs =
  25. 'abs accept alarm atan2 bind binmode chdir chmod chomp chop chown chr ' +
  26. 'chroot close closedir connect cos crypt defined delete each endgrent ' +
  27. 'endhostent endnetent endprotoent endpwent endservent eof exec exists ' +
  28. 'exp fcntl fileno flock fork format formline getc getgrent getgrgid ' +
  29. 'getgrnam gethostbyaddr gethostbyname gethostent getlogin getnetbyaddr ' +
  30. 'getnetbyname getnetent getpeername getpgrp getppid getpriority ' +
  31. 'getprotobyname getprotobynumber getprotoent getpwent getpwnam getpwuid ' +
  32. 'getservbyname getservbyport getservent getsockname getsockopt glob ' +
  33. 'gmtime grep hex index int ioctl join keys kill lc lcfirst length link ' +
  34. 'listen localtime lock log lstat map mkdir msgctl msgget msgrcv msgsnd ' +
  35. 'oct open opendir ord pack pipe pop pos print printf prototype push ' +
  36. 'quotemeta rand read readdir readline readlink readpipe recv rename ' +
  37. 'reset reverse rewinddir rindex rmdir scalar seek seekdir select semctl ' +
  38. 'semget semop send setgrent sethostent setnetent setpgrp setpriority ' +
  39. 'setprotoent setpwent setservent setsockopt shift shmctl shmget shmread ' +
  40. 'shmwrite shutdown sin sleep socket socketpair sort splice split sprintf ' +
  41. 'sqrt srand stat study substr symlink syscall sysopen sysread sysseek ' +
  42. 'system syswrite tell telldir time times tr truncate uc ucfirst umask ' +
  43. 'undef unlink unpack unshift utime values vec wait waitpid warn write';
  44. var keywords =
  45. 'bless caller continue dbmclose dbmopen die do dump else elsif eval exit ' +
  46. 'for foreach goto if import last local my next no our package redo ref ' +
  47. 'require return sub tie tied unless untie until use wantarray while';
  48. this.regexList = [
  49. { regex: new RegExp('#[^!].*$', 'gm'), css: 'comments' },
  50. { regex: new RegExp('^\\s*#!.*$', 'gm'), css: 'preprocessor' }, // shebang
  51. { regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' },
  52. { regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' },
  53. { regex: new RegExp('(\\$|@|%)\\w+', 'g'), css: 'variable' },
  54. { regex: new RegExp(this.getKeywords(funcs), 'gmi'), css: 'functions' },
  55. { regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' }
  56. ];
  57. this.forHtmlScript(SyntaxHighlighter.regexLib.phpScriptTags);
  58. }
  59. Brush.prototype = new SyntaxHighlighter.Highlighter();
  60. Brush.aliases = ['perl', 'Perl', 'pl'];
  61. SyntaxHighlighter.brushes.Perl = Brush;
  62. // CommonJS
  63. typeof(exports) != 'undefined' ? exports.Brush = Brush : null;
  64. })();