summaryrefslogtreecommitdiffstats
path: root/usr.bin
diff options
context:
space:
mode:
authorschweikh <schweikh@FreeBSD.org>2001-10-19 19:10:36 +0000
committerschweikh <schweikh@FreeBSD.org>2001-10-19 19:10:36 +0000
commit49b9e95f88fb18f09ff9755480811141d1108922 (patch)
tree4863f33aa823f1879cfcb73e78e60089a6af8560 /usr.bin
parent7d137e3ffb9f873f301def92f781d7837a7c480b (diff)
downloadFreeBSD-src-49b9e95f88fb18f09ff9755480811141d1108922.zip
FreeBSD-src-49b9e95f88fb18f09ff9755480811141d1108922.tar.gz
Properly handle backslash newline within an identifier or keyword.
PR: bin/6015 Submitted by: myself (schweikh) Patch by: Alexey V.Neyman <alex.neyman@auriga.ru> Tested by: indenting my chess problem solver and running its test suite MFC after: 3 weeks
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/indent/lexi.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/usr.bin/indent/lexi.c b/usr.bin/indent/lexi.c
index 7c3892c..12e51dc 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();
OpenPOWER on IntegriCloud