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

#include <go.h>

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

Public Member Functions

 CpgotoTable (const Span *span, uint32_t nSpans)
 
 ~CpgotoTable ()
 
void emit (OutputFile &o, uint32_t ind)
 
void used_labels (std::set< label_t > &used)
 

Public Attributes

const State ** table
 

Static Public Attributes

static const uint32_t TABLE_SIZE = 0x100
 

Detailed Description

Definition at line 134 of file go.h.

Constructor & Destructor Documentation

re2c::CpgotoTable::CpgotoTable ( const Span span,
uint32_t  nSpans 
)

Definition at line 160 of file go_construct.cc.

161  : table (new const State * [TABLE_SIZE])
162 {
163  uint32_t c = 0;
164  for (uint32_t i = 0; i < nSpans; ++i)
165  {
166  for(; c < span[i].ub && c < TABLE_SIZE; ++c)
167  {
168  table[c] = span[i].to;
169  }
170  }
171 }
static const uint32_t TABLE_SIZE
Definition: go.h:136
const State ** table
Definition: go.h:137
re2c::CpgotoTable::~CpgotoTable ( )

Definition at line 62 of file go_destruct.cc.

63 {
64  delete [] table;
65 }
const State ** table
Definition: go.h:137

Member Function Documentation

void re2c::CpgotoTable::emit ( OutputFile o,
uint32_t  ind 
)

Definition at line 195 of file go_emit.cc.

196 {
197  o.wind(ind).ws("static void *").wstring(opts->yytarget).ws("[256] = {\n");
198  o.wind(++ind);
199  const uint32_t max_digits = max_label ().width ();
200  for (uint32_t i = 0; i < TABLE_SIZE; ++i)
201  {
202  o.ws("&&").wstring(opts->labelPrefix).wlabel(table[i]->label);
203  if (i == TABLE_SIZE - 1)
204  {
205  o.ws("\n");
206  }
207  else if (i % 8 == 7)
208  {
209  o.ws(",\n").wind(ind);
210  }
211  else
212  {
213  const uint32_t padding = max_digits - table[i]->label.width () + 1;
214  o.ws(",").wstring(std::string (padding, ' '));
215  }
216  }
217  o.wind(--ind).ws("};\n");
218 }
static const uint32_t TABLE_SIZE
Definition: go.h:136
uint32_t width() const
Definition: label.cc:28
std::string yytarget
Definition: opt.h:118
const State ** table
Definition: go.h:137
std::string labelPrefix
Definition: opt.h:118
label_t label
Definition: adfa.h:25
Opt opts
Definition: opt.cc:7

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 75 of file go_used_labels.cc.

76 {
77  for (uint32_t i = 0; i < TABLE_SIZE; ++i)
78  {
79  used.insert (table[i]->label);
80  }
81 }
static const uint32_t TABLE_SIZE
Definition: go.h:136
const State ** table
Definition: go.h:137

Here is the caller graph for this function:

Member Data Documentation

const State** re2c::CpgotoTable::table

Definition at line 137 of file go.h.

const uint32_t re2c::CpgotoTable::TABLE_SIZE = 0x100
static

Definition at line 136 of file go.h.


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