17 "Expected a size specifier after the %s name. Example: %s",
32 snprintf(message,
sizeof message - 1,
"Expected a close bracket here. Example: %s", example);
36 tkclose_bracket->
line,
39 "Expected a close bracket here. Example: bitfield Name[4]"
59 "Expected a bitfield identifier here. Example: Reg{1}"
71 "Expected a open braces after bitfield name. Examples:\n"
92 "Expected a close braces at end of field specification list. Examples:\n"
109 unsigned int ntokens = 0;
130 for (
int i = 0; i < ntypes; i++) {
131 if (
token[ntokens].type == types[i]) {
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.
const char * mya_keywords[]
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_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 parse_bitfield_spec(module_t *module, ast_node_t *parent, token_t *token)
Parse a bitfield specification in the format Bitfield { FIELD_LIST } or Bitfield { EXPRESSION }...
unsigned int parse_fieldlist_spec(module_t *module, ast_node_t *parent, token_t *token)
Parse a field list specification in the format field = EXPRESSION, ... adding it as a children on par...
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.
long long int value
Integer value of the token.
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.
enum token_type token_type_t
Enumeration of token types.
struct token token_t
Struct for a Mya token.