25 const std::string content =
stream.str ();
26 const char * p = content.c_str ();
27 for (uint32_t i = 0; i < content.size (); ++i)
39 , used_yyaccept (false)
40 , force_start_label (false)
49 for (
unsigned int i = 0; i <
fragments.size (); ++i)
60 , warn_condition_order (!
opts->tFlag)
81 if (file != NULL && file != stdout)
85 for (
unsigned int i = 0; i < blocks.size (); ++i)
91 std::ostream & OutputFile::stream ()
93 return blocks.back ()->fragments.back ()->stream;
98 stream ().write (s, static_cast<std::streamsize> (n));
122 stream () << std::setw (w);
141 const std::string label = blocks.back ()->user_start_label;
197 void OutputFile::insert_code ()
251 blocks.back ()->used_yyaccept =
true;
256 return blocks.back ()->used_yyaccept;
261 blocks.back ()->force_start_label = force;
266 blocks.back ()->user_start_label = label;
271 return blocks.back ()->force_start_label;
276 blocks.back ()->line = l;
281 return blocks.back ()->line;
291 (
const std::vector<std::string> & types
297 unsigned int line_count = 1;
298 for (
unsigned int j = 0; j < blocks.size (); ++j)
301 for (
unsigned int i = 0; i < b.
fragments.size (); ++i)
318 if (warn_condition_order)
330 std::string content = f.
stream.str ();
331 fwrite (content.c_str (), 1, content.size (), file);
343 , file_name (fn ? fn :
"<stdout>.h")
349 file = fopen (file_name,
"wb");
365 std::string content = stream.str ();
366 fwrite (content.c_str (), 1, content.size (), file);
372 : source (source_name)
373 , header (header_name)
393 o <<
indent(ind) <<
"default: abort();\n";
404 o <<
indent(ind) <<
"}\n";
421 o <<
"#define YYMAXFILL " << max_fill <<
"\n";
428 o <<
"#line " << line_number <<
" \"" << file_name <<
"\"\n";
432 void output_types (std::ostream & o, uint32_t ind,
const std::vector<std::string> & types)
435 for (
unsigned int i = 0; i < types.size (); ++i)
439 o <<
indent (--ind) <<
"};\n";
444 o <<
"/* Generated by re2c";
447 o <<
" " << PACKAGE_VERSION;
452 time_t now = time (NULL);
453 o.write (ctime (&now), 24);
OutputFile & wdelay_warn_condition_order()
void output_line_info(std::ostream &o, uint32_t line_number, const char *file_name)
OutputFragment(type_t t, uint32_t i)
bool get_used_yyaccept() const
OutputFile & wuser_start_label()
std::ostringstream stream
std::string indent(uint32_t ind)
OutputFile & wversion_time()
void printSpan(std::ostream &o, uint32_t lb, uint32_t ub)
OutputFile & ws(const char *s)
OutputFile & wu32(uint32_t n)
OutputFile & wdelay_state_goto(uint32_t ind)
OutputFile & wdelay_yymaxfill()
OutputFile & wind(uint32_t ind)
OutputFile & wlabel(label_t l)
void output_state_goto(std::ostream &o, uint32_t ind, uint32_t start_label)
OutputFile & wdelay_types()
OutputFile & wc_hex(uint32_t n)
OutputFile & wrange(uint32_t u, uint32_t l)
std::string condEnumPrefix
OutputFile & wdelay_line_info()
void output_types(std::ostream &o, uint32_t ind, const std::vector< std::string > &types)
OutputFile & wu64(uint64_t n)
void emit(const std::vector< std::string > &types, size_t max_fill)
OutputFile(const char *fn)
std::string output_get_state()
Output(const char *source_name, const char *header_name)
bool warn_condition_order
void set_block_line(uint32_t l)
OutputFile & wdelay_yyaccept_init(uint32_t ind)
void output_version_time(std::ostream &o)
void prtChOrHex(std::ostream &o, uint32_t c)
OutputFile & wu32_hex(uint32_t n)
bool get_force_start_label() const
OutputFile & wraw(const char *s, size_t n)
void condition_order(uint32_t line)
std::vector< OutputFragment * > fragments
void output_yymaxfill(std::ostream &o, size_t max_fill)
uint32_t get_block_line() const
OutputFile & wrank(rule_rank_t l)
OutputFile & wu32_width(uint32_t n, int w)
void set_user_start_label(const std::string &label)
void output_yyaccept_init(std::ostream &o, uint32_t ind, bool used_yyaccept)
OutputFile & wline_info(uint32_t l, const char *fn)
OutputFile & wstring(const std::string &s)
void set_force_start_label(bool force)
void prtHex(std::ostream &o, uint32_t c)