LRDE Tiger Compiler
1.34a $Id: 7fef12e1f5fa43449d667a0eec1d837c40fc1202 $
|
TWEAST stands for ``Text With Embedded Abstract Syntax Trees''. More...
#include <tweast.hh>
Public Member Functions | |
Tweast () | |
Tweast (const std::string &str) | |
virtual | ~Tweast () |
template<typename T > | |
Tweast & | operator<< (const T &t) |
Stream manipulator. | |
template<typename T > | |
T * | take (unsigned s) |
Metavariables manipulator. | |
void | flatten () |
std::string | input_get () const |
Get the current input string. | |
std::ostream & | dump (std::ostream &ostr) const |
Print the table. | |
std::string | show (unsigned key) |
std::string | show (unsigned key) |
std::string | show (unsigned key) |
std::string | show (unsigned key) |
std::string | show (unsigned key) |
Protected Types | |
typedef misc::map< unsigned, ast::Exp * > | map_type |
Metavariables. | |
typedef misc::map< unsigned, ast::Var * > | map_type |
Metavariables. | |
typedef misc::map< unsigned, ast::NameTy * > | map_type |
Metavariables. | |
typedef misc::map< unsigned, ast::DecsList * > | map_type |
Metavariables. | |
typedef misc::map< unsigned, parse::Tweast * > | map_type |
Metavariables. |
Protected Member Functions | |
template<typename T > | |
T & | append_ (unsigned &, T &data) const |
Fake append (default case, i.e. when data is not a metavariable). | |
template<typename T > | |
void | move_metavars_ (Tweast &tweast, std::string &input) |
virtual std::string | append_ (unsigned &key, ast::Exp *data) |
Append a metavariable to the map. | |
virtual ast::Exp * | take_ (unsigned key) |
Extract a metavariable. | |
virtual std::string | append_ (unsigned &key, ast::Var *data) |
Append a metavariable to the map. | |
virtual ast::Var * | take_ (unsigned key) |
Extract a metavariable. | |
virtual std::string | append_ (unsigned &key, ast::NameTy *data) |
Append a metavariable to the map. | |
virtual ast::NameTy * | take_ (unsigned key) |
Extract a metavariable. | |
virtual std::string | append_ (unsigned &key, ast::DecsList *data) |
Append a metavariable to the map. | |
virtual ast::DecsList * | take_ (unsigned key) |
Extract a metavariable. | |
virtual std::string | append_ (unsigned &key, parse::Tweast *data) |
Append a metavariable to the map. | |
virtual parse::Tweast * | take_ (unsigned key) |
Extract a metavariable. |
Protected Attributes | |
std::stringstream | input_ |
The string to parse. | |
const std::string | name_ |
Name of the kind of variable. | |
map_type | map_ |
const std::string | name_ |
Name of the kind of variable. | |
map_type | map_ |
const std::string | name_ |
Name of the kind of variable. | |
map_type | map_ |
const std::string | name_ |
Name of the kind of variable. | |
map_type | map_ |
const std::string | name_ |
Name of the kind of variable. | |
map_type | map_ |
Static Protected Attributes | |
static unsigned | count_ = 0 |
The next identifier suffix to create. |
TWEAST stands for ``Text With Embedded Abstract Syntax Trees''.
Aggregate string to parse and tables of metavariables.
|
protectedinherited |
Metavariables.
|
protectedinherited |
Metavariables.
|
protectedinherited |
Metavariables.
|
protectedinherited |
Metavariables.
|
protectedinherited |
Metavariables.
parse::Tweast::Tweast | ( | ) |
parse::Tweast::Tweast | ( | const std::string & | str | ) |
|
virtual |
|
protectedvirtualinherited |
Append a metavariable to the map.
|
protectedvirtualinherited |
Append a metavariable to the map.
|
protectedvirtualinherited |
Append a metavariable to the map.
|
protectedvirtualinherited |
Append a metavariable to the map.
|
protectedvirtualinherited |
Append a metavariable to the map.
|
protected |
Fake append (default case, i.e. when data is not a metavariable).
Referenced by operator<<().
std::ostream & parse::Tweast::dump | ( | std::ostream & | ostr | ) | const |
Print the table.
References misc::decendl(), misc::incendl(), and input_.
Referenced by parse::operator<<().
void parse::Tweast::flatten | ( | ) |
Move the contents of all aggregated Tweast metavariables into the current Tweast.
References input_, input_get(), and parse::MetavarMap< ast::Exp >::show().
Referenced by parse::TigerParser::parse_input().
std::string parse::Tweast::input_get | ( | ) | const |
|
protected |
References count_, and parse::MetavarMap< ast::Exp >::show().
Tweast & parse::Tweast::operator<< | ( | const T & | t | ) |
|
inherited |
Generate a (concrete syntax) Tiger statement for metavariable number key (of kind Data
).
|
inherited |
Generate a (concrete syntax) Tiger statement for metavariable number key (of kind Data
).
|
inherited |
Generate a (concrete syntax) Tiger statement for metavariable number key (of kind Data
).
Referenced by flatten(), and move_metavars_().
|
inherited |
Generate a (concrete syntax) Tiger statement for metavariable number key (of kind Data
).
|
inherited |
Generate a (concrete syntax) Tiger statement for metavariable number key (of kind Data
).
T * parse::Tweast::take | ( | unsigned | s | ) |
Metavariables manipulator.
References parse::MetavarMap< ast::Exp >::take_().
|
protectedvirtualinherited |
Extract a metavariable.
|
protectedvirtualinherited |
Extract a metavariable.
|
protectedvirtualinherited |
Extract a metavariable.
Referenced by take().
|
protectedvirtualinherited |
Extract a metavariable.
|
protectedvirtualinherited |
Extract a metavariable.
|
staticprotected |
The next identifier suffix to create.
Referenced by move_metavars_(), and operator<<().
|
protected |
The string to parse.
Referenced by dump(), flatten(), input_get(), and operator<<().
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
Name of the kind of variable.
|
protectedinherited |
Name of the kind of variable.
|
protectedinherited |
Name of the kind of variable.
|
protectedinherited |
Name of the kind of variable.
|
protectedinherited |
Name of the kind of variable.