user data in "public" section by default now; storing list of tokens in the generated parser for use later by the rules
This commit is contained in:
parent
dfbd319329
commit
b689923475
@ -105,7 +105,7 @@ string TokenDefinition::getClassDefinition() const
|
|||||||
{
|
{
|
||||||
ret += " virtual void process(const Matches & matches);\n";
|
ret += " virtual void process(const Matches & matches);\n";
|
||||||
}
|
}
|
||||||
ret += "protected:\n";
|
ret += "\n";
|
||||||
ret += m_data + "\n";
|
ret += m_data + "\n";
|
||||||
ret += "};\n";
|
ret += "};\n";
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -138,6 +138,7 @@ bool I_CLASSNAME::parse(istream & i)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
token->process(matches);
|
token->process(matches);
|
||||||
|
m_tokens.push_back(token);
|
||||||
buff_pos += longest_match_length;
|
buff_pos += longest_match_length;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
#include <list>
|
||||||
|
|
||||||
{%user_includes%}
|
{%user_includes%}
|
||||||
|
|
||||||
@ -119,17 +120,6 @@ template <typename T> void refptr<T>::destroy()
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
class I_CLASSNAME
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
I_CLASSNAME();
|
|
||||||
bool parse(std::istream & in);
|
|
||||||
const char * getError() { return m_errstr; }
|
|
||||||
|
|
||||||
protected:
|
|
||||||
const char * m_errstr;
|
|
||||||
};
|
|
||||||
|
|
||||||
class Matches
|
class Matches
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -165,12 +155,26 @@ class Token : public Node
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
int m_type;
|
int m_type;
|
||||||
|
|
||||||
|
public:
|
||||||
{%token_data%}
|
{%token_data%}
|
||||||
};
|
};
|
||||||
typedef refptr<Token> TokenRef;
|
typedef refptr<Token> TokenRef;
|
||||||
|
|
||||||
{%token_classes%}
|
{%token_classes%}
|
||||||
|
|
||||||
|
class I_CLASSNAME
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
I_CLASSNAME();
|
||||||
|
bool parse(std::istream & in);
|
||||||
|
const char * getError() { return m_errstr; }
|
||||||
|
|
||||||
|
protected:
|
||||||
|
const char * m_errstr;
|
||||||
|
std::list<TokenRef> m_tokens;
|
||||||
|
};
|
||||||
|
|
||||||
#ifdef I_NAMESPACE
|
#ifdef I_NAMESPACE
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user