PUMA Library Reference Manual
Puma::Tracing Class Reference

#include <Puma/Tracing.h>

Description

Implements tracing support for the parser.

Public Member Functions

void trace (std::ostream &os, bool trace_tokens=false)
 Setup the tracer. More...
 

Protected Member Functions

 Tracing ()
 Constructor. More...
 
void trace (int token)
 Trace the given token. More...
 
void trace (const char *rule, int n=1, bool quote=false)
 Trace the given parser rule. More...
 
void trace (Token *token, const char *ok, const char *failed)
 Trace the given token. More...
 
int trace_mode () const
 Get the current tracing mode. More...
 
std::ostream & tos () const
 Get the tracing output stream. More...
 

Constructor & Destructor Documentation

◆ Tracing()

Puma::Tracing::Tracing ( )
inlineprotected

Constructor.

Member Function Documentation

◆ tos()

std::ostream& Puma::Tracing::tos ( ) const
protected

Get the tracing output stream.

◆ trace() [1/4]

void Puma::Tracing::trace ( const char *  rule,
int  n = 1,
bool  quote = false 
)
protected

Trace the given parser rule.

Parameters
ruleThe rule name.
nThe indentation depth.
quoteQuote the rule name.

◆ trace() [2/4]

void Puma::Tracing::trace ( int  token)
inlineprotected

Trace the given token.

Parameters
tokenThe token type.

◆ trace() [3/4]

void Puma::Tracing::trace ( std::ostream &  os,
bool  trace_tokens = false 
)

Setup the tracer.

Parameters
osThe output stream on which to write the tracing output.
trace_tokensTurn on/off token level tracing.

◆ trace() [4/4]

void Puma::Tracing::trace ( Token token,
const char *  ok,
const char *  failed 
)
protected

Trace the given token.

Parameters
tokenThe token to trace.
okThe message if the token is not NULL.
failedThe message if the token is NULL.

◆ trace_mode()

int Puma::Tracing::trace_mode ( ) const
inlineprotected

Get the current tracing mode.

0 means tracing is disabled, 1 means rule level tracing, 2 means token level tracing.