?? ptnode.cpp
字號:
#include <stdio.h>
#include "PTNode.H"
void
PTNode::Dump() const
{
Dump_Internal( 0 );
printf( "\n" );
}
void
PTNode::Dump_Internal( int indent ) const
{
int c = 0;
for ( ; c < indent; c += 2 )
printf( " |" );
printf( " +-- %s\n", GetName().c_str() );
NodeList::const_iterator i = GetChildrenBegin();
NodeList::const_iterator end = GetChildrenEnd();
indent += 2;
for ( ; i != end; ++i ) {
PTNodePtr node = *i;
// It is okay for some nodes to have NULL pointers in their list of
// children. This just means that the optional child is not specified.
if ( node == NULL )
continue;
node->Dump_Internal( indent );
}
indent -= 2;
}
// When dumping the parse tree, it is useful to see what the actual constant
// number. Make sure to add its value to the name string.
string
ConstantNode::GetName() const
{
char name[64];
sprintf( name, "Constant %d", m_value );
return name;
}
string
IdentifierNode::GetName() const
{
return "Identifier " + m_name;
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -