]> git.saurik.com Git - bison.git/blobdiff - src/skeleton.h
Really add m4sugar to the repo.
[bison.git] / src / skeleton.h
index b76ae333931cee99940abaecbd2d79503b117c23..fa328eaf980467d25255ca3a19052fbbb522f368 100644 (file)
 #ifndef SKELETON_H_
 # define SKELETON_H_
 
-/* From parse-skel.y.  */
+# include "parse-skel.h"
+
+/* Initialize LOC. */
+# define LOCATION_RESET(Loc)                  \
+  (Loc).first_column = (Loc).first_line = 1;  \
+  (Loc).last_column =  (Loc).last_line = 1;
+
+/* Advance of NUM lines. */
+# define LOCATION_LINES(Loc, Num)             \
+  (Loc).last_column = 1;                      \
+  (Loc).last_line += Num;
+
+/* Restart: move the first cursor to the last position. */
+# define LOCATION_STEP(Loc)                   \
+  (Loc).first_column = (Loc).last_column;     \
+  (Loc).first_line = (Loc).last_line;
+
+/* Output LOC on the stream OUT. */
+# define LOCATION_PRINT(Out, Loc)                               \
+  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)
+
+
+/* Pure parsers need to pass arguments to yyparse. */
+typedef struct skel_control_s
+{
+  /* For the time being, nothing.  */
+} skel_control_t;
+
+/* From parse-skel.y. */
+extern int skel_debug;
+void skel_error PARAMS ((skel_control_t *control,
+                        const yyltype *loc, const char *msg));
 void process_skeleton PARAMS ((const char* skel));
 
 /* From scan-skel.l. */
+extern int skel__flex_debug;
+
+/* Renamed yyin. */
+extern FILE* skel_in;
+
 # define YY_DECL \
-  int yylex PARAMS ((void))
+  int skel_lex PARAMS ((yystype *yylval, yyltype *yylloc))
 YY_DECL;
 
 #endif SKELETON_H_