main
Last change
on this file since 65b6638 was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 15 months ago |
Initial commit
|
-
Property mode
set to
100644
|
File size:
1.5 KB
|
Line | |
---|
1 | /*
|
---|
2 | Language: Smalltalk
|
---|
3 | Description: Smalltalk is an object-oriented, dynamically typed reflective programming language.
|
---|
4 | Author: Vladimir Gubarkov <xonixx@gmail.com>
|
---|
5 | Website: https://en.wikipedia.org/wiki/Smalltalk
|
---|
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: 'self super nil true false thisContext', // only 6
|
---|
22 | contains: [
|
---|
23 | hljs.COMMENT('"', '"'),
|
---|
24 | hljs.APOS_STRING_MODE,
|
---|
25 | {
|
---|
26 | className: 'type',
|
---|
27 | begin: '\\b[A-Z][A-Za-z0-9_]*',
|
---|
28 | relevance: 0
|
---|
29 | },
|
---|
30 | {
|
---|
31 | begin: VAR_IDENT_RE + ':',
|
---|
32 | relevance: 0
|
---|
33 | },
|
---|
34 | hljs.C_NUMBER_MODE,
|
---|
35 | SYMBOL,
|
---|
36 | CHAR,
|
---|
37 | {
|
---|
38 | // This looks more complicated than needed to avoid combinatorial
|
---|
39 | // explosion under V8. It effectively means `| var1 var2 ... |` with
|
---|
40 | // whitespace adjacent to `|` being optional.
|
---|
41 | begin: '\\|[ ]*' + VAR_IDENT_RE + '([ ]+' + VAR_IDENT_RE + ')*[ ]*\\|',
|
---|
42 | returnBegin: true,
|
---|
43 | end: /\|/,
|
---|
44 | illegal: /\S/,
|
---|
45 | contains: [ {
|
---|
46 | begin: '(\\|[ ]*)?' + VAR_IDENT_RE
|
---|
47 | } ]
|
---|
48 | },
|
---|
49 | {
|
---|
50 | begin: '#\\(',
|
---|
51 | end: '\\)',
|
---|
52 | contains: [
|
---|
53 | hljs.APOS_STRING_MODE,
|
---|
54 | CHAR,
|
---|
55 | hljs.C_NUMBER_MODE,
|
---|
56 | SYMBOL
|
---|
57 | ]
|
---|
58 | }
|
---|
59 | ]
|
---|
60 | };
|
---|
61 | }
|
---|
62 |
|
---|
63 | module.exports = smalltalk;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.