2 * $Id: loc.h,v 1.3 2007/08/10 20:21:26 khansen Exp $
4 * Revision 1.3 2007/08/10 20:21:26 khansen
5 * *** empty log message ***
7 * Revision 1.2 2007/07/22 13:35:20 khansen
8 * convert tabs to whitespaces
10 * Revision 1.1 2004/06/30 07:56:29 kenth
16 * Definitions for flex location tracking.
22 #if ! defined (YYLTYPE) && ! defined (YYLTYPE_IS_DECLARED)
23 typedef struct YYLTYPE
31 # define yyltype YYLTYPE /* obsolescent; will be withdrawn */
32 # define YYLTYPE_IS_DECLARED 1
33 # define YYLTYPE_IS_TRIVIAL 1
36 const char *yy_current_filename();
38 typedef struct YYLTYPE location
;
41 # define LOCATION_RESET(Loc) \
42 (Loc).first_column = (Loc).first_line = 1; \
43 (Loc).last_column = (Loc).last_line = 1; \
44 (Loc).file = yy_current_filename();
46 /* Advance of NUM lines. */
47 # define LOCATION_LINES(Loc, Num) \
48 (Loc).last_column = 1; \
49 (Loc).last_line += Num; \
50 (Loc).file = (Loc).file;
52 /* Restart: move the first cursor to the last position. */
53 # define LOCATION_STEP(Loc) \
54 (Loc).first_column = (Loc).last_column; \
55 (Loc).first_line = (Loc).last_line; \
56 (Loc).file = (Loc).file;
58 /* Output LOC on the stream OUT. */
59 # define LOCATION_PRINT(Out, Loc) \
60 fprintf (Out, "%d", (Loc).first_line)
62 # define LOCATION_PRINT(Out, Loc) \
63 if ((Loc).first_line != (Loc).last_line) \
64 fprintf (Out, "%d.%d-%d.%d", \
65 (Loc).first_line, (Loc).first_column, \
66 (Loc).last_line, (Loc).last_column - 1); \
67 else if ((Loc).first_column < (Loc).last_column - 1) \
68 fprintf (Out, "%d.%d-%d", (Loc).first_line, \
69 (Loc).first_column, (Loc).last_column - 1); \
71 fprintf (Out, "%d.%d", (Loc).first_line, (Loc).first_column)