1 """
   2 	MoinMoin - Perl Source Parser
   3 
   4     @copyright: 2006 by Johannes Hoerburger <jh@underground8.com>
   5     @license: GNU GPL.
   6 
   7 """
   8 
   9 from MoinMoin.util.ParserBase import ParserBase
  10 
  11 Dependencies = []
  12 
  13 class Parser(ParserBase):
  14 
  15     parsername = "ColorizedPerl"
  16     extensions = ['.pl']
  17     Dependencies = []
  18 
  19     def setupRules(self):
  20         ParserBase.setupRules(self)
  21                 
  22         self.addRule("Comment","#.*$")
  23 	self.addRulePair("String",r"(?<!\\)\"",r"(?<!\\)\"")
  24 	self.addRulePair("String",r"(?<!\\)\'",r"(?<!\\)\'")
  25         self.addRule("Char",r"'\\.'|#[a-f0-9][a-f0-9]")
  26         self.addRule("Number",r"[0-9](\.[0-9]*)")
  27         self.addRule("ID","[a-zA-Z_][0-9a-zA-Z_]*")
  28 	self.addRule("SPChar","[=<>/\"]")
  29 	reserved_words = ['abs','accept','alarm','Answer','Ask','atan2','bind','binmode','bless','caller','chdir','chmod','chomp','Choose','chop','chown','chr','chroot','close','closedir','connect','continue','cos','crypt','dbmclose','dbmopen','defined','delete','die','Directory','do','DoAppleScript','dump','each','else','elsif','endgrent','endhostent','endnetent','endprotoent','endpwent','eof','eval','exec','exists','exit','exp','FAccess','fcntl','fileno','find','flock','for','foreach','fork','format','formline','getc','GetFileInfo','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','m//','MakeFSSpec','MakePath','map','mkdir','msgctl','msgget','msgrcv','msgsnd','my','next','no','oct','open','opendir','ord','pack','package','Pick','pipe','pop','pos','print','printf','push','pwd','q//','qq//','Quit','quotemeta','qw//','qx//','rand','read','readdir','readlink','recv','redo','ref','rename','Reply','require','reset','return','reverse','rewinddir','rindex','rmdir','s///','scalar','seek','seekdir','select','semctl','semget','semop','send','SetFileInfo','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','syswrite','tell','telldir','tie','tied','time','times','tr///','truncate','uc','ucfirst','umask','undef','unless','unlink','until','unpack','unshift','untie','use','utime','values','vec','Volumes','wait','waitpid','wantarray','warn','while','write','y///']
  30 	self.addReserved(reserved_words)

MoinMoin: parser/Perl (last edited 2007-10-29 19:10:15 by localhost)