Provides handlers for #including files.
Class that applies search rules for #include statements.
Search tactics based on RVCT and Berkeley UNIX search rules:
I is the usr includes.
J is the sys includes.
Size of I Size of J #include <...> #include "..."
0 0 None CP
0 >0 SYSTEMINCLUDEdirs CP, SYSTEMINCLUDEdirs
>0 0 USERINCLUDEdirs CP, USERINCLUDEdirs
>0 >0 SYSTEMINCLUDEdirs, CP, USERINCLUDEdirs,
USERINCLUDEdirs SYSTEMINCLUDEdirs
ISO/IEC 9899:1999 (E) 6.10.2-3 means that a failure of q-char must be retried as if it was a h-char. i.e. A failure of a q-char-sequence thus: #include "..."
Is to be retried as if it was written as a h-char-sequence thus: #include <...>
See: _includeQcharseq()
Codes for the results of a search for an include
Returns True if the last include succeeded.
Clears the list of find results for a single #include statement.
Clears the CP stack. This needed if you use this class as a persistent one and it encounters an exception. You need to call this function before you can reuse it.
Returns the current stack of current places.
Pops and returns the CP string off the current place stack. This is public so that the PpLexer can use it when processing pre-include files that might themselves include other files.
Appends the CP from the FilePathOrigin to the current place stack. This is public so that the PpLexer can use it when processing pre-include files that might themselves include other files.
Returns the size of the current stack of current places.
Returns the last current place or None if #include failed.
Notify end of #include’d file. This pops the CP stack.
Finalise at the end of the translation unit. Might raise a ExceptionCppInclude.
Returns a list of strings that describe _how_ the file was found For example:
['<foo.h>', 'CP=None', 'sys=None', 'usr=include/foo.h']
Each string after [0] is of the form: key=value Where:
The intermediate ones are various tries in order. So:
['<foo.h>', 'CP=None', 'sys=None', 'usr=include/foo.h']
Wwould mean:
Return the file location of a #include header-name where the header-name is a pp-token either a <h-char-sequence> or a “q-char-sequence” (including delimiters). If not None return value this also records the CP for the file.
Return the file location of a #include_next header-name where the header-name is a pp-token either a <h-char-sequence> or a “q-char-sequence” (including delimiters).
This is a GCC extension, see: https://gcc.gnu.org/onlinedocs/cpp/Wrapper-Headers.html
If not None return value this also records the CP for the file.
Given an Translation Unit Identifier this should return a class FilePathOrigin or None for the initial translation unit. As a precaution this should include code to check that the stack of current places is empty. For example:
if len(self._cpStack) != 0:
raise ExceptionCppInclude('setTu() with CP stack: %s' % self._cpStack)
Tests the coherence of the CP stack. A None can not be followed by a non-None.
This implements _searchFile() based on an OS file system call.
Given an path as a string this returns the class FilePathOrigin or None for the initial translation unit
This reads stdin for the ITU but delegates _searchFile() to the OS file system call.
Given an path as a string this returns the class FilePathOrigin or None for the initial translation unit
This implements _searchFile() based on a lookup of stings that returns StringIO file-like object.
Given an path as a string this returns the class FilePathOrigin or None for the initial translation unit
Simple specialisation of an exception class for the CppInclude.
FilePathOrigin is a class used externally to collect:
Any or all or these attributes may be None as the methods _searchFile(), _includeQcharseq() and _includeHcharseq() return such an object (or None).
Alias for field number 2
Alias for field number 0
Alias for field number 1
Alias for field number 3