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 += "protected:\n";
|
||||
ret += "\n";
|
||||
ret += m_data + "\n";
|
||||
ret += "};\n";
|
||||
return ret;
|
||||
|
@ -138,6 +138,7 @@ bool I_CLASSNAME::parse(istream & i)
|
||||
return false;
|
||||
}
|
||||
token->process(matches);
|
||||
m_tokens.push_back(token);
|
||||
buff_pos += longest_match_length;
|
||||
}
|
||||
}
|
||||
|
@ -10,6 +10,7 @@
|
||||
#include <iostream>
|
||||
#include <map>
|
||||
#include <vector>
|
||||
#include <list>
|
||||
|
||||
{%user_includes%}
|
||||
|
||||
@ -119,17 +120,6 @@ template <typename T> void refptr<T>::destroy()
|
||||
#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
|
||||
{
|
||||
public:
|
||||
@ -165,12 +155,26 @@ class Token : public Node
|
||||
|
||||
protected:
|
||||
int m_type;
|
||||
|
||||
public:
|
||||
{%token_data%}
|
||||
};
|
||||
typedef refptr<Token> TokenRef;
|
||||
|
||||
{%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
|
||||
};
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user