PageRenderTime 8ms CodeModel.GetById 1ms RepoModel.GetById 0ms app.codeStats 0ms

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

http://github.com/scalate/scalate
JavaScript | 52 lines | 47 code | 1 blank | 4 comment | 0 complexity | 61e40b220f5d889665ab3d40561cc52d MD5 | raw file
  1. /*
  2. Language: Smalltalk
  3. Author: Vladimir Gubarkov <xonixx@gmail.com>
  4. */
  5. hljs.LANGUAGES.smalltalk = function(){
  6. var VAR_IDENT_RE = '[a-z][a-zA-Z0-9_]*';
  7. return {
  8. defaultMode: {
  9. lexems: [hljs.UNDERSCORE_IDENT_RE],
  10. contains: ['comment', 'string', 'class', 'method',
  11. 'number', 'symbol', 'char', 'localvars', 'array'],
  12. keywords: {'self': 1, 'super': 1, 'nil': 1, 'true': 1, 'false': 1, 'thisContext': 1} // only 6
  13. },
  14. modes: [
  15. {
  16. className: 'class',
  17. begin: '\\b[A-Z][A-Za-z0-9_]*', end: '^',
  18. relevance: 0
  19. },
  20. {
  21. className: 'symbol',
  22. begin: '#' + hljs.UNDERSCORE_IDENT_RE, end: '^'
  23. },
  24. hljs.C_NUMBER_MODE,
  25. hljs.APOS_STRING_MODE,
  26. {
  27. className: 'comment',
  28. begin: '"', end: '"',
  29. relevance: 0
  30. },
  31. {
  32. className: 'method',
  33. begin: VAR_IDENT_RE + ':', end:'^'
  34. },
  35. {
  36. className: 'char',
  37. begin: '\\$.{1}', end: '^'
  38. },
  39. {
  40. className: 'localvars',
  41. begin: '\\|\\s*((' + VAR_IDENT_RE + ')\\s*)+\\|', end: '^',
  42. relevance: 10
  43. },
  44. {
  45. className: 'array',
  46. begin: '\\#\\(', end: '\\)',
  47. contains: ['string', 'char', 'number', 'symbol']
  48. }
  49. ]
  50. };
  51. }();