pygccxml.parser

Package pygccxml :: Package parser |

# Source Code for Package pygccxml.parser

     1  # Copyright 2004-2008 Roman Yakovenko.
     2  # Distributed under the Boost Software License, Version 1.0. (See
     3  # accompanying file LICENSE_1_0.txt or copy at
     4  # http://www.boost.org/LICENSE_1_0.txt)
     5
     6  """Parser sub-package.
     7  """
     8
     9  from config import config_t
    10  from config import gccxml_configuration_t
    11
    12  from project_reader import COMPILATION_MODE
    13  from project_reader import project_reader_t
    14  from project_reader import file_configuration_t
    15  from project_reader import create_text_fc
    16  from project_reader import create_source_fc
    17  from project_reader import create_gccxml_fc
    18  from project_reader import create_cached_source_fc
    19
    20  from source_reader import source_reader_t
    21  from source_reader import gccxml_runtime_error_t
    22  from declarations_cache import cache_base_t
    23  from declarations_cache import file_cache_t
    24  from declarations_cache import dummy_cache_t
    25  from directory_cache import directory_cache_t
    26  #shortcut
    27  CONTENT_TYPE = file_configuration_t.CONTENT_TYPE
    28
    29
    30 -def parse( files
    31             , config=None
    32             , compilation_mode=COMPILATION_MODE.FILE_BY_FILE
    33             , cache=None ):
    34      """Parse header files.
    35
    36      @param files: The header files that should be parsed
    37      @type files: list of str
    38      @param config: Configuration object or None
    39      @type config: L{config_t}
    40      @param compilation_mode: Determines whether the files are parsed individually or as one single chunk
    41      @type compilation_mode: L{COMPILATION_MODE}
    42      @param cache: Declaration cache (None=no cache)
    43      @type cache: L{cache_base_t} or str
    44      @returns: Declarations
    45      """
    46
    47      if not config:
    48          config = config_t()
    49      parser = project_reader_t( config=config, cache=cache )
    50      answer = parser.read_files(files, compilation_mode)
    51      return answer
    52
    53 -def parse_string(content, config=None):
    54      if not config:
    55          config = config_t()
    56      parser = project_reader_t(config )
    57      return parser.read_string(content)
    58
    59 -def parse_xml_file( content, config=None ):
    60      parser = source_reader_t( config )
    61      return parser.read_xml_file( content )
    62