Verilog hiliter for nano

3 views
Skip to first unread message

Rick Hohensee

unread,
Oct 19, 2021, 2:50:57 PM10/19/21
to

## Oct 2021 Rick Hohensee
##

syntax v "\.([vV]|vs)$"

# punct
color pink ","
color pink "\("
color pink "\)"
color red "\;"
color blue "\:"
color blue "\]"
color blue "\["

# operators
color purple,green "@"
color purple,green "/"
color purple,green "<="
color purple,green "="
color purple,green "(&|\?|%|<|<<<|!|')"
color purple,green "\+"
color purple,green "(\+|\{|\})"
color purple,green "(-|&&|~|^|\||<<|>|>>|>>>|\.|\*|\*\*|!=|\\|~^|\^)"

# Labels.
color brightmagenta "^[[:space:]]*[A-Z_a-z]+:[[:space:]]*$"

color red,green "\<(module|endmodule)\>"
color green "\<(and|always|automatic|assign|buf|bufif0|bufif1)\>"
color green "\<(casex|casez|cell)\>"
color green "\<(config|deassign|default|defparam|design|disable|edge|else)\>"
color peach "\<(end|endcase|endconfig|endfunction|endgenerate|endprimitive|endspecify|endtable|endtask)\>"
color peach "\<(begin|case|config|function|generate|primitive|specify|table|task)\>"
color brightyellow "\<(nmos|pmos|cmos|rcmos|rnmos|rpmos)\>"

color green "\<(event|for|forever|for|fork|genvar|highz0|highz1|if|ifnone|initial)\>"
color green "\<(instance|integer|join|large|liblist|localparam|macromodule|medium)\>"
color green "\<(nand|negedge|nor|noshowcancelled|not|notif0|notif1|or|parameter|posedge)\>"
color green "\<(posedge|pull0|pull1|pullup|pulldown|pulsestyle_ondetect|pulsestyle_onevent)\>"
color green "\<(real|realtime|reg|release|repeat|rtran|rtranif0|rtranif1|scalared|showcancelled)\>"
color green "\<(signed|small|specify|specparam|strong0|strong1|tran|time)\>"
color green "\<(tri|tri0|tri1|triand|trior|trireg|use|vectored|wait|wand|weak0|weak1|while)\>"
color green "\<(wor|xnor|xor|tranif0|tranif1|force)\>"

color brightmagenta "'([^'\]|(\\["'abfnrtv\\]))'" "'\\(([0-3]?[0-7]{1,2}))'" "'\\x[0-9A-Fa-f]{1,2}'"

color cyan "wire"
color cyan "\<(input|output|inout|supply0|supply1)\>"

# Strings. In general you will want your strings and comments to come last,
# because highlighting rules are applied in the order they are read in.
color brightyellow ""([^"]|\\")*"" "#[[:space:]]*include[[:space:]]+<[^[:blank:]=]*>"

# Preprocessor directives.
color brightcyan "`"
color brightcyan,red "(`include|`define|`undef|`ifdef|`elseif|`else)"
color brightcyan,red "(`ifndef|`timescale|`celldefine|`endcelldefine)"
color brightcyan,red "(`elsif|`default_nettype|`resetall|`unconnected_drive|`nounconnected_drive)"
color brightcyan,red "(`detault_trireg_strength|`delay_mode_distributed|`delay_mode_path)"
color brightcyan,red "(`delay_mode_unit|`delay_mode_zero)"
color brightcyan,red "(`endif|`line|`default_decay_time|`default_trireg_strength)"


# testing
color black,pink "(\$monitor|\$display|\$scanf|\$time|\$fopen|\$write)\>"
color black,pink "(\$strobe|\$monitor|\$monitoron|\$monitoroff|\$displayb|\$writeb|\$strobeb|\$monitorb|\$displayo|\$strobeo|\$monitoro|\$displayh|\$writeh|\$strobeh|\$monitorh|\$fopen|\$fclose|\$frewind|\$fflush|\$fseek|\$ftell|\$swrite|\$fstrobe|\$fmonitor|\$fread|\$fscanf|\$fdisplayb|\$fwriteb|\$swriteb|\$fstrobeb|\$fmonitorb|\$fdisplayo|\$fwriteo|\$writeo|\$fstrobeo|\$fmonitoro|\$fdisplayh|\$fwriteh|\$swriteh|\$fstrobeh|\$fmonitorh|\$sscanf|\$sdf_annotate)"
color black,pink "\#[0-9]*"
color black,pink "(\$fdisplay|\$fwrite)"

# Reminders.
color brightwhite,red "\<(FIXME|TODO|XXX)\>"

# Trailing whitespace.
color ,green "[[:space:]]+$"

# Comments. 219-64-7434
color brightblack "//.*"
color brightblack start="/\*" end="\*/"

# color brightblack is grey.
Reply all
Reply to author
Forward
0 new messages