-
Notifications
You must be signed in to change notification settings - Fork 629
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(System)Verilog: escaped identifiers (LRM 5.6.1)
Add support for escaped identifiers in Verilog and SystemVerilog: `\` + zero or more non-whitespace characters + whitespace. Note that the `\` itself isn't part of the identifier, and that `\foo` is the same as just `foo` (unlike in VHDL), but that identifiers identical to keywords such as `\begin` are also allowed. This definition also theoretically allows an empty identifier, `\`, which ctags doesn't support. In that case, leave the `\` as part of the name. Since this would create ambiguity with an identifier declared as `\\`, leave the `\` if the name starts with `\\` as well (so `\foo` becomes `foo` but `\\foo` stays as `\\foo`). Escaped identifiers are defined in the standard in section 3.7.1 (Verilog) / 5.6.1 (SystemVerilog).
- Loading branch information
1 parent
45735bd
commit 38eda10
Showing
4 changed files
with
62 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
--sort=no |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
themodule#(x=42) input.v /^module \\themodule#(x=42) ($/;" m | ||
clk,rst, input.v /^ input wire \\clk,rst, , \\d ,$/;" p module:themodule#(x=42) | ||
d input.v /^ input wire \\clk,rst, , \\d ,$/;" p module:themodule#(x=42) | ||
1+1=2 input.v /^ output reg \\1+1=2$/;" p module:themodule#(x=42) | ||
\\ input.v /^localparam \\ = 1;$/;" c module:themodule#(x=42) | ||
\\\\ input.v /^localparam \\\\ = \\ ;$/;" c module:themodule#(x=42) | ||
\\\\\\ input.v /^localparam \\\\\\ = \\\\ ;$/;" c module:themodule#(x=42) | ||
r\\n input.v /^localparam \\r\\n = \\\\\\ ;$/;" c module:themodule#(x=42) | ||
\\\\r\\n input.v /^localparam \\\\r\\n = \\r\\n ;$/;" c module:themodule#(x=42) | ||
\\\\\\r\\n input.v /^localparam \\\\\\r\\n = \\\\r\\n ;$/;" c module:themodule#(x=42) | ||
end input.v /^always @(posedge \\clk,rst, ) begin : \\end$/;" b module:themodule#(x=42) | ||
\\\\end input.v /^ if (\\\\\\r\\n ) begin : \\\\end$/;" b block:themodule#(x=42).end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
module \themodule#(x=42) ( | ||
input wire \clk,rst, , \d , | ||
output reg \1+1=2 | ||
); | ||
|
||
localparam \ = 1; | ||
localparam \\ = \ ; | ||
localparam \\\ = \\ ; | ||
localparam \r\n = \\\ ; | ||
localparam \\r\n = \r\n ; | ||
localparam \\\r\n = \\r\n ; | ||
|
||
always @(posedge \clk,rst, ) begin : \end | ||
if (\\\r\n ) begin : \\end | ||
\1+1=2 <= d; | ||
end | ||
end | ||
|
||
endmodule |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters