libmya 0.1.0
Library to parse Mya language.
Loading...
Searching...
No Matches
module.h
Go to the documentation of this file.
1#pragma once
2
3#include <stdio.h>
4
5#include "types/ast.h"
6#include "types/dstring.h"
7#include "types/queue.h"
8#include "types/token.h"
9
10#define MODULE_MAX_FILEPATH_SIZE 127
11#define MODULE_INITIAL_ERRORS_LENGTH 5
12#define MODULE_INITIAL_TOKENS_LENGTH 100
13#define MODULE_ERRORS_LENGTH_INCREMENT 10
14#define MODULE_TOKENS_LENGTH_INCREMENT 50
15#define MODULE_MAX_QUEUE_LENGTH 100
16#define MODULE_MIN_QUEUE_LENGTH 20
17
21typedef struct module_error
22{
23 unsigned int line;
24 unsigned int column;
25 unsigned int length;
29
Struct that represents a error inside a Mya module.
Definition module.h:22
dstring_t message
The error message to print.
Definition module.h:27
unsigned int line
The module's line where the error is.
Definition module.h:23
unsigned int length
The length of the part where has an error in the line.
Definition module.h:25
unsigned int column
The line's column where the error starts.
Definition module.h:24
Struct that represents a Mya module.
Definition module.h:34
ast_node_t ast
AST of the module.
Definition module.h:37
module_error_t * errors
List of errors inside the module.
Definition module.h:38
cqueue_t _queue
Internal queue to read file character by character.
Definition module.h:43
char filepath[MODULE_MAX_FILEPATH_SIZE+1]
Module's filepath.
Definition module.h:44
unsigned int _tokens_length
Internal field with the size of tokens allocated memory.
Definition module.h:40
unsigned int _errors_length
Internal field with the size of errors allocated memory.
Definition module.h:42
unsigned int errors_count
Number of errors on errors list.
Definition module.h:41
token_t * tokens
List of tokens inside the module.
Definition module.h:36
FILE * file
Module's file handler.
Definition module.h:35
unsigned int tokens_count
Number of tokens on tokens list.
Definition module.h:39
struct ast_node ast_node_t
struct dstring dstring_t
A dynamic string (dstring) that automatically reallocate her buffer when needed.
#define MODULE_MAX_FILEPATH_SIZE
Definition module.h:10
struct module module_t
Struct that represents a Mya module.
struct module_error module_error_t
Struct that represents a error inside a Mya module.
struct cqueue cqueue_t
Circular queue of integers.
struct token token_t
Struct for a Mya token.