? src/scan-skeleton.l ? src/parse-skeleton.y Index: ChangeLog =================================================================== RCS file: /cvsroot/bison/bison/ChangeLog,v retrieving revision 1.494 diff -r1.494 ChangeLog 0a1,39 > 2001-12-29 Robert Anisko > > * src/muscle_tab.h (MUSCLE_INSERT_INT, MUSCLE_INSERT_STRING) > (MUSCLE_INSERT_PREFIX): ...to there. > * src/output.c (MUSCLE_INSERT_INT, MUSCLE_INSERT_STRING) > (MUSCLE_INSERT_PREFIX): Move from here... > > * src/bison.hairy: Add a section directive. Put braces around muscle > names. This parser skeleton is still broken, but Bison should not > choke on a bad muscle 'syntax'. > * src/bison.simple: Add a section directive. Put braces around muscle > names. > > * src/files.h (strsuffix, stringappend): Add declarations. > (tab_extension): Add declaration. > (short_base_name): Add declaration. > > * src/files.c (strsuffix, stringappend): No longer static. These > functions are used in the skeleton parser. > (tab_extension): New. > (compute_base_names): Use the computations done in this function > to guess if the generated parsers should have '.tab' in their > names. > (short_base_name): No longer static. > > * src/output.c (output_skeleton): New. > (output): Disable call to output_master_parser, and give a try to > the a new skeleton handling system. > (guards_output, actions_output): No longer static. > (token_definitions_output, get_lines_number): No longer static. > > * configure.in: Use AM_PROG_LEX and AC_PROG_YACC. > > * src/Makefile.am (bison_SOURCES): Add scan-skeleton.l and > parse-skeleton.y. > > * src/parse-skeleton.y: New file. > * src/scan-skeleton.l: New file. > Index: configure.in =================================================================== RCS file: /cvsroot/bison/bison/configure.in,v retrieving revision 1.49 diff -r1.49 configure.in 37a38,39 > AM_PROG_LEX > AC_PROG_YACC Index: src/Makefile.am =================================================================== RCS file: /cvsroot/bison/bison/src/Makefile.am,v retrieving revision 1.34 diff -r1.34 Makefile.am 25a26 > YFLAGS = "-dv" 46c47,48 < print.c reader.c reduce.c symtab.c warshall.c vcg.c --- > print.c reader.c reduce.c symtab.c warshall.c vcg.c \ > parse-skeleton.y scan-skeleton.l Index: src/bison.hairy =================================================================== RCS file: /cvsroot/bison/bison/src/bison.hairy,v retrieving revision 1.3 diff -r1.3 bison.hairy 0a1 > %%{section} %%{body} %%".c" %%{yacc} 335c336 < %%actions --- > %%{actions} Index: src/bison.simple =================================================================== RCS file: /cvsroot/bison/bison/src/bison.simple,v retrieving revision 1.99 diff -r1.99 bison.simple 0a1 > %%{section} %%{body} %%".c" %%{yacc} 3,4c4,5 < /* A Bison parser, made from %%filename < by GNU bison %%version. */ --- > /* A Bison parser, made from %%{filename} > by GNU bison %%{version}. */ 38c39 < #define YYPURE %%pure --- > #define YYPURE %%{pure} 41c42 < #define YYLSP_NEEDED %%locations-flag --- > #define YYLSP_NEEDED %%{locations-flag} 45,51c46,52 < #define yyparse %%prefix##parse < #define yylex %%prefix##lex < #define yyerror %%prefix##error < #define yylval %%prefix##lval < #define yychar %%prefix##char < #define yydebug %%prefix##debug < #define yynerrs %%prefix##nerrs --- > #define yyparse %%{prefix}parse > #define yylex %%{prefix}lex > #define yyerror %%{prefix}error > #define yylval %%{prefix}lval > #define yychar %%{prefix}char > #define yydebug %%{prefix}debug > #define yynerrs %%{prefix}nerrs 53c54 < # define yylloc %%prefix##lloc --- > # define yylloc %%{prefix}lloc 58c59 < %%prologue --- > %%{prologue} 62c63 < # define YYDEBUG %%debug --- > # define YYDEBUG %%{debug} 70c71 < # define YYERROR_VERBOSE %%error-verbose --- > # define YYERROR_VERBOSE %%{error-verbose} 74c75 < typedef %%stype yystype; --- > typedef %%{stype} yystype; 86c87 < # define YYLTYPE %%ltype --- > # define YYLTYPE %%{ltype} 89,90c90,91 < /* Line %%skeleton-line of %%skeleton. */ < #line %%line "%%parser-file-name" --- > /* Line %%{skeleton-line} of %%{skeleton}. */ > #line %%{line} "%%{parser-file-name}" 187c188 < %%tokendef --- > %%{tokendef} 190,192c191,193 < #define YYFINAL %%final < #define YYFLAG %%flag < #define YYLAST %%last --- > #define YYFINAL %%{final} > #define YYFLAG %%{flag} > #define YYLAST %%{last} 195c196 < #define YYNTOKENS %%ntokens --- > #define YYNTOKENS %%{ntokens} 197c198 < #define YYNNTS %%nnts --- > #define YYNNTS %%{nnts} 199c200 < #define YYNRULES %%nrules --- > #define YYNRULES %%{nrules} 201,202c202,203 < #define YYNSTATES %%nstates < #define YYMAXUTOK %%maxtok --- > #define YYNSTATES %%{nstates} > #define YYMAXUTOK %%{maxtok} 205c206 < #define YYTRANSLATE(x) ((unsigned)(x) <= %%maxtok ? yytranslate[x] : %%nsym) --- > #define YYTRANSLATE(x) ((unsigned)(x) <= %%{maxtok} ? yytranslate[x] : %%{nsym}) 210c211 < %%translate --- > %%{translate} 218c219 < %%prhs --- > %%{prhs} 224c225 < %%rhs --- > %%{rhs} 230c231 < %%rline --- > %%{rline} 239c240 < %%tname --- > %%{tname} 246c247 < %%toknum --- > %%{toknum} 252c253 < %%r1 --- > %%{r1} 258c259 < %%r2 --- > %%{r2} 266c267 < %%defact --- > %%{defact} 272c273 < %%defgoto --- > %%{defgoto} 279c280 < %%pact --- > %%{pact} 285c286 < %%pgoto --- > %%{pgoto} 293c294 < %%table --- > %%{table} 298c299 < %%check --- > %%{check} 422c423 < # define YYINITDEPTH %%initdepth --- > # define YYINITDEPTH %%{initdepth} 437c438 < # define YYMAXDEPTH %%maxdepth --- > # define YYMAXDEPTH %%{maxdepth} 906c907 < %%actions --- > %%{actions} 909,910c910,911 < /* Line %%skeleton-line of %%skeleton. */ < #line %%line "%%parser-file-name" --- > /* Line %%{skeleton-line} of %%{skeleton}. */ > #line %%{line} "%%{parser-file-name}" 1141c1142 < %%epilogue --- > %%{epilogue} Index: src/files.c =================================================================== RCS file: /cvsroot/bison/bison/src/files.c,v retrieving revision 1.63 diff -r1.63 files.c 54c54 < static char *short_base_name = NULL; --- > char *short_base_name = NULL; 59a60,62 > > /* Should we insert '.tab' in yacc-compatible parsers? */ > int tab_extension = 0; 66c69 < static int --- > int 83c86 < static char * --- > char* 336a340,344 > /* FIXME: This is a quick and dirty way for me to find out if we > should .tab or not, using the computations above. */ > if (strcmp (base_name, short_base_name)) > tab_extension = 1; > 362a371,374 > /* It seems that when only a prefix is given, '.tab' should always be > used. */ > tab_extension = 1; > 394a407,409 > > /* By default, Bison should insert '.tab' were needed. */ > tab_extension = 1; Index: src/files.h =================================================================== RCS file: /cvsroot/bison/bison/src/files.h,v retrieving revision 1.25 diff -r1.25 files.h 70a71,84 > > /* Is SUFFIX ending STRING? */ > int strsuffix (const char* string, const char* suffix); > > /* Return a newly allocated string composed of the concatenation of > STRING1, and STRING2. */ > char* stringappend (const char* string1, const char* string2); > > /* Should we insert '.tab' in yacc-compatible parsers? */ > extern int tab_extension; > > /* Prefix used to generate output files names. */ > extern char* short_base_name; > Index: src/muscle_tab.h =================================================================== RCS file: /cvsroot/bison/bison/src/muscle_tab.h,v retrieving revision 1.1 diff -r1.1 muscle_tab.h 35a36,57 > #define MUSCLE_INSERT_INT(Key, Value) \ > { \ > obstack_fgrow1 (&muscle_obstack, "%d", Value); \ > obstack_1grow (&muscle_obstack, 0); \ > muscle_insert (Key, obstack_finish (&muscle_obstack)); \ > } > > #define MUSCLE_INSERT_STRING(Key, Value) \ > { \ > obstack_sgrow (&muscle_obstack, Value); \ > obstack_1grow (&muscle_obstack, 0); \ > muscle_insert (Key, obstack_finish (&muscle_obstack)); \ > } > > #define MUSCLE_INSERT_PREFIX(Key, Value) \ > { \ > obstack_fgrow2 (&muscle_obstack, "%s%s", \ > spec_name_prefix ? spec_name_prefix : "yy", Value); \ > obstack_1grow (&muscle_obstack, 0); \ > muscle_insert (Key, obstack_finish (&muscle_obstack)); \ > } > Index: src/output.c =================================================================== RCS file: /cvsroot/bison/bison/src/output.c,v retrieving revision 1.119 diff -r1.119 output.c 128c128 < static size_t --- > size_t 506c506 < static void --- > void 542c542 < static void --- > void 574c574 < static void --- > void 1044a1045,1049 > > /* FIXME: Remove the two following lines. */ > printf ("Test: %s\n", infile); > printf ("Test: %s\n", parser_file_name); > 1058a1064 > /* Call the skeleton parser. */ 1060c1066,1077 < /* FIXME. */ --- > static > void > output_skeleton () > { > /* Find the right skeleton file. */ > if (!skeleton) > { > if (semantic_parser) > skeleton = skeleton_find ("BISON_HAIRY", BISON_HAIRY); > else > skeleton = skeleton_find ("BISON_SIMPLE", BISON_SIMPLE); > } 1062,1081c1079,1081 < #define MUSCLE_INSERT_INT(Key, Value) \ < { \ < obstack_fgrow1 (&muscle_obstack, "%d", Value); \ < obstack_1grow (&muscle_obstack, 0); \ < muscle_insert (Key, obstack_finish (&muscle_obstack)); \ < } < < #define MUSCLE_INSERT_STRING(Key, Value) \ < { \ < obstack_sgrow (&muscle_obstack, Value); \ < obstack_1grow (&muscle_obstack, 0); \ < muscle_insert (Key, obstack_finish (&muscle_obstack)); \ < } < < #define MUSCLE_INSERT_PREFIX(Key, Value) \ < { \ < obstack_fgrow2 (&muscle_obstack, "%s%s", \ < spec_name_prefix ? spec_name_prefix : "yy", Value); \ < obstack_1grow (&muscle_obstack, 0); \ < muscle_insert (Key, obstack_finish (&muscle_obstack)); \ --- > /* Parse the skeleton file and output the needed parsers. */ > muscle_insert ("skeleton", skeleton); > process_skeleton (infile, skeleton); 1105d1104 < 1190a1190,1192 > /* Process the selected skeleton file. */ > output_skeleton (); > 1191a1194 > #if 0 1192a1196 > #endif