在 Tcl 文件中以 proc foo::bar {} 的形式列出所有过程的方法

问题描述 投票:0回答:0

我正在尝试获取以下代码的过程名称列表:

命名空间 eval foo::bar { 命名空间导出 fun1 命名空间导出 fun2 }

proc foo::bar::fun1 {} {

}

proc foo::bar::fun2 {} {

}

proc fun3 {} { }

它应该返回 过程列表: fun1 fun2 fun3

set f [打开 $filepath] 设置数据 [阅读 $f] 关闭 $f

foreach {dummy procName} [regexp -all -inline -line {^[\s:]*proc (\S+)} $data] { 提出“找到过程$ procName” }

但没有得到预期的输出。

namespaces tcl proc
© www.soinside.com 2019 - 2024. All rights reserved.