src
Public Types | Public Member Functions | List of all members
re2c::InputAPI Class Reference

#include <input_api.h>

Public Types

enum  type_t { DEFAULT, CUSTOM }
 

Public Member Functions

 InputAPI ()
 
type_t type () const
 
void set (type_t t)
 
std::string expr_peek () const
 
std::string expr_peek_save () const
 
std::string stmt_peek (uint32_t ind) const
 
std::string stmt_skip (uint32_t ind) const
 
std::string stmt_backup (uint32_t ind) const
 
std::string stmt_backupctx (uint32_t ind) const
 
std::string stmt_restore (uint32_t ind) const
 
std::string stmt_restorectx (uint32_t ind) const
 
std::string stmt_skip_peek (uint32_t ind) const
 
std::string stmt_skip_backup (uint32_t ind) const
 
std::string stmt_backup_peek (uint32_t ind) const
 
std::string stmt_skip_backup_peek (uint32_t ind) const
 
std::string expr_lessthan_one () const
 
std::string expr_lessthan (size_t n) const
 

Detailed Description

Definition at line 10 of file input_api.h.

Member Enumeration Documentation

Enumerator
DEFAULT 
CUSTOM 

Definition at line 13 of file input_api.h.

Constructor & Destructor Documentation

re2c::InputAPI::InputAPI ( )

Definition at line 11 of file input_api.cc.

12  : type_ (DEFAULT)
13 {}

Member Function Documentation

std::string re2c::InputAPI::expr_lessthan ( size_t  n) const

Definition at line 160 of file input_api.cc.

161 {
162  std::ostringstream s;
163  switch (type_)
164  {
165  case DEFAULT:
166  s << "(" << opts->yylimit << " - " << opts->yycursor << ") < " << n;
167  break;
168  case CUSTOM:
169  s << opts->yylessthan << " (" << n << ")";
170  break;
171  }
172  return s.str ();
173 }
std::string yylimit
Definition: opt.h:118
std::string yycursor
Definition: opt.h:118
std::string yylessthan
Definition: opt.h:118
Opt opts
Definition: opt.cc:7

Here is the caller graph for this function:

std::string re2c::InputAPI::expr_lessthan_one ( ) const

Definition at line 153 of file input_api.cc.

154 {
155  return type_ == DEFAULT
156  ? opts->yylimit + " <= " + opts->yycursor
157  : expr_lessthan (1);
158 }
std::string yylimit
Definition: opt.h:118
std::string yycursor
Definition: opt.h:118
Opt opts
Definition: opt.cc:7
std::string expr_lessthan(size_t n) const
Definition: input_api.cc:160

Here is the call graph for this function:

Here is the caller graph for this function:

std::string re2c::InputAPI::expr_peek ( ) const

Definition at line 25 of file input_api.cc.

26 {
27  std::string s;
28  switch (type_)
29  {
30  case DEFAULT:
31  s = "*" + opts->yycursor;
32  break;
33  case CUSTOM:
34  s = opts->yypeek + " ()";
35  break;
36  }
37  return s;
38 }
std::string yycursor
Definition: opt.h:118
std::string yypeek
Definition: opt.h:118
Opt opts
Definition: opt.cc:7

Here is the caller graph for this function:

std::string re2c::InputAPI::expr_peek_save ( ) const

Definition at line 40 of file input_api.cc.

41 {
42  return opts->yych + " = " + opts.yychConversion () + expr_peek ();
43 }
std::string expr_peek() const
Definition: input_api.cc:25
std::string yych
Definition: opt.h:118
std::string yychConversion()
Definition: opt.h:193
Opt opts
Definition: opt.cc:7

Here is the call graph for this function:

Here is the caller graph for this function:

void re2c::InputAPI::set ( type_t  t)

Definition at line 20 of file input_api.cc.

21 {
22  type_ = t;
23 }

Here is the caller graph for this function:

std::string re2c::InputAPI::stmt_backup ( uint32_t  ind) const

Definition at line 65 of file input_api.cc.

66 {
67  std::string s;
68  switch (type_)
69  {
70  case DEFAULT:
71  s = opts->yymarker + " = " + opts->yycursor;
72  break;
73  case CUSTOM:
74  s = opts->yybackup + " ()";
75  break;
76  }
77  return indent (ind) + s + ";\n";
78 }
std::string indent(uint32_t ind)
Definition: indent.h:11
std::string yybackup
Definition: opt.h:118
std::string yycursor
Definition: opt.h:118
Opt opts
Definition: opt.cc:7
std::string yymarker
Definition: opt.h:118

Here is the call graph for this function:

Here is the caller graph for this function:

std::string re2c::InputAPI::stmt_backup_peek ( uint32_t  ind) const

Definition at line 139 of file input_api.cc.

140 {
141  return type_ == DEFAULT
142  ? indent (ind) + opts->yych + " = " + opts.yychConversion () + "*(" + opts->yymarker + " = " + opts->yycursor + ");\n"
143  : stmt_backup (ind) + stmt_peek (ind);
144 }
std::string indent(uint32_t ind)
Definition: indent.h:11
std::string yych
Definition: opt.h:118
std::string yycursor
Definition: opt.h:118
std::string yychConversion()
Definition: opt.h:193
std::string stmt_backup(uint32_t ind) const
Definition: input_api.cc:65
Opt opts
Definition: opt.cc:7
std::string stmt_peek(uint32_t ind) const
Definition: input_api.cc:45
std::string yymarker
Definition: opt.h:118

Here is the call graph for this function:

Here is the caller graph for this function:

std::string re2c::InputAPI::stmt_backupctx ( uint32_t  ind) const

Definition at line 80 of file input_api.cc.

81 {
82  std::string s;
83  switch (type_)
84  {
85  case DEFAULT:
86  s = opts->yyctxmarker + " = " + opts->yycursor;
87  break;
88  case CUSTOM:
89  s = opts->yybackupctx + " ()";
90  break;
91  }
92  return indent (ind) + s + ";\n";
93 }
std::string indent(uint32_t ind)
Definition: indent.h:11
std::string yycursor
Definition: opt.h:118
std::string yybackupctx
Definition: opt.h:118
Opt opts
Definition: opt.cc:7
std::string yyctxmarker
Definition: opt.h:118

Here is the call graph for this function:

Here is the caller graph for this function:

std::string re2c::InputAPI::stmt_peek ( uint32_t  ind) const

Definition at line 45 of file input_api.cc.

46 {
47  return indent (ind) + expr_peek_save () + ";\n";
48 }
std::string indent(uint32_t ind)
Definition: indent.h:11
std::string expr_peek_save() const
Definition: input_api.cc:40

Here is the call graph for this function:

Here is the caller graph for this function:

std::string re2c::InputAPI::stmt_restore ( uint32_t  ind) const

Definition at line 95 of file input_api.cc.

96 {
97  std::string s;
98  switch (type_)
99  {
100  case DEFAULT:
101  s = opts->yycursor + " = " + opts->yymarker;
102  break;
103  case CUSTOM:
104  s = opts->yyrestore + " ()";
105  break;
106  }
107  return indent (ind) + s + ";\n";
108 }
std::string yyrestore
Definition: opt.h:118
std::string indent(uint32_t ind)
Definition: indent.h:11
std::string yycursor
Definition: opt.h:118
Opt opts
Definition: opt.cc:7
std::string yymarker
Definition: opt.h:118

Here is the call graph for this function:

Here is the caller graph for this function:

std::string re2c::InputAPI::stmt_restorectx ( uint32_t  ind) const

Definition at line 110 of file input_api.cc.

111 {
112  std::string s;
113  switch (type_)
114  {
115  case DEFAULT:
116  s = indent (ind) + opts->yycursor + " = " + opts->yyctxmarker + ";\n";
117  break;
118  case CUSTOM:
119  s = indent (ind) + opts->yyrestorectx + " ();\n";
120  break;
121  }
122  return s;
123 }
std::string indent(uint32_t ind)
Definition: indent.h:11
std::string yycursor
Definition: opt.h:118
Opt opts
Definition: opt.cc:7
std::string yyrestorectx
Definition: opt.h:118
std::string yyctxmarker
Definition: opt.h:118

Here is the call graph for this function:

Here is the caller graph for this function:

std::string re2c::InputAPI::stmt_skip ( uint32_t  ind) const

Definition at line 50 of file input_api.cc.

51 {
52  std::string s;
53  switch (type_)
54  {
55  case DEFAULT:
56  s = "++" + opts->yycursor;
57  break;
58  case CUSTOM:
59  s = opts->yyskip + " ()";
60  break;
61  }
62  return indent (ind) + s + ";\n";
63 }
std::string indent(uint32_t ind)
Definition: indent.h:11
std::string yyskip
Definition: opt.h:118
std::string yycursor
Definition: opt.h:118
Opt opts
Definition: opt.cc:7

Here is the call graph for this function:

Here is the caller graph for this function:

std::string re2c::InputAPI::stmt_skip_backup ( uint32_t  ind) const

Definition at line 132 of file input_api.cc.

133 {
134  return type_ == DEFAULT
135  ? indent (ind) + opts->yymarker + " = ++" + opts->yycursor + ";\n"
136  : stmt_skip (ind) + stmt_backup (ind);
137 }
std::string indent(uint32_t ind)
Definition: indent.h:11
std::string yycursor
Definition: opt.h:118
std::string stmt_skip(uint32_t ind) const
Definition: input_api.cc:50
std::string stmt_backup(uint32_t ind) const
Definition: input_api.cc:65
Opt opts
Definition: opt.cc:7
std::string yymarker
Definition: opt.h:118

Here is the call graph for this function:

Here is the caller graph for this function:

std::string re2c::InputAPI::stmt_skip_backup_peek ( uint32_t  ind) const

Definition at line 146 of file input_api.cc.

147 {
148  return type_ == DEFAULT
149  ? indent (ind) + opts->yych + " = " + opts.yychConversion () + "*(" + opts->yymarker + " = ++" + opts->yycursor + ");\n"
150  : stmt_skip (ind) + stmt_backup (ind) + stmt_peek (ind);
151 }
std::string indent(uint32_t ind)
Definition: indent.h:11
std::string yych
Definition: opt.h:118
std::string yycursor
Definition: opt.h:118
std::string yychConversion()
Definition: opt.h:193
std::string stmt_skip(uint32_t ind) const
Definition: input_api.cc:50
std::string stmt_backup(uint32_t ind) const
Definition: input_api.cc:65
Opt opts
Definition: opt.cc:7
std::string stmt_peek(uint32_t ind) const
Definition: input_api.cc:45
std::string yymarker
Definition: opt.h:118

Here is the call graph for this function:

Here is the caller graph for this function:

std::string re2c::InputAPI::stmt_skip_peek ( uint32_t  ind) const

Definition at line 125 of file input_api.cc.

126 {
127  return type_ == DEFAULT
128  ? indent (ind) + opts->yych + " = " + opts.yychConversion () + "*++" + opts->yycursor + ";\n"
129  : stmt_skip (ind) + stmt_peek (ind);
130 }
std::string indent(uint32_t ind)
Definition: indent.h:11
std::string yych
Definition: opt.h:118
std::string yycursor
Definition: opt.h:118
std::string yychConversion()
Definition: opt.h:193
std::string stmt_skip(uint32_t ind) const
Definition: input_api.cc:50
Opt opts
Definition: opt.cc:7
std::string stmt_peek(uint32_t ind) const
Definition: input_api.cc:45

Here is the call graph for this function:

Here is the caller graph for this function:

InputAPI::type_t re2c::InputAPI::type ( ) const

Definition at line 15 of file input_api.cc.

16 {
17  return type_;
18 }

Here is the caller graph for this function:


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