PageRenderTime 13ms CodeModel.GetById 9ms RepoModel.GetById 0ms app.codeStats 0ms

/samples/scalate-sample-sitegen/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. /*
  2. Language: PHP
  3. Author: Victor Karamzin <Victor.Karamzin@enterra-inc.com>
  4. */
  5. hljs.LANGUAGES.php = {
  6. defaultMode: {
  7. lexems: [hljs.IDENT_RE],
  8. contains: ['comment', 'number', 'string', 'variable', 'preprocessor'],
  9. 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}
  10. },
  11. case_insensitive: true,
  12. modes: [
  13. hljs.C_LINE_COMMENT_MODE,
  14. hljs.HASH_COMMENT_MODE,
  15. {
  16. className: 'comment',
  17. begin: '/\\*', end: '\\*/',
  18. contains: ['phpdoc']
  19. },
  20. {
  21. className: 'phpdoc',
  22. begin: '\\s@[A-Za-z]+', end: '^',
  23. relevance: 10
  24. },
  25. hljs.C_NUMBER_MODE,
  26. {
  27. className: 'string',
  28. begin: '\'', end: '\'',
  29. contains: ['escape'],
  30. relevance: 0
  31. },
  32. {
  33. className: 'string',
  34. begin: '"', end: '"',
  35. contains: ['escape'],
  36. relevance: 0
  37. },
  38. hljs.BACKSLASH_ESCAPE,
  39. {
  40. className: 'variable',
  41. begin: '\\$[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*', end: '^'
  42. },
  43. {
  44. className: 'preprocessor',
  45. begin: '<\\?php', end: '^',
  46. relevance: 10
  47. },
  48. {
  49. className: 'preprocessor',
  50. begin: '\\?>', end: '^'
  51. }
  52. ]
  53. };