@@ -318,10 +318,6 @@ completion.")
318318 (eval-when-compile
319319 (regexp-opt '(" task_declaration" " function_declaration" " class_constructor_declaration" ) 'symbols )))
320320
321- (defconst verilog-ext-tags-port-header-ts-re
322- (eval-when-compile
323- (regexp-opt '(" variable_port_header" " net_port_header1" " interface_port_header" ) 'symbols )))
324-
325321(cl-defun verilog-ext-tags-table-push-defs-ts (&key table inst-table file )
326322 " Push definitions inside hash table TABLE using tree-sitter.
327323
@@ -341,38 +337,20 @@ completion and navigation."
341337 :node tree
342338 :file file)))
343339
344- (defun verilog-ext-tags-table-push-defs-ts--type (ts-type ts-node )
345- " Return type of current TS-NODE depending on tree-sitter TS-TYPE."
346- (cond (; ; Variables
347- (string-match " \\ <variable_decl_assignment\\ >" ts-type)
348- (treesit-node-text (verilog-ts--node-has-child-recursive (verilog-ts--node-has-parent-recursive ts-node " \\ <data_declaration\\ >" ) " \\ <data_type\\ >" ) :no-prop ))
349- ; ; TODO: Still not taking (random_qualifier) sibling of (data_type )into account for rand/randc attributes
350- ; ; TODO: Still not taking unpacked/queue/array dimensions into account
351- (; ; Nets
352- (string-match " \\ <net_decl_assignment\\ >" ts-type)
353- (verilog-ts--node-identifier-name (verilog-ts--node-has-parent-recursive ts-node " \\ <net_declaration\\ >" )))
354- (; ; Module/interface/program ports
355- (string-match " \\ <ansi_port_declaration\\ >" ts-type)
356- (treesit-node-text (treesit-search-subtree ts-node verilog-ext-tags-port-header-ts-re) :no-prop ))
357- (; ; Task/function arguments
358- (string-match " \\ <tf_port_item1\\ >" ts-type)
359- (let ((port-direction (treesit-node-text (treesit-search-subtree ts-node " \\ <tf_port_direction\\ >" ) :no-prop )))
360- (concat (when port-direction (concat port-direction " " ))
361- (treesit-node-text (treesit-search-subtree ts-node " \\ <data_type_or_implicit1\\ >" ) :no-prop ))))
362- (; ; Typedefs
363- (string-match " \\ <type_declaration\\ >" ts-type)
364- (treesit-node-text (verilog-ts--node-has-child-recursive (verilog-ts--node-has-parent-recursive ts-node " \\ <data_declaration\\ >" ) " \\ <data_type\\ >" ) :no-prop ))
365- (t ; ; Default
366- ts-type)))
340+ (defun verilog-ext-tags-table-push-defs-ts--parent (ts-node ts-type parent-node )
341+ " Return parent identifier of TS-NODE.
342+
343+ PARENT-NODE is the default parent for TS-NODE.
367344
368- (defun verilog-ext-tags-table-push-defs-ts--parent (parent ts-type ts-node )
369- " Return parent of current TS-NODE depending on tree-sitter TS-TYPE and PARENT."
345+ TS-TYPE is provided to avoid an additional call to `treesit-node-type' since
346+ this function is synctactic sugar for
347+ `verilog-ext-tags-table-push-defs-ts--recurse' ."
370348 (cond (; ; Externally defined methods
371349 (and (string-match verilog-ext-tags-method-declaration-ts-re ts-type)
372350 (verilog-ts--node-has-child-recursive ts-node " class_type" ))
373351 (verilog-ts--node-identifier-name (verilog-ts--node-has-child-recursive ts-node " class_identifier" )))
374352 (t ; ; Default
375- (verilog-ts--node-identifier-name parent))))
353+ (verilog-ts--node-identifier-name parent-node ))))
376354
377355(cl-defun verilog-ext-tags-table-push-defs-ts--recurse (&key table inst-table node parent file )
378356 " Push definitions recursively inside hash table TABLE using tree-sitter.
@@ -409,10 +387,10 @@ completion and navigation."
409387 :parent (verilog-ts--node-identifier-name parent))
410388 (verilog-ext-tags-table-push :table table
411389 :tag (verilog-ts--node-identifier-name ts-node)
412- :type (verilog-ext-tags-table-push-defs- ts--type ts -type ts-node)
390+ :type (verilog-ts--node-identifier -type ts-node)
413391 :desc (verilog-ext-tags-desc)
414392 :file file
415- :parent (verilog-ext-tags-table-push-defs-ts--parent parent ts-type ts-node ))))))
393+ :parent (verilog-ext-tags-table-push-defs-ts--parent ts-node ts-type parent ))))))
416394
417395(cl-defun verilog-ext-tags-table-push-refs-ts (&key table defs-table file )
418396 " Push references inside hash table TABLE using tree-sitter.
0 commit comments