]> luflow.net public git repositories - flow-web.git/blob - static/highlight/languages/smalltalk.js
Initial commit.
[flow-web.git] / static / highlight / languages / smalltalk.js
1 /*! `smalltalk` grammar compiled for Highlight.js 11.11.1 */
2 (function(){
3 var hljsGrammar = (function () {
4 'use strict';
5
6 /*
7 Language: Smalltalk
8 Description: Smalltalk is an object-oriented, dynamically typed reflective programming language.
9 Author: Vladimir Gubarkov <xonixx@gmail.com>
10 Website: https://en.wikipedia.org/wiki/Smalltalk
11 Category: system
12 */
13
14 function smalltalk(hljs) {
15 const VAR_IDENT_RE = '[a-z][a-zA-Z0-9_]*';
16 const CHAR = {
17 className: 'string',
18 begin: '\\$.{1}'
19 };
20 const SYMBOL = {
21 className: 'symbol',
22 begin: '#' + hljs.UNDERSCORE_IDENT_RE
23 };
24 return {
25 name: 'Smalltalk',
26 aliases: [ 'st' ],
27 keywords: [
28 "self",
29 "super",
30 "nil",
31 "true",
32 "false",
33 "thisContext"
34 ],
35 contains: [
36 hljs.COMMENT('"', '"'),
37 hljs.APOS_STRING_MODE,
38 {
39 className: 'type',
40 begin: '\\b[A-Z][A-Za-z0-9_]*',
41 relevance: 0
42 },
43 {
44 begin: VAR_IDENT_RE + ':',
45 relevance: 0
46 },
47 hljs.C_NUMBER_MODE,
48 SYMBOL,
49 CHAR,
50 {
51 // This looks more complicated than needed to avoid combinatorial
52 // explosion under V8. It effectively means `| var1 var2 ... |` with
53 // whitespace adjacent to `|` being optional.
54 begin: '\\|[ ]*' + VAR_IDENT_RE + '([ ]+' + VAR_IDENT_RE + ')*[ ]*\\|',
55 returnBegin: true,
56 end: /\|/,
57 illegal: /\S/,
58 contains: [ { begin: '(\\|[ ]*)?' + VAR_IDENT_RE } ]
59 },
60 {
61 begin: '#\\(',
62 end: '\\)',
63 contains: [
64 hljs.APOS_STRING_MODE,
65 CHAR,
66 hljs.C_NUMBER_MODE,
67 SYMBOL
68 ]
69 }
70 ]
71 };
72 }
73
74 return smalltalk;
75
76 })();
77
78 hljs.registerLanguage('smalltalk', hljsGrammar);
79 })();