PageRenderTime 18ms CodeModel.GetById 12ms app.highlight 4ms RepoModel.GetById 1ms app.codeStats 0ms

/samples/scalate-presentation/src/highlight/languages/php.js

http://github.com/scalate/scalate
JavaScript | 54 lines | 49 code | 1 blank | 4 comment | 0 complexity | a320fc9890866455e15f3d35ff882b7d MD5 | raw file
 1/*
 2Language: PHP
 3Author: Victor Karamzin <Victor.Karamzin@enterra-inc.com>
 4*/
 5
 6hljs.LANGUAGES.php = {
 7  defaultMode: {
 8    lexems: [hljs.IDENT_RE],
 9    contains: ['comment', 'number', 'string', 'variable', 'preprocessor'],
10    keywords: {'and': 1, 'include_once': 1, 'list': 1, 'abstract': 1, 'global': 1, 'private': 1, 'echo': 1, 'interface': 1, 'as': 1, 'static': 1, 'endswitch': 1, 'array': 1, 'null': 1, 'if': 1, 'endwhile': 1, 'or': 1, 'const': 1, 'for': 1, 'endforeach': 1, 'self': 1, 'var': 1, 'while': 1, 'isset': 1, 'public': 1, 'protected': 1, 'exit': 1, 'foreach': 1, 'throw': 1, 'elseif': 1, 'extends': 1, 'include': 1, '__FILE__': 1, 'empty': 1, 'require_once': 1, 'function': 1, 'do': 1, 'xor': 1, 'return': 1, 'implements': 1, 'parent': 1, 'clone': 1, 'use': 1, '__CLASS__': 1, '__LINE__': 1, 'else': 1, 'break': 1, 'print': 1, 'eval': 1, 'new': 1, 'catch': 1, '__METHOD__': 1, 'class': 1, 'case': 1, 'exception': 1, 'php_user_filter': 1, 'default': 1, 'die': 1, 'require': 1, '__FUNCTION__': 1, 'enddeclare': 1, 'final': 1, 'try': 1, 'this': 1, 'switch': 1, 'continue': 1, 'endfor': 1, 'endif': 1, 'declare': 1, 'unset': 1}
11  },
12  case_insensitive: true,
13  modes: [
14    hljs.C_LINE_COMMENT_MODE,
15    hljs.HASH_COMMENT_MODE,
16    {
17      className: 'comment',
18      begin: '/\\*', end: '\\*/',
19      contains: ['phpdoc']
20    },
21    {
22      className: 'phpdoc',
23      begin: '\\s@[A-Za-z]+', end: '^',
24      relevance: 10
25    },
26    hljs.C_NUMBER_MODE,
27    {
28      className: 'string',
29      begin: '\'', end: '\'',
30      contains: ['escape'],
31      relevance: 0
32    },
33    {
34      className: 'string',
35      begin: '"', end: '"',
36      contains: ['escape'],
37      relevance: 0
38    },
39    hljs.BACKSLASH_ESCAPE,
40    {
41      className: 'variable',
42      begin: '\\$[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*', end: '^'
43    },
44    {
45      className: 'preprocessor',
46      begin: '<\\?php', end: '^',
47      relevance: 10
48    },
49    {
50      className: 'preprocessor',
51      begin: '\\?>', end: '^'
52    }
53  ]
54};