src
Public Types | Public Member Functions | Public Attributes | List of all members
re2c::SwitchIf Struct Reference

#include <go.h>

Collaboration diagram for re2c::SwitchIf:
Collaboration graph
[legend]

Public Types

enum  { SWITCH, IF }
 

Public Member Functions

 SwitchIf (const Span *sp, uint32_t nsp, const State *next)
 
 ~SwitchIf ()
 
void emit (OutputFile &o, uint32_t ind, bool &readCh)
 
void used_labels (std::set< label_t > &used)
 

Public Attributes

enum re2c::SwitchIf:: { ... }  type
 
union {
   Cases *   cases
 
   If *   ifs
 
info
 

Detailed Description

Definition at line 102 of file go.h.

Member Enumeration Documentation

anonymous enum
Enumerator
SWITCH 
IF 

Definition at line 104 of file go.h.

105  {
106  SWITCH,
107  IF
108  } type;
enum re2c::SwitchIf::@1 type

Constructor & Destructor Documentation

re2c::SwitchIf::SwitchIf ( const Span sp,
uint32_t  nsp,
const State next 
)

Definition at line 120 of file go_construct.cc.

121  : type (IF)
122  , info ()
123 {
124  if ((!opts->sFlag && nsp > 2) || (nsp > 8 && (sp[nsp - 2].ub - sp[0].ub <= 3 * (nsp - 2))))
125  {
126  type = SWITCH;
127  info.cases = new Cases (sp, nsp);
128  }
129  else if (nsp > 5)
130  {
131  info.ifs = new If (If::BINARY, sp, nsp, next);
132  }
133  else
134  {
135  info.ifs = new If (If::LINEAR, sp, nsp, next);
136  }
137 }
enum re2c::SwitchIf::@1 type
bool sFlag
Definition: opt.h:118
Opt opts
Definition: opt.cc:7
union re2c::SwitchIf::@2 info
re2c::SwitchIf::~SwitchIf ( )

Definition at line 43 of file go_destruct.cc.

44 {
45  switch (type)
46  {
47  case SWITCH:
48  delete info.cases;
49  break;
50  case IF:
51  delete info.ifs;
52  break;
53  }
54 }
enum re2c::SwitchIf::@1 type
union re2c::SwitchIf::@2 info

Member Function Documentation

void re2c::SwitchIf::emit ( OutputFile o,
uint32_t  ind,
bool &  readCh 
)

Definition at line 148 of file go_emit.cc.

149 {
150  switch (type)
151  {
152  case SWITCH:
153  info.cases->emit (o, ind, readCh);
154  break;
155  case IF:
156  info.ifs->emit (o, ind, readCh);
157  break;
158  }
159 }
enum re2c::SwitchIf::@1 type
union re2c::SwitchIf::@2 info

Here is the caller graph for this function:

void re2c::SwitchIf::used_labels ( std::set< label_t > &  used)

Definition at line 49 of file go_used_labels.cc.

50 {
51  switch (type)
52  {
53  case SWITCH:
54  info.cases->used_labels (used);
55  break;
56  case IF:
57  info.ifs->used_labels (used);
58  break;
59  }
60 }
enum re2c::SwitchIf::@1 type
union re2c::SwitchIf::@2 info

Here is the caller graph for this function:

Member Data Documentation

Cases* re2c::SwitchIf::cases

Definition at line 111 of file go.h.

If* re2c::SwitchIf::ifs

Definition at line 112 of file go.h.

union { ... } re2c::SwitchIf::info
enum { ... } re2c::SwitchIf::type

The documentation for this struct was generated from the following files: