]> luflow.net public git repositories - flow-web.git/blob - static/highlight/es/languages/hy.js
Initial commit.
[flow-web.git] / static / highlight / es / languages / hy.js
1 /*! `hy` grammar compiled for Highlight.js 11.11.1 */
2 var hljsGrammar = (function () {
3 'use strict';
4
5 /*
6 Language: Hy
7 Description: Hy is a wonderful dialect of Lisp that’s embedded in Python.
8 Author: Sergey Sobko <s.sobko@profitware.ru>
9 Website: http://docs.hylang.org/en/stable/
10 Category: lisp
11 */
12
13 function hy(hljs) {
14 const SYMBOLSTART = 'a-zA-Z_\\-!.?+*=<>&#\'';
15 const SYMBOL_RE = '[' + SYMBOLSTART + '][' + SYMBOLSTART + '0-9/;:]*';
16 const keywords = {
17 $pattern: SYMBOL_RE,
18 built_in:
19 // keywords
20 '!= % %= & &= * ** **= *= *map '
21 + '+ += , --build-class-- --import-- -= . / // //= '
22 + '/= < << <<= <= = > >= >> >>= '
23 + '@ @= ^ ^= abs accumulate all and any ap-compose '
24 + 'ap-dotimes ap-each ap-each-while ap-filter ap-first ap-if ap-last ap-map ap-map-when ap-pipe '
25 + 'ap-reduce ap-reject apply as-> ascii assert assoc bin break butlast '
26 + 'callable calling-module-name car case cdr chain chr coll? combinations compile '
27 + 'compress cond cons cons? continue count curry cut cycle dec '
28 + 'def default-method defclass defmacro defmacro-alias defmacro/g! defmain defmethod defmulti defn '
29 + 'defn-alias defnc defnr defreader defseq del delattr delete-route dict-comp dir '
30 + 'disassemble dispatch-reader-macro distinct divmod do doto drop drop-last drop-while empty? '
31 + 'end-sequence eval eval-and-compile eval-when-compile even? every? except exec filter first '
32 + 'flatten float? fn fnc fnr for for* format fraction genexpr '
33 + 'gensym get getattr global globals group-by hasattr hash hex id '
34 + 'identity if if* if-not if-python2 import in inc input instance? '
35 + 'integer integer-char? integer? interleave interpose is is-coll is-cons is-empty is-even '
36 + 'is-every is-float is-instance is-integer is-integer-char is-iterable is-iterator is-keyword is-neg is-none '
37 + 'is-not is-numeric is-odd is-pos is-string is-symbol is-zero isinstance islice issubclass '
38 + 'iter iterable? iterate iterator? keyword keyword? lambda last len let '
39 + 'lif lif-not list* list-comp locals loop macro-error macroexpand macroexpand-1 macroexpand-all '
40 + 'map max merge-with method-decorator min multi-decorator multicombinations name neg? next '
41 + 'none? nonlocal not not-in not? nth numeric? oct odd? open '
42 + 'or ord partition permutations pos? post-route postwalk pow prewalk print '
43 + 'product profile/calls profile/cpu put-route quasiquote quote raise range read read-str '
44 + 'recursive-replace reduce remove repeat repeatedly repr require rest round route '
45 + 'route-with-methods rwm second seq set-comp setattr setv some sorted string '
46 + 'string? sum switch symbol? take take-nth take-while tee try unless '
47 + 'unquote unquote-splicing vars walk when while with with* with-decorator with-gensyms '
48 + 'xi xor yield yield-from zero? zip zip-longest | |= ~'
49 };
50
51 const SIMPLE_NUMBER_RE = '[-+]?\\d+(\\.\\d+)?';
52
53 const SYMBOL = {
54 begin: SYMBOL_RE,
55 relevance: 0
56 };
57 const NUMBER = {
58 className: 'number',
59 begin: SIMPLE_NUMBER_RE,
60 relevance: 0
61 };
62 const STRING = hljs.inherit(hljs.QUOTE_STRING_MODE, { illegal: null });
63 const COMMENT = hljs.COMMENT(
64 ';',
65 '$',
66 { relevance: 0 }
67 );
68 const LITERAL = {
69 className: 'literal',
70 begin: /\b([Tt]rue|[Ff]alse|nil|None)\b/
71 };
72 const COLLECTION = {
73 begin: '[\\[\\{]',
74 end: '[\\]\\}]',
75 relevance: 0
76 };
77 const HINT = {
78 className: 'comment',
79 begin: '\\^' + SYMBOL_RE
80 };
81 const HINT_COL = hljs.COMMENT('\\^\\{', '\\}');
82 const KEY = {
83 className: 'symbol',
84 begin: '[:]{1,2}' + SYMBOL_RE
85 };
86 const LIST = {
87 begin: '\\(',
88 end: '\\)'
89 };
90 const BODY = {
91 endsWithParent: true,
92 relevance: 0
93 };
94 const NAME = {
95 className: 'name',
96 relevance: 0,
97 keywords: keywords,
98 begin: SYMBOL_RE,
99 starts: BODY
100 };
101 const DEFAULT_CONTAINS = [
102 LIST,
103 STRING,
104 HINT,
105 HINT_COL,
106 COMMENT,
107 KEY,
108 COLLECTION,
109 NUMBER,
110 LITERAL,
111 SYMBOL
112 ];
113
114 LIST.contains = [
115 hljs.COMMENT('comment', ''),
116 NAME,
117 BODY
118 ];
119 BODY.contains = DEFAULT_CONTAINS;
120 COLLECTION.contains = DEFAULT_CONTAINS;
121
122 return {
123 name: 'Hy',
124 aliases: [ 'hylang' ],
125 illegal: /\S/,
126 contains: [
127 hljs.SHEBANG(),
128 LIST,
129 STRING,
130 HINT,
131 HINT_COL,
132 COMMENT,
133 KEY,
134 COLLECTION,
135 NUMBER,
136 LITERAL
137 ]
138 };
139 }
140
141 return hy;
142
143 })();
144 ;
145 export default hljsGrammar;