diff options
author | Galin Simeonov <gts@volconst.com> | 2021-05-31 22:02:10 +0300 |
---|---|---|
committer | Galin Simeonov <gts@volconst.com> | 2021-07-15 18:00:15 +0300 |
commit | 255a49ba5a41b3854dbdfebdec75fb6229450507 (patch) | |
tree | 616ea5786cb91d03ef609d32b402941dc30e926b /src/program/program.h | |
parent | f768d9bdb84e846d89aac66a4f3433a44241c298 (diff) | |
download | MEGATRON-255a49ba5a41b3854dbdfebdec75fb6229450507.tar.gz |
added cmake file
Diffstat (limited to 'src/program/program.h')
-rw-r--r-- | src/program/program.h | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/src/program/program.h b/src/program/program.h new file mode 100644 index 0000000..d5e45b7 --- /dev/null +++ b/src/program/program.h @@ -0,0 +1,76 @@ +#ifndef PROGRAM_H +#define PROGRAM_H +#include <stdlib.h> +#include <stdio.h> +#include <string.h> +#include <queue.h> +#include <lexer.h> +#include <assert.h> + +struct token; +enum Keyword; + +enum Options_Target_Type +{ + OPTION_TARGET_TOKENS, + OPTION_TARGET_AST, + OPTION_DEFAULT, +}; + +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 +{ + enum Options_Target_Type target; + int is_quiet:1; + char *src_name; +}; + +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(int argc,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 Translation_Data *translation_data); +char has_new_errors(struct Translation_Data *translation_data); +void touch_errors(struct Translation_Data *translation_data); +char get_and_check(struct Translation_Data *translation_data,enum Keyword kw); +enum Keyword get_kw(struct Translation_Data *translation_data); +void chomp(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 |