added: an optional string parameter to normal statement e.g. [function "parameter"]
parameters to "for" statement [for function "parameter"] changed: in Info struct there is a "par" std::string reference now changed: Info::result to Info::res removed: Info::is git-svn-id: svn://ttmath.org/publicrep/ezc/trunk@295 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
1 parent
f65178dd0e
commit
b89c6daa7d
4 files changed
+231
-111
No files matched your search
@@ -164,6 +164,7 @@ private:
|
||||
void ReadDirectiveComment(Item & item);
|
||||
void ReadDirectiveInclude(Item & item);
|
||||
void ReadDirectiveDef(Item & item);
|
||||
void ReadDirectiveNormal(Item::Directive & directive, Item & item);
|
||||
|
||||
void CreateTreeReadItemDirective(Item & item);
|
||||
|
||||
@@ -185,22 +186,25 @@ private:
|
||||
|
||||
struct Info
|
||||
{
|
||||
// this variables you can set in your function
|
||||
// output stream
|
||||
std::ostringstream & out;
|
||||
//std::string out_string;
|
||||
bool result;
|
||||
|
||||
// in a [is function "text"] statement this is the pointer to "text" object
|
||||
// otherwise this is null pointer
|
||||
const std::string * is;
|
||||
|
||||
// an optional string parameter in a normal statement [user_function "parameter"]
|
||||
// or in "is" statement [is user_function "parameter"]
|
||||
// or in "for" statement [for user_function "parameter"]
|
||||
const std::string & par;
|
||||
|
||||
// this is set by Generator
|
||||
// normally is 0
|
||||
// in a [for] statement it indicates the number of the current iteration (the first is 0)
|
||||
int iter;
|
||||
|
||||
// return value from a user function (default false if not set directly by the user function)
|
||||
// for a variable it is set to true if the variable is not empty
|
||||
bool res;
|
||||
|
||||
Info(std::ostringstream & o);
|
||||
// arguments: output_stream, string_parameter
|
||||
Info(std::ostringstream & o, const std::string & p);
|
||||
void Clear();
|
||||
};
|
||||
|
||||
@@ -250,26 +254,36 @@ private:
|
||||
|
||||
class Generator
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
Generator(std::ostringstream &, Pattern & data, Functions & functions);
|
||||
Generator();
|
||||
Generator(std::ostringstream & o, Pattern & p, Functions & f);
|
||||
|
||||
void SetOutStream(std::ostringstream & o);
|
||||
void SetPattern(Pattern & p);
|
||||
void SetFunctions(Functions & f);
|
||||
void SetMax(int max_items_, int max_for_items_);
|
||||
|
||||
void Generate();
|
||||
|
||||
private:
|
||||
|
||||
std::ostringstream & output_stream;
|
||||
Pattern & pattern;
|
||||
Functions & functions;
|
||||
|
||||
Info info1, info2;
|
||||
int loop;
|
||||
std::ostringstream * output_stream;
|
||||
Pattern * pattern;
|
||||
Functions * functions;
|
||||
|
||||
int current_item;
|
||||
int max_items;
|
||||
int max_for_items;
|
||||
|
||||
// an empty string for info objects
|
||||
const std::string empty;
|
||||
|
||||
bool Find(const std::string & key, Functions::Function ** function);
|
||||
|
||||
|
||||
void Call(Functions::Function * function, Info & info, const std::string * is = 0);
|
||||
bool Call(const std::string & name, Info & info, Functions::Function ** pfun = 0, const std::string * is = 0);
|
||||
void Call(Functions::Function * function, Info & info);
|
||||
bool Call(const std::string & name, Info & info, Functions::Function ** pfun = 0);
|
||||
|
||||
void CallUserFunction(Functions::Function * function, Info & info);
|
||||
void CallVariable(Functions::Function * function, Info & info);
|
||||
@@ -280,6 +294,7 @@ private:
|
||||
void MakeTextIfno(Pattern::Item & item);
|
||||
void MakeTextIfone(Pattern::Item & item);
|
||||
void MakeTextIfindex(Pattern::Item & item);
|
||||
void MakeTextForLoop(Pattern::Item & item, Functions::Function * function);
|
||||
void MakeTextFor(Pattern::Item & item);
|
||||
void MakeTextContainer(Pattern::Item & item);
|
||||
void MakeTextNormal(Pattern::Item & item);
|
||||
|
||||
Reference in new issue
Block a user