aboutsummaryrefslogtreecommitdiffstats
path: root/program.h
blob: 8445fa3f57e7be4a62f0eff2a7d7ebc61f874905 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#ifndef PROGRAM_H
#define PROGRAM_H
#include <queue.h>
#include <lexer.h>
#include <stdlib.h>
#include <stdio.h>

struct token;

struct Source
{
	size_t src_size;
	size_t where_in_src;
	size_t current_column;
	size_t current_row;
	char *src_name;
	char *src;

};

struct Options
{
	int print_tokens:1;
	char *source;
};
	
struct Error
{
	char *message;
	size_t row;
	size_t column;
};

struct Translation_Data
{
	struct Queue *errors;
	struct Queue *tokens;
	size_t hold_number_of_errors;
};
struct Program
{
	struct Source *source;
	
};

struct Source* extract_source(char *src_name);
struct Options* parse_command_line(char **argv);
struct Translation_Data* get_translation_data();
struct Error* get_error(char *message,size_t row,size_t column);

void push_lexing_error(char *error_message,struct Source *src,struct Translation_Data *translation_data);
void push_parsing_error(char *error_message,struct token *token ,struct Translation_Data *translation_data);
char has_new_errors(struct Translation_Data *translation_data);

void delete_translation_data(struct Translation_Data *data);
void delete_source(struct Source *src);
void delete_options(struct Options *options);
void delete_error(struct Error *error);


#endif