1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 | function smalltalk(hljs) {
|
9 | const VAR_IDENT_RE = '[a-z][a-zA-Z0-9_]*';
|
10 | const CHAR = {
|
11 | className: 'string',
|
12 | begin: '\\$.{1}'
|
13 | };
|
14 | const SYMBOL = {
|
15 | className: 'symbol',
|
16 | begin: '#' + hljs.UNDERSCORE_IDENT_RE
|
17 | };
|
18 | return {
|
19 | name: 'Smalltalk',
|
20 | aliases: [ 'st' ],
|
21 | keywords: [
|
22 | "self",
|
23 | "super",
|
24 | "nil",
|
25 | "true",
|
26 | "false",
|
27 | "thisContext"
|
28 | ],
|
29 | contains: [
|
30 | hljs.COMMENT('"', '"'),
|
31 | hljs.APOS_STRING_MODE,
|
32 | {
|
33 | className: 'type',
|
34 | begin: '\\b[A-Z][A-Za-z0-9_]*',
|
35 | relevance: 0
|
36 | },
|
37 | {
|
38 | begin: VAR_IDENT_RE + ':',
|
39 | relevance: 0
|
40 | },
|
41 | hljs.C_NUMBER_MODE,
|
42 | SYMBOL,
|
43 | CHAR,
|
44 | {
|
45 |
|
46 |
|
47 |
|
48 | begin: '\\|[ ]*' + VAR_IDENT_RE + '([ ]+' + VAR_IDENT_RE + ')*[ ]*\\|',
|
49 | returnBegin: true,
|
50 | end: /\|/,
|
51 | illegal: /\S/,
|
52 | contains: [ {
|
53 | begin: '(\\|[ ]*)?' + VAR_IDENT_RE
|
54 | } ]
|
55 | },
|
56 | {
|
57 | begin: '#\\(',
|
58 | end: '\\)',
|
59 | contains: [
|
60 | hljs.APOS_STRING_MODE,
|
61 | CHAR,
|
62 | hljs.C_NUMBER_MODE,
|
63 | SYMBOL
|
64 | ]
|
65 | }
|
66 | ]
|
67 | };
|
68 | }
|
69 |
|
70 | export { smalltalk as default };
|