|
Reduct
v1.0.4-3-gdaf0d70
A functional and immutable language.
|
Data Structures | |
| struct | reduct_error_t |
| Error structure. More... | |
Macros | |
| #define | REDUCT_ERROR_MAX_LEN 512 |
| Maximum length of an error string. | |
| #define | REDUCT_ERROR() ((reduct_error_t){0}) |
| Create a Reduct error structure. | |
| #define | REDUCT_ERROR_CATCH(_error) (REDUCT_SETJMP((_error)->jmp)) |
| Catch an error using the jump buffer in the error structure. | |
| #define | REDUCT_ERROR_THROW(_error, _item, _type, ...) |
| Throw an error using the jump buffer in the error structure. | |
| #define | REDUCT_ERROR_SYNTAX(_error, _input, _ptr, ...) |
| Throw a syntax error using the jump buffer in the error structure. | |
| #define | REDUCT_ERROR_COMPILE(_compiler, _item, ...) |
| Throw a compile error using the jump buffer in the error structure. | |
| #define | REDUCT_ERROR_RUNTIME(_reduct, ...) reduct_error_throw_runtime((_reduct), __VA_ARGS__) |
| Throw a runtime error using the jump buffer in the error structure. | |
| #define | REDUCT_ERROR_INTERNAL(_reduct, ...) REDUCT_ERROR_THROW((_reduct)->error, REDUCT_NULL, INTERNAL, __VA_ARGS__) |
| Throw an internal error using the jump buffer in the error structure. | |
| #define | REDUCT_ERROR_CHECK_TYPE(_reduct, _name, _handle, _expected) |
| Report a type error for a handle. | |
| #define | REDUCT_ERROR_CHECK_LIST(_reduct, _handle, _name) |
| Assert that a handle is a list. | |
| #define | REDUCT_ERROR_CHECK_CALLABLE(_reduct, _handle, _name) |
| Assert that a handle is a callable. | |
| #define | REDUCT_ERROR_CHECK_SEQUENCE(_reduct, _handle, _name) |
| Assert that a handle is a sequence (list or atom). | |
Enumerations | |
| enum | reduct_error_type_t { REDUCT_ERROR_TYPE_NONE , REDUCT_ERROR_TYPE_SYNTAX , REDUCT_ERROR_TYPE_COMPILE , REDUCT_ERROR_TYPE_RUNTIME , REDUCT_ERROR_TYPE_INTERNAL } |
| Error type enumeration. More... | |
Functions | |
| REDUCT_API void | reduct_error_print (reduct_error_t *error, reduct_file_t file) |
| Format and print the error to a file. | |
| REDUCT_API void | reduct_error_get_row_column (reduct_error_t *error, reduct_size_t *row, reduct_size_t *column) |
| Get the row and column by traversing the input buffer. | |
| REDUCT_API void | reduct_error_set (reduct_error_t *error, const char *path, const char *input, reduct_size_t inputLength, reduct_size_t regionLength, reduct_size_t position, reduct_error_type_t type, const char *message,...) |
| Set the error information in the error structure. | |
| REDUCT_API void | reduct_error_get_item_params (struct reduct_item *item, const char **path, const char **input, reduct_size_t *inputLength, reduct_size_t *regionLength, reduct_size_t *position) |
| Get the error parameters from a Reduct item. | |
| REDUCT_API REDUCT_NORETURN void | reduct_error_throw_runtime (struct reduct *reduct, const char *message,...) |
| Throw a runtime error utilizing the evaluation state to determine the context. | |
| REDUCT_API void | reduct_error_check_arity (struct reduct *reduct, reduct_size_t argc, reduct_size_t expected, const char *name) |
| Check the arity of a native function call. | |
| REDUCT_API void | reduct_error_check_min_arity (struct reduct *reduct, reduct_size_t argc, reduct_size_t min, const char *name) |
| REDUCT_API void | reduct_error_check_arity_range (struct reduct *reduct, reduct_size_t argc, reduct_size_t min, reduct_size_t max, const char *name) |
| #define REDUCT_ERROR_MAX_LEN 512 |
| #define REDUCT_ERROR | ( | ) | ((reduct_error_t){0}) |
| #define REDUCT_ERROR_CATCH | ( | _error | ) | (REDUCT_SETJMP((_error)->jmp)) |
| #define REDUCT_ERROR_THROW | ( | _error, | |
| _item, | |||
| _type, | |||
| ... | |||
| ) |
Throw an error using the jump buffer in the error structure.
| _error | Pointer to the error structure. |
| _item | Pointer to the item that caused the error. |
| _type | The suffix of the error type (e.g., INTERNAL, RUNTIME, etc.). |
| ... | The error message format string and any optional arguments. |
| #define REDUCT_ERROR_SYNTAX | ( | _error, | |
| _input, | |||
| _ptr, | |||
| ... | |||
| ) |
Throw a syntax error using the jump buffer in the error structure.
| _error | Pointer to the error structure. |
| _input | Pointer to the input structure being parsed. |
| _ptr | Pointer to the current position in the input buffer. |
| ... | The error message format string and any optional arguments. |
| #define REDUCT_ERROR_COMPILE | ( | _compiler, | |
| _item, | |||
| ... | |||
| ) |
Throw a compile error using the jump buffer in the error structure.
| _compiler | The compiler instance. |
| _item | Pointer to the item that caused the error. |
| ... | The error message format string and any optional arguments. |
| #define REDUCT_ERROR_RUNTIME | ( | _reduct, | |
| ... | |||
| ) | reduct_error_throw_runtime((_reduct), __VA_ARGS__) |
| #define REDUCT_ERROR_INTERNAL | ( | _reduct, | |
| ... | |||
| ) | REDUCT_ERROR_THROW((_reduct)->error, REDUCT_NULL, INTERNAL, __VA_ARGS__) |
| #define REDUCT_ERROR_CHECK_TYPE | ( | _reduct, | |
| _name, | |||
| _handle, | |||
| _expected | |||
| ) |
Report a type error for a handle.
| #define REDUCT_ERROR_CHECK_LIST | ( | _reduct, | |
| _handle, | |||
| _name | |||
| ) |
Assert that a handle is a list.
| #define REDUCT_ERROR_CHECK_CALLABLE | ( | _reduct, | |
| _handle, | |||
| _name | |||
| ) |
Assert that a handle is a callable.
| #define REDUCT_ERROR_CHECK_SEQUENCE | ( | _reduct, | |
| _handle, | |||
| _name | |||
| ) |
Assert that a handle is a sequence (list or atom).
| enum reduct_error_type_t |
| REDUCT_API void reduct_error_print | ( | reduct_error_t * | error, |
| reduct_file_t | file | ||
| ) |
Format and print the error to a file.
| error | Pointer to the error structure. |
| file | The file to print to. |
Definition at line 99 of file error_impl.h.
| REDUCT_API void reduct_error_get_row_column | ( | reduct_error_t * | error, |
| reduct_size_t * | row, | ||
| reduct_size_t * | column | ||
| ) |
Get the row and column by traversing the input buffer.
| error | Pointer to the error structure. |
| row | Pointer to the row variable. |
| column | Pointer to the column variable. |
Definition at line 153 of file error_impl.h.
| REDUCT_API void reduct_error_set | ( | reduct_error_t * | error, |
| const char * | path, | ||
| const char * | input, | ||
| reduct_size_t | inputLength, | ||
| reduct_size_t | regionLength, | ||
| reduct_size_t | position, | ||
| reduct_error_type_t | type, | ||
| const char * | message, | ||
| ... | |||
| ) |
Set the error information in the error structure.
| error | Pointer to the error structure. |
| path | The path to the file where the error occurred. |
| input | The input buffer where the error occurred. |
| inputLength | The total length of the input buffer. |
| regionLength | The length of the token/region that caused the error. |
| position | The position in the input buffer where the error occurred. |
| type | The type of the error. |
| message | The error message format string. |
| ... | The arguments for the format string. |
Definition at line 181 of file error_impl.h.
| REDUCT_API void reduct_error_get_item_params | ( | struct reduct_item * | item, |
| const char ** | path, | ||
| const char ** | input, | ||
| reduct_size_t * | inputLength, | ||
| reduct_size_t * | regionLength, | ||
| reduct_size_t * | position | ||
| ) |
Get the error parameters from a Reduct item.
| item | Pointer to the item. |
| path | Pointer to the path variable. |
| input | Pointer to the input variable. |
| inputLength | Pointer to the input length variable. |
| regionLength | Pointer to the region length variable. |
| position | Pointer to the position variable. |
Definition at line 200 of file error_impl.h.
| REDUCT_API REDUCT_NORETURN void reduct_error_throw_runtime | ( | struct reduct * | reduct, |
| const char * | message, | ||
| ... | |||
| ) |
Throw a runtime error utilizing the evaluation state to determine the context.
| reduct | Pointer to the Reduct instance. |
| message | The error message format string. |
| ... | Additional arguments. |
Definition at line 226 of file error_impl.h.
| REDUCT_API void reduct_error_check_arity | ( | struct reduct * | reduct, |
| reduct_size_t | argc, | ||
| reduct_size_t | expected, | ||
| const char * | name | ||
| ) |
Check the arity of a native function call.
| REDUCT_API void reduct_error_check_min_arity | ( | struct reduct * | reduct, |
| reduct_size_t | argc, | ||
| reduct_size_t | min, | ||
| const char * | name | ||
| ) |
| REDUCT_API void reduct_error_check_arity_range | ( | struct reduct * | reduct, |
| reduct_size_t | argc, | ||
| reduct_size_t | min, | ||
| reduct_size_t | max, | ||
| const char * | name | ||
| ) |