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/cqueue.h"
7#include "types/dstring.h"
8#include "types/token.h"
9
10#define MODULE_MAX_FILEPATH_SIZE 255
11#define MODULE_INITIAL_ERRORS_LENGTH 5
12#define MODULE_INITIAL_TOKENS_LENGTH 100
13#define MODULE_INITIAL_SUBMODULES_LENGTH 5
14#define MODULE_ERRORS_LENGTH_INCREMENT 10
15#define MODULE_TOKENS_LENGTH_INCREMENT 50
16#define MODULE_SUBMODULES_LENGTH_INCREMENT 10
17#define MODULE_MAX_QUEUE_LENGTH 100
18#define MODULE_MIN_QUEUE_LENGTH 20
19
23typedef struct module_error
24{
25 unsigned int line;
26 unsigned int column;
27 unsigned int length;
31
Struct that represents an error inside a Mya module.
Definition module.h:24
dstring_t message
The error message to print.
Definition module.h:29
unsigned int line
The module's line where the error is.
Definition module.h:25
unsigned int length
The length of the part where has an error in the line.
Definition module.h:27
unsigned int column
The line's column where the error starts.
Definition module.h:26
Struct that represents a Mya module.
Definition module.h:36
ast_node_t ast
AST of the module.
Definition module.h:39
module_error_t * errors
List of errors inside the module.
Definition module.h:40
cqueue_t _queue
Internal queue to read file character by character.
Definition module.h:48
char filepath[MODULE_MAX_FILEPATH_SIZE+1]
Module's filepath.
Definition module.h:49
unsigned int _tokens_length
Internal field with the size of tokens allocated memory.
Definition module.h:43
unsigned int _errors_length
Internal field with the size of errors allocated memory.
Definition module.h:45
unsigned int submodules_count
Number of submodules on submodules list.
Definition module.h:46
unsigned int errors_count
Number of errors on errors list.
Definition module.h:44
token_t * tokens
List of tokens inside the module.
Definition module.h:38
FILE * file
Module's file handler.
Definition module.h:37
struct module * submodules
List of submodules included by include statement.
Definition module.h:41
unsigned int _submodules_length
Internal field with the size of submodules allocated memory.
Definition module.h:47
unsigned int tokens_count
Number of tokens on tokens list.
Definition module.h:42
struct ast_node ast_node_t
struct cqueue cqueue_t
Circular queue of integers.
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 an error inside a Mya module.
struct token token_t
Struct for a Mya token.