]> luflow.net public git repositories - flow-web.git/blob - static/highlight/languages/pony.js
Initial commit.
[flow-web.git] / static / highlight / languages / pony.js
1 /*! `pony` grammar compiled for Highlight.js 11.11.1 */
2 (function(){
3 var hljsGrammar = (function () {
4 'use strict';
5
6 /*
7 Language: Pony
8 Author: Joe Eli McIlvain <joe.eli.mac@gmail.com>
9 Description: Pony is an open-source, object-oriented, actor-model,
10 capabilities-secure, high performance programming language.
11 Website: https://www.ponylang.io
12 Category: system
13 */
14
15 function pony(hljs) {
16 const KEYWORDS = {
17 keyword:
18 'actor addressof and as be break class compile_error compile_intrinsic '
19 + 'consume continue delegate digestof do else elseif embed end error '
20 + 'for fun if ifdef in interface is isnt lambda let match new not object '
21 + 'or primitive recover repeat return struct then trait try type until '
22 + 'use var where while with xor',
23 meta:
24 'iso val tag trn box ref',
25 literal:
26 'this false true'
27 };
28
29 const TRIPLE_QUOTE_STRING_MODE = {
30 className: 'string',
31 begin: '"""',
32 end: '"""',
33 relevance: 10
34 };
35
36 const QUOTE_STRING_MODE = {
37 className: 'string',
38 begin: '"',
39 end: '"',
40 contains: [ hljs.BACKSLASH_ESCAPE ]
41 };
42
43 const SINGLE_QUOTE_CHAR_MODE = {
44 className: 'string',
45 begin: '\'',
46 end: '\'',
47 contains: [ hljs.BACKSLASH_ESCAPE ],
48 relevance: 0
49 };
50
51 const TYPE_NAME = {
52 className: 'type',
53 begin: '\\b_?[A-Z][\\w]*',
54 relevance: 0
55 };
56
57 const PRIMED_NAME = {
58 begin: hljs.IDENT_RE + '\'',
59 relevance: 0
60 };
61
62 const NUMBER_MODE = {
63 className: 'number',
64 begin: '(-?)(\\b0[xX][a-fA-F0-9]+|\\b0[bB][01]+|(\\b\\d+(_\\d+)?(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)',
65 relevance: 0
66 };
67
68 /**
69 * The `FUNCTION` and `CLASS` modes were intentionally removed to simplify
70 * highlighting and fix cases like
71 * ```
72 * interface Iterator[A: A]
73 * fun has_next(): Bool
74 * fun next(): A?
75 * ```
76 * where it is valid to have a function head without a body
77 */
78
79 return {
80 name: 'Pony',
81 keywords: KEYWORDS,
82 contains: [
83 TYPE_NAME,
84 TRIPLE_QUOTE_STRING_MODE,
85 QUOTE_STRING_MODE,
86 SINGLE_QUOTE_CHAR_MODE,
87 PRIMED_NAME,
88 NUMBER_MODE,
89 hljs.C_LINE_COMMENT_MODE,
90 hljs.C_BLOCK_COMMENT_MODE
91 ]
92 };
93 }
94
95 return pony;
96
97 })();
98
99 hljs.registerLanguage('pony', hljsGrammar);
100 })();