FileIncludeStack¶
This module represents a stack of file includes as used by the
PpLexer.PpLexer
-
exception
cpip.core.FileIncludeStack.
ExceptionFileIncludeStack
¶ Exception for FileIncludeStack object.
-
class
cpip.core.FileIncludeStack.
FileInclude
(theFpo, theDiag)¶ Represents a single TU fragment with a PpTokeniser and a token counter.
- theFpo
- A FilePathOrigin object that identifies the file.
- theDiag
- A CppDiagnostic object to give to the PpTokeniser.
-
tokenCountInc
(tok, isUnCond, num=1)¶ Increment the token counter.
-
tokenCounterAdd
(theC)¶ Add a token counter to my token counter (used when a macro is declared).
-
class
cpip.core.FileIncludeStack.
FileIncludeStack
(theDiagnostic)¶ This maintains information about the stack of file includes. This holds several stacks (or representations of them):
- self._ppts
- A stack of
PpTokeniser.PpTokeniser
objects. - self._figr
- A
FileIncludeGraph.FileIncludeGraphRoot
for tracking the#include
graph. - self._fns
- A stack of file IDs as strings (e.g. the file path).
- self._tcs
- A
PpTokenCount.PpTokenCountStack
object for counting tokens.
-
currentFile
¶ Returns the file ID from the top of the stack.
-
depth
¶ Returns the current include depth as an integer.
-
fileIncludeGraphRoot
¶ The
FileIncludeGraph.FileIncludeGraphRoot
object.
-
fileLineCol
¶ Return an instance of FileLineCol from the current physical line column.
-
fileStack
¶ Returns a copy of the stack of file IDs.
-
finalise
()¶ Finalisation, may raise an ExceptionFileIncludeStack.
-
includeFinish
()¶ End an
#include
file, returns the file ID that has been finished.
-
includeStart
(theFpo, theLineNum, isUncond, condStr, incLogic)¶ Start an
#include
file.- theFpo
- A
FileLocation.FilePathOrigin
object that identifies the file. - theLineNum
- The integer line number of the file that includes (None if Root).
- isUncond
- A boolean that is the conditional compilation state.
- condStr
- A string of the conditional compilation stack.
- incLogic
- A string that describes the find include logic.
-
ppt
¶ Returns the PpTokeniser from the top of the stack.
-
tokenCountInc
(tok, isUnCond, num=1)¶ Increment the token counter.
-
tokenCounter
()¶ Returns the Token Counter object at the tip of the stack.
-
tokenCounterAdd
(theC)¶ Add a token counter to my token counter (used when a macro is declared).