aboutsummaryrefslogtreecommitdiffstats
path: root/src/program
diff options
context:
space:
mode:
authorGalin Simeonov <gts@volconst.com>2021-06-03 12:38:37 +0300
committerGalin Simeonov <gts@volconst.com>2021-07-15 18:04:02 +0300
commit76fc38b3cdfded2911b464baa7b182b5102318d1 (patch)
tree389223f76086bff07a3cd762683e5a16d34d12d2 /src/program
parent85b23fbee717f047af5a89eac6f4dba8e7812524 (diff)
downloadMEGATRON-76fc38b3cdfded2911b464baa7b182b5102318d1.tar.gz
work on generated C code
Diffstat (limited to 'src/program')
-rw-r--r--src/program/program.c7
-rw-r--r--src/program/program.h2
2 files changed, 8 insertions, 1 deletions
diff --git a/src/program/program.c b/src/program/program.c
index 1e7882d..2632c57 100644
--- a/src/program/program.c
+++ b/src/program/program.c
@@ -40,6 +40,7 @@ struct Options* parse_command_line(int argc,char **argv)
ret=malloc(sizeof(struct Options));
ret->target=OPTION_DEFAULT;
ret->src_name=NULL;
+ ret->output_name=NULL;
ret->is_quiet=0;
for(i=0;i<argc;++i)
@@ -55,7 +56,7 @@ struct Options* parse_command_line(int argc,char **argv)
if(++i<argc)
{
if(strnlen(argv[i],101)<100)
- ret->src_name=argv[i];
+ ret->output_name=argv[i];
else if(!ret->is_quiet)
{
fprintf(stderr,"Error: Output filename is too long");
@@ -182,4 +183,8 @@ void touch_errors(struct Translation_Data *translation_data)
assert(translation_data->hold_number_of_errors>0);
--translation_data->hold_number_of_errors;
}
+void push_error_with_token(char *error_message,struct Translation_Data *translation_data,struct token *token)
+{
+ Queue_Push(translation_data->errors,get_error(error_message,token->row,token->column));
+}
#endif
diff --git a/src/program/program.h b/src/program/program.h
index 99a02c3..1fa0db6 100644
--- a/src/program/program.h
+++ b/src/program/program.h
@@ -34,6 +34,7 @@ struct Options
enum Options_Target_Type target;
int is_quiet:1;
char *src_name;
+ char *output_name;
};
struct Error
@@ -63,6 +64,7 @@ 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);
+void push_error_with_token(char *error_message,struct Translation_Data *translation_data,struct token *token);
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);