#include "ast.h"
#include "macro_utils.h"
#include "module.h"
#include "parser.h"
Go to the source code of this file.
◆ parse_statement_bitfield()
Parse a bitfield 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 10 of file parse_statement_bitfield.c.
11{
14
21 "Expected an identifier here. Example: bitfield Name[4]"
22 );
23
24 return 1;
25 }
26
29
31
34 ntokens += 1 + _parse_bitfield_body(
module, body, tkopen_braces + 1);
35 }
36
37 return ntokens;
38}
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_size_spec(module_t *module, ast_node_t *parent, token_t *token, const char *example)
Parse a size specification in the format [ 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.