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