SCons.cpp

Package SCons :: Module cpp |
[hide private]
[frames] | no frames]

# Module cpp

source code
SCons C Pre-Processor module

Classes | [hide private]
| FunctionEvaluator Handles delayed evaluation of a #define function call.
| PreProcessor The main workhorse class for handling C pre-processing.
| DumbPreProcessor A preprocessor that ignores all #if/#elif/#else/#endif directives and just reports back all of the #include files (like the classic SCons scanner did).

Functions | [hide private]
CPP_to_Python_Ops_Sub(m, d=`{``'``\r``'``:` `'````'``,` `'``!``'``:` `'``not` `'``,` `'``!=``'``:` `'``!=` `'``,` `'``&&``'``:` `'``and` `'``,` `'``:``'``:` `'``o``...`) | source code
CPP_to_Python(s) Converts a C pre-processor expression into an equivalent Python expression that can be evaluated. | source code

Variables | [hide private]
| __doc__ = ``...``
| cpp_lines_dict = ``{``(``'``define``'``)``:` `'``\\s+([_A-Za-z][_A-Za-z0-9_]+)(\``...``
| Table = ``{``'``define``'``:` re.compile(r'\s`+``(``[`_A`-`Za`-`z`]``[`_A`-`Za`-`z0`-`9_`]``+``)``(`\`...``
| e = ``'``^\\s*#\\s*(elif|undef|include_next|endif|else|include|ifd``...``
| CPP_Expression = `re.compile(r'`(?m)`^\s`*`#\s`*``(`elif`|`undef`|`include_`...``
| CPP_to_Python_Ops_Dict = ``{``'``\r``'``:` `'````'``,` `'``!``'``:` `'``not` `'``,` `'``!=``'``:` `'``!=` `'``...``
| CPP_to_Python_Ops_Expression = `re.compile(r'\|\|`|`&&`|`!=`|`!`|`\r`|`:`|``...``
| CPP_to_Python_Eval_List = ``[``[`re.compile(r'defined\s`+``(`\w`+``)`')`,` `'``_``...``
| line_continuations = `re.compile(r'\\\r`?`\n')`
| function_name = `re.compile(r'`(`\S`+``)`\(`(``[^`\)`]``*``)`\)')`
| function_arg_separator = `re.compile(r',\s`*`')`

Variables Details | [hide private]

  ### __doc__ Value:
      """
      SCons C Pre-Processor module
      """

  ### cpp_lines_dict Value:
      {('define'): '\\s+([_A-Za-z][_A-Za-z0-9_]+)(\\([^)]*\\))?\\s*(.*)',
       ('else', 'endif'): '',
       ('if', 'elif', 'ifdef', 'ifndef'): '\\s+(.+)',
       ('import', 'include', 'include_next'): '\\s*(.+)',
       ('undef'): '\\s+([_A-Za-z][A-Za-z0-9_]+)'}

  ### Table Value:
      {'define': re.compile(r'\s+([_A-Za-z][_A-Za-z0-9_]+)(\([^\)]*\))?\s*(.
      *)'),
       'elif': re.compile(r'\s+(.+)'),
       'else': re.compile(r''),
       'endif': re.compile(r''),
       'if': re.compile(r'\s+(.+)'),
       'ifdef': re.compile(r'\s+(.+)'),
       'ifndef': re.compile(r'\s+(.+)'),
      ...

  ### e Value:
      '^\\s*#\\s*(elif|undef|include_next|endif|else|include|ifdef|ifndef|im
      port|define|if(?!def))(.*)$'

  ### CPP_Expression Value:
      re.compile(r'(?m)^\s*#\s*(elif|undef|include_next|endif|else|include|i
      fdef|ifndef|import|define|if(?!def))(.*)$')

  ### CPP_to_Python_Ops_Dict Value:
      {'\r': '',
       '!': ' not ',
       '!=': ' != ',
       '&&': ' and ',
       ':': ' or ',
       '?': ' and ',
       '||': ' or '}

  ### CPP_to_Python_Ops_Expression Value:
      re.compile(r'\|\||&&|!=|!|\r|:|\?')

  ### CPP_to_Python_Eval_List Value:
      [[re.compile(r'defined\s+(\w+)'), '__dict__.has_key("\\1")'],
       [re.compile(r'defined\s*\((\w+)\)'), '__dict__.has_key("\\1")'],
       [re.compile(r'/\*.*\*/'), ''],
       [re.compile(r'/\*.*'), ''],
       [re.compile(r'//.*'), ''],
       [re.compile(r'(0x[0-9A-Fa-f]*)[UL]+'), '\\1L']]