Bond 0.9
C++ Bond Runtime Library API Documentation
Loading...
Searching...
No Matches
Bond::ParseNodeCounter Class Reference

A parse tree traverser that counts encountered parse nodes. More...

#include <bond/tools/parsenodecounter.h>

Inheritance diagram for Bond::ParseNodeCounter:
Bond::ParseNodeTraverser

Public Member Functions

 ParseNodeCounter ()
 Constructs a ParseNodeCounter with all counters initialized to zero.
virtual ~ParseNodeCounter ()
const ParseNodeCountGetCount () const
 Returns the current parse node counters.
void Count (const ParseNode *parseNode)
 Traverses a parse tree and accumulates node counts.
void CountList (const ListParseNode *listNode)
 Traverses a linked list of parse nodes and accumulates node counts.

Detailed Description

A parse tree traverser that counts encountered parse nodes.

ParseNodeCounter traverses parse trees and increments counters in ParseNodeCount for each parse node type visited.

See also
ParseNodeCount, ParseNodeTraverser

Constructor & Destructor Documentation

◆ ParseNodeCounter()

Bond::ParseNodeCounter::ParseNodeCounter ( )
inline

Constructs a ParseNodeCounter with all counters initialized to zero.

◆ ~ParseNodeCounter()

virtual Bond::ParseNodeCounter::~ParseNodeCounter ( )
inlinevirtual

Member Function Documentation

◆ Count()

void Bond::ParseNodeCounter::Count ( const ParseNode * parseNode)
inline

Traverses a parse tree and accumulates node counts.

Parameters
parseNodeRoot parse node to traverse.

◆ CountList()

void Bond::ParseNodeCounter::CountList ( const ListParseNode * listNode)
inline

Traverses a linked list of parse nodes and accumulates node counts.

Parameters
listNodeHead of the parse node list to traverse.

◆ GetCount()

const ParseNodeCount & Bond::ParseNodeCounter::GetCount ( ) const
inline

Returns the current parse node counters.

Returns
The accumulated ParseNodeCount values.

The documentation for this class was generated from the following file:
  • include/bond/tools/parsenodecounter.h