## Syntax highlighting for Verilog files. ## Copied from https://savannah.gnu.org/patch/?10015. ## Original author: Jorge Juan-Chico ## License: Public domain ## Based on IEEE Std 1364-2005 syntax verilog "\.[vV][hH]?$" comment "//" # Regular keywords. # (keywords in (System)Verilog may be escaped with "\") color green "([^\\]\<|^)(always|and|assign|automatic|begin|buf)\>" color green "([^\\]\<|^)(bufif0|bufif1|case|casex|casez|cell|cmos)\>" color green "([^\\]\<|^)(config|deassign|default|defparam|design)\>" color green "([^\\]\<|^)(disable|edge|else|end|endcase|endconfig)\>" color green "([^\\]\<|^)(endfunction|endgenerate|endmodule)\>" color green "([^\\]\<|^)(endprimitive|endspecify|endtable|endtask)\>" color green "([^\\]\<|^)(event|for|force|forever|fork|function)\>" color green "([^\\]\<|^)(generate|genvar|highz0|highz1|if|ifnone)\>" color green "([^\\]\<|^)(incdir|include|initial|inout|input|instance)\>" color green "([^\\]\<|^)(join|large|liblist|library|localparam)\>" color green "([^\\]\<|^)(macromodule|medium|module|nand|negedge|nmos)\>" color green "([^\\]\<|^)(nor|noshowcancelled|not|notif0|notif1|or)\>" color green "([^\\]\<|^)(output|parameter|pmos|posedge|primitive)\>" color green "([^\\]\<|^)(pull0|pull1|pulldown|pullup)\>" color green "([^\\]\<|^)(pulsestyle_ondetect|pulsestyle_onevent)\>" color green "([^\\]\<|^)(rcmos|release|repeat|rnmos|rpmos|rtran)\>" color green "([^\\]\<|^)(rtranif0|rtranif1|scalared|showcancelled)\>" color green "([^\\]\<|^)(small|specify|specparam|strong0|strong1)\>" color green "([^\\]\<|^)(table|task|tran|tranif0|tranif1|use)\>" color green "([^\\]\<|^)(vectored|wait|weak0|weak1|while|xnor|xor)\>" # Built-in net type keywords. color brightgreen "([^\\]\<|^)(supply0|supply1|tri|tri0|tri1|triand)\>" color brightgreen "([^\\]\<|^)(trior|trireg|uwire|wand|wire|wor)\>" # Built-in var type keywords. color brightgreen "([^\\]\<|^)(event|integer|real|realtime|reg|signed)\>" color brightgreen "([^\\]\<|^)(time|unsigned)\>" # Numbers. color brightmagenta "(\<[0-9]*|\B)\s*'[sS]?[dD]\s*[0-9_]+\>" color brightmagenta "(\<[0-9]*|\B)\s*'[sS]?[bB]\s*[0-1_xXzZ?]+\>" color brightmagenta "(\<[0-9]*|\B)\s*'[sS]?[oO]\s*[0-7_xXzZ?]+\>" color brightmagenta "(\<[0-9]*|\B)\s*'[sS]?[hH]\s*[0-9a-fA-F_xXzZ?]+\>" color brightmagenta "\<[0-9][0-9_]*(\.[0-9][0-9_]*)?([eE]-?[0-9][0-9_]*)?\>" color brightmagenta "\B'[01xXzZ]\>" # Operator characters. color cyan "[][~&|^>" # Standard system tasks and functions. color cyan "\B\$(acos|acosh|asin|asinh|async\$and\$array)\>" color cyan "\B\$(async\$and\$plane|async\$nand\$array)\>" color cyan "\B\$(async\$nand\$plane|async\$nor\$array)\>" color cyan "\B\$(async\$nor\$plane|async\$or\$array|async\$or\$plane)\>" color cyan "\B\$(atan|atan2|atanh|bitstoreal|ceil|clog2|cos|cosh)\>" color cyan "\B\$(display|displayb|displayh|displayo|dist_chi_square)\>" color cyan "\B\$(dist_erlang|dist_exponential|dist_normal)\>" color cyan "\B\$(dist_poisson|dist_t|dist_uniform|exp|fclose)\>" color cyan "\B\$(fdisplay|fdisplayb|fdisplayh|fdisplayo|feof|ferror)\>" color cyan "\B\$(fflush|fgetc|fgets|finish|floor|fmonitor|fmonitorb)\>" color cyan "\B\$(fmonitorh|fmonitoro|fopen|fread|fscanf|fseek)\>" color cyan "\B\$(fstrobe|fstrobeb|fstrobeh|fstrobeo|ftell|fwrite)\>" color cyan "\B\$(fwriteb|fwriteh|fwriteo|hypot|itor|ln|log10)\>" color cyan "\B\$(monitor|monitorb|monitorh|monitoro|monitoroff)\>" color cyan "\B\$(monitoron|pow|printtimescale|q_add|q_exam|q_full)\>" color cyan "\B\$(q_initialize|q_remove|random|readmemb|readmemh)\>" color cyan "\B\$(realtime|realtobits|rewind|rtoi|sdf_annotate)\>" color cyan "\B\$(sformat|signed|sin|sinh|sqrt|sscanf|stime|stop)\>" color cyan "\B\$(strobe|strobeb|strobeh|strobeo|swrite|swriteb)\>" color cyan "\B\$(swriteh|swriteo|sync\$and\$array|sync\$and\$plane)\>" color cyan "\B\$(sync\$nand\$array|sync\$nand\$plane|sync\$nor\$array)\>" color cyan "\B\$(sync\$nor\$plane|sync\$or\$array|sync\$or\$plane)\>" color cyan "\B\$(tan|tanh|test\$plusargs|time|timeformat|ungetc)\>" color cyan "\B\$(unsigned|value\$plusargs|write|writeb|writeh|writeo)\>" # Macros. color brightmagenta "\B`[A-Za-z_][0-9A-Za-z_]*\>" # Strings. # SystemVerilog strings can span multiple lines by using a "\" at the end of the # line. Here we allow strings to span multiple lines regardless of an "\" at EOL. color brightyellow start=""" end="([^"]|\\")*"" # Generic compiler directives. # (we want these after macros) color brightcyan "^[[:space:]]*`[A-Za-z_][0-9A-Za-z_]*\>" # Standard compiler directives. color cyan "^[[:space:]]*`(begin_keywords|celldefine|default_nettype)\>" color cyan "^[[:space:]]*`(define|else|elsif|end_keywords)\>" color cyan "^[[:space:]]*`(endcelldefine|endif|ifdef|ifndef|include)\>" color cyan "^[[:space:]]*`(line|nounconnected_drive|pragma|resetall)\>" color cyan "^[[:space:]]*`(timescale|unconnected_drive|undef)\>" # Comments. color brightblue "//.*" color brightblue start="/\*" end="\*/" # Reminders. color brightwhite,yellow "\<(FIXME|TODO|XXX)\>" # Trailing whitespace. color ,green "[[:space:]]+$"