python中的Doxygen C ++注释字符串解析器? [英] Doxygen C++ comment string parser in python?

查看:122
本文介绍了python中的Doxygen C ++注释字符串解析器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人知道一个python模块来解析doxygen风格的C ++注释字符串吗?我的意思是这样的字符串(简单的示例):

Does anybody know of a python module to parse a doxygen style C++ comment string? I mean a string like this (simple example):

  /**
   * A constructor.
   * A more elaborate description of the constructor.
   * @param param1 test1
   * @param param2 test2
   */

,我想提取简要说明,详细说明,参数,返回值等.我目前正在使用字符串方法和正则表达式来执行此操作,但是我的解决方案不是很可靠. 或者,有人可以推荐一个我可以快速设置的易于使用的python解析器库吗?

and I would like to extract the brief, the long description, the parameters, the return value etc. I'm currently doing this using string methods and regular expressions but my solution is not very robust. Alternatively can anybody recommend an easy to use python parser lib that I can set up quickly?

预先感谢

推荐答案

您也许可以使用 SimpleParse进行设置模块,但这确实需要创建EBNF语法,这可能比您感兴趣的投资更多.

You might be able to set something up using the SimpleParse module, but this does require creating an EBNF grammar which might be more investment than you are interested in.

Sphinx/Doxygen桥( Breathe )使用Doxygen的xml输出并对其进行操作.也许类似的方法可以在这里工作-运行Doxygen提取xml格式的文档,然后利用 Breathe 获取所需的数据.

The Sphinx/Doxygen bridge (Breathe) uses the xml output of Doxygen and acts on that instead. Perhaps a similar approach could work here - run Doxygen to extract xml formatted docs and then leverage some of the code from Breathe to get at the data you require.

这篇关于python中的Doxygen C ++注释字符串解析器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆