Loading...
Searching...
No Matches
ledger::expr_t::op_t Class Reference

#include <op.h>

Inherits boost::noncopyable.

Classes

struct  context_t
 

Public Types

enum  kind_t {
  PLUG , VALUE , IDENT , CONSTANTS ,
  FUNCTION , SCOPE , TERMINALS , O_NOT ,
  O_NEG , UNARY_OPERATORS , O_EQ , O_LT ,
  O_LTE , O_GT , O_GTE , O_AND ,
  O_OR , O_ADD , O_SUB , O_MUL ,
  O_DIV , O_QUERY , O_COLON , O_CONS ,
  O_SEQ , O_DEFINE , O_LOOKUP , O_LAMBDA ,
  O_CALL , O_MATCH , BINARY_OPERATORS , OPERATORS ,
  UNKNOWN , LAST
}
 
typedef expr_t::ptr_op_t ptr_op_t
 

Public Member Functions

const expr_t::func_tas_function () const
 
expr_t::func_tas_function_lval ()
 
const stringas_ident () const
 
stringas_ident_lval ()
 
const ptr_op_tas_op () const
 
ptr_op_tas_op_lval ()
 
const shared_ptr< scope_tas_scope () const
 
shared_ptr< scope_tas_scope_lval ()
 
const value_tas_value () const
 
value_tas_value_lval ()
 
value_t calc (scope_t &scope, ptr_op_t *locus=NULL, const int depth=0)
 
value_t call (const value_t &args, scope_t &scope, ptr_op_t *locus=NULL, const int depth=0)
 
ptr_op_t compile (scope_t &scope, const int depth=0, scope_t *param_scope=NULL)
 
void dump (std::ostream &out, const int depth=0) const
 
bool has_right () const
 
bool is_function () const
 
bool is_ident () const
 
bool is_scope () const
 
bool is_scope_unset () const
 
bool is_value () const
 
ptr_op_tleft ()
 
const ptr_op_tleft () const
 
 op_t ()
 
 op_t (const kind_t _kind)
 
bool print (std::ostream &out, const context_t &context=context_t()) const
 
ptr_op_tright ()
 
const ptr_op_tright () const
 
void set_function (const expr_t::func_t &val)
 
void set_ident (const string &val)
 
void set_left (const ptr_op_t &expr)
 
void set_right (const ptr_op_t &expr)
 
void set_scope (shared_ptr< scope_t > val)
 
void set_value (const value_t &val)
 
 ~op_t ()
 

Static Public Member Functions

static ptr_op_t new_node (kind_t _kind, ptr_op_t _left=NULL, ptr_op_t _right=NULL)
 
static ptr_op_t wrap_functor (expr_t::func_t fobj)
 
static ptr_op_t wrap_scope (shared_ptr< scope_t > sobj)
 
static ptr_op_t wrap_value (const value_t &val)
 

Public Attributes

kind_t kind
 

Friends

class expr_t
 
class expr_t::parser_t
 
void intrusive_ptr_add_ref (const op_t *op)
 
void intrusive_ptr_release (const op_t *op)
 

Detailed Description

Definition at line 50 of file op.h.

Member Typedef Documentation

◆ ptr_op_t

Member Enumeration Documentation

◆ kind_t

Enumerator
PLUG 
VALUE 
IDENT 
CONSTANTS 
FUNCTION 
SCOPE 
TERMINALS 
O_NOT 
O_NEG 
UNARY_OPERATORS 
O_EQ 
O_LT 
O_LTE 
O_GT 
O_GTE 
O_AND 
O_OR 
O_ADD 
O_SUB 
O_MUL 
O_DIV 
O_QUERY 
O_COLON 
O_CONS 
O_SEQ 
O_DEFINE 
O_LOOKUP 
O_LAMBDA 
O_CALL 
O_MATCH 
BINARY_OPERATORS 
OPERATORS 
UNKNOWN 
LAST 

Definition at line 71 of file op.h.

Constructor & Destructor Documentation

◆ op_t() [1/2]

ledger::expr_t::op_t::op_t ( )
inlineexplicit

Definition at line 127 of file op.h.

References TRACE_CTOR.

Referenced by new_node().

+ Here is the caller graph for this function:

◆ op_t() [2/2]

ledger::expr_t::op_t::op_t ( const kind_t _kind)
inlineexplicit

Definition at line 130 of file op.h.

References TRACE_CTOR.

◆ ~op_t()

ledger::expr_t::op_t::~op_t ( )
inline

Definition at line 133 of file op.h.

References assert, and TRACE_DTOR.

Member Function Documentation

◆ as_function()

const expr_t::func_t & ledger::expr_t::op_t::as_function ( ) const
inline

Definition at line 184 of file op.h.

References as_function_lval().

+ Here is the call graph for this function:

◆ as_function_lval()

expr_t::func_t & ledger::expr_t::op_t::as_function_lval ( )
inline

Definition at line 180 of file op.h.

References assert, and is_function().

Referenced by as_function().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ as_ident()

const string & ledger::expr_t::op_t::as_ident ( ) const
inline

Definition at line 170 of file op.h.

References as_ident_lval().

+ Here is the call graph for this function:

◆ as_ident_lval()

string & ledger::expr_t::op_t::as_ident_lval ( )
inline

Definition at line 166 of file op.h.

References assert, and is_ident().

Referenced by as_ident().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ as_op()

const ptr_op_t & ledger::expr_t::op_t::as_op ( ) const
inline

Definition at line 228 of file op.h.

References as_op_lval().

Referenced by has_right(), and right().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ as_op_lval()

ptr_op_t & ledger::expr_t::op_t::as_op_lval ( )
inline

Definition at line 224 of file op.h.

References assert, is_ident(), kind, and TERMINALS.

Referenced by as_op(), and right().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ as_scope()

const shared_ptr< scope_t > ledger::expr_t::op_t::as_scope ( ) const
inline

Definition at line 201 of file op.h.

References as_scope_lval().

+ Here is the call graph for this function:

◆ as_scope_lval()

shared_ptr< scope_t > ledger::expr_t::op_t::as_scope_lval ( )
inline

Definition at line 197 of file op.h.

References assert, and is_scope().

Referenced by as_scope().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ as_value()

const value_t & ledger::expr_t::op_t::as_value ( ) const
inline

Definition at line 151 of file op.h.

References as_value_lval().

+ Here is the call graph for this function:

◆ as_value_lval()

value_t & ledger::expr_t::op_t::as_value_lval ( )
inline

Definition at line 145 of file op.h.

References assert, ledger::downcast(), is_value(), and VERIFY.

Referenced by as_value().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ calc()

value_t ledger::expr_t::op_t::calc ( scope_t & scope,
ptr_op_t * locus = NULL,
const int depth = 0 )

◆ call()

value_t ledger::expr_t::op_t::call ( const value_t & args,
scope_t & scope,
ptr_op_t * locus = NULL,
const int depth = 0 )

◆ compile()

ptr_op_t ledger::expr_t::op_t::compile ( scope_t & scope,
const int depth = 0,
scope_t * param_scope = NULL )

◆ dump()

void ledger::expr_t::op_t::dump ( std::ostream & out,
const int depth = 0 ) const

◆ has_right()

bool ledger::expr_t::op_t::has_right ( ) const
inline

Definition at line 244 of file op.h.

References as_op(), kind, and TERMINALS.

+ Here is the call graph for this function:

◆ is_function()

bool ledger::expr_t::op_t::is_function ( ) const
inline

Definition at line 177 of file op.h.

References FUNCTION, and kind.

Referenced by as_function_lval().

+ Here is the caller graph for this function:

◆ is_ident()

bool ledger::expr_t::op_t::is_ident ( ) const
inline

Definition at line 159 of file op.h.

References assert, IDENT, and kind.

Referenced by as_ident_lval(), and as_op_lval().

+ Here is the caller graph for this function:

◆ is_scope()

bool ledger::expr_t::op_t::is_scope ( ) const
inline

Definition at line 191 of file op.h.

References kind, and SCOPE.

Referenced by as_scope_lval(), left(), left(), and set_left().

+ Here is the caller graph for this function:

◆ is_scope_unset()

bool ledger::expr_t::op_t::is_scope_unset ( ) const
inline

Definition at line 194 of file op.h.

◆ is_value()

bool ledger::expr_t::op_t::is_value ( ) const
inline

Definition at line 138 of file op.h.

References assert, kind, and VALUE.

Referenced by as_value_lval().

+ Here is the caller graph for this function:

◆ left() [1/2]

ptr_op_t & ledger::expr_t::op_t::left ( )
inline

Definition at line 211 of file op.h.

References assert, IDENT, is_scope(), kind, and TERMINALS.

+ Here is the call graph for this function:

◆ left() [2/2]

const ptr_op_t & ledger::expr_t::op_t::left ( ) const
inline

Definition at line 215 of file op.h.

References assert, IDENT, is_scope(), kind, and TERMINALS.

+ Here is the call graph for this function:

◆ new_node()

expr_t::ptr_op_t ledger::expr_t::op_t::new_node ( kind_t _kind,
ptr_op_t _left = NULL,
ptr_op_t _right = NULL )
inlinestatic

Definition at line 321 of file op.h.

References ledger::downcast(), and op_t().

+ Here is the call graph for this function:

◆ print()

bool ledger::expr_t::op_t::print ( std::ostream & out,
const context_t & context = context_t() ) const

◆ right() [1/2]

ptr_op_t & ledger::expr_t::op_t::right ( )
inline

Definition at line 232 of file op.h.

References as_op_lval(), assert, kind, and TERMINALS.

+ Here is the call graph for this function:

◆ right() [2/2]

const ptr_op_t & ledger::expr_t::op_t::right ( ) const
inline

Definition at line 236 of file op.h.

References as_op(), assert, kind, and TERMINALS.

+ Here is the call graph for this function:

◆ set_function()

void ledger::expr_t::op_t::set_function ( const expr_t::func_t & val)
inline

Definition at line 187 of file op.h.

References ledger::downcast().

+ Here is the call graph for this function:

◆ set_ident()

void ledger::expr_t::op_t::set_ident ( const string & val)
inline

Definition at line 173 of file op.h.

References ledger::downcast().

+ Here is the call graph for this function:

◆ set_left()

void ledger::expr_t::op_t::set_left ( const ptr_op_t & expr)
inline

Definition at line 219 of file op.h.

References assert, IDENT, is_scope(), kind, and TERMINALS.

+ Here is the call graph for this function:

◆ set_right()

void ledger::expr_t::op_t::set_right ( const ptr_op_t & expr)
inline

Definition at line 240 of file op.h.

References assert, kind, and TERMINALS.

◆ set_scope()

void ledger::expr_t::op_t::set_scope ( shared_ptr< scope_t > val)
inline

Definition at line 204 of file op.h.

References ledger::downcast().

+ Here is the call graph for this function:

◆ set_value()

void ledger::expr_t::op_t::set_value ( const value_t & val)
inline

Definition at line 154 of file op.h.

References ledger::downcast(), and VERIFY.

+ Here is the call graph for this function:

◆ wrap_functor()

expr_t::ptr_op_t ledger::expr_t::op_t::wrap_functor ( expr_t::func_t fobj)
inlinestatic

Definition at line 336 of file op.h.

References ledger::downcast(), and FUNCTION.

+ Here is the call graph for this function:

◆ wrap_scope()

static ptr_op_t ledger::expr_t::op_t::wrap_scope ( shared_ptr< scope_t > sobj)
static

◆ wrap_value()

expr_t::ptr_op_t ledger::expr_t::op_t::wrap_value ( const value_t & val)
inlinestatic

Definition at line 329 of file op.h.

References ledger::downcast(), and VALUE.

+ Here is the call graph for this function:

Friends And Related Symbol Documentation

◆ expr_t

Definition at line 52 of file op.h.

◆ expr_t::parser_t

Definition at line 53 of file op.h.

◆ intrusive_ptr_add_ref

void intrusive_ptr_add_ref ( const op_t * op)
friend

◆ intrusive_ptr_release

void intrusive_ptr_release ( const op_t * op)
friend

Member Data Documentation

◆ kind

kind_t ledger::expr_t::op_t::kind

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