final move of files
[web.mtrack] / MTrack / hyperlight / shell.php
1 <?php # vim:ts=2:sw=2:et:
2 /* For licensing and copyright terms, see the file named LICENSE */
3
4 class ShellLanguage extends HyperLanguage {
5   public function __construct() {
6     $this->setInfo(array(
7           parent::NAME => 'Shell',
8           ));
9     $this->setExtensions(array('sh'));
10     $this->setCaseInsensitive(false);
11     $this->addStates(array(
12           'init' => array(
13             'string',
14             'char',
15             'ticked',
16             'comment',
17             'keyword' => array('', 'operator'),
18             'identifier'
19             ),
20           ));
21
22     $this->addRules(array(
23           'string' => Rule::C_DOUBLEQUOTESTRING,
24           'char' => Rule::C_SINGLEQUOTESTRING,
25           'ticked' => "/\`(?:\\\`|.)*\`/sU",
26           'comment' => '/#.*/',
27           'keyword' => array(
28             array(
29               'break', 'test', 'continue',
30               'else', 'for', 'then',
31               'if', 'in', 'case', 'esac', 'while',
32               'end', 'fi', 'until', 'return', 'elif', 'exit'
33               ),
34             'operator' => '/[;&|!<>\[\]]|&&|\$\(\(|\$\(|\)\)|\)|\(\|\||<<|>>|=|==/',
35             ),
36           'identifier' => Rule::C_IDENTIFIER,
37           ));
38         $this->addMappings(array(
39             'char' => 'string',
40             'ticked' => 'string',
41         ));
42
43   }
44 }