MysoreScript
Public Member Functions | Public Attributes | List of all members
Interpreter::Context Class Reference

#include <interpreter.hh>

Collaboration diagram for Interpreter::Context:
Collaboration graph
[legend]

Public Member Functions

void pushSymbols (SymbolTable &s)
 Push a new symbol table on top of the stack. More...
 
void popSymbols ()
 Pop the top symbol table off the stack. More...
 
ObjlookupSymbol (const std::string &name)
 Look up a symbol, walking up the symbol table stack until it's found. More...
 
void setSymbol (const std::string &name, Obj *val)
 Set the address where the variable corresponding to a particular symbol is stored. More...
 
void setSymbol (const std::string &name, Obj val)
 Set a symbol to the specified value. More...
 

Public Attributes

SymbolTable globalSymbols
 Global symbols. More...
 
Value retVal = nullptr
 The value currently being returned, if there is one. More...
 
bool isReturning = false
 Are we currently returning? More...
 

Detailed Description

Definition at line 104 of file interpreter.hh.

Member Function Documentation

§ lookupSymbol()

Obj * Interpreter::Context::lookupSymbol ( const std::string &  name)

Look up a symbol, walking up the symbol table stack until it's found.

Definition at line 321 of file interpreter.cc.

Here is the caller graph for this function:

§ popSymbols()

void Interpreter::Context::popSymbols ( )
inline

Pop the top symbol table off the stack.

Definition at line 140 of file interpreter.hh.

Here is the caller graph for this function:

§ pushSymbols()

void Interpreter::Context::pushSymbols ( SymbolTable s)
inline

Push a new symbol table on top of the stack.

Definition at line 136 of file interpreter.hh.

Here is the caller graph for this function:

§ setSymbol() [1/2]

void Interpreter::Context::setSymbol ( const std::string &  name,
Obj *  val 
)

Set the address where the variable corresponding to a particular symbol is stored.

Here is the caller graph for this function:

§ setSymbol() [2/2]

void Interpreter::Context::setSymbol ( const std::string &  name,
Obj  val 
)

Set a symbol to the specified value.

This will allocate global storage for the symbol if it is not already allocated.

Member Data Documentation

§ globalSymbols

SymbolTable Interpreter::Context::globalSymbols

Global symbols.

These all refer to values in the globals list.

Definition at line 121 of file interpreter.hh.

§ isReturning

bool Interpreter::Context::isReturning = false

Are we currently returning?

Definition at line 132 of file interpreter.hh.

§ retVal

Value Interpreter::Context::retVal = nullptr

The value currently being returned, if there is one.

When a return statement is interpreted, it sets this value and returns. We then don't interpret any more statements until we come to the end of the current function and return the value stored here.

Definition at line 128 of file interpreter.hh.


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