F diff --git a/src/frontend/lex/lex_preprocessing_directive.c b/src/frontend/lex/lex_preprocessing_directive.c --- a/src/frontend/lex/lex_preprocessing_directive.c +++ b/src/frontend/lex/lex_preprocessing_directive.c}struct token* preprocessing_extract_next_directive(struct Lexer_Data *lexer_data){- return preprocessing_extract_next_token_inner(lexer_data,1);+ return preprocessing_extract_next_token_inner(lexer_data,1,0);+ }+ struct token* preprocessing_extract_next_token_in_iflike_directive_control_statement(struct Lexer_Data *lexer_data)+ {+ return preprocessing_extract_next_token_inner(lexer_data,0,1);}struct token* preprocessing_extract_next_token(struct Lexer_Data *lexer_data){- return preprocessing_extract_next_token_inner(lexer_data,0);+ return preprocessing_extract_next_token_inner(lexer_data,0,0);}- struct token* preprocessing_extract_next_token_inner(struct Lexer_Data *lexer_data,_Bool extract_directive)+ struct token* preprocessing_extract_next_token_inner(struct Lexer_Data *lexer_data,_Bool extract_directive,_Bool extract_defined_statement){struct token *ret;lexer_data->program);}while(hold_node->keyword==KW_COMMENT);- ret=preprocessing_make_token_finishing_on_node(lexer_data, hold_node, where_does_the_token_start_in_the_source_file,extract_directive);+ ret=preprocessing_make_token_finishing_on_node(lexer_data, hold_node, where_does_the_token_start_in_the_source_file,extract_directive,extract_defined_statement);lexer_data->is_in_the_begining_of_line=0;return ret;}{return lexer_data->src->src[lexer_data->where_in_src]=='\n' || lexer_eof(lexer_data);}- struct token *preprocessing_make_token_finishing_on_node(struct Lexer_Data *lexer_data,struct Automata_Node *finishing_node,size_t start_position,_Bool create_directive)+ struct token *preprocessing_make_token_finishing_on_node(struct Lexer_Data *lexer_data,struct Automata_Node *finishing_node,size_t start_position,_Bool create_directive,_Bool create_defined_statement){struct Source_Location *token_location;return preprocessing_lex_error_directive(lexer_data,token_location);case PKW_PRAGMA:return get_error_token("PREPROCESSING PRAGMA NOT DONE",token_location,lexer_data->previous_token_location,lexer_data->program);- case PKW_DEFINED:- return preprocessing_lex_defined_unary_operator(lexer_data,token_location);default:return lexer_make_token_finishing_on_node(lexer_data,finishing_node,start_position);}wonky_assert(SHOULD_NOT_REACH_HERE);+ }else if(create_defined_statement && finishing_node->preprocessing_keyword==PKW_DEFINED)+ {+ return preprocessing_lex_defined_unary_operator(lexer_data,token_location);}else{return lexer_make_token_finishing_on_node(lexer_data,finishing_node,start_position);Queue_Init(ret->if_false);while(!preprocessing_eol(lexer_data))- Queue_Push(ret->controlling_expression,preprocessing_extract_next_token(lexer_data));+ Queue_Push(ret->controlling_expression,+ preprocessing_extract_next_token_in_iflike_directive_control_statement(lexer_data));preprocessing_lex_finish_iflike_directive(lexer_data,ret->if_true,ret->if_false);F diff --git a/src/frontend/lex/lex_preprocessing_directive.h b/src/frontend/lex/lex_preprocessing_directive.h --- a/src/frontend/lex/lex_preprocessing_directive.h +++ b/src/frontend/lex/lex_preprocessing_directive.hstruct token* preprocessing_extract_next_token(struct Lexer_Data *lexer_data);struct token* preprocessing_extract_next_directive(struct Lexer_Data *lexer_data);- struct token* preprocessing_extract_next_token_inner(struct Lexer_Data *lexer_data,_Bool extract_directive);+ struct token* preprocessing_extract_next_token_in_iflike_directive_control_statement(struct Lexer_Data *lexer_data);+ struct token* preprocessing_extract_next_token_inner(struct Lexer_Data *lexer_data,_Bool extract_directive,_Bool extract_defined_statement);_Bool preprocessing_get_and_check_token(struct Lexer_Data *lexer_data,enum LEXER_TYPE token_type);struct Automata_Node* preprocessing_feed_automata_until_error(struct Lexer_Data *lexer_data);struct Automata_Node* preprocessing_feed_automata_next_char(struct Lexer_Data *lexer_data,struct Automata_Node *node);void preprocessing_skip_white_space(struct Lexer_Data *lexer_data);_Bool preprocessing_eol(struct Lexer_Data *lexer_data);- struct token *preprocessing_make_token_finishing_on_node(struct Lexer_Data *lexer_data,struct Automata_Node *finishing_node,size_t start_position,_Bool create_directive);+ struct token *preprocessing_make_token_finishing_on_node(struct Lexer_Data *lexer_data,struct Automata_Node *finishing_node,size_t start_position,_Bool create_directive,_Bool create_defined_statement);void preprocessing_parse_functionlike_macro_id_list(struct Lexer_Data *lexer_data,struct token_functionlike_define_directive *directive);F diff --git a/src/frontend/parse/parse_expression.c b/src/frontend/parse/parse_expression.c --- a/src/frontend/parse/parse_expression.c +++ b/src/frontend/parse/parse_expression.cif(translation_eof(translation_data)){- /*TODO error*/push_translation_error("expected something here",translation_data);return (struct AST_Expression*)get_error_tree(NULL);}hold_token=get_next_token(translation_data);- switch(hold_token->type) /*the token is not wonky_freed so there is a memory leak here*/+ switch(hold_token->type){case KW_STRING:case KW_WIDE_STRING: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.ctoken_ptr_goto_next_normal_token(token_pointer);+ if(!token_ptr_has_remaining_tokens(token_pointer))+ return get_eof_token();+if(token_ptr_has_buffered_tokens(token_pointer)) /*A special macro might buffer a token*/return token_ptr_get_buffered_token(token_pointer);