Le 14 déc. 2012 à 10:26, Théophile Ranquet <[email protected]> a écrit :
> I am going for the following, does this satisfy you? > > commit a860ad081d025db0629120d030fbf7fd8218949f > Author: Theophile Ranquet <[email protected]> > Date: Thu Nov 15 17:10:35 2012 +0000 > > scanner: reintroduce unput for missing end tokens > > Unput was no longer used since a POSIX-compatiblity issue with Flex 2.5.31, > which has been adressed in newer versions of Flex. See this discussion: > <http://lists.gnu.org/archive/html/bug-bison/2003-04/msg00029.html> > > This partially reverts commit aa4180418fff518198e1b0f2c43fec6432210dc7. > > * src/scan-gram.l (unexpected_end): Here. > * tests/input.at: Adjust for new order of error reports. OK. > >> >>> index 5e5b1e8..70ad41b 100644 >>> --- a/tests/input.at >>> +++ b/tests/input.at >>> @@ -1480,10 +1480,10 @@ AT_CHECK([[$PERL -e "print 'start: \'';" >> empty.y >>> || exit 77]]) >>> >>> AT_BISON_CHECK([empty.y], [1], [], >>> [[empty.y:2.8-9: warning: empty character literal [-Wother] >>> -empty.y:3.8-4.0: warning: empty character literal [-Wother] >>> empty.y:3.8-4.0: error: missing "'" at end of line >>> -empty.y:4.8: warning: empty character literal [-Wother] >>> +empty.y:3.8-4.0: warning: empty character literal [-Wother] >>> empty.y:4.8: error: missing "'" at end of file >>> +empty.y:4.8: warning: empty character literal [-Wother] >>> ]]) >> >> I'd like to see -fcaret used here, to see how "cute" the location is. > > Sure. This revealed a bug in our carets, when the input is not > terminated by a line feed. The following trivial patch fixes this, so > it will be installed as another commit. > > diff --git a/src/location.c b/src/location.c > index d48a0a1..c4e0a76 100644 > --- a/src/location.c > +++ b/src/location.c > @@ -197,6 +197,8 @@ location_caret (FILE *out, location loc) > > /* Quote the file, indent by a single column. */ > fputc (' ', out); > + if (buf[len - 1] != '\n') > + buf[len++] = '\n'; How do you know the buffer is large enough??? > fwrite (buf, 1, len, out); I would prefer that you just add the \n afterwards. And really, I'm having second thoughts on using getline here, as a simple while loop on getc and putc would perfectly suffice. > > /* Print the caret, with the same indent as above. */
