From f828df9d17e040c36e1e24914749dca40ac836e3 Mon Sep 17 00:00:00 2001 From: Jens Schweikhardt Date: Fri, 19 Oct 2001 19:10:36 +0000 Subject: Properly handle backslash newline within an identifier or keyword. PR: bin/6015 Submitted by: myself (schweikh) Patch by: Alexey V.Neyman Tested by: indenting my chess problem solver and running its test suite MFC after: 3 weeks --- usr.bin/indent/lexi.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'usr.bin') diff --git a/usr.bin/indent/lexi.c b/usr.bin/indent/lexi.c index 7c3892c48bc6..12e51dc90178 100644 --- a/usr.bin/indent/lexi.c +++ b/usr.bin/indent/lexi.c @@ -209,8 +209,18 @@ lexi() } } else - while (chartype[*buf_ptr] == alphanum) { /* copy it over */ + while (chartype[*buf_ptr] == alphanum || *buf_ptr == BACKSLASH) { + /* fill_buffer() terminates buffer with newline */ + if (*buf_ptr == BACKSLASH) { + if (*(buf_ptr + 1) == '\n') { + buf_ptr += 2; + if (buf_ptr >= buf_end) + fill_buffer(); + } else + break; + } CHECK_SIZE_TOKEN; + /* copy it over */ *e_token++ = *buf_ptr++; if (buf_ptr >= buf_end) fill_buffer(); -- cgit v1.3