From f768d9bdb84e846d89aac66a4f3433a44241c298 Mon Sep 17 00:00:00 2001 From: Galin Simeonov Date: Mon, 17 May 2021 17:29:08 +0300 Subject: parser formed --- program.h | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) (limited to 'program.h') diff --git a/program.h b/program.h index 8445fa3..d5e45b7 100644 --- a/program.h +++ b/program.h @@ -1,11 +1,21 @@ #ifndef PROGRAM_H #define PROGRAM_H -#include -#include #include #include +#include +#include +#include +#include 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); -- cgit v1.2.3