public

Inheritance Graph

graph BT
	FnCompileContext
	click FnCompileContext "classEScript_1_1FnCompileContext"

Description

Collection of “things” used during the compilation process of one user function function (or block of code without surrounding function).

Classes

   
struct EScript::FnCompileContext::SettingsStackEntry

Public Types

   
   
enum setting_t {VISIBLE_LOCAL_AND_STATIC_VARIABLES, BREAK_MARKER, CONTINUE_MARKER, EXCEPTION_MARKER}

Public Functions

   
   
  FnCompileContext( Compiler & _compiler, StaticData & sData, InstructionBlock & _instructions, const CodeFragment & _code)
   
  FnCompileContext( FnCompileContext & parentCtxt, InstructionBlock & _instructions, const CodeFragment & _code)
   
void addInstruction(const Instruction & newInstruction)
   
std::vector< size_t > collectLocalVariables( setting_t entryType)
Collect all variable indices on the settings stack until an entry with the given type is found.
   
void addExpression( EPtr < AST::ASTNode > expression)
   
void addStatement( EPtr < AST::ASTNode > stmt)
   
uint32_t createMarker()
   
StringId createOnceStatementMarker()
   
uint32_t declareString(const std::string & str)
   
const CodeFragment & getCode() const
   
Compiler & getCompiler() const
   
StaticData & getStaticData() const
   
int getCurrentLine() const
   
uint32_t getCurrentMarker( setting_t markerType) const
if the setting is not defined, Instruction::INVALID_JUMP_ADDRESS is returned.
   
varLocation_t getCurrentVarLocation(const StringId & name) const
   
std::string getInstructionsAsString() const
   
StringId getLocalVarName(const size_t index) const
   
size_t getNumLocalVars() const
   
std::string getStringConstant(const uint32_t index) const
   
bool getUsesStaticVars() const
   
void markAsUsingStaticVars()
   
void pushSetting_basicLocalVars()
Add the local variables which are already defined in the instructionBlock (e.g. ‘this’ or the parameters), to the set of visible variables.
   
void pushSetting_marker( setting_t type, const uint32_t marker)
   
void pushSetting_declaredVars(const declaredVariableMap_t & variables)
   
void popSetting()
   
uint32_t registerInternalFunction(const ObjPtr & userFunction)
   
void setLine(int l)
   
void pushLocalVarsCollector(std::vector< size_t > * collection)
All newly defined variables are also added to the topmost collection.
   
void popLocalVarsCollector()

Documentation

enum
EScript::FnCompileContext::setting_t

public
 
 
enum setting_t
Enumerator   Description
Enumerator   Description
VISIBLE_LOCAL_AND_STATIC_VARIABLES   the local variables declared in a Block
BREAK_MARKER    
CONTINUE_MARKER    
EXCEPTION_MARKER   the marker of the next variables declared in a Block

Defined in EScript/EScript/Compiler/FnCompileContext.h:38


function
EScript::FnCompileContext::FnCompileContext

public inline
     
     
FnCompileContext( Compiler & _compiler,
  StaticData & sData,
  InstructionBlock & _instructions,
  const CodeFragment & _code
)    

Defined in EScript/EScript/Compiler/FnCompileContext.h:69


function
EScript::FnCompileContext::FnCompileContext

public inline
     
     
FnCompileContext( FnCompileContext & parentCtxt,
  InstructionBlock & _instructions,
  const CodeFragment & _code
)    

Defined in EScript/EScript/Compiler/FnCompileContext.h:74


function
EScript::FnCompileContext::addInstruction

public inline
     
     
void addInstruction( const Instruction & newInstruction )

Defined in EScript/EScript/Compiler/FnCompileContext.h:79


function
EScript::FnCompileContext::collectLocalVariables

public
     
     
std::vector< size_t > collectLocalVariables( setting_t entryType )

Collect all variable indices on the settings stack until an entry with the given type is found.

Defined in EScript/EScript/Compiler/FnCompileContext.h:83


function
EScript::FnCompileContext::addExpression

public
     
     
void addExpression( EPtr < AST::ASTNode > expression )

Defined in EScript/EScript/Compiler/FnCompileContext.h:85


function
EScript::FnCompileContext::addStatement

public
     
     
void addStatement( EPtr < AST::ASTNode > stmt )

Defined in EScript/EScript/Compiler/FnCompileContext.h:86


function
EScript::FnCompileContext::createMarker

public inline
   
   
uint32_t createMarker( )

Defined in EScript/EScript/Compiler/FnCompileContext.h:88


function
EScript::FnCompileContext::createOnceStatementMarker

public
   
   
StringId createOnceStatementMarker( )

Defined in EScript/EScript/Compiler/FnCompileContext.h:89


function
EScript::FnCompileContext::declareString

public inline
     
     
uint32_t declareString( const std::string & str )

Defined in EScript/EScript/Compiler/FnCompileContext.h:90


function
EScript::FnCompileContext::getCode

public const inline
   
   
const CodeFragment & getCode( ) const

Defined in EScript/EScript/Compiler/FnCompileContext.h:92


function
EScript::FnCompileContext::getCompiler

public const inline
   
   
Compiler & getCompiler( ) const

Defined in EScript/EScript/Compiler/FnCompileContext.h:93


function
EScript::FnCompileContext::getStaticData

public const inline
   
   
StaticData & getStaticData( ) const

Defined in EScript/EScript/Compiler/FnCompileContext.h:94


function
EScript::FnCompileContext::getCurrentLine

public const inline
   
   
int getCurrentLine( ) const

Defined in EScript/EScript/Compiler/FnCompileContext.h:95


function
EScript::FnCompileContext::getCurrentMarker

public const
     
     
uint32_t getCurrentMarker( setting_t markerType ) const

if the setting is not defined, Instruction::INVALID_JUMP_ADDRESS is returned.

Defined in EScript/EScript/Compiler/FnCompileContext.h:97


function
EScript::FnCompileContext::getCurrentVarLocation

public const
     
     
varLocation_t getCurrentVarLocation( const StringId & name ) const

Defined in EScript/EScript/Compiler/FnCompileContext.h:99


function
EScript::FnCompileContext::getInstructionsAsString

public const inline
   
   
std::string getInstructionsAsString( ) const

Defined in EScript/EScript/Compiler/FnCompileContext.h:101


function
EScript::FnCompileContext::getLocalVarName

public const inline
     
     
StringId getLocalVarName( const size_t index ) const

Defined in EScript/EScript/Compiler/FnCompileContext.h:102


function
EScript::FnCompileContext::getNumLocalVars

public const inline
   
   
size_t getNumLocalVars( ) const

Defined in EScript/EScript/Compiler/FnCompileContext.h:104


function
EScript::FnCompileContext::getStringConstant

public const inline
     
     
std::string getStringConstant( const uint32_t index ) const

Defined in EScript/EScript/Compiler/FnCompileContext.h:105


function
EScript::FnCompileContext::getUsesStaticVars

public const inline
   
   
bool getUsesStaticVars( ) const

Defined in EScript/EScript/Compiler/FnCompileContext.h:106


function
EScript::FnCompileContext::markAsUsingStaticVars

public inline
   
   
void markAsUsingStaticVars( )

Defined in EScript/EScript/Compiler/FnCompileContext.h:108


function
EScript::FnCompileContext::pushSetting_basicLocalVars

public
   
   
void pushSetting_basicLocalVars( )

Add the local variables which are already defined in the instructionBlock (e.g. ‘this’ or the parameters), to the set of visible variables.

Defined in EScript/EScript/Compiler/FnCompileContext.h:111


function
EScript::FnCompileContext::pushSetting_marker

public inline
     
     
void pushSetting_marker( setting_t type,
  const uint32_t marker
)    

Defined in EScript/EScript/Compiler/FnCompileContext.h:113


function
EScript::FnCompileContext::pushSetting_declaredVars

public
     
     
void pushSetting_declaredVars( const declaredVariableMap_t & variables )

Defined in EScript/EScript/Compiler/FnCompileContext.h:115


function
EScript::FnCompileContext::popSetting

public inline
   
   
void popSetting( )

Defined in EScript/EScript/Compiler/FnCompileContext.h:116


function
EScript::FnCompileContext::registerInternalFunction

public inline
     
     
uint32_t registerInternalFunction( const ObjPtr & userFunction )

Defined in EScript/EScript/Compiler/FnCompileContext.h:118


function
EScript::FnCompileContext::setLine

public inline
     
     
void setLine( int l )

Defined in EScript/EScript/Compiler/FnCompileContext.h:119


function
EScript::FnCompileContext::pushLocalVarsCollector

public inline
     
     
void pushLocalVarsCollector( std::vector< size_t > * collection )

All newly defined variables are also added to the topmost collection.

Defined in EScript/EScript/Compiler/FnCompileContext.h:122


function
EScript::FnCompileContext::popLocalVarsCollector

public inline
   
   
void popLocalVarsCollector( )

Defined in EScript/EScript/Compiler/FnCompileContext.h:123