PageRenderTime 27ms CodeModel.GetById 22ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 0ms

/BlogEngine/BlogEngine.NET/Scripts/syntaxhighlighter/shBrushPerl.js

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