~oriansj/M3-Preprocess

06c5b741239ead13e31c9dd1d7d5f66062749460 — Jeremiah Orians 2 years ago 9cf01db
Support lines broken by '\\\n'
1 files changed, 14 insertions(+), 1 deletions(-)

M cc_macro.c
M cc_macro.c => cc_macro.c +14 -1
@@ 427,6 427,8 @@ int macro_bitwise_expr()
	int rhs;
	int lhs = macro_relational_expr();

macro_bitwise_expr_reset:

	if(match("&", macro_token->s))
	{
		eat_current_token();


@@ 456,6 458,18 @@ int macro_bitwise_expr()
		rhs = macro_bitwise_expr();
		return lhs ^ rhs;
	}
	else if(match("\\", macro_token->s))
	{   /* Deal with lines that are broken up */
		require(NULL != macro_token->next, "You escaped EOF, that isn't valid\n");
		if(match("\n", macro_token->next->s))
		{
			eat_current_token();
			eat_current_token();
			goto macro_bitwise_expr_reset;
		}

		return lhs;
	}
	else
	{
		return lhs;


@@ 827,7 841,6 @@ void macro_directive()
				return;
			}

//			eat_current_token();
			macro_token = macro_token->next;
		}
	}