17 token = &
module->tokens[tk_index];
22 "Parsing statement: %s at %s:%d:%d.\n",
40 "Unexpected token here. It's expected to be a valid statement keyword."
#define DPRINTF2(fmt,...)
enum error_code error_code_t
Enumeration of error codes.
#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.
error_code_t mya_parser(module_t *module)
Make the syntactical analysis on the given module and construct the AST.
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_statement(module_t *module, ast_node_t *parent, token_t *token)
Parse a statement adding it as a children on parent AST node.
unsigned int length
The length of the string.
char * data
Pointer for the raw string content (a normal C string).
Struct that represents a Mya module.
ast_node_t ast
AST of the module.
char filepath[MODULE_MAX_FILEPATH_SIZE+1]
Module's filepath.
unsigned int errors_count
Number of errors on errors list.
token_t * tokens
List of tokens inside the module.
unsigned int tokens_count
Number of tokens on tokens 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 module module_t
Struct that represents a Mya module.
struct token token_t
Struct for a Mya token.