added TokenDefinition::getClassName()
This commit is contained in:
parent
3f3dd81e67
commit
5219989f2a
@ -157,7 +157,7 @@ refptr<string> Parser::buildBuildToken()
|
|||||||
t++)
|
t++)
|
||||||
{
|
{
|
||||||
*buildToken += "case " + (*t)->getIdentifier() + ":\n";
|
*buildToken += "case " + (*t)->getIdentifier() + ":\n";
|
||||||
*buildToken += " token = new " + (*t)->getName() + "();\n";
|
*buildToken += " token = new " + (*t)->getClassName() + "();\n";
|
||||||
*buildToken += " break;\n";
|
*buildToken += " break;\n";
|
||||||
}
|
}
|
||||||
return buildToken;
|
return buildToken;
|
||||||
|
@ -99,8 +99,7 @@ string TokenDefinition::getCString() const
|
|||||||
|
|
||||||
string TokenDefinition::getClassDefinition() const
|
string TokenDefinition::getClassDefinition() const
|
||||||
{
|
{
|
||||||
string ret = "class ";
|
string ret = "class "+ getClassName() + " : public Token {\n";
|
||||||
ret += m_name + " : public Token {\n";
|
|
||||||
ret += "public:\n";
|
ret += "public:\n";
|
||||||
if (m_process)
|
if (m_process)
|
||||||
{
|
{
|
||||||
@ -117,7 +116,7 @@ string TokenDefinition::getProcessMethod() const
|
|||||||
string ret;
|
string ret;
|
||||||
if (m_code != "")
|
if (m_code != "")
|
||||||
{
|
{
|
||||||
ret += "void " + m_name + "::process(Matches matches) {\n";
|
ret += "void " + getClassName() + "::process(Matches matches) {\n";
|
||||||
ret += m_code + "\n";
|
ret += m_code + "\n";
|
||||||
ret += "}\n";
|
ret += "}\n";
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,8 @@ class TokenDefinition
|
|||||||
std::string getCode() const { return m_code; }
|
std::string getCode() const { return m_code; }
|
||||||
std::string getClassDefinition() const;
|
std::string getClassDefinition() const;
|
||||||
std::string getProcessMethod() const;
|
std::string getProcessMethod() const;
|
||||||
std::string getIdentifier() { return std::string("TK_") + m_name; }
|
std::string getIdentifier() const { return "TK_" + m_name; }
|
||||||
|
std::string getClassName() const { return "Tk" + m_name; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
std::string m_name;
|
std::string m_name;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user