Skip to main content

Very simple OMG IDL (Interface Definition Language) parser. This parses IDL files and outputs intermediate class objects.

Project description

Travis Build Status Coverage Status

Description

OMG IDL file parser. This library just parse IDL files, and output intermidiate type objects.

Example

"""
example for idl_parser package
"""

from idl_parser import parser
parser_ = 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'
for m in dataGetter.methods:
  print '- method:'
  print '  name:', m.name
  print '  returns:', m.returns.name
  print '  arguments:'
  for a in m.arguments:
    print '    name:', a.name
    print '    type:', a.type
    print '    direction:', a.direction

doubleSeq = my_module.typedef_by_name('DoubleSeq')
print 'typedef %s %s' % (doubleSeq.type.name, doubleSeq.name)

timedDoubleSeq = my_module.struct_by_name('TimedDoubleSeq')
print 'TimedDoubleSeq'
for m in timedDoubleSeq.members:
  print '- member:'
  print '  name:', m.name
  print '  type:', m.type.name

How to install

sudo pip install idl_parser

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

idl_parser-0.0.15.tar.gz (10.8 kB view details)

Uploaded Source

File details

Details for the file idl_parser-0.0.15.tar.gz.

File metadata

  • Download URL: idl_parser-0.0.15.tar.gz
  • Upload date:
  • Size: 10.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for idl_parser-0.0.15.tar.gz
Algorithm Hash digest
SHA256 aa71961676fa5ea2402fc376308d7fff17f0f4471d135222afd925c72c58bdb2
MD5 e79cead10c17ff1833f4144ec2e7aa10
BLAKE2b-256 e3ae9a55209d17f5148de2cf4f2928163d4b76c4d2800bdab335d1488f167e45

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page