This is the first push to this repo with my dotfiles
[dotfilesold/.git] / .nano / verilog.nanorc
1 ## (System)Verilog syntax highlighting.
2
3 # See http://savannah.gnu.org/patch/?9356
4 # From bc2635d9c8dcf6a71e834582501546fac6bdbfff Mon Sep 17 00:00:00 2001
5 # From: Ben Rosser <rosser.bjr@gmail.com>
6 # Date: Tue, 23 May 2017 17:43:15 -0400
7 # Subject: [PATCH] Add Verilog nanorc file for syntax highlighting
8
9 # This adds a verilog.nanorc file for syntax highlighting of Verilog
10 # and SystemVerilog code. It is based off of the nanorc files for
11 # Python and C.
12
13 # All keywords in both Verilog (*.v, *.vh) and SystemVerilog (*.sv,
14 # *.svh) are listed. Compiler directives (commands beginning with a
15 # backtick) and builtin functions are also colorized.
16
17 # Possibly the color scheme could use some work, but this is at least
18 # a starting point. I based verilog.nanorc off of c.nanorc and
19 # python.nanorc.
20
21 syntax "verilog" "\.(v|vh|sv|svh)$"
22
23 # I don't think we want this.
24 #color brightred "\<[A-Z_][0-9A-Z_]+\>"
25
26 # Module, package, etc. definitions: colorize their names.
27 # (I'm not sure if brightred is a good color).
28 icolor brightred "(module|package|task|interface|program|class) [0-9A-Z_]+"
29 icolor brightred "function [0-9A-Z_]+ [0-9A-Z_]+"
30
31 # Verilog keywords, taken from http://svref.renerta.com/sv00003.htm.
32 color green "\<(always|and|assign|automatic|begin|buf|bufif0|bufif1|case|casex|casez|cell|class|cmos|config)\>"
33 color green "\<(deassign|default|defparam|design|disable|edge|else|end|endcase|endconfig|endfunction|endgenerate)\>"
34 color green "\<(endmodule|endprimitive|endspecify|endtable|endtask|event|for|force|forever|fork|function|generate)\>"
35 color green "\<(genvar|highz0|highz1|if|iff|ifnone|incdir|include|initial|inout|input|instance|integer|join)\>"
36 color green "\<(large|liblist|library|localparam|macromodule|medium|module|nand|negedge|nmos|nor|noshowcancelled)\>"
37 color green "\<(not|notif0|notif1|null|or|output|parameter|pmos|posedge|primitive|pull0|pull1|pulldown|pullup)\>"
38 color green "\<(pulsestyle_onevent|pulsestyle_ondetect|rcmos|real|realtime|reg|release|repeat|rnmos|rpmos|rtran)\>"
39 color green "\<(rtranif0|rtranif1|scalared|showcancelled|signed|small|specify|specparam|strong0|strong1|supply0)\>"
40 color green "\<(supply1|table|task|time|tran|tranif0|tranif1|tri|tri0|tri1|triand|trior|trireg|unsigned|use|uwire)\>"
41 color green "\<(vectored|wait|wand|weak0|weak1|while|wire|wor|xnor|xor)\>"
42
43 # System Verilog keywords, taken from same source.
44 color green "\<(alias|always_comb|always_ff|always_latch|assert|assume|before|bind|bins|binsof|bit|break|byte)\>"
45 color green "\<(chandle|clocking|const|constraint|context|continue|cover|covergroup|coverpoint|cross|dist|do)\>"
46 color green "\<(endclass|endclocking|endgroup|endinterface|endpackage|endprogram|endproperty|endsequence|enum)\>"
47 color green "\<(expect|export|extends|extern|final|first_match|foreach|forkjoin|ignore_bins|illegal_bins|import)\>"
48 color green "\<(inside|int|interface|intersect|join_any|join_none|local|logic|longint|matches|modport|new|package)\>"
49 color green "\<(packed|priority|program|property|protected|pure|rand|randc|randcase|randsequence|ref|return)\>"
50 color green "\<(sequence|shortint|shortreal|solve|static|string|struct|super|tagged|this|throughout|timeprecision)\>"
51 color green "\<(timeunit|type|typedef|union|unique|var|virtual|void|wait_order|wildcard|with|within)\>"
52
53 # We need to go through these and decide if everything should be the same color, and remove extra things from C.
54 # I don't think this is wanted.
55 #color green "\<((s?size)|((u_?)?int(8|16|32|64|ptr)))_t\>"
56
57 # Builtin function names (e.g. $display).
58 icolor cyan "\$[0-9A-Z_]+"
59
60 # Macros. Here are some of the standard ones, as per http://verilog.renerta.com/source/vrg00008.htm.
61 #color cyan "^[[:space:]]*`[[:space:]]*(define|include(_next)?|timescale|(un|ifn?)def|endif|el(sif|se)|if|resetall)"
62 #color cyan "^[[:space:]]*`[[:space:]]*(celldefine|endcelldefine|default_nettype|unconnected_drive|nounconnected_drive)"
63 # This isn't complete and it may be better to just colorize `(string), like so:
64 icolor cyan "^[[:space:]]*`[0-9A-Z_]+"
65
66 # I'm not sure what this line does... it was in c.nanorc.
67 #color brightmagenta "'([^'\]|(\\["'abfnrtv\\]))'" "'\\(([0-3]?[0-7]{1,2}))'" "'\\x[0-9A-Fa-f]{1,2}'"
68
69 # Strings.  In general you will want your strings and comments to come last,
70 # because highlighting rules are applied in the order they are read in.
71 color brightyellow ""([^"]|\\")*"" "<[^[:blank:]=]*>"
72 # Multiline strings.  This regex is VERY resource intensive,
73 # and sometimes colours things that shouldn't be coloured.
74 ###color brightyellow start=""(\\.|[^"])*\\[[:space:]]*$" end="^(\\.|[^"])*""
75
76 # Comments.
77 color brightblue "^\s*//.*"
78 color brightblue start="/\*" end="\*/"
79
80 # Reminders.
81 color ,yellow "\<(FIXME|TODO|XXX)\>"
82
83 # Trailing whitespace.
84 color ,green "[[:space:]]+$"