15{
18
25 "Expected an identifier here. Example: inst mov[16](arg1: register[32], arg2: immediate[8]) { ... }"
26 );
27
28 return 1;
29 }
30
32 unsigned int ntokens =
33 2 +
35
37
44 "Expected a list of arguments for the instruction inside parentheses. Example: inst mov[16](arg1: register[32], "
45 "arg2: immediate[8]) { ... }"
46 );
47
48 return ntokens + 1;
49 }
50
51 ntokens += _parse_inst_args(
module, node_statement, tkopen_parens);
52
60 "Expected an open braces at start of the body of the instruction. Example: inst mov[16](arg1: register[32], "
61 "arg2: immediate[8]) { ... }"
62 );
63
64 return ntokens;
65 }
66
68
69 return ntokens;
70}
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 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 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.