]> luflow.net public git repositories - flow-web.git/blob - static/highlight/es/languages/vhdl.js
Initial commit.
[flow-web.git] / static / highlight / es / languages / vhdl.js
1 /*! `vhdl` grammar compiled for Highlight.js 11.11.1 */
2 var hljsGrammar = (function () {
3 'use strict';
4
5 /*
6 Language: VHDL
7 Author: Igor Kalnitsky <igor@kalnitsky.org>
8 Contributors: Daniel C.K. Kho <daniel.kho@tauhop.com>, Guillaume Savaton <guillaume.savaton@eseo.fr>
9 Description: VHDL is a hardware description language used in electronic design automation to describe digital and mixed-signal systems.
10 Website: https://en.wikipedia.org/wiki/VHDL
11 Category: hardware
12 */
13
14 function vhdl(hljs) {
15 // Regular expression for VHDL numeric literals.
16
17 // Decimal literal:
18 const INTEGER_RE = '\\d(_|\\d)*';
19 const EXPONENT_RE = '[eE][-+]?' + INTEGER_RE;
20 const DECIMAL_LITERAL_RE = INTEGER_RE + '(\\.' + INTEGER_RE + ')?' + '(' + EXPONENT_RE + ')?';
21 // Based literal:
22 const BASED_INTEGER_RE = '\\w+';
23 const BASED_LITERAL_RE = INTEGER_RE + '#' + BASED_INTEGER_RE + '(\\.' + BASED_INTEGER_RE + ')?' + '#' + '(' + EXPONENT_RE + ')?';
24
25 const NUMBER_RE = '\\b(' + BASED_LITERAL_RE + '|' + DECIMAL_LITERAL_RE + ')';
26
27 const KEYWORDS = [
28 "abs",
29 "access",
30 "after",
31 "alias",
32 "all",
33 "and",
34 "architecture",
35 "array",
36 "assert",
37 "assume",
38 "assume_guarantee",
39 "attribute",
40 "begin",
41 "block",
42 "body",
43 "buffer",
44 "bus",
45 "case",
46 "component",
47 "configuration",
48 "constant",
49 "context",
50 "cover",
51 "disconnect",
52 "downto",
53 "default",
54 "else",
55 "elsif",
56 "end",
57 "entity",
58 "exit",
59 "fairness",
60 "file",
61 "for",
62 "force",
63 "function",
64 "generate",
65 "generic",
66 "group",
67 "guarded",
68 "if",
69 "impure",
70 "in",
71 "inertial",
72 "inout",
73 "is",
74 "label",
75 "library",
76 "linkage",
77 "literal",
78 "loop",
79 "map",
80 "mod",
81 "nand",
82 "new",
83 "next",
84 "nor",
85 "not",
86 "null",
87 "of",
88 "on",
89 "open",
90 "or",
91 "others",
92 "out",
93 "package",
94 "parameter",
95 "port",
96 "postponed",
97 "procedure",
98 "process",
99 "property",
100 "protected",
101 "pure",
102 "range",
103 "record",
104 "register",
105 "reject",
106 "release",
107 "rem",
108 "report",
109 "restrict",
110 "restrict_guarantee",
111 "return",
112 "rol",
113 "ror",
114 "select",
115 "sequence",
116 "severity",
117 "shared",
118 "signal",
119 "sla",
120 "sll",
121 "sra",
122 "srl",
123 "strong",
124 "subtype",
125 "then",
126 "to",
127 "transport",
128 "type",
129 "unaffected",
130 "units",
131 "until",
132 "use",
133 "variable",
134 "view",
135 "vmode",
136 "vprop",
137 "vunit",
138 "wait",
139 "when",
140 "while",
141 "with",
142 "xnor",
143 "xor"
144 ];
145 const BUILT_INS = [
146 "boolean",
147 "bit",
148 "character",
149 "integer",
150 "time",
151 "delay_length",
152 "natural",
153 "positive",
154 "string",
155 "bit_vector",
156 "file_open_kind",
157 "file_open_status",
158 "std_logic",
159 "std_logic_vector",
160 "unsigned",
161 "signed",
162 "boolean_vector",
163 "integer_vector",
164 "std_ulogic",
165 "std_ulogic_vector",
166 "unresolved_unsigned",
167 "u_unsigned",
168 "unresolved_signed",
169 "u_signed",
170 "real_vector",
171 "time_vector"
172 ];
173 const LITERALS = [
174 // severity_level
175 "false",
176 "true",
177 "note",
178 "warning",
179 "error",
180 "failure",
181 // textio
182 "line",
183 "text",
184 "side",
185 "width"
186 ];
187
188 return {
189 name: 'VHDL',
190 case_insensitive: true,
191 keywords: {
192 keyword: KEYWORDS,
193 built_in: BUILT_INS,
194 literal: LITERALS
195 },
196 illegal: /\{/,
197 contains: [
198 hljs.C_BLOCK_COMMENT_MODE, // VHDL-2008 block commenting.
199 hljs.COMMENT('--', '$'),
200 hljs.QUOTE_STRING_MODE,
201 {
202 className: 'number',
203 begin: NUMBER_RE,
204 relevance: 0
205 },
206 {
207 className: 'string',
208 begin: '\'(U|X|0|1|Z|W|L|H|-)\'',
209 contains: [ hljs.BACKSLASH_ESCAPE ]
210 },
211 {
212 className: 'symbol',
213 begin: '\'[A-Za-z](_?[A-Za-z0-9])*',
214 contains: [ hljs.BACKSLASH_ESCAPE ]
215 }
216 ]
217 };
218 }
219
220 return vhdl;
221
222 })();
223 ;
224 export default hljsGrammar;