非常简单的omg idl(接口定义语言)解析器。这将解析idl文件并输出中间类对象。
idl_parser的Python项目详细描述
说明
omg idl文件分析器。这个库只解析idl文件,并输出中间类型对象。
示例
""" example for idl_parser package """fromidl_parserimportparserparser_=parser.IDLParser()idl_str=""" module my_module { struct Time { long sec; long usec; }; typedef sequence<double> DoubleSeq; struct TimedDoubleSeq { Time tm; DoubleSeq data; }; enum RETURN_VALUE { RETURN_OK, RETURN_FAILED, }; interface DataGetter { RETURN_VALUE getData(out TimedDoubleSeq data); }; }; """global_module=parser_.load(idl_str)my_module=global_module.module_by_name('my_module')dataGetter=my_module.interface_by_name('DataGetter')print'DataGetter interface'formindataGetter.methods:print'- method:'print' name:',m.nameprint' returns:',m.returns.nameprint' arguments:'forainm.arguments:print' name:',a.nameprint' type:',a.typeprint' direction:',a.directiondoubleSeq=my_module.typedef_by_name('DoubleSeq')print'typedef %s%s'%(doubleSeq.type.name,doubleSeq.name)timedDoubleSeq=my_module.struct_by_name('TimedDoubleSeq')print'TimedDoubleSeq'formintimedDoubleSeq.members:print'- member:'print' name:',m.nameprint' type:',m.type.name
如何安装
sudo pip install idl_parser
版权所有
- 作者:suga yuki
- 版权所有:yuki suga@ssr.tokyo
- 许可证:GPLv3