21 "Expected an identifier here. Example: bitfield Name[4]"
34 ntokens += 1 + _parse_bitfield_body(
module, body, tkopen_braces + 1);
43 unsigned int ntokens = 0;
49 nerrors =
module->errors_count;
50 current = &
token[ntokens];
52 switch (current->
type) {
66 "Unexpected token inside a bitfield body. It should only have field lists with size specification. Example:\n"
67 " bitfield Opcode[4] {\n"
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.
#define ARR_TT(...)
Same as ARR_ARG() macro, but with the specific type token_type_t.
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_statement_bitfield(module_t *module, ast_node_t *parent, token_t *token)
Parse a bitfield statement adding it as a children on parent AST node.
unsigned int parse_advance(token_t *token, token_type_t *types, size_t ntypes)
Finds the next token TK_EOF or any of the specified types and then returns the number of tokens trave...
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.
unsigned int errors_count
Number of errors on errors list.
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 module module_t
Struct that represents a Mya module.
struct token token_t
Struct for a Mya token.