mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-13 14:23:04 +00:00
* 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 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-skel.l and parse-skel.y. * src/parse-skel.y: New file. * src/scan-skel.l: New file.
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
%%{section} %%{body} %%".c" %%{yacc}
|
||||
/* -*- C -*- */
|
||||
|
||||
/* A Bison parser, made from %%filename
|
||||
by GNU bison %%version. */
|
||||
/* A Bison parser, made from %%{filename}
|
||||
by GNU bison %%{version}. */
|
||||
|
||||
/* Skeleton output parser for bison,
|
||||
Copyright 1984, 1989, 1990, 2000, 2001 Free Software Foundation, Inc.
|
||||
@@ -35,31 +36,31 @@
|
||||
#define YYBISON 1
|
||||
|
||||
/* Pure parsers. */
|
||||
#define YYPURE %%pure
|
||||
#define YYPURE %%{pure}
|
||||
|
||||
/* Using locations. */
|
||||
#define YYLSP_NEEDED %%locations-flag
|
||||
#define YYLSP_NEEDED %%{locations-flag}
|
||||
|
||||
/* If NAME_PREFIX is specified substitute the variables and functions
|
||||
names. */
|
||||
#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
|
||||
#if YYLSP_NEEDED
|
||||
# define yylloc %%prefix##lloc
|
||||
# define yylloc %%{prefix}lloc
|
||||
#endif
|
||||
|
||||
|
||||
/* Copy the user declarations. */
|
||||
%%prologue
|
||||
%%{prologue}
|
||||
|
||||
/* Enabling traces. */
|
||||
#ifndef YYDEBUG
|
||||
# define YYDEBUG %%debug
|
||||
# define YYDEBUG %%{debug}
|
||||
#endif
|
||||
|
||||
/* Enabling verbose error messages. */
|
||||
@@ -67,11 +68,11 @@
|
||||
# undef YYERROR_VERBOSE
|
||||
# define YYERROR_VERBOSE 1
|
||||
#else
|
||||
# define YYERROR_VERBOSE %%error-verbose
|
||||
# define YYERROR_VERBOSE %%{error-verbose}
|
||||
#endif
|
||||
|
||||
#ifndef YYSTYPE
|
||||
typedef %%stype yystype;
|
||||
typedef %%{stype} yystype;
|
||||
# define YYSTYPE yystype
|
||||
#endif
|
||||
|
||||
@@ -83,11 +84,11 @@ typedef struct yyltype
|
||||
int last_line;
|
||||
int last_column;
|
||||
} yyltype;
|
||||
# define YYLTYPE %%ltype
|
||||
# define YYLTYPE %%{ltype}
|
||||
#endif
|
||||
|
||||
/* Line %%skeleton-line of %%skeleton. */
|
||||
#line %%line "%%parser-file-name"
|
||||
/* Line %%{skeleton-line} of %%{skeleton}. */
|
||||
#line %%{line} "%%{parser-file-name}"
|
||||
|
||||
/* All symbols defined below should begin with yy or YY, to avoid
|
||||
infringing on user name space. This should be done even for local
|
||||
@@ -184,30 +185,30 @@ union yyalloc
|
||||
#endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
|
||||
|
||||
/* Tokens. */
|
||||
%%tokendef
|
||||
%%{tokendef}
|
||||
|
||||
/* YYFINAL -- State number of the termination state. */
|
||||
#define YYFINAL %%final
|
||||
#define YYFLAG %%flag
|
||||
#define YYLAST %%last
|
||||
#define YYFINAL %%{final}
|
||||
#define YYFLAG %%{flag}
|
||||
#define YYLAST %%{last}
|
||||
|
||||
/* YYNTOKENS -- Number of terminals. */
|
||||
#define YYNTOKENS %%ntokens
|
||||
#define YYNTOKENS %%{ntokens}
|
||||
/* YYNNTS -- Number of nonterminals. */
|
||||
#define YYNNTS %%nnts
|
||||
#define YYNNTS %%{nnts}
|
||||
/* YYNRULES -- Number of rules. */
|
||||
#define YYNRULES %%nrules
|
||||
#define YYNRULES %%{nrules}
|
||||
/* YYNRULES -- Number of states. */
|
||||
#define YYNSTATES %%nstates
|
||||
#define YYMAXUTOK %%maxtok
|
||||
#define YYNSTATES %%{nstates}
|
||||
#define YYMAXUTOK %%{maxtok}
|
||||
|
||||
/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
|
||||
#define YYTRANSLATE(x) ((unsigned)(x) <= %%maxtok ? yytranslate[x] : %%nsym)
|
||||
#define YYTRANSLATE(x) ((unsigned)(x) <= %%{maxtok} ? yytranslate[x] : %%{nsym})
|
||||
|
||||
/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
|
||||
static const char yytranslate[] =
|
||||
{
|
||||
%%translate
|
||||
%%{translate}
|
||||
};
|
||||
|
||||
#if YYDEBUG
|
||||
@@ -215,19 +216,19 @@ static const char yytranslate[] =
|
||||
YYRHS. */
|
||||
static const short yyprhs[] =
|
||||
{
|
||||
%%prhs
|
||||
%%{prhs}
|
||||
};
|
||||
|
||||
/* YYRHS -- A `-1'-separated list of the rules' RHS. */
|
||||
static const short yyrhs[] =
|
||||
{
|
||||
%%rhs
|
||||
%%{rhs}
|
||||
};
|
||||
|
||||
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
|
||||
static const short yyrline[] =
|
||||
{
|
||||
%%rline
|
||||
%%{rline}
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -236,26 +237,26 @@ static const short yyrline[] =
|
||||
First, the terminals, then, starting at YYNTOKENS, nonterminals. */
|
||||
static const char *const yytname[] =
|
||||
{
|
||||
%%tname
|
||||
%%{tname}
|
||||
};
|
||||
#endif
|
||||
|
||||
/* YYTOKNUM[YYN] -- Index in YYTNAME corresponding to YYLEX. */
|
||||
static const short yytoknum[] =
|
||||
{
|
||||
%%toknum
|
||||
%%{toknum}
|
||||
};
|
||||
|
||||
/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
|
||||
static const short yyr1[] =
|
||||
{
|
||||
%%r1
|
||||
%%{r1}
|
||||
};
|
||||
|
||||
/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
|
||||
static const short yyr2[] =
|
||||
{
|
||||
%%r2
|
||||
%%{r2}
|
||||
};
|
||||
|
||||
/* YYDEFACT[S] -- default rule to reduce with in state S when YYTABLE
|
||||
@@ -263,26 +264,26 @@ static const short yyr2[] =
|
||||
error. */
|
||||
static const short yydefact[] =
|
||||
{
|
||||
%%defact
|
||||
%%{defact}
|
||||
};
|
||||
|
||||
/* YYPGOTO[NTERM-NUM]. */
|
||||
static const short yydefgoto[] =
|
||||
{
|
||||
%%defgoto
|
||||
%%{defgoto}
|
||||
};
|
||||
|
||||
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
|
||||
STATE-NUM. */
|
||||
static const short yypact[] =
|
||||
{
|
||||
%%pact
|
||||
%%{pact}
|
||||
};
|
||||
|
||||
/* YYPGOTO[NTERM-NUM]. */
|
||||
static const short yypgoto[] =
|
||||
{
|
||||
%%pgoto
|
||||
%%{pgoto}
|
||||
};
|
||||
|
||||
/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
|
||||
@@ -290,12 +291,12 @@ static const short yypgoto[] =
|
||||
number is the opposite. If zero, do what YYDEFACT says. */
|
||||
static const short yytable[] =
|
||||
{
|
||||
%%table
|
||||
%%{table}
|
||||
};
|
||||
|
||||
static const short yycheck[] =
|
||||
{
|
||||
%%check
|
||||
%%{check}
|
||||
};
|
||||
|
||||
|
||||
@@ -419,7 +420,7 @@ int yydebug;
|
||||
|
||||
/* YYINITDEPTH -- initial size of the parser's stacks. */
|
||||
#ifndef YYINITDEPTH
|
||||
# define YYINITDEPTH %%initdepth
|
||||
# define YYINITDEPTH %%{initdepth}
|
||||
#endif
|
||||
|
||||
/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
|
||||
@@ -434,7 +435,7 @@ int yydebug;
|
||||
#endif
|
||||
|
||||
#ifndef YYMAXDEPTH
|
||||
# define YYMAXDEPTH %%maxdepth
|
||||
# define YYMAXDEPTH %%{maxdepth}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -903,11 +904,11 @@ yyreduce:
|
||||
#endif
|
||||
switch (yyn)
|
||||
{
|
||||
%%actions
|
||||
%%{actions}
|
||||
}
|
||||
|
||||
/* Line %%skeleton-line of %%skeleton. */
|
||||
#line %%line "%%parser-file-name"
|
||||
/* Line %%{skeleton-line} of %%{skeleton}. */
|
||||
#line %%{line} "%%{parser-file-name}"
|
||||
|
||||
yyvsp -= yylen;
|
||||
yyssp -= yylen;
|
||||
@@ -1138,4 +1139,4 @@ yyreturn:
|
||||
return yyresult;
|
||||
}
|
||||
|
||||
%%epilogue
|
||||
%%{epilogue}
|
||||
|
||||
Reference in New Issue
Block a user