src
emit.h
Go to the documentation of this file.
1 #ifndef _RE2C_CODEGEN_EMIT_
2 #define _RE2C_CODEGEN_EMIT_
3 
4 #include "src/codegen/output.h"
5 #include "src/ir/adfa/adfa.h"
6 
7 namespace re2c {
8 
9 typedef std::vector<std::string> RegExpIndices;
10 
11 void emit_action
12  ( const Action & action
13  , OutputFile & o
14  , uint32_t ind
15  , bool & readCh
16  , const State * const s
17  , const std::string & condName
18  , const Skeleton * skeleton
19  , const std::set<label_t> & used_labels
20  , bool save_yyaccept
21  );
22 
23 // helpers
24 void genGoTo (OutputFile & o, uint32_t ind, const State * from, const State * to, bool & readCh);
25 
26 template<typename _Ty> std::string replaceParam (std::string str, const std::string & param, const _Ty & value)
27 {
28  if (!param.empty ())
29  {
30  std::ostringstream strValue;
31  strValue << value;
32  std::string::size_type pos;
33  while((pos = str.find(param)) != std::string::npos)
34  {
35  str.replace(pos, param.length(), strValue.str());
36  }
37  }
38  return str;
39 }
40 
41 } // namespace re2c
42 
43 #endif // _RE2C_CODEGEN_EMIT_
void emit_action(const Action &action, OutputFile &o, uint32_t ind, bool &readCh, const State *const s, const std::string &condName, const Skeleton *skeleton, const std::set< label_t > &used_labels, bool save_yyaccept)
Definition: emit_action.cc:36
std::string replaceParam(std::string str, const std::string &param, const _Ty &value)
Definition: emit.h:26
void genGoTo(OutputFile &o, uint32_t ind, const State *from, const State *to, bool &readCh)
Definition: emit_dfa.cc:37
std::vector< std::string > RegExpIndices
Definition: emit.h:9
Definition: bitmap.cc:10