X-Git-Url: https://git.saurik.com/bison.git/blobdiff_plain/1a715ef2fcaa8acc91ccc3e62fac830f0552dd29..efc6bf1b94135c0b858896ef966aa7eaca4ff3cf:/src/location.h diff --git a/src/location.h b/src/location.h index 94afc244..5a2d64a3 100644 --- a/src/location.h +++ b/src/location.h @@ -40,20 +40,6 @@ do { \ (Loc).last_column = (Loc).last_line = 1; \ } while (0) -/* Advance of NUM columns. */ -# define LOCATION_COLUMNS(Loc, Num) \ -do { \ - (Loc).last_column += Num; \ -} while (0) - - -/* Advance of NUM lines. */ -# define LOCATION_LINES(Loc, Num) \ -do { \ - (Loc).last_column = 1; \ - (Loc).last_line += Num; \ -} while (0) - /* Restart: move the first cursor to the last position. */ # define LOCATION_STEP(Loc) \ @@ -63,23 +49,27 @@ do { \ } while (0) -/* Output LOC on the stream OUT. */ +/* Output LOC on the stream OUT. + Warning: it uses quotearg's slot 3. */ # define LOCATION_PRINT(Out, Loc) \ do { \ - fprintf (stderr, "%s:", quotearg_style (escape_quoting_style, \ - (Loc).file)); \ - if ((Loc).first_line != (Loc).last_line) \ - fprintf (Out, "%d.%d-%d.%d", \ - (Loc).first_line, (Loc).first_column, \ - (Loc).last_line, (Loc).last_column - 1); \ - else if ((Loc).first_column < (Loc).last_column - 1) \ - fprintf (Out, "%d.%d-%d", (Loc).first_line, \ - (Loc).first_column, (Loc).last_column - 1); \ - else \ - fprintf (Out, "%d.%d", (Loc).first_line, (Loc).first_column); \ + fprintf (stderr, "%s:", quotearg_n_style (3, escape_quoting_style, \ + (Loc).file)); \ + if ((Loc).first_line) \ + { \ + if ((Loc).first_line != (Loc).last_line) \ + fprintf (Out, "%d.%d-%d.%d", \ + (Loc).first_line, (Loc).first_column, \ + (Loc).last_line, (Loc).last_column - 1); \ + else if ((Loc).first_column < (Loc).last_column - 1) \ + fprintf (Out, "%d.%d-%d", (Loc).first_line, \ + (Loc).first_column, (Loc).last_column - 1); \ + else \ + fprintf (Out, "%d.%d", (Loc).first_line, (Loc).first_column); \ + } \ } while (0) - extern location_t empty_location; + #endif /* !LOCATION_H_ */