X-Git-Url: https://git.saurik.com/bison.git/blobdiff_plain/1239777d4f4f96a23e5cd177121f16f0d9e71c68..ea6cfe9ebd960e2cb4573c2c6f02b02931ac1f86:/src/skeleton.h?ds=inline diff --git a/src/skeleton.h b/src/skeleton.h index b76ae333..fa328eaf 100644 --- a/src/skeleton.h +++ b/src/skeleton.h @@ -21,12 +21,56 @@ #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_