PageRenderTime 24ms CodeModel.GetById 15ms app.highlight 6ms RepoModel.GetById 2ms app.codeStats 0ms

/samples/scalate-sample-sitegen/src/highlight/languages/scala.js

http://github.com/scalate/scalate
JavaScript | 63 lines | 58 code | 1 blank | 4 comment | 0 complexity | 756399e5e4ffc57cee8f531344bb4248 MD5 | raw file
 1/*
 2Language: Scala
 3Author: Jan Berkel <jan.berkel@gmail.com>
 4*/
 5
 6hljs.LANGUAGES.scala  = {
 7  defaultMode: {
 8    lexems: [hljs.UNDERSCORE_IDENT_RE],
 9    contains: ['javadoc', 'comment', 'string', 'class', 'number', 'annotation'],
10    keywords: { 'type': 1, 'yield': 1, 'lazy': 1, 'override': 1, 'def': 1, 'with': 1, 'val':1, 'var': 1, 'false': 1, 'true': 1, 'sealed': 1, 'abstract': 1, 'private': 1, 'trait': 1,  'object': 1, 'null': 1, 'if': 1, 'for': 1, 'while': 1, 'throw': 1, 'finally': 1, 'protected': 1, 'extends': 1, 'import': 1, 'final': 1, 'return': 1, 'else': 1, 'break': 1, 'new': 1, 'catch': 1, 'super': 1, 'class': 1, 'case': 1,'package': 1, 'default': 1, 'try': 1, 'this': 1, 'match': 1, 'continue': 1, 'throws': 1}
11  },
12  modes: [
13    {
14      className: 'class',
15      lexems: [hljs.UNDERSCORE_IDENT_RE],
16      begin: '((case )?class |object |trait )', end: '({|$)',
17      illegal: ':',
18      keywords: {'case' : 1, 'class': 1, 'trait': 1, 'object': 1},
19      contains: ['inheritance', 'title', 'params']
20    },
21    {
22      className: 'inheritance',
23      begin: '(extends|with)', end: '^', noMarkup: true,
24      lexems: [hljs.IDENT_RE],
25      keywords: {'extends': 1, 'with': 1},
26      relevance: 10
27    },
28    {
29      className: 'title',
30      begin: hljs.UNDERSCORE_IDENT_RE, end: '^'
31    },
32    {
33      className: 'params',
34      begin: '\\(', end: '\\)',
35      contains: ['string', 'annotation']
36    },
37    hljs.C_NUMBER_MODE,
38    hljs.APOS_STRING_MODE,
39    hljs.QUOTE_STRING_MODE,
40    hljs.BACKSLASH_ESCAPE,
41    hljs.C_LINE_COMMENT_MODE,
42    {
43      className: 'javadoc',
44      begin: '/\\*\\*', end: '\\*/',
45      contains: ['javadoctag'],
46      relevance: 10
47    },
48    {
49      className: 'javadoctag',
50      begin: '@[A-Za-z]+', end: '^'
51    },
52    hljs.C_BLOCK_COMMENT_MODE,
53    {
54      className: 'annotation',
55      begin: '@[A-Za-z]+', end: '^'
56    },
57    {
58      className: 'string',
59      begin: 'u?r?"""', end: '"""',
60      relevance: 10
61    }
62  ]
63};