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

#include <go.h>

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

Public Member Functions

 GoBitmap (const Span *span, uint32_t nSpans, const Span *hspan, uint32_t hSpans, const BitMap *bm, const State *bm_state, const State *next)
 
 ~GoBitmap ()
 
void emit (OutputFile &o, uint32_t ind, bool &readCh)
 
void used_labels (std::set< label_t > &used)
 
 FORBID_COPY (GoBitmap)
 

Public Attributes

const BitMapbitmap
 
const Statebitmap_state
 
SwitchIfhgo
 
SwitchIflgo
 

Detailed Description

Definition at line 120 of file go.h.

Constructor & Destructor Documentation

re2c::GoBitmap::GoBitmap ( const Span span,
uint32_t  nSpans,
const Span hspan,
uint32_t  hSpans,
const BitMap bm,
const State bm_state,
const State next 
)

Definition at line 139 of file go_construct.cc.

140  : bitmap (bm)
141  , bitmap_state (bm_state)
142  , hgo (NULL)
143  , lgo (NULL)
144 {
145  Span * bspan = allocate<Span> (nSpans);
146  uint32_t bSpans = unmap (bspan, span, nSpans, bm_state);
147  lgo = bSpans == 0
148  ? NULL
149  : new SwitchIf (bspan, bSpans, next);
150  // if there are any low spans, then next state for high spans
151  // must be NULL to trigger explicit goto generation in linear 'if'
152  hgo = hSpans == 0
153  ? NULL
154  : new SwitchIf (hspan, hSpans, lgo ? NULL : next);
155  operator delete (bspan);
156 }
SwitchIf * hgo
Definition: go.h:124
SwitchIf * lgo
Definition: go.h:125
static uint32_t unmap(Span *new_span, const Span *old_span, uint32_t old_nspans, const State *x)
const State * bitmap_state
Definition: go.h:123
const BitMap * bitmap
Definition: go.h:122

Here is the call graph for this function:

re2c::GoBitmap::~GoBitmap ( )

Definition at line 56 of file go_destruct.cc.

57 {
58  delete hgo;
59  delete lgo;
60 }
SwitchIf * hgo
Definition: go.h:124
SwitchIf * lgo
Definition: go.h:125

Member Function Documentation

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

Definition at line 161 of file go_emit.cc.

162 {
163  std::string yych = output_hgo (o, ind, readCh, hgo);
164  o.ws("if (").wstring(opts->yybm).ws("[").wu32(bitmap->i).ws("+").wstring(yych).ws("] & ");
165  if (opts->yybmHexTable)
166  {
167  o.wu32_hex(bitmap->m);
168  }
169  else
170  {
171  o.wu32(bitmap->m);
172  }
173  o.ws(") {\n");
174  output_goto (o, ind + 1, readCh, bitmap_state->label);
175  o.wind(ind).ws("}\n");
176  if (lgo != NULL)
177  {
178  lgo->emit (o, ind, readCh);
179  }
180 }
SwitchIf * hgo
Definition: go.h:124
static std::string output_hgo(OutputFile &o, uint32_t ind, bool &readCh, SwitchIf *hgo)
Definition: go_emit.cc:54
std::string yybm
Definition: opt.h:118
uint32_t m
Definition: bitmap.h:25
uint32_t i
Definition: bitmap.h:24
SwitchIf * lgo
Definition: go.h:125
label_t label
Definition: adfa.h:25
const State * bitmap_state
Definition: go.h:123
Opt opts
Definition: opt.cc:7
static void output_goto(OutputFile &o, uint32_t ind, bool &readCh, label_t to)
Definition: go_emit.cc:44
const BitMap * bitmap
Definition: go.h:122
bool yybmHexTable
Definition: opt.h:118
void emit(OutputFile &o, uint32_t ind, bool &readCh)
Definition: go_emit.cc:148

Here is the call graph for this function:

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

Definition at line 62 of file go_used_labels.cc.

63 {
64  if (hgo != NULL)
65  {
66  hgo->used_labels (used);
67  }
68  used.insert (bitmap_state->label);
69  if (lgo != NULL)
70  {
71  lgo->used_labels (used);
72  }
73 }
SwitchIf * hgo
Definition: go.h:124
SwitchIf * lgo
Definition: go.h:125
void used_labels(std::set< label_t > &used)
label_t label
Definition: adfa.h:25
const State * bitmap_state
Definition: go.h:123

Here is the call graph for this function:

Member Data Documentation

const BitMap* re2c::GoBitmap::bitmap

Definition at line 122 of file go.h.

const State* re2c::GoBitmap::bitmap_state

Definition at line 123 of file go.h.

SwitchIf* re2c::GoBitmap::hgo

Definition at line 124 of file go.h.

SwitchIf* re2c::GoBitmap::lgo

Definition at line 125 of file go.h.


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