1 <?php # vim:ts=2:sw=2:et:
2 /* For licensing and copyright terms, see the file named LICENSE */
4 class JavascriptLanguage extends HyperLanguage {
5 public function __construct() {
7 parent::NAME => 'Javascript',
9 $this->setExtensions(array('js', 'json'));
10 $this->setCaseInsensitive(false);
11 $this->addStates(array(
17 'keyword' => array('', 'literal', 'operator'),
22 $this->addRules(array(
23 'string' => Rule::C_DOUBLEQUOTESTRING,
24 'char' => Rule::C_SINGLEQUOTESTRING,
25 'number' => Rule::C_NUMBER,
26 'comment' => Rule::C_COMMENT,
29 'assert', 'break', 'class', 'continue',
30 'else', 'except', 'finally', 'for',
31 'if', 'in', 'function',
32 'throw', 'return', 'try', 'while', 'with', 'typeof'
35 'false', 'null', 'true'
37 'operator' => '/[-+*\/%&|^!~=<>?{}()\[\].,:;]|&&|\|\||<<|>>|[-=!<>+*\/%&|^]=|<<=|>>=|->/',
39 'identifier' => Rule::C_IDENTIFIER,
41 $this->addMappings(array(