added MatchSet class; Token::process()
This commit is contained in:
parent
c0e88f5c6f
commit
3a0a7e494d
@ -136,6 +136,35 @@ refptr<Node> Node::operator[](const std::string & index)
|
|||||||
: NULL;
|
: NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Token::process()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
MatchSet::MatchSet(const char * data, int * ovector, int ovec_size)
|
||||||
|
: m_data(data), m_ovector(ovector), m_ovec_size(ovec_size)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string MatchSet::operator[](int index)
|
||||||
|
{
|
||||||
|
if (0 <= index && index < (m_ovec_size / 3))
|
||||||
|
{
|
||||||
|
int idx = 2 * index;
|
||||||
|
if (m_ovector[idx] >= 0 && m_ovector[idx + 1] >= 0)
|
||||||
|
{
|
||||||
|
return string(m_data, m_ovector[idx],
|
||||||
|
m_ovector[idx + 1] - m_ovector[idx]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string MatchSet::operator[](const std::string & index)
|
||||||
|
{
|
||||||
|
/* FIXME */
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef I_NAMESPACE
|
#ifdef I_NAMESPACE
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
@ -121,6 +121,20 @@ class I_CLASSNAME
|
|||||||
const char * m_errstr;
|
const char * m_errstr;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class MatchSet
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
MatchSet(const char * data, int * ovector, int ovec_size);
|
||||||
|
std::string operator[](int index);
|
||||||
|
std::string operator[](const std::string & index);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
const char * m_data;
|
||||||
|
int * m_ovector;
|
||||||
|
int m_ovec_size;
|
||||||
|
};
|
||||||
|
typedef refptr<MatchSet> MatchSetRef;
|
||||||
|
|
||||||
class Node
|
class Node
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -131,14 +145,16 @@ class Node
|
|||||||
std::map< std::string, refptr<Node> > m_named_children;
|
std::map< std::string, refptr<Node> > m_named_children;
|
||||||
std::vector< refptr<Node> > m_indexed_children;
|
std::vector< refptr<Node> > m_indexed_children;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef refptr<Node> NodeRef;
|
typedef refptr<Node> NodeRef;
|
||||||
|
|
||||||
class Token : public Node
|
class Token : public Node
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
virtual void process();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
};
|
};
|
||||||
|
typedef refptr<Token> TokenRef;
|
||||||
|
|
||||||
#ifdef I_NAMESPACE
|
#ifdef I_NAMESPACE
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user