#include "ast.h"
#include "module.h"
#include "parser.h"
Go to the source code of this file.
◆ parse_statement_set()
Parse a set statement adding it as a children on parent
AST node.
- Parameters
-
module | The module where the AST is. |
parent | The AST node parent for the statement. |
token | The token where to start parsing the statement. |
- Returns
- The number of tokens used on the statement.
Definition at line 6 of file parse_statement_set.c.
7{
12
19 "Expected an identifier here. Example: set NAME = value;"
20 );
21
22 return 1;
23 }
24
31 "Expected an equal operator here. Example: set NAME = value;"
32 );
33 }
34
37
38 return 3;
39}
ast_node_t * ast_add_children(ast_node_t *parent, node_type_t type, token_t *token)
Add a new children for the given AST node.
void module_add_error(module_t *module, unsigned int line, unsigned int column, unsigned int length, const char *message)
Add error for the given module.
unsigned int parse_expression(module_t *module, ast_node_t *parent, token_t *token)
Parse a mathematical expression adding it as a children on parent AST node.
unsigned int length
The length of the string.
Struct that represents a Mya module.
token_type_t type
Token type.
dstring_t lexeme
Lexeme of the token.
unsigned int line
Token line inside the module.
unsigned int column
Column of the token position on the line.
struct ast_node ast_node_t
struct token token_t
Struct for a Mya token.