Getting line number - Python API

23 views
Skip to first unread message

Srinivasan Venkataramanan

unread,
Feb 19, 2025, 4:01:03 PM2/19/25
to Verible Users
I am using below code with Verible. I can get file name, what about line number(s) for a given token/item such as kDataDeclaration?

Thanks
Srini

def af_no_global_vars(fp: str, data: verible_verilog_syntax.SyntaxData):
  for lvar in data.tree.iter_find_all({"tag": "kDataDeclaration"}):
    if (lvar.depth == 1):
      print ("Error, found global variable: ", lvar.text, " file: ", fp)

Reply all
Reply to author
Forward
0 new messages