PragmaHandler

exception cpip.core.PragmaHandler.ExceptionPragmaHandler

Simple specialisation of an exception class for the PragmaHandler. If raised this will cause the PpLexer to register undefined behaviour.

exception cpip.core.PragmaHandler.ExceptionPragmaHandlerStopParsing

Exception class for the PragmaHandler to stop parsing token stream.

class cpip.core.PragmaHandler.PragmaHandlerABC

Abstract base class for a pragma handler.

isLiteral

Treat the result of pragma() literally so no further processing required.

pragma(theTokS)

Takes a list of PpTokens, processes then and should return a newline terminated string that will be preprocessed in the current environment.

replaceTokens

An boolean attribute that says whether the supplied tokens should be macro replaced before being passed to self.

class cpip.core.PragmaHandler.PragmaHandlerEcho

A pragma handler that retains the #pragma line verbatim.

isLiteral

This class is just going to echo the line back complete with the ‘#pragma’ prefix. If the PpLexer re-interpreted this it would be an infinite loop.

pragma(theTokS)

Consume and return.

replaceTokens

Tokens do not require macro replacement.

class cpip.core.PragmaHandler.PragmaHandlerNull

A pragma handler that does nothing.

pragma(theTokS)

Consume and return.

replaceTokens

Tokens do not require macro replacement.

class cpip.core.PragmaHandler.PragmaHandlerSTDC

Base class for a pragma handler that implements ISO/IEC 9899:1999 (E) 6.10.5 Error directive para. 2.

DIRECTIVES = ('FP_CONTRACT', 'FENV_ACCESS', 'CX_LIMITED_RANGE')

Standard C acceptable macro directives

ON_OFF_SWITCH_STATES = ('ON', 'OFF', 'DEFAULT')

Standard C macro states

STDC = 'STDC'

Standard C macro

pragma(theTokS)

Inject a macro declaration into the environment.

See ISO/IEC 9899:1999 (E) 6.10.5 Error directive para. 2.

replaceTokens

STDC lines do not require macro replacement.