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