def ParseFiles(filenames):
    parser = IDLParser()
    filenodes = []

    if not filenames:
        filenames = []
        srcroot = GetOption('srcroot')
        dirs = default_dirs
        if GetOption('include_private'):
            dirs += ['private']
        for dirname in dirs:
            srcdir = os.path.join(srcroot, dirname, '*.idl')
            srcdir = os.path.normpath(srcdir)
            filenames += sorted(glob.glob(srcdir))

    if not filenames:
        ErrOut.Log('No sources provided.')

    for filename in filenames:
        filenode = parser.ParseFile(filename)
        filenodes.append(filenode)

    ast = IDLAst(filenodes)
    if GetOption('dump_tree'): ast.Dump(0)

    Lint(ast)
    return ast
Esempio n. 2
0
def ParseFiles(filenames):
  parser = IDLParser()
  filenodes = []
  errors = 0

  if not filenames:
    filenames = []
    srcroot = GetOption('srcroot')
    for dir in default_dirs:
      srcdir = os.path.join(srcroot, dir, '*.idl')
      srcdir = os.path.normpath(srcdir)
      filenames += sorted(glob.glob(srcdir))

  for filename in filenames:
    filenode = parser.ParseFile(filename)
    filenodes.append(filenode)

  ast = IDLAst(filenodes)
  if GetOption('dump_tree'): ast.Dump(0)

  Lint(ast)
  return ast