2009-07-26 10:07:13 +00:00
|
|
|
#include "ASTNode.h"
|
|
|
|
|
|
|
|
PycRef<ASTNode> Node_NULL = (ASTNode*)0;
|
|
|
|
|
2009-07-27 00:23:49 +00:00
|
|
|
/* ASTNodeList */
|
|
|
|
void ASTNodeList::removeLast()
|
|
|
|
{
|
|
|
|
list_t::iterator it = m_nodes.end();
|
|
|
|
--it;
|
|
|
|
m_nodes.erase(it);
|
|
|
|
}
|
|
|
|
|
|
|
|
void ASTNodeList::removeFirst()
|
|
|
|
{
|
|
|
|
list_t::iterator it = m_nodes.begin();
|
|
|
|
m_nodes.erase(it);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-08-03 23:13:50 +00:00
|
|
|
/* ASTUnary */
|
|
|
|
const char* ASTUnary::op_str() const
|
|
|
|
{
|
|
|
|
static const char* s_op_strings[] = {
|
2010-08-31 23:17:38 -07:00
|
|
|
"+", "-", "~", "not ", "`"
|
2009-08-03 23:13:50 +00:00
|
|
|
};
|
|
|
|
return s_op_strings[op()];
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-07-27 00:23:49 +00:00
|
|
|
/* ASTBinary */
|
|
|
|
const char* ASTBinary::op_str() const
|
|
|
|
{
|
|
|
|
static const char* s_op_strings[] = {
|
2009-08-03 23:13:50 +00:00
|
|
|
".", " ** ", " * ", " / ", " // ", " % ", " + ", " - ",
|
2010-08-31 23:17:38 -07:00
|
|
|
" << ", " >> ", " & ", " ^ ", " | ", " and ", " or ",
|
|
|
|
" += ", " -= ", " *= ", " /= ", " %= ", " **= ", " <<= ",
|
2010-09-03 21:56:29 -07:00
|
|
|
" >>= ", " &= ", " ^= ", " |= ", " //= "
|
2009-07-27 00:23:49 +00:00
|
|
|
};
|
|
|
|
return s_op_strings[op()];
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-07-26 10:07:13 +00:00
|
|
|
/* ASTCompare */
|
|
|
|
const char* ASTCompare::op_str() const
|
|
|
|
{
|
|
|
|
static const char* s_cmp_strings[] = {
|
2010-08-31 23:17:38 -07:00
|
|
|
" < ", " <= ", " == ", " != ", " > ", " >= ", " in ", " not in ", " is ", " is not ",
|
2009-07-26 10:07:13 +00:00
|
|
|
"<EXCEPTION MATCH>", "<BAD>"
|
|
|
|
};
|
2009-07-27 00:23:49 +00:00
|
|
|
return s_cmp_strings[op()];
|
2009-07-26 10:07:13 +00:00
|
|
|
}
|