Project

General

Profile

1
/*
2
 * CodePress regular expressions for Perl syntax highlighting
3
 * By J. Nick Koston
4
 */
5

    
6
Language.syntax = [ // Perl
7
	{
8
	input  : /\"(.*?)(\"|<br>|<\/P>)/g,
9
	output : '<s>"$1$2</s>' // strings double quote
10
	},{
11
	input  : /\'(.*?)(\'|<br>|<\/P>)/g,
12
	output : '<s>\'$1$2</s>' // strings single quote
13
	},{
14
    input  : /([\$\@\%][\w\.]*)/g,
15
	output : '<a>$1</a>' // vars
16
	},{
17
    input  : /(sub\s+)([\w\.]*)/g,
18
	output : '$1<em>$2</em>' // functions
19
	},{
20
    input  : /\b(abs|accept|alarm|atan2|bind|binmode|bless|caller|chdir|chmod|chomp|chop|chown|chr|chroot|close|closedir|connect|continue|cos|crypt|dbmclose|dbmopen|defined|delete|die|do|dump|each|else|elsif|endgrent|endhostent|endnetent|endprotoent|endpwent|eof|eval|exec|exists|exit|fcntl|fileno|find|flock|for|foreach|fork|format|formlinegetc|getgrent|getgrgid|getgrnam|gethostbyaddr|gethostbyname|gethostent|getlogin|getnetbyaddr|getnetbyname|getnetent|getpeername|getpgrp|getppid|getpriority|getprotobyname|getprotobynumber|getprotoent|getpwent|getpwnam|getpwuid|getservbyaddr|getservbyname|getservbyport|getservent|getsockname|getsockopt|glob|gmtime|goto|grep|hex|hostname|if|import|index|int|ioctl|join|keys|kill|last|lc|lcfirst|length|link|listen|LoadExternals|local|localtime|log|lstat|map|mkdir|msgctl|msgget|msgrcv|msgsnd|my|next|no|oct|open|opendir|ordpack|package|pipe|pop|pos|print|printf|push|pwd|qq|quotemeta|qw|rand|read|readdir|readlink|recv|redo|ref|rename|require|reset|return|reverse|rewinddir|rindex|rmdir|scalar|seek|seekdir|select|semctl|semget|semop|send|setgrent|sethostent|setnetent|setpgrp|setpriority|setprotoent|setpwent|setservent|setsockopt|shift|shmctl|shmget|shmread|shmwrite|shutdown|sin|sleep|socket|socketpair|sort|splice|split|sprintf|sqrt|srand|stat|stty|study|sub|substr|symlink|syscall|sysopen|sysread|system|syswritetell|telldir|tie|tied|time|times|tr|truncate|uc|ucfirst|umask|undef|unless|unlink|until|unpack|unshift|untie|use|utime|values|vec|waitpid|wantarray|warn|while|write)\b/g,
21
	output : '<b>$1</b>' // reserved words
22
	},{
23
    input  : /([\(\){}])/g,
24
	output : '<u>$1</u>' // special chars
25
	},{
26
    input  : /#(.*?)(<br>|<\/P>)/g,
27
	output : '<i>#$1</i>$2' // comments
28
	}
29
]
30

    
31
Language.snippets = [];
32

    
33
Language.complete = [ // Auto complete only for 1 character
34
	{input : '\'',output : '\'$0\'' },
35
	{input : '"', output : '"$0"' },
36
	{input : '(', output : '\($0\)' },
37
	{input : '[', output : '\[$0\]' },
38
	{input : '{', output : '{\n\t$0\n}' }		
39
];
40

    
41
Language.shortcuts = [];
(12-12/20)