WONKY



LOG | FILES | OVERVIEW


F diff --git a/src/backend/text/print/print.c b/src/backend/text/print/print.c --- a/src/backend/text/print/print.c +++ b/src/backend/text/print/print.c
fprintf(out,"\nTOKENS OF %s {\n",src->src_name->full_name);
- ptr=get_token_ptr(hold_unit);
+ ptr=get_token_ptr(hold_unit,program);
print_tokens(out,ptr,data);
obj=get_print_compile_object(data->lines);
F diff --git a/src/environment/error/gcc_error.c b/src/environment/error/gcc_error.c --- a/src/environment/error/gcc_error.c +++ b/src/environment/error/gcc_error.c
return ret;
}
-
+ void push_translation_message_into_program_as_error(struct Translation_Message *message,struct Program *program)
+ {
+ Queue_Push(program->errors,message);
+ }
void push_translation_message_inner(const char *prefix,const char *message_format,struct Program *program,struct Source_Location *location,va_list args)
{
struct Translation_Message *hold_message;
F diff --git a/src/environment/error/gcc_error.h b/src/environment/error/gcc_error.h --- a/src/environment/error/gcc_error.h +++ b/src/environment/error/gcc_error.h
struct Translation_Message* get_translation_message(const char *message_format,struct Program *program,struct Source_Location *location,va_list args);
struct Translation_Message* get_translation_message_inner(const char *message,struct Program *program,struct Source_Location *location);
+ void push_translation_message_into_program_as_error(struct Translation_Message *message,struct Program *program);
void push_translation_message_inner(const char *prefix,const char *message_format,struct Program *program,struct Source_Location *location,va_list args);
void push_translation_error(const char *message_format,struct Translation_Data *translation_data, ...);
F diff --git a/src/frontend/lex/lexer.c b/src/frontend/lex/lexer.c --- a/src/frontend/lex/lexer.c +++ b/src/frontend/lex/lexer.c
ret->where_in_src=0;
ret->which_column=0;
ret->which_row=0;
- ret->is_in_the_begining_of_line=0;
+ ret->is_in_the_begining_of_line=1;
ret->automata_view=AUTOMATA_VIEW_NORMAL;
ret->src=src;
ret->program=program;
F diff --git a/src/semantics/program/program.c b/src/semantics/program/program.c --- a/src/semantics/program/program.c +++ b/src/semantics/program/program.c
struct Translation_Data *ret;
ret=wonky_malloc(sizeof(struct Translation_Data));
- ret->token_pointer=get_token_ptr(start_unit);
+ ret->token_pointer=get_token_ptr(start_unit,program);
ret->internal_linkage=internal_linkage;
ret->program=program;
F diff --git a/src/semantics/program/translation_unit.c b/src/semantics/program/translation_unit.c --- a/src/semantics/program/translation_unit.c +++ b/src/semantics/program/translation_unit.c
return;
}
break;
+ case LT_ERROR:
+ push_translation_message_into_program_as_error(((struct token_error*)hold_token)->error,token_pointer->program);
+ token_pointer->current_token_node=token_pointer->current_token_node->prev;
+ break;
default:
return;
}
token_pointer->current_token_node=token_pointer->current_token_node->prev;
}
- struct Token_Pointer* get_token_ptr(struct Preprocessing_Translation_Unit *unit)
+ struct Token_Pointer* get_token_ptr(struct Preprocessing_Translation_Unit *unit,struct Program *program)
{
struct Token_Pointer *ret;
ret=wonky_malloc(sizeof(struct Token_Pointer));
Queue_Init(ret->ungeted_tokens);
ret->current_location=((struct token*)unit->tokens->first->data)->location;/*todo: make sure translation unit has a token*/
- ret->program=NULL;/*todo*/
+ ret->program=program;
return ret;
}
F diff --git a/src/semantics/program/translation_unit.h b/src/semantics/program/translation_unit.h --- a/src/semantics/program/translation_unit.h +++ b/src/semantics/program/translation_unit.h
void token_ptr_goto_next_token(struct Token_Pointer *token_pointer);
void token_ptr_goto_next_normal_token(struct Token_Pointer *token_pointer);
- struct Token_Pointer* get_token_ptr(struct Preprocessing_Translation_Unit *unit);
+ struct Token_Pointer* get_token_ptr(struct Preprocessing_Translation_Unit *unit,struct Program *program);
void delete_token_ptr(struct Token_Pointer *ptr);
_Bool token_ptr_has_remaining_tokens(struct Token_Pointer *ptr);