comparison files.c @ 186:9637bf434f8e

Don't report unclosed comments as "no newline at end of file". If we get EOF in the "middle" of a line but there's a newline at the end of the buffer we've got, it's because we're in the middle of a comment. So, say so.
author David A. Holland
date Fri, 12 Jun 2015 04:13:41 -0400
parents 4c3375895c6e
children 8c7e508da6cc
comparison
equal deleted inserted replaced
185:16b4451e34b8 186:9637bf434f8e
224 } else if (result == 0) { 224 } else if (result == 0) {
225 /* eof in middle of line */ 225 /* eof in middle of line */
226 ateof = true; 226 ateof = true;
227 ptmp = places.current; 227 ptmp = places.current;
228 ptmp.column += bufend - linestart; 228 ptmp.column += bufend - linestart;
229 complain(&ptmp, "No newline at end of file"); 229 if (buf[bufend - 1] == '\n') {
230 complain(&ptmp, "Unclosed comment");
231 } else {
232 complain(&ptmp,
233 "No newline at end of file");
234 }
230 if (mode.werror) { 235 if (mode.werror) {
231 complain_fail(); 236 complain_fail();
232 } 237 }
233 assert(bufend < bufmax); 238 assert(bufend < bufmax);
234 lineend = bufend++; 239 lineend = bufend++;