Constructs a new Context.
Constructs a global context
Attempt to declare and assign a new variable in the current context. Returns false if it already exists.
Forces the removal of a const or variable in the current context.
Force sets a variable or const no matter if the variable was declared already or is const. This is used by the host application to set globals or locals.
climb context stack until finding one without a parent
inserts a label into the list of valid labels
Retrieves the interpreter object from the top level context
checks context stack for a label
Attempts to look up existing variable or const throughout the stack. If found, returns a pointer to the variable location, and if it is const, sets isConst to true. Note, this pointer should not be stored by native functions because the variable table may be modified between function calls.
returns the name property of the Context
returns the parent property
Attempts to reassign a variable anywhere in the stack and returns a pointer to the variable or null if the variable doesn't exist or is const. If the failure is due to const, failedBecauseConst is set to true. Note: this pointer should not be stored by native functions due to modifications to the variable table that may invalidate it and result in undefined behavior.
removes a label from the existing context
Returns a string representing the type and name
Removes a variable from anywhere on the Context stack it is located. This function cannot be used to unset consts.
Searches the entire Context stack for a variable starting with the current context and climbing the parent chain.
Holds the variables and consts of a script stack frame. The global context can be accessed by climbing the Context.parent chain until reaching the Context whose parent is null. This allows native functions to define local and global variables. Note that calling a native function does not create a stack frame so one could write a native function that adds local variables to the stack frame where it was called.