Hermes
Loading...
Searching...
No Matches
hermes::ParseTree Class Reference

The ParseTree represents a parsing tree (or derivation tree) generated by a parser. The tree consists in a hierarchy of nodes containing portions of the text identified by the parser rules. More...

#include <parsers.h>

Classes

struct  Node
 A node represents a element in the parsed string. More...
 

Public Types

enum class  NodeType { INPUT = 0 , TOKEN = 1 , BLOCK = 2 }
 Parse tree nodes can be of different types: More...
 

Public Member Functions

void iterate (const std::function< bool(const Node &)> &callback) const
 

Friends

class StringParser
 
std::ostream & operator<< (std::ostream &os, const ParseTree &parse_tree)
 Dumps all contant of the tree.
 

Detailed Description

The ParseTree represents a parsing tree (or derivation tree) generated by a parser. The tree consists in a hierarchy of nodes containing portions of the text identified by the parser rules.

Member Enumeration Documentation

◆ NodeType

Parse tree nodes can be of different types:

Note
INPUT: a piece of text which might contain other nodes
TOKEN: a single token (a word identified by the parser) \node BLOCK: a block of of text enclosed by block delimiters which might contain other nodes
Enumerator
INPUT 

a piece of text which might contain other nodes

TOKEN 

a single token (a word identified by the parser)

BLOCK 

a block of of text enclosed by block delimiters which might contain other nodes

Friends And Related Symbol Documentation

◆ operator<<

std::ostream & operator<< ( std::ostream &  os,
const ParseTree parse_tree 
)
friend

Dumps all contant of the tree.

Parameters
os
parse_tree
Returns

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