From 41dd0e2f153afbde078d73fa92bc43e0c193ec83 Mon Sep 17 00:00:00 2001 From: Jorge Juan-Chico Date: Wed, 6 Jan 2021 20:57:41 +0100 Subject: [PATCH] Add Verilog HDL syntax highlighting Syntax highlighting definitions for Verilog HDL. Signed-off-by: Jorge Juan-Chico --- syntax/Makefile.am | 1 + syntax/verilog.nanorc | 72 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 73 insertions(+) create mode 100644 syntax/verilog.nanorc diff --git a/syntax/Makefile.am b/syntax/Makefile.am index 8d747546..2bab6ef2 100644 --- a/syntax/Makefile.am +++ b/syntax/Makefile.am @@ -36,6 +36,7 @@ pkgdata_DATA = asm.nanorc \ tcl.nanorc \ tex.nanorc \ texinfo.nanorc \ + verilog.nanorc \ xml.nanorc nobase_pkgdata_DATA = \ diff --git a/syntax/verilog.nanorc b/syntax/verilog.nanorc new file mode 100644 index 00000000..01f6a7b3 --- /dev/null +++ b/syntax/verilog.nanorc @@ -0,0 +1,72 @@ +## Syntax highlighting for Verilog files. + +# Partially inspired by vim's Verilog syntax by Mun Johl +# and c.nanorc. + +syntax verilog "\.[vV][hH]?$" +comment "//" + +# Keywords. +color green "\<(always|and|assign|automatic|buf|bufif0|bufif1)\>" +color green "\<(cell|cmos|config|deassign|defparam|design)\>" +color green "\<(disable|edge|endconfig|endfunction|endgenerate)\>" +color green "\<(endmodule|endprimitive|endspecify|endtable|endtask)\>" +color green "\<(event|force|function|generate|genvar|highz0|highz1)\>" +color green "\<(ifnone|incdir|include|initial|inout|input|instance)\>" +color green "\<(integer|large|liblist|library|localparam|macromodule)\>" +color green "\<(medium|module|nand|negedge|nmos|nor|noshowcancelled)\>" +color green "\<(not|notif0|notif1|or|output|parameter|pmos|posedge)\>" +color green "\<(primitive|pull0|pull1|pulldown|pullup)\>" +color green "\<(pulsestyle_onevent|pulsestyle_ondetect|rcmos|real)\>" +color green "\<(realtime|reg|release|rnmos|rpmos|rtran|rtranif0)\>" +color green "\<(rtranif1|scalared|showcancelled|signed|small|specify)\>" +color green "\<(specparam|strong0|strong1|supply0|supply1|table|task)\>" +color green "\<(time|tran|tranif0|tranif1|tri|tri0|tri1|triand|trior)\>" +color green "\<(trireg|unsigned|use|vectored|wait|wand|weak0|weak1)\>" +color green "\<(wire|wor|xnor|xor)\>" + +# Process delimiters. +color brightyellow "\<(begin|end|fork|join)\>" + +# Flow control. +color green "\<(if|else|case|casex|casez|default|endcase)\>" +color green "\<(forever|repeat|while|for)\>" + +# Numbers. +color brightmagenta "(\<[0-9]*|\B)'[sS]?[dD][0-9_]+\>" +color brightmagenta "(\<[0-9]*|\B)'[sS]?[bB][0-1_xXzZ?]+\>" +color brightmagenta "(\<[0-9]*|\B)'[sS]?[oO][0-7_xXzZ?]+\>" +color brightmagenta "(\<[0-9]*|\B)'[sS]?[hH][0-9a-fA-F_xXzZ?]+\>" +color brightmagenta "\<[+-]?[0-9_]+(\.[0-9_]+)?(e-?[0-9_]+)?\>" + +# Operators. +color cyan "[][~&|^>" + +# Constants and macros. +color brightmagenta "\<[A-Z_][0-9A-Z_]*\>" +color brightmagenta "\B`[A-Za-z_][0-9A-Za-z_]*\>" + +# Strings. +# (borrowed from c.nanorc) +color brightyellow ""([^"]|\\")*"" "#[[:space:]]*include[[:space:]]+<[^[:blank:]=]*>" + +# Preprocessor directives. +# (we want these after macros) +color brightcyan "^[[:space:]]*`(celldefine|default_nettype|define|else|elsif)\>" +color brightcyan "^[[:space:]]*`(endcelldefine|endif|ifdef|ifndef|include)\>" +color brightcyan "^[[:space:]]*`(nounconnected_drive|resetall|timescale)\>" +color brightcyan "^[[:space:]]*`(unconnected_drive|undef)\>" + +# Comments. +color brightblue "//.*" +color brightblue start="/\*" end="\*/" + +# Reminders. +color brightwhite,yellow "\<(FIXME|TODO|XXX)\>" + +# Trailing whitespace. +color ,green "[[:space:]]+$" + -- 2.25.1