PageRenderTime 9ms CodeModel.GetById 2ms app.highlight 5ms RepoModel.GetById 1ms app.codeStats 0ms

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