mirror of
https://github.com/zrax/pycdc.git
synced 2026-06-23 11:34:07 +00:00
Fix
This commit is contained in:
parent
7f3265e419
commit
f35c494dd0
4 changed files with 4440 additions and 4373 deletions
162
ASTNode.cpp
162
ASTNode.cpp
|
|
@ -1,81 +1,81 @@
|
|||
#include "ASTNode.h"
|
||||
|
||||
/* ASTNodeList */
|
||||
void ASTNodeList::removeLast()
|
||||
{
|
||||
list_t::iterator it = m_nodes.end();
|
||||
--it;
|
||||
m_nodes.erase(it);
|
||||
}
|
||||
|
||||
void ASTNodeList::removeFirst()
|
||||
{
|
||||
m_nodes.erase(m_nodes.cbegin());
|
||||
}
|
||||
|
||||
|
||||
/* ASTUnary */
|
||||
const char* ASTUnary::op_str() const
|
||||
{
|
||||
static const char* s_op_strings[] = {
|
||||
"+", "-", "~", "not "
|
||||
};
|
||||
return s_op_strings[op()];
|
||||
}
|
||||
|
||||
|
||||
/* ASTBinary */
|
||||
const char* ASTBinary::op_str() const
|
||||
{
|
||||
static const char* s_op_strings[] = {
|
||||
".", " ** ", " * ", " / ", " // ", " % ", " + ", " - ",
|
||||
" << ", " >> ", " & ", " ^ ", " | ", " and ", " or ", " @ ",
|
||||
" += ", " -= ", " *= ", " /= ", " %= ", " **= ", " <<= ",
|
||||
" >>= ", " &= ", " ^= ", " |= ", " //= ", " @= ",
|
||||
};
|
||||
return s_op_strings[op()];
|
||||
}
|
||||
|
||||
|
||||
/* ASTCompare */
|
||||
const char* ASTCompare::op_str() const
|
||||
{
|
||||
static const char* s_cmp_strings[] = {
|
||||
" < ", " <= ", " == ", " != ", " > ", " >= ", " in ", " not in ", " is ", " is not ",
|
||||
"<EXCEPTION MATCH>", "<BAD>"
|
||||
};
|
||||
return s_cmp_strings[op()];
|
||||
}
|
||||
|
||||
|
||||
/* ASTKeyword */
|
||||
const char* ASTKeyword::word_str() const
|
||||
{
|
||||
static const char* s_word_strings[] = {
|
||||
"pass", "break", "continue"
|
||||
};
|
||||
return s_word_strings[key()];
|
||||
}
|
||||
|
||||
|
||||
/* ASTBlock */
|
||||
void ASTBlock::removeLast()
|
||||
{
|
||||
list_t::iterator it = m_nodes.end();
|
||||
--it;
|
||||
m_nodes.erase(it);
|
||||
}
|
||||
|
||||
void ASTBlock::removeFirst()
|
||||
{
|
||||
m_nodes.erase(m_nodes.begin());
|
||||
}
|
||||
|
||||
const char* ASTBlock::type_str() const
|
||||
{
|
||||
static const char* s_type_strings[] = {
|
||||
"", "if", "else", "elif", "try", "CONTAINER", "except",
|
||||
"finally", "while", "for", "with", "async for"
|
||||
};
|
||||
return s_type_strings[blktype()];
|
||||
}
|
||||
#include "ASTNode.h"
|
||||
|
||||
/* ASTNodeList */
|
||||
void ASTNodeList::removeLast()
|
||||
{
|
||||
list_t::iterator it = m_nodes.end();
|
||||
--it;
|
||||
m_nodes.erase(it);
|
||||
}
|
||||
|
||||
void ASTNodeList::removeFirst()
|
||||
{
|
||||
m_nodes.erase(m_nodes.cbegin());
|
||||
}
|
||||
|
||||
|
||||
/* ASTUnary */
|
||||
const char* ASTUnary::op_str() const
|
||||
{
|
||||
static const char* s_op_strings[] = {
|
||||
"+", "-", "~", "not "
|
||||
};
|
||||
return s_op_strings[op()];
|
||||
}
|
||||
|
||||
|
||||
/* ASTBinary */
|
||||
const char* ASTBinary::op_str() const
|
||||
{
|
||||
static const char* s_op_strings[] = {
|
||||
".", " ** ", " * ", " / ", " // ", " % ", " + ", " - ",
|
||||
" << ", " >> ", " & ", " ^ ", " | ", " and ", " or ", " @ ",
|
||||
" += ", " -= ", " *= ", " /= ", " %= ", " **= ", " <<= ",
|
||||
" >>= ", " &= ", " ^= ", " |= ", " //= ", " @= ",
|
||||
};
|
||||
return s_op_strings[op()];
|
||||
}
|
||||
|
||||
|
||||
/* ASTCompare */
|
||||
const char* ASTCompare::op_str() const
|
||||
{
|
||||
static const char* s_cmp_strings[] = {
|
||||
" < ", " <= ", " == ", " != ", " > ", " >= ", " in ", " not in ", " is ", " is not ",
|
||||
"<EXCEPTION MATCH>", "<BAD>"
|
||||
};
|
||||
return s_cmp_strings[op()];
|
||||
}
|
||||
|
||||
|
||||
/* ASTKeyword */
|
||||
const char* ASTKeyword::word_str() const
|
||||
{
|
||||
static const char* s_word_strings[] = {
|
||||
"pass", "break", "continue"
|
||||
};
|
||||
return s_word_strings[key()];
|
||||
}
|
||||
|
||||
|
||||
/* ASTBlock */
|
||||
void ASTBlock::removeLast()
|
||||
{
|
||||
list_t::iterator it = m_nodes.end();
|
||||
--it;
|
||||
m_nodes.erase(it);
|
||||
}
|
||||
|
||||
void ASTBlock::removeFirst()
|
||||
{
|
||||
m_nodes.erase(m_nodes.begin());
|
||||
}
|
||||
|
||||
const char* ASTBlock::type_str() const
|
||||
{
|
||||
static const char* s_type_strings[] = {
|
||||
"", "if", "else", "elif", "try", "CONTAINER", "except",
|
||||
"finally", "while", "for", "with", "async for"
|
||||
};
|
||||
return s_type_strings[blktype()];
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue