feat(parser + ast): function parsing support
This commit is contained in:
parent
a63632005c
commit
132f4f3a53
5 changed files with 54 additions and 11 deletions
|
|
@ -23,7 +23,7 @@ struct ast *ast_create_function(char *name, struct ast *value)
|
|||
if (!function_data)
|
||||
return NULL;
|
||||
|
||||
function_data->name = strdup(name);
|
||||
function_data->name = name;
|
||||
function_data->value = value;
|
||||
|
||||
return ast_create(AST_FUNCTION, function_data);
|
||||
|
|
|
|||
|
|
@ -9,18 +9,19 @@ struct ast_function
|
|||
|
||||
|
||||
/**
|
||||
* Checks if the given AST node is an ast_function
|
||||
* @brief: Checks if the given AST node is an ast_function
|
||||
*/
|
||||
bool ast_is_function(struct ast *node);
|
||||
|
||||
/**
|
||||
* Retrieves the function data from the given AST node.
|
||||
* Assumes that the node is of type AST_function.
|
||||
* @brief: Retrieves the function data from the given AST node.
|
||||
* Assumes that the node is of type AST_function.
|
||||
*/
|
||||
struct ast_function *ast_get_function(struct ast *node);
|
||||
|
||||
/**
|
||||
* Creates a new AST node representing an AST_function
|
||||
* @brief: Creates a new AST node representing an AST_function
|
||||
* @warning: name must be already allocated.
|
||||
*/
|
||||
struct ast *ast_create_function(char *name, struct ast *value);
|
||||
/*
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue