Reduct  v1.0.4-3-gdaf0d70
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 "core.h"
5#include "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_CATCH` before calling this function.
19 *
20 * @param reduct The Reduct structure.
21 * @param str The Reduct string to parse, Reduct will take ownership of this string.
22 * @param len The length of the input string.
23 * @param path The path to the file being parsed (for error reporting).
24 * @return The root item of the parsed expression, will be retained by the GC.
25 */
26REDUCT_API reduct_handle_t reduct_parse(reduct_t* reduct, const char* str, reduct_size_t len, const char* path);
27
28/**
29 * @brief Parse a Reduct file.
30 *
31 * @warning The jump buffer must have been set using `REDUCT_CATCH` before calling this function.
32 *
33 * @param reduct The Reduct structure.
34 * @param path The path to the file to parse.
35 * @return The root item of the parsed expression, will be retained by the GC.
36 */
37REDUCT_API reduct_handle_t reduct_parse_file(reduct_t* reduct, const char* path);
38
39/** @} */
40
41#endif
Core definitions and structures.
size_t reduct_size_t
Definition defs.h:100
reduct_uint64_t reduct_handle_t
Handle type.
Definition defs.h:189
#define REDUCT_API
Definition defs.h:7
REDUCT_API reduct_handle_t reduct_parse_file(reduct_t *reduct, const char *path)
Parse a Reduct file.
Definition parse_impl.h:388
REDUCT_API reduct_handle_t reduct_parse(reduct_t *reduct, const char *str, reduct_size_t len, const char *path)
Parse a Reduct string.
Definition parse_impl.h:369
Handle management.
State structure.
Definition core.h:61