Reduct  v4.0.5-1-g4851deb
A functional and immutable language.
Loading...
Searching...
No Matches
parse.h
Go to the documentation of this file.
1#ifndef REDUCT_PARSE_H
2#define REDUCT_PARSE_H 1
3
4#include <reduct/core.h>
5#include <reduct/handle.h>
6
7/**
8 * @file parse.h
9 * @brief Parser.
10 * @defgroup parse Parse
11 *
12 * @{
13 */
14
15/**
16 * @brief Parse a Reduct string.
17 *
18 * @warning The jump buffer must have been set using `REDUCT_ERROR_CATCH` before calling this function.
19 *
20 * @param reduct Pointer to the Reduct structure.
21 * @param str The Reduct string to parse. The caller is responsible for the memory of this string, it must not be freed
22 * for the lifetime of the parsed items.
23 * @param len The length of the input string.
24 * @param path The path to the file being parsed (for error reporting).
25 * @return The root item of the parsed expression, will be retained by the GC.
26 */
27REDUCT_API reduct_handle_t reduct_parse(reduct_t* reduct, const char* str, size_t len, const char* path);
28
29/**
30 * @brief Parse a Reduct file.
31 *
32 * @warning The jump buffer must have been set using `REDUCT_ERROR_CATCH` before calling this function.
33 *
34 * @param reduct Pointer to the Reduct structure.
35 * @param path The path to the file to parse.
36 * @return The root item of the parsed expression, will be retained by the GC.
37 */
39
40/** @} */
41
42#endif
Core definitions and structures.
#define REDUCT_API
Definition defs.h:24
REDUCT_API reduct_handle_t reduct_parse_file(reduct_t *reduct, const char *path)
Parse a Reduct file.
REDUCT_API reduct_handle_t reduct_parse(reduct_t *reduct, const char *str, size_t len, const char *path)
Parse a Reduct string.
Handle management.
Handle type.
Definition defs.h:119
Per-thread state structure.
Definition core.h:133