1 <?php # vim:ts=2:sw=2:et:
2 /* For licensing and copyright terms, see the file named LICENSE */
4 class PerlLanguage extends HyperLanguage {
5 public function __construct() {
7 parent::NAME => 'Perl',
9 $this->setExtensions(array('pl'));
10 $this->setCaseInsensitive(false);
11 $this->addStates(array(
19 'keyword' => array('', 'operator'),
22 'variable' => array('identifier'),
26 $this->addRules(array(
27 'string' => Rule::C_DOUBLEQUOTESTRING,
28 'char' => Rule::C_SINGLEQUOTESTRING,
29 'ticked' => "/\`(?:\\\`|.)*\`/sU",
30 'number' => Rule::C_NUMBER,
34 'use', 'my', 'our', 'open', 'close', 'tie',
35 'exists', 'keys', 'values', 'chomp',
36 'last', 'next', 'print', 'unless',
37 'and', 'or', 'not', 'defined', 'undef',
38 'push', 'unshift', 'shift', 'pop',
39 'system', 'exec', 'goto', 'uc', 'lc',
41 'sort', 'grep', 'map', 'die', 'eval',
42 'require', 'bless', 'sub', 'package',
43 'eq', 'ne', 'le', 'lt', 'ge', 'gt',
44 'else', 'for', 'foreach', 'then',
45 'if', 'in', 'case', 'esac', 'while',
46 'end', 'do', 'return', 'elsif', 'exit'
48 'operator' => '/&&|\|\||<<|>>|\.=|==|=~|!~|[=;&|!<>\[\].]/',
50 'identifier' => Rule::C_IDENTIFIER,
51 'variable' => new Rule('/(@\$|%\$|&\$|@|%|&|\$)/', '//'),
53 $this->addMappings(array(