|
Auto-uppercase
[Back]
These smart indent macros automatically convert strings specified in
$uppercase_strings after a delimiting character is typed, the
example given is for VHDL.
Initialization macro:
$uppercase_strings="<([aA]bs|[aA]ccess|[aA]fter|[aA]ll|[aA]nd|\
[aA]rchitecture|[aA]rray|[aA]ssert|[aA]ttribute|[bB]egin|[bB]lock|[bB]ody|\
[bB]uffer|[bB]us|[cC]ase|[cC]omponent|[cC]onfiguration|[cC]onstant|\
[dD]isconnect|[dD]ownto|[eE]lse|[eE]lsif|[eE]nd|[eE]ntity|[eE]rror|[eE]xit|\
[fF]ailure|[fF]ile|[fF]or|[fF]unction|[gG]enerate|[gG]eneric|[gG]uarded|[iI]f|\
[iI]n|[iI]nout|[iI]s|[lL]abel|[lL]ibrary|[lL]inkage|[lL]oop|[mM]ap|[mM]od|\
[nN]and|[nN]ew|[nN]ext|[nN]or|[nN]ot|[nN]ote|[nN]ull|[oO]f|[oO]n|[oO]pen|[oO]r|\
[oO]thers|[oO]ut|[pP]ackage|[pP]ort|[pP]rocedure|[pP]rocess|[rR]ange|[rR]ecord|\
[rR]egister|[rR]em|[rR]eport|[rR]eturn|[sS]elect|[sS]everity|[sS]ignal|[tT]hen|\
[tT]o|[tT]ransport|[uU]nits|[uU]ntil|[uU]se|[wW]ait|[wW]arning|[wW]hen|\
[wW]hile|[wW]ith|[xX]or|[gG]roup|[iI]mpure|[iI]nertial|[lL]iteral|[pP]ostponed|\
[pP]ure|[rR]eject|[rR]ol|[rR]or|[sS]hared|[sS]la|[sS]ll|[sS]ra|[sS]rl|\
[uU]naffected|[vV]ariable|[xX]nor)>"
Newline macro:
anf=search("<", $cursor, "regex", "backward")
if (anf == -1) return -1
xstr=get_range(anf, $cursor)
if (search_string(xstr, $uppercase_strings, 0, "regex") != -1) {
startline=search("^", $cursor, "regex", "backward")
start_to_cursor=get_range(startline, $cursor)
if (search_string(start_to_cursor, "--", 0) == -1) {
select(anf, $cursor)
uppercase()
deselect_all()
}
}
return -1
Type-in macro:
if(search_string($2, "[A-Za-z0-9_]", 0, "regex" )==-1) {
anf=search("<", $cursor-1, "regex", "backward")
bnf=search("'event", $cursor, "backward")
if ((anf == -1) && (bnf == -1)) return
xstr=get_range(anf, $cursor)
ystr=get_range(bnf, $cursor)
if ((search_string(xstr, $uppercase_strings, 0, "regex") != -1) &&\
(anf != -1)) {
startline=search("^", $cursor-1, "regex", "backward")
start_to_cursor=get_range(startline, $cursor)
if (search_string(start_to_cursor, "--", 0) == -1) {
select(anf, $cursor)
uppercase()
deselect_all()
}
}
else {
if ((search_string(ystr, "^'[eE]vent$", 0, "regex") != -1) &&\
(bnf != -1)) {
startline=search("^", $cursor-1, "regex", "backward")
start_to_cursor=get_range(startline, $cursor)
if (search_string(start_to_cursor, "--", 0) == -1) {
select(bnf, $cursor)
uppercase()
deselect_all()
}
}
}
}
[Back]
Released on Wed, 21 Nov 2001
by
C. Denat
|
|