/usr/share/highlight/langDefs/perl.lang is in highlight-common 3.18-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 | Description="Perl"
Keywords={
{ Id=1,
List={"if", "else", "elsif", "unless", "given", "when", "default", "while", "for", "foreach",
"do", "until", "continue", "return", "last", "next", "redo", "goto", "break", "exit", "sub",
"package", "use", "no", "dump", "require", "BEGIN", "CHECK", "INIT", "END", "UNITCHECK" },
},
{ Id=2,
Regex=[[ [$@%]\#?\w+ ]],
},
{ Id=3,
List={"defined", "undef", "eq", "ne", "lt", "gt", "ge", "le", "cmp", "not",
"and", "or", "xor", "bless", "ref", "my", "our", "local", "state", "chomp",
"chop", "chr", "crypt", "index", "rindex", "lc", "lcfirst", "length", "ord",
"pack", "print", "printf", "sprintf", "substr", "uc",
"ucfirst", "pos", "quotemeta", "split", "study", "abs", "atan2", "cos",
"exp", "hex", "int", "log", "oct", "rand", "sin", "sqrt", "srand", "splice",
"unshift", "shift", "push", "pop", "join", "reverse", "grep", "map", "sort",
"unpack", "pack", "delete", "each", "exists", "keys",
"values", "syscall", "dbmopen", "dbmclose", "binmode", "close", "closedir",
"eof", "fileno", "getc", "stat", "lstat", "read", "readdir", "readline", "pipe",
"rewinddir", "say", "select", "tell", "telldir", "write", "fcntl", "flock",
"ioctl", "open", "opendir", "seek", "seekdir",
"sysopen", "sysread", "sysseek", "syswrite", "truncate", "chdir", "chmod",
"chown", "chroot", "glob", "link", "mkdir", "readlink", "rename", "rmdir", "symlink",
"umask", "unlink", "utime", "caller", "die", "wantarray", "vec", "alarm",
"exec", "fork", "getpgrp", "getppid", "getpriority", "kill", "pipe", "setpgrp",
"setpriority", "sleep", "system", "times", "wait", "waitpid", "accept", "bind",
"connect", "getpeername", "getsockname",
"getsockopt", "listen", "recv", "send", "setsockopt", "shutdown", "socket",
"socketpair", "msgctl", "msgget", "msgrcv", "msgsnd", "semctl", "semget",
"semop", "shmctl", "shmget", "shmread", "shmwrite", "gethostent", "getnetent",
"getprotoent", "getservent", "setpwent",
"setgrent", "sethostent", "setnetent", "setprotoent", "setservent",
"endpwent", "endgrent", "endhostent", "endnetent", "endprotoent", "endservent",
"gethostbyaddr", "gethostbyname", "getnetbyaddr", "getnetbyname",
"getprotobyname", "getprotobynumber", "getservbyname",
"getservbyport", "getpwuid", "getpwnam", "getgrgid", "getgrnam", "getlogin",
"getpwent", "getgrent", "gmtime", "localtime", "time", "warn", "formline",
"reset", "scalar", "prototype", "lock", "tied", "untie", "qw", "qq", "qx", "q", "eval" },
},
{ Id=4,
Regex=[[->([a-zA-Z0-9_]+)]],
Group=1,
},
{ Id=4,
--# Still only covers more common usage but by far not all
Regex=[[\/.*?\/[msixpodualgc]*|m\/.*?\/[msixpodualgc]*|qr\/.*?\/[msixpodual]*|s\/.*?\/.*?\/[msixpodualgcer]*|(?:tr|y)\/.*?\/.*?\/[cdsr]*|m!.*?![msixpodualgc]*|qr!.*?![msixpodual]*|s!.*?!.*?![msixpodualgcer]*|(?:tr|y)!.*?!.*?![cdsr]*|m\?.*?\?[msixpodualgc]*|m\{.*?\}[msixpodualgc]*|qr\{.*?\}[msixpodual]*|s\{.*?\}\s*\{.*?\}[msixpodualgcer]*|(?:tr|y)\{.*?\}\s*\{.*?\}[cdsr]*]],
Group=0
},
}
-- hereDoc opening delimiter, see OnStateChange to handle end of string
Strings={
Delimiter=[["|'|`|<<["']?\w+["']?]],
Interpolation=[[ [@\$%]\w+ ]],
}
IgnoreCase=false
Comments={
{ Block=true,
Nested=false,
Delimiter = { [[(?:^=pod|^=head[1234]|^=over|^=item|^=back|^=begin|^=end|^=for|^=encoding)]], [[^=cut\s*\Z]] } },
{ Block=false,
Delimiter= { [[(?<!\\)#]] },
},
}
Operators=[[\(|\)|\[|\]|\{|\}|\,|\;|\:|\&|<|>|\!|\=|\/|\*|\+|\-|\$|\.|\^|\~|\%|\|]]
-- fix recognition of $
function OnStateChange(oldState, newState, token)
if (string.sub(token,1,1) =="$" or string.sub(token,1,1) =="@" or string.sub(token,1,1) =="%") and oldState==HL_STRING and newState==HL_KEYWORD then
return HL_INTERPOLATION
end
--recognize hereDoc multine strings
--do not clear hereDoc if token is ",' or `
if (oldState==HL_STANDARD or oldState==HL_STRING) and newState==HL_STRING and not string.find("\"'`", token) then
hereDoc = string.match(token, "<<'?\"?(%a+)" )
end
if oldState==HL_STRING and token==hereDoc then
hereDoc = nil
return HL_STRING_END
end
return newState
end
|