| eRPC Generator (erpcgen) Rev. 1.8.1 NXP Semiconductors

- Main Page
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Classes | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
erpcgen::AstWalker Class Reference

Performs a depth-first walk of an AST. More...

`#include <AstWalker.h>`

Inheritance diagram for erpcgen::AstWalker:

## Classes
struct | bottom_up
| Specifier type to select bottom-up handler using ADL. More...
struct | top_down
| Specifier type to select top-down handler using ADL. More...

## Public Member Functions
| AstWalker ()=default
| default constructor
| AstWalker (std::string inputFile)
| Constructor. More...
virtual | ~AstWalker ()=default
| destructor
virtual void | startWalk (AstNode *node)
| This function walk the AstNode depth-first and invoke handler methods. More...

## Protected Member Functions
virtual void | walk (AstNode *node)
| This function walk the AstNode depth-first and invoke handler methods. More...
template<typename D >
void | dispatch (AstNode *node)
| This function invoke the appropriate handler method for the node's token type.. More...
virtual void | handleRoot (AstNode *node, top_down)
virtual AstNode * | handleProgram (AstNode *node, top_down)
virtual AstNode * | handleConst (AstNode *node, top_down)
virtual AstNode * | handleChildren (AstNode *node, top_down)
virtual AstNode * | handleType (AstNode *node, top_down)
virtual AstNode * | handleEnum (AstNode *node, top_down)
virtual AstNode * | handleEnumMember (AstNode *node, top_down)
virtual AstNode * | handleStruct (AstNode *node, top_down)
virtual AstNode * | handleStructMember (AstNode *node, top_down)
virtual AstNode * | handleUnion (AstNode *node, top_down)
virtual AstNode * | handleUnionCase (AstNode *node, top_down)
virtual AstNode * | handleInterface (AstNode *node, top_down)
virtual AstNode * | handleFunction (AstNode *node, top_down)
virtual AstNode * | handleParam (AstNode *node, top_down)
virtual AstNode * | handleExpr (AstNode *node, top_down)
virtual AstNode * | handleBinaryOp (AstNode *node, top_down)
virtual AstNode * | handleUnaryOp (AstNode *node, top_down)
virtual AstNode * | handleAnnotation (AstNode *node, top_down)
virtual void | handleRoot (AstNode *node, bottom_up)
virtual AstNode * | handleProgram (AstNode *node, bottom_up)
virtual AstNode * | handleConst (AstNode *node, bottom_up)
virtual AstNode * | handleChildren (AstNode *node, bottom_up)
virtual AstNode * | handleType (AstNode *node, bottom_up)
virtual AstNode * | handleEnum (AstNode *node, bottom_up)
virtual AstNode * | handleEnumMember (AstNode *node, bottom_up)
virtual AstNode * | handleStruct (AstNode *node, bottom_up)
virtual AstNode * | handleStructMember (AstNode *node, bottom_up)
virtual AstNode * | handleUnion (AstNode *node, bottom_up)
virtual AstNode * | handleUnionCase (AstNode *node, bottom_up)
virtual AstNode * | handleInterface (AstNode *node, bottom_up)
virtual AstNode * | handleFunction (AstNode *node, bottom_up)
virtual AstNode * | handleParam (AstNode *node, bottom_up)
virtual AstNode * | handleExpr (AstNode *node, bottom_up)
virtual AstNode * | handleBinaryOp (AstNode *node, bottom_up)
virtual AstNode * | handleUnaryOp (AstNode *node, bottom_up)
virtual AstNode * | handleAnnotation (AstNode *node, bottom_up)

## Protected Attributes
std::string | m_fileName
| Stores name of file from which AST was built.

## Detailed Description

Performs a depth-first walk of an AST.

Handles these token types:

- TOK_PROGRAM
- TOK_CONST
- TOK_ENUM
- TOK_STRUCT
- TOK_TYPE
- TOK_INTERFACE
- TOK_CHILDREN
- TOK_ENUM_MEMBER
- TOK_STRUCT_MEMBER
- TOK_FUNCTION
- TOK_PARAM
- TOK_EXPR
- TOK_ANNOTATION
- TOK_LIST
- TOK_ARRAY

## Class Documentation

struct erpcgen::AstWalker::bottom_up

Specifier type to select bottom-up handler using ADL.

struct erpcgen::AstWalker::top_down

Specifier type to select top-down handler using ADL.

## Constructor & Destructor Documentation

erpcgen::AstWalker::AstWalker | ( | std::string | inputFile | ) |
| inline

Constructor.

This function initializes object attributes.

Parameters

  [in] | inputFile | Parsed file name.

## Member Function Documentation

template<typename D >

void AstWalker::dispatch | ( | AstNode * | node | ) |
| protected

This function invoke the appropriate handler method for the node's token type..

This function call handle functions for AstNode, which is specified with node token. The template argument `D` specifies whether the top-down or bottom-up handler should be called, by passing either of the top_down or bottom_up typenames.

Parameters

  [in] | node | Node to handle.

Exceptions

  internal_error | Thrown if handle function return new node, which want replace given node, but given node is root.

See also
  void AstWalker::walk(AstNode * node)

void AstWalker::startWalk | ( | AstNode * | node | ) |
| virtual

This function walk the AstNode depth-first and invoke handler methods.

Parameters

  [in] | node | The root node of the tree to walk.

See also
  void AstWalker::dispatch(AstNode * node)
  void AstWalker::walk(AstNode * node)

void AstWalker::walk | ( | AstNode * | node | ) |
| protected virtual

This function walk the AstNode depth-first and invoke handler methods.

This function call for dispatch given node before and after calling walk function for node children.

Parameters

  [in] | node | The root node of the tree to walk.

See also
  void AstWalker::dispatch(AstNode * node)

The documentation for this class was generated from the following files:

- AstWalker.h
- AstWalker.cpp