changed token list to a STL list instead of a vector
This commit is contained in:
parent
762ff3d561
commit
c0e88f5c6f
14
Parser.cc
14
Parser.cc
@ -65,14 +65,16 @@ bool Parser::write(const string & fname)
|
|||||||
refptr<string> Parser::buildTokenList()
|
refptr<string> Parser::buildTokenList()
|
||||||
{
|
{
|
||||||
refptr<string> tokenlist = new string();
|
refptr<string> tokenlist = new string();
|
||||||
for (int i = 0; i < m_tokens.size(); i++)
|
for (list<TokenDefinitionRef>::const_iterator t = m_tokens.begin();
|
||||||
|
t != m_tokens.end();
|
||||||
|
t++)
|
||||||
{
|
{
|
||||||
if (i > 0)
|
if (t != m_tokens.begin())
|
||||||
*tokenlist += " ";
|
*tokenlist += " ";
|
||||||
*tokenlist += "{ \"" + m_tokens[i]->getName() + "\", \""
|
*tokenlist += "{ \"" + (*t)->getName() + "\", \""
|
||||||
+ m_tokens[i]->getCString() + "\", "
|
+ (*t)->getCString() + "\", "
|
||||||
+ (m_tokens[i]->getProcessFlag() ? "true" : "false") + " }";
|
+ ((*t)->getProcessFlag() ? "true" : "false") + " }";
|
||||||
if (i < m_tokens.size() - 1)
|
if (({typeof(t) tmp = t; ++tmp;}) != m_tokens.end())
|
||||||
*tokenlist += ", \\\n";
|
*tokenlist += ", \\\n";
|
||||||
}
|
}
|
||||||
return tokenlist;
|
return tokenlist;
|
||||||
|
3
Parser.h
3
Parser.h
@ -4,6 +4,7 @@
|
|||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <list>
|
||||||
|
|
||||||
#include "refptr.h"
|
#include "refptr.h"
|
||||||
#include "TokenDefinition.h"
|
#include "TokenDefinition.h"
|
||||||
@ -36,7 +37,7 @@ class Parser
|
|||||||
protected:
|
protected:
|
||||||
refptr<std::string> buildTokenList();
|
refptr<std::string> buildTokenList();
|
||||||
|
|
||||||
std::vector< refptr< TokenDefinition > > m_tokens;
|
std::list<TokenDefinitionRef> m_tokens;
|
||||||
std::vector< refptr< RuleDefinition > > m_rules;
|
std::vector< refptr< RuleDefinition > > m_rules;
|
||||||
std::string m_classname;
|
std::string m_classname;
|
||||||
std::string m_namespace;
|
std::string m_namespace;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user