Namespace Synopsis::PTree

Namespaces Summary:
Kwd
Class templates Summary:
template <Token::Type t>
class KeywordT
references
source code
template <typename T>
class StatementT
references
source code
template <typename T>
class ExpressionT
references
source code
Classes Summary:
class Literal
references
source code
references
source code
class DupAtom
references
source code
references
source code
class Keyword
references
source code
references
source code
class Display
references
source code

The Display class provides an annotated view of the ptree, for debugging purposes

references
source code
references
source code
class Encoding
references
source code

An Encoding represents a mangled (type) name.

class Head
references
source code

Head is used to implement qmake()

class Brace
references
source code
class Block
references
source code
class ClassBody
references
source code
class Typedef
references
source code
references
source code
references
source code
references
source code
references
source code
references
source code
references
source code
references
source code
references
source code
references
source code
references
source code
references
source code
references
source code
references
source code
class Name
references
source code
references
source code
class ClassSpec
references
source code
class EnumSpec
references
source code
references
source code
references
source code
references
source code
references
source code
references
source code
references
source code
references
source code
references
source code
references
source code
references
source code
references
source code
references
source code
references
source code
references
source code
references
source code
references
source code
references
source code
references
source code
references
source code
references
source code
references
source code
class CondExpr
references
source code
class InfixExpr
references
source code
class PmExpr
references
source code
class CastExpr
references
source code
class UnaryExpr
references
source code
class ThrowExpr
references
source code
references
source code
references
source code
references
source code
references
source code
class NewExpr
references
source code
references
source code
class ArrayExpr
references
source code
references
source code
references
source code
references
source code
references
source code
references
source code
class ParenExpr
references
source code
references
source code
class Node
references
source code
class Iterator
references
source code
class Array
references
source code
class Atom
references
source code
class List
references
source code
references
source code
class Visitor
references
source code

The Visitor class is used to dynamically resolve type information about a given Node.

class Writer
references
source code
Function templates Summary:
template <typename N>
 N* nconc(N* p, Node* q)
references
source code
template <typename N>
 N* snoc(N* p, Node* q)
references
source code
Functions Summary:
inline void display(const Node* node, std::ostream& os, bool encoded = false, bool typeinfo = false)
source code

Display the given parse tree segment on the given output stream.

inline void generate_dot_file(const Node* node, std::ostream& os)
source code

Generate a dot file for the given parse tree segment.

inline bool operator<(const Encoding& e1, const Encoding& e2)
references
source code
inline std::ostream& operator<<(std::ostream& os, const Encoding& e)
source code
 bool reify(Node*, unsigned int&)
references
source code
 bool reify(Node*, const char*&)
references
source code
 bool match(Node*, const char*, ...)
references
source code
 Node* make(const char* pat, ...)
references
source code
references
source code
 Node* qmake(const char*)
references
source code
 bool operator==(const Node& p, char c)
references
source code
inline bool operator!=(const Node& p, char c)
references
source code
 bool operator==(const Node& p, const char* str)
references
source code
inline bool operator!=(const Node& p, const char* str)
references
source code
 bool operator==(const Node& p, const Node& q)
references
source code
inline bool operator!=(const Node& p, const Node& q)
references
source code
 bool equal(const Node& p, const char* str, size_t len)
references
source code
 bool equal(const Node* p, const Node* q)
references
source code
 bool equiv(const Node* p, const Node* q)
references
source code
 const Node* last(const Node*)
references
source code

Return the last cons cell.

 Node* last(Node*)
references
source code

Return the last cons cell.

inline const Node* first(const Node* p)
references
source code
inline Node* first(Node* p)
references
source code
inline const Node* rest(const Node* p)
references
source code
inline Node* rest(Node* p)
references
source code
inline const Node* nth(const Node* p, size_t n)
references
source code
inline Node* nth(Node* p, size_t n)
references
source code
inline const Node* tail(const Node* p, size_t k)
references
source code
inline Node* tail(Node* p, size_t k)
references
source code
 const Node* second(const Node*)
references
source code
references
source code
 const Node* third(const Node*)
references
source code
references
source code
 int length(const Node*)
references
source code
inline const Node* cadr(const Node* p)
references
source code
inline Node* cadr(Node* p)
references
source code
inline const Node* cddr(const Node* p)
references
source code
inline Node* cddr(Node* p)
references
source code
 const Node* ca_ar(const Node*)
references
source code

compute Caa..ar

references
source code
 Node* cons(Node*, Node*)
references
source code
 List* list()
references
source code
 List* list(Node*)
references
source code
 List* list(Node*, Node*)
references
source code
 List* list(Node*, Node*, Node*)
references
source code
 List* list(Node*, Node*, Node*, Node*)
references
source code
 List* list(Node*, Node*, Node*, Node*, Node*)
references
source code
 List* list(Node*, Node*, Node*, Node*, Node*, Node*)
references
source code
 List* list(Node*, Node*, Node*, Node*, Node*, Node*, Node*)
references
source code
 List* list(Node*, Node*, Node*, Node*, Node*, Node*, Node*, Node*)
references
source code
 Node* copy(Node*)
references
source code
references
source code
references
source code
 Node* subst(Node*, Node*, Node*)
references
source code
 Node* subst(Node*, Node*, Node*, Node*, Node*)
references
source code
 Node* subst(Node*, Node*, Node*, Node*, Node*, Node*, Node*)
references
source code
references
source code
references
source code
references
source code
references
source code
references
source code
references
source code
 Node* nconc(Node*, Node*, Node*)
references
source code
 Node* snoc(Node*, Node*)
references
source code
inline Token::Type type_of(const Node* node)
references
source code
inline bool is_a(const Node* node, Token::Type t)
source code
inline bool is_a(const Node* node, Token::Type t1, Token::Type t2)
source code
inline bool is_a(const Node* node, Token::Type t1, Token::Type t2, Token::Type t3)
source code
inline std::string reify(const Node* p)
references
source code
Classes Details:
class Display
references
source code

The Display class provides an annotated view of the ptree, for debugging purposes

class Encoding
references
source code

An Encoding represents a mangled (type) name. Here is a quick reference of the grammar:

  • b: boolean
  • c: char
  • w: wchar_t
  • i: int (signed, unsigned)
  • s: short (short int)
  • l: long (long int)
  • j: long long
  • f: float
  • d: double
  • r: long double
  • v: void
  • T: template class (e.g. Foo<int,char> ==> T[3]Foo[2]ic. [2] means the length of ic. It doesn't mean the number of template arguments.
  • e: ...
  • ?: no return type. the return type of constructors
  • *: non-type template parameter
  • S: signed
  • U: unsigned
  • C: const
  • V: volatile
  • P: pointer
  • R: reference
  • A: array (e.g. char[16] ==> A16_c)
  • F: function (e.g. char foo(int) ==> Fi_c)
  • M: pointer to member (e.g. Type::* ==> M[4]Type)
  • Q: qualified class (e.g. X::YY ==> Q[2][1]X[2]YY, ::YY ==> Q[2][0][2]YY)
  • [x]: means 0x80 + x
  • 0: means :: (global scope)

Special function names:

  • operator + ==> +
  • operator new[] ==> new[]
  • operator <type> ==> @<encoded type> cast operator
class Head
references
source code

Head is used to implement qmake()

class Visitor
references
source code

The Visitor class is used to dynamically resolve type information about a given Node. The default implementation does nothing, so you only need to implement the methods you actually need. Any types for which no corresponding 'visit' methods exist will be caught by the 'visit' of the closest parent.

Functions Details:
inline void display(const Node* node, std::ostream& os, bool encoded = false, bool typeinfo = false)
source code

Display the given parse tree segment on the given output stream. If 'encoded' is set to 'true', print encoded names / types on appropriate nodes. If 'typeinfo' is set to 'true', print the class names of the nodes.

inline void generate_dot_file(const Node* node, std::ostream& os)
source code

Generate a dot file for the given parse tree segment.

 const Node* last(const Node*)
references
source code

Return the last cons cell.

 Node* last(Node*)
references
source code

Return the last cons cell.

 const Node* ca_ar(const Node*)
references
source code

compute Caa..ar