Skip to content

Commit

Permalink
Wrap regexp-opt vars in eval-when-compile
Browse files Browse the repository at this point in the history
  • Loading branch information
gmlarumbe committed Sep 16, 2023
1 parent 5967d2e commit 0b42058
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 29 deletions.
35 changes: 18 additions & 17 deletions verilog-ext-tags.el
Original file line number Diff line number Diff line change
Expand Up @@ -265,23 +265,24 @@ buffer."

;;;; Tree-sitter
(defconst verilog-ext-tags-definitions-ts-re
(regexp-opt
'("module_declaration"
"interface_declaration"
"program_declaration"
"package_declaration"
"class_declaration"
"function_declaration"
"task_declaration"
"class_constructor_declaration"
"local_parameter_declaration"
"ansi_port_declaration"
"variable_decl_assignment"
"net_decl_assignment"
"class_property"
"module_instantiation"
"interface_instantiation")
'symbols)
(eval-when-compile
(regexp-opt
'("module_declaration"
"interface_declaration"
"program_declaration"
"package_declaration"
"class_declaration"
"function_declaration"
"task_declaration"
"class_constructor_declaration"
"local_parameter_declaration"
"ansi_port_declaration"
"variable_decl_assignment"
"net_decl_assignment"
"class_property"
"module_instantiation"
"interface_instantiation")
'symbols))
"Regexp of tree-sitter node types to be used for tags definitions.
Need to be quoted as symbols to avoid bugs: E.g:
Expand Down
27 changes: 15 additions & 12 deletions verilog-ext-utils.el
Original file line number Diff line number Diff line change
Expand Up @@ -472,22 +472,25 @@ Return alist with block type, name and boundaries."
(end-point . ,block-end-point)))))))

(defconst verilog-ext-block-at-point-all-re
(regexp-opt
'("function" "endfunction" "task" "endtask" "class" "endclass"
"generate" "endgenerate" "module" "endmodule" "interface"
"endinterface" "program" "endprogram" "package" "endpackage"
"always" "initial" "final")
'symbols))
(eval-when-compile
(regexp-opt
'("function" "endfunction" "task" "endtask" "class" "endclass"
"generate" "endgenerate" "module" "endmodule" "interface"
"endinterface" "program" "endprogram" "package" "endpackage"
"always" "initial" "final")
'symbols)))

(defconst verilog-ext-block-at-point-top-and-class-re
(regexp-opt
'("class" "package" "module" "interface" "program")
'symbols))
(eval-when-compile
(regexp-opt
'("class" "package" "module" "interface" "program")
'symbols)))

(defconst verilog-ext-block-at-point-top-re
(regexp-opt
'("package" "module" "interface" "program")
'symbols))
(eval-when-compile
(regexp-opt
'("package" "module" "interface" "program")
'symbols)))

(defun verilog-ext-block-at-point (&optional return-pos)
"Return current block type and name at point.
Expand Down

0 comments on commit 0b42058

Please sign in to comment.