Toy 1.1.6
The Toy programming language is an imperative bytecode-intermediate embedded scripting language
Loading...
Searching...
No Matches
Data Structures | Typedefs | Functions
toy_scope.h File Reference

@???@ More...

#include <stdbool.h>
#include "toy_literal.h"
#include "toy_literal_array.h"
#include "toy_literal_dictionary.h"

Go to the source code of this file.

Data Structures

struct  Toy_Scope
 

Typedefs

typedef struct Toy_Scope Toy_Scope
 @???@
 

Functions

TOY_API Toy_Scope * Toy_pushScope (Toy_Scope *scope)
 Creates a new Toy_scope with scope as it's ancestor, and returns it.
 
TOY_API Toy_Scope * Toy_popScope (Toy_Scope *scope)
 Frees the given scope, and returns it's ancestor.
 
TOY_API Toy_Scope * Toy_copyScope (Toy_Scope *original)
 Copies an existing scope, and returns the copy.
 
TOY_API bool Toy_declareScopeVariable (Toy_Scope *scope, Toy_Literal key, Toy_Literal type)
 Declares a new variable key within scope, giving it the type of type. This function returns true on success, otherwise it returns failure (such as if the given key already exists).
 
TOY_API bool Toy_isDelcaredScopeVariable (Toy_Scope *scope, Toy_Literal key)
 Checks to see if a given variable with the name key has been previously declared.
 
TOY_API bool Toy_setScopeVariable (Toy_Scope *scope, Toy_Literal key, Toy_Literal value, bool constCheck)
 Sets an existing variable named key to the value of value. This function fails if constCheck is true and the given key's type has the constaant flag set. It also fails if the given key doesn't exist. Returns true on success, otherwise it returns false.
 
TOY_API bool Toy_getScopeVariable (Toy_Scope *scope, Toy_Literal key, Toy_Literal *value)
 Sets the literal pointed to by value to equal the variable named key. Returns true on success, otherwise it returns false.
 
TOY_API Toy_Literal Toy_getScopeType (Toy_Scope *scope, Toy_Literal key)
 Returns a new Toy_Literal representing the type of the variable named key.
 

Detailed Description

@???@

Typedef Documentation

◆ Toy_Scope

@???@

Function Documentation

◆ Toy_copyScope()

Toy_Scope * Toy_copyScope ( Toy_Scope *  original)

Copies an existing scope, and returns the copy.

Parameters
original
Returns

◆ Toy_declareScopeVariable()

bool Toy_declareScopeVariable ( Toy_Scope *  scope,
Toy_Literal  key,
Toy_Literal  type 
)

Declares a new variable key within scope, giving it the type of type. This function returns true on success, otherwise it returns failure (such as if the given key already exists).

Parameters
scope
key
type
Returns

◆ Toy_getScopeType()

Toy_Literal Toy_getScopeType ( Toy_Scope *  scope,
Toy_Literal  key 
)

Returns a new Toy_Literal representing the type of the variable named key.

Parameters
scope
key
Returns

◆ Toy_getScopeVariable()

bool Toy_getScopeVariable ( Toy_Scope *  scope,
Toy_Literal  key,
Toy_Literal *  value 
)

Sets the literal pointed to by value to equal the variable named key. Returns true on success, otherwise it returns false.

Parameters
scope
key
value
Returns

◆ Toy_isDelcaredScopeVariable()

bool Toy_isDelcaredScopeVariable ( Toy_Scope *  scope,
Toy_Literal  key 
)

Checks to see if a given variable with the name key has been previously declared.

Parameters
scope
key
Returns

◆ Toy_popScope()

Toy_Scope * Toy_popScope ( Toy_Scope *  scope)

Frees the given scope, and returns it's ancestor.

Parameters
scope
Returns

◆ Toy_pushScope()

Toy_Scope * Toy_pushScope ( Toy_Scope *  scope)

Creates a new Toy_scope with scope as it's ancestor, and returns it.

Parameters
scope
Returns

◆ Toy_setScopeVariable()

bool Toy_setScopeVariable ( Toy_Scope *  scope,
Toy_Literal  key,
Toy_Literal  value,
bool  constCheck 
)

Sets an existing variable named key to the value of value. This function fails if constCheck is true and the given key's type has the constaant flag set. It also fails if the given key doesn't exist. Returns true on success, otherwise it returns false.

Parameters
scope
key
value
constCheck
Returns