diff options
author | Galin Simeonov <gts@volconst.com> | 2021-05-17 17:29:08 +0300 |
---|---|---|
committer | Galin Simeonov <gts@volconst.com> | 2021-07-15 18:00:15 +0300 |
commit | f768d9bdb84e846d89aac66a4f3433a44241c298 (patch) | |
tree | b7e8248bebd80c8b1f911f666260ad52b7213b84 /program.h | |
parent | 679cbe58c4e53f0163588a7731154f3afe2d25aa (diff) | |
download | MEGATRON-f768d9bdb84e846d89aac66a4f3433a44241c298.tar.gz |
parser formed
Diffstat (limited to 'program.h')
-rw-r--r-- | program.h | 27 |
1 files changed, 21 insertions, 6 deletions
@@ -1,11 +1,21 @@ #ifndef PROGRAM_H #define PROGRAM_H -#include <queue.h> -#include <lexer.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 { @@ -20,8 +30,9 @@ struct Source struct Options { - int print_tokens:1; - char *source; + enum Options_Target_Type target; + int is_quiet:1; + char *src_name; }; struct Error @@ -44,13 +55,17 @@ struct Program }; struct Source* extract_source(char *src_name); -struct Options* parse_command_line(char **argv); +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 token *token ,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); |