|
coan
6.0.1
A C/C++ Configuration Analyzer
|
Maintains state with respect to #if logic.
More...
#include <if_control.h>
Public Types | |
| enum | if_state { IF_STATE_OUTSIDE, IF_STATE_FALSE_PREFIX, IF_STATE_TRUE_PREFIX, IF_STATE_PASS_MIDDLE, IF_STATE_FALSE_MIDDLE, IF_STATE_TRUE_MIDDLE, IF_STATE_PASS_ELSE, IF_STATE_FALSE_ELSE, IF_STATE_TRUE_ELSE, IF_STATE_FALSE_TRAILER, IF_STATE_COUNT } |
| symbolic constants denoting the if-control states. More... | |
Static Public Member Functions | |
| static void | transition (line_type linetype) |
| Transition the if-control state given an evaluated line type. More... | |
| static bool | dead_line () |
| Is the current line rejected? | |
| static bool | was_unconditional_line () |
Is the current line outside any #if scope? | |
| static bool | is_unconditional_line () |
Is the current line outside any #if scope or in the scope of a satisfied #if? | |
| static size_t | if_start_line () |
Get the starting line number of the current #if sequence. | |
| static size_t | if_depth () |
Get the current depth of #if-nesting. | |
| static if_state | state () |
Get the current #if-state. | |
| static void | top () |
Reset the depth of #if-nesting to 0. | |
Private Types | |
| using | transition_t ) = void( |
Type of #if-state transition functions. | |
Static Private Member Functions | |
| static void | nest () |
Increment the #if-nesting depth. | |
| static void | set_state (if_state is) |
Set the #if-state at the current nesting depth. | |
| static void | Strue () |
| State transition. | |
| static void | Sfalse () |
| State transition. | |
| static void | Selse () |
| State transition. | |
| static void | Pelif () |
| State transition. | |
| static void | Pelse () |
| State transition. | |
| static void | Pendif () |
| State transition. | |
| static void | Dfalse () |
| State transition. | |
| static void | Delif () |
| State transition. | |
| static void | Delse () |
| State transition. | |
| static void | Dendif () |
| State transition. | |
| static void | Fdrop () |
| State transition. | |
| static void | Fpass () |
| State transition. | |
| static void | Ftrue () |
| State transition. | |
| static void | Ffalse () |
| State transition. | |
| static void | Mpass () |
| State transition. | |
| static void | Mtrue () |
| State transition. | |
| static void | Melif () |
| State transition. | |
| static void | Melse () |
| State transition. | |
| static void | orphan_elif () |
Diagnose an input orphan #elif on cerr | |
| static void | orphan_else () |
Diagnose an input orphan #else on cerr | |
| static void | orphan_endif () |
Diagnose an input orphan #endif on cerr | |
| static void | early_eof () |
Diagnose unexpected end of input on cerr | |
Static Private Attributes | |
| static const unsigned | MAXDEPTH = 64 |
| Maximum depth of hash-if nesting. More... | |
| static transition_t *const | transition_table [IF_STATE_COUNT][LT_SENTINEL] |
The #if-state transition table. More... | |
| static if_state | ifstate [MAXDEPTH] = {if_state(0)} |
Array of states of nested #if-directives. | |
| static size_t | depth = 0 |
Current depth of #if-nesting. | |
| static size_t | if_start_lines [MAXDEPTH] = {0} |
Array of start lines of nested #if-directives. | |
Maintains state with respect to #if logic.
struct if_control maintains state with respect to #if logic in the course of parsing and provides queries on this state.
Definition at line 59 of file if_control.h.
| enum if_control::if_state |
symbolic constants denoting the if-control states.
Definition at line 62 of file if_control.h.
|
static |
Transition the if-control state given an evaluated line type.
The function advances a state-machine whose parameters are the current input linetype and the current if-control state. The transition performs the appropriate action to despatch the line just evaluated and sets a new if-state.
| linetype | The linetype of the last evaluated input line. |
Definition at line 310 of file if_control.cpp.
|
staticprivate |
Maximum depth of hash-if nesting.
c.f. Minimum translation limits from ISO/IEC 9899:1999 5.2.4.1
Definition at line 138 of file if_control.h.
|
staticprivate |
The #if-state transition table.
An array of pointers to state transition functions.
Definition at line 147 of file if_control.h.