/usr/share/jed/lib/vhdlmode.sl is in jed-common 1:0.99.19-4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 | % VHDL mode -* SLang -*-
%
% This is a simple vhdl mode. First it implements a highlighting scheme.
%
% modified by Thei Wijnen 22-nov-2001: added: xor xnor with after alias select
% modified by Thei Wijnen 21-mar-2002: added: generate transport rising_edge falling_edge
% Modified by Thei Wijnen 10-Aug-2003: implemented indentation style and folding.
% Modified by Thei Wijnen 06-Jun-2004: indent region, added more keywords.
% Modified by Thei Wijnen 03-Mar-2005: allow mixed case, added more keywords.
%
% Loading this file, then executing 'vhdl_mode' will start
% VHDL mode on the current buffer.
custom_variable ("VHDL_Comment_String", "--");
custom_variable ("VHDL_Indent_Amount", 2);
%
% VHDL indent routine
define vhdl_indent ()
{
variable goal = 1; % start in column 1.
variable cs = CASE_SEARCH;
variable ch;
push_spot ();
push_spot ();
CASE_SEARCH = 0; % VHDL is not case sensitive
while (up_1 ())
{
bol_skip_white();
if (eolp() ) continue;
goal = what_column ();
if (goal == 1) continue;
if (looking_at("do ")
or looking_at("elsif ") or looking_at("elsif(")
or looking_at("else") )
{
goal += VHDL_Indent_Amount;
}
else if (looking_at("if ") or looking_at("if("))
{
if (ffind("then")) { goal += VHDL_Indent_Amount; }
}
else if (looking_at("for") or looking_at("for("))
{
if (ffind("loop")) goal += VHDL_Indent_Amount;
}
else if (looking_at("when"))
{
if (ffind("=>")) goal += VHDL_Indent_Amount;
}
else if (looking_at("case"))
{
if (ffind("is")) goal += VHDL_Indent_Amount;
}
else if (looking_at("begin"))
{
goal += VHDL_Indent_Amount;
}
% else if (looking_at("begin"))
% {
% push_spot ();
% while (up_1 ())
% {
% bol_skip_white();
% if (eolp() ) continue;
% if (looking_at("variable ") or looking_at("process") )
% {
% goal -= VHDL_Indent_Amount;
% }
% break;
% }
% pop_spot ();
% }
break;
}
pop_spot ();
% now check current line
bol_skip_white();
% if (looking_at("begin"))
% goal += VHDL_Indent_Amount;
if (looking_at("elsif")
or looking_at("else")
or looking_at("end")
or looking_at("when")
% or looking_at("end if")
% or looking_at("end process")
% or looking_at("end loop")
)
{
goal -= VHDL_Indent_Amount;
}
CASE_SEARCH = cs; % done getting indent
bol_skip_white ();
ch = char(what_char());
switch (ch)
%* {
%* isdigit (ch) : % label
%*
%* if (what_column () >= 6)
%* {
%* bol_trim ();
%* insert_single_space ();
%* }
%* X_USER_BLOCK1 ();
%* }
{
not (bolp()) or eolp (): % general case
bol_trim ();
goal--;
insert_spaces (goal);
}
pop_spot ();
skip_white ();
}
define vhdl_newline ()
{
variable p, cont;
if (bolp ())
{
newline ();
return;
}
vhdl_indent ();
push_spot ();
bskip_white (); trim ();
pop_spot ();
newline ();
insert_single_space ();
vhdl_indent ();
}
%
% Look for beginning of current subroutine/function
define vhdl_beg_of_subprogram ()
{
variable cs = CASE_SEARCH;
CASE_SEARCH = 0;
do
{
bol_skip_white ();
if (_get_point ())
{
if (looking_at ("process")
or looking_at ("switch")) break;
}
}
while (up_1 ());
CASE_SEARCH = cs;
}
%
% Look for end of current subroutine/function
define vhdl_end_of_subprogram ()
{
variable cs = CASE_SEARCH;
CASE_SEARCH = 0;
do
{
bol_skip_white ();
if (looking_at ("end;")
or looking_at ("end process")) break;
% {
% go_right (3);
% skip_white ();
% if (eolp ()) break;
% }
}
while (down_1 ());
CASE_SEARCH = cs;
}
define vhdl_mark_subprogram ()
{
vhdl_end_of_subprogram ();
go_down_1 ();
set_mark_cmd ();
vhdl_beg_of_subprogram ();
bol ();
}
% Indent the selected region (bound to \e^i)
define vhdl_indent_region ()
{
check_region(1);
pop_mark_1 ();
push_mark();
vhdl_indent(); % set initial line indentation before narrowing
pop_spot();
push_spot();
go_up_1 ();
narrow();
bob();
flush("Indenting region...");
while (down_1 ()) { % indent line by line (ie slowly)
vhdl_indent();
% flush(Sprintf("Indenting line %d", what_line(), 1));
}
flush("Indenting region... Done.");
widen();
pop_spot();
}
%
% main entry point into the VHDL mode
%
% Set up syntax table
$1 = "VHDL";
create_syntax_table ($1);
define_syntax ("--","",'%', $1); % comments
define_syntax ("([{", ")]}", '(', $1); % parentheses
define_syntax ('"', '"', $1); % quoted strings
%define_syntax ('\'', '\'', $1); % quoted characters (paired ')
define_syntax ('\'', '\\', $1); % continuations
define_syntax ("0-9a-zA-Z_", 'w', $1); % words
define_syntax ("-+0-9a-fA-F.xXL", '0', $1); % numbers
define_syntax (",;.?:=<>", ',', $1); % delimiters
define_syntax ('#', '#', $1); % preprocessor
define_syntax ("%-+/&*<>|!~^", '+', $1); % operators
set_syntax_flags ($1, 8); %
% Type 0 keywords
() = define_keywords ($1, "ifinisofonorto", 2);
() = define_keywords ($1, "absandendformapmaxminmodnornotoutremrunusexor", 3);
() = define_keywords ($1, "casebodyelsefileloopnandnextopenportpurethentypewaitwhenwithxnor", 4);
() = define_keywords ($1, "afteraliasbeginelsifgroupinoutlabeltraceuntilwhile", 5);
() = define_keywords ($1, "accessassertassignbufferdowntoentityimpureothersrecordrejectreportreturnselectsharedsignal", 6);
() = define_keywords ($1, "genericguardedlibraryliteralpackageprocesssubtype", 7);
() = define_keywords ($1, "constantfunctiongenerateinertialregisterseverityvariable", 8);
() = define_keywords ($1, "attributecomponentpostponedproceduretransport", 9);
() = define_keywords ($1, "architecture", 12);
() = define_keywords ($1, "configuration", 13);
% Type 1 keywords - use for operator like keywords
() = define_keywords_n ($1, "eqgegtleltne", 2, 1);
() = define_keywords_n ($1, "lowposslasllsrasrlval", 3, 1);
() = define_keywords_n ($1, "basehighleftnotepredsucctrue", 4, 1);
() = define_keywords_n ($1, "erroreventfalseimagequietrangerightvalue", 5, 1);
() = define_keywords_n ($1, "activeleftoflengthstable", 6, 1);
() = define_keywords_n ($1, "delayeddrivingfailurerightofwarning", 7, 1);
() = define_keywords_n ($1, "ascendingdecending", 9, 1);
() = define_keywords_n ($1, "last_eventlast_value", 10, 1);
() = define_keywords_n ($1, "last_activerising_edgetransaction", 11, 1);
() = define_keywords_n ($1, "falling_edge", 12, 1);
() = define_keywords_n ($1, "driving_valuereverse_range", 13, 1);
% Type 2 keywords - use for type declarator keywords
() = define_keywords_n ($1, "msnspsus", 2, 2);
() = define_keywords_n ($1, "linetime", 4, 2);
() = define_keywords_n ($1, "string", 6, 2);
() = define_keywords_n ($1, "booleanintegernatural", 7, 2);
() = define_keywords_n ($1, "unsigned", 8, 2);
() = define_keywords_n ($1, "characterstd_logic", 9, 2);
() = define_keywords_n ($1, "std_logic_vector", 16, 2);
% Set up syntax table
$1 = "VHDL";
!if (keymap_p ($1)) make_keymap ($1);
definekey ("vhdl_beg_of_subprogram", "\e^A", $1);
definekey ("vhdl_end_of_subprogram", "\e^E", $1);
definekey ("vhdl_mark_subprogram", "\e^H", $1);
definekey ("vhdl_indent_region", "\e^I", $1);
%!%+
%\function{vhdl_mode}
%\synopsis{vhdl_mode}
%\description
% Mode designed for the purpose of editing VHDL files.
% After the mode is loaded, the hook 'vhdl_hook' is called.
% Useful functions include
%
% Function: Default Binding:
% vhdl_beg_of_subprogram ESC ^A
% moves cursor to beginning of current function/process
% vhdl_end_of_subprogram ESC ^E
% moves cursor to end of current function/process
% vhdl_mark_subprogram ESC ^H
% mark the current function/process
%
% Variables include:
% VHDL_Comment_String : string used by 'vhdl_comment' to
% comment out a line. Default is "--".
% VHDL_Indent_Amount : number of spaces to indent statements in
% a block. The default is 2.
%!%-
define vhdl_mode ()
{
variable mode = "VHDL";
set_mode (mode, 0x4 | 0x10);
use_keymap (mode);
use_syntax_table (mode);
set_syntax_flags (mode, 0x01);
set_buffer_hook ("indent_hook", "vhdl_indent");
set_buffer_hook ("newline_indent_hook", "vhdl_newline");
mode_set_mode_info (mode, "fold_info", "--{{{\r--}}}\r\r");
run_mode_hooks ("vhdl_mode_hook");
}
|