summaryrefslogtreecommitdiff
path: root/cpp/demo/book/evictor_filesystem/Grammar.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/demo/book/evictor_filesystem/Grammar.cpp')
-rw-r--r--cpp/demo/book/evictor_filesystem/Grammar.cpp319
1 files changed, 175 insertions, 144 deletions
diff --git a/cpp/demo/book/evictor_filesystem/Grammar.cpp b/cpp/demo/book/evictor_filesystem/Grammar.cpp
index 2104fad405b..e6a9689518e 100644
--- a/cpp/demo/book/evictor_filesystem/Grammar.cpp
+++ b/cpp/demo/book/evictor_filesystem/Grammar.cpp
@@ -1,24 +1,23 @@
-/* A Bison parser, made by GNU Bison 2.3. */
-/* Skeleton implementation for Bison's Yacc-like parsers in C
+/* A Bison parser, made by GNU Bison 2.4.1. */
- Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
+/* Skeleton implementation for Bison's Yacc-like parsers in C
+
+ Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
+
+ This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
-
+
You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA. */
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* As a special exception, you may create a larger work that contains
part or all of the Bison parser skeleton and distribute that work
@@ -29,7 +28,7 @@
special exception, which will cause the skeleton and the resulting
Bison output files to be licensed under the GNU General Public
License without this special exception.
-
+
This special exception was added by the Free Software Foundation in
version 2.2 of Bison. */
@@ -47,7 +46,7 @@
#define YYBISON 1
/* Bison version. */
-#define YYBISON_VERSION "2.3"
+#define YYBISON_VERSION "2.4.1"
/* Skeleton name. */
#define YYSKELETON_NAME "yacc.c"
@@ -55,49 +54,20 @@
/* Pure parsers. */
#define YYPURE 1
-/* Using locations. */
-#define YYLSP_NEEDED 0
-
-
+/* Push parsers. */
+#define YYPUSH 0
-/* Tokens. */
-#ifndef YYTOKENTYPE
-# define YYTOKENTYPE
- /* Put the tokens into the symbol table, so that GDB and other debuggers
- know about them. */
- enum yytokentype {
- TOK_HELP = 258,
- TOK_EXIT = 259,
- TOK_STRING = 260,
- TOK_LIST = 261,
- TOK_LIST_RECURSIVE = 262,
- TOK_CREATE_FILE = 263,
- TOK_CREATE_DIR = 264,
- TOK_PWD = 265,
- TOK_CD = 266,
- TOK_CAT = 267,
- TOK_WRITE = 268,
- TOK_RM = 269
- };
-#endif
-/* Tokens. */
-#define TOK_HELP 258
-#define TOK_EXIT 259
-#define TOK_STRING 260
-#define TOK_LIST 261
-#define TOK_LIST_RECURSIVE 262
-#define TOK_CREATE_FILE 263
-#define TOK_CREATE_DIR 264
-#define TOK_PWD 265
-#define TOK_CD 266
-#define TOK_CAT 267
-#define TOK_WRITE 268
-#define TOK_RM 269
+/* Pull parsers. */
+#define YYPULL 1
+/* Using locations. */
+#define YYLSP_NEEDED 0
/* Copy the first part of user declarations. */
+
+/* Line 189 of yacc.c */
#line 1 "Grammar.y"
@@ -130,6 +100,9 @@ yyerror(const char* s)
+/* Line 189 of yacc.c */
+#line 105 "Grammar.tab.c"
+
/* Enabling traces. */
#ifndef YYDEBUG
# define YYDEBUG 1
@@ -148,20 +121,43 @@ yyerror(const char* s)
# define YYTOKEN_TABLE 0
#endif
+
+/* Tokens. */
+#ifndef YYTOKENTYPE
+# define YYTOKENTYPE
+ /* Put the tokens into the symbol table, so that GDB and other debuggers
+ know about them. */
+ enum yytokentype {
+ TOK_HELP = 258,
+ TOK_EXIT = 259,
+ TOK_STRING = 260,
+ TOK_LIST = 261,
+ TOK_LIST_RECURSIVE = 262,
+ TOK_CREATE_FILE = 263,
+ TOK_CREATE_DIR = 264,
+ TOK_PWD = 265,
+ TOK_CD = 266,
+ TOK_CAT = 267,
+ TOK_WRITE = 268,
+ TOK_RM = 269
+ };
+#endif
+
+
+
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
typedef int YYSTYPE;
+# define YYSTYPE_IS_TRIVIAL 1
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
-# define YYSTYPE_IS_TRIVIAL 1
#endif
-
/* Copy the second part of user declarations. */
-/* Line 216 of yacc.c. */
-#line 165 "Grammar.tab.c"
+/* Line 264 of yacc.c */
+#line 161 "Grammar.tab.c"
#ifdef short
# undef short
@@ -236,14 +232,14 @@ typedef short int yytype_int16;
#if (defined __STDC__ || defined __C99__FUNC__ \
|| defined __cplusplus || defined _MSC_VER)
static int
-YYID (int i)
+YYID (int yyi)
#else
static int
-YYID (i)
- int i;
+YYID (yyi)
+ int yyi;
#endif
{
- return i;
+ return yyi;
}
#endif
@@ -324,9 +320,9 @@ void free (void *); /* INFRINGES ON USER NAME SPACE */
/* A type that is properly aligned for any stack member. */
union yyalloc
{
- yytype_int16 yyss;
- YYSTYPE yyvs;
- };
+ yytype_int16 yyss_alloc;
+ YYSTYPE yyvs_alloc;
+};
/* The size of the maximum gap between one aligned stack and the next. */
# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
@@ -360,12 +356,12 @@ union yyalloc
elements in the stack, and YYPTR gives the new location of the
stack. Advance YYPTR to a properly aligned location for the next
stack. */
-# define YYSTACK_RELOCATE(Stack) \
+# define YYSTACK_RELOCATE(Stack_alloc, Stack) \
do \
{ \
YYSIZE_T yynewbytes; \
- YYCOPY (&yyptr->Stack, Stack, yysize); \
- Stack = &yyptr->Stack; \
+ YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
+ Stack = &yyptr->Stack_alloc; \
yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
yyptr += yynewbytes / sizeof (*yyptr); \
} \
@@ -740,17 +736,20 @@ yy_symbol_print (yyoutput, yytype, yyvaluep)
#if (defined __STDC__ || defined __C99__FUNC__ \
|| defined __cplusplus || defined _MSC_VER)
static void
-yy_stack_print (yytype_int16 *bottom, yytype_int16 *top)
+yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
#else
static void
-yy_stack_print (bottom, top)
- yytype_int16 *bottom;
- yytype_int16 *top;
+yy_stack_print (yybottom, yytop)
+ yytype_int16 *yybottom;
+ yytype_int16 *yytop;
#endif
{
YYFPRINTF (stderr, "Stack now");
- for (; bottom <= top; ++bottom)
- YYFPRINTF (stderr, " %d", *bottom);
+ for (; yybottom <= yytop; yybottom++)
+ {
+ int yybot = *yybottom;
+ YYFPRINTF (stderr, " %d", yybot);
+ }
YYFPRINTF (stderr, "\n");
}
@@ -784,11 +783,11 @@ yy_reduce_print (yyvsp, yyrule)
/* The symbols being reduced. */
for (yyi = 0; yyi < yynrhs; yyi++)
{
- fprintf (stderr, " $%d = ", yyi + 1);
+ YYFPRINTF (stderr, " $%d = ", yyi + 1);
yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
&(yyvsp[(yyi + 1) - (yynrhs)])
);
- fprintf (stderr, "\n");
+ YYFPRINTF (stderr, "\n");
}
}
@@ -1068,10 +1067,8 @@ yydestruct (yymsg, yytype, yyvaluep)
break;
}
}
-
/* Prevent warnings from -Wmissing-prototypes. */
-
#ifdef YYPARSE_PARAM
#if defined __STDC__ || defined __cplusplus
int yyparse (void *YYPARSE_PARAM);
@@ -1090,10 +1087,9 @@ int yyparse ();
-
-/*----------.
-| yyparse. |
-`----------*/
+/*-------------------------.
+| yyparse or yypush_parse. |
+`-------------------------*/
#ifdef YYPARSE_PARAM
#if (defined __STDC__ || defined __C99__FUNC__ \
@@ -1117,74 +1113,75 @@ yyparse ()
#endif
#endif
{
- /* The look-ahead symbol. */
+/* The lookahead symbol. */
int yychar;
-/* The semantic value of the look-ahead symbol. */
+/* The semantic value of the lookahead symbol. */
YYSTYPE yylval;
-/* Number of syntax errors so far. */
-int yynerrs;
-
- int yystate;
- int yyn;
- int yyresult;
- /* Number of tokens to shift before error messages enabled. */
- int yyerrstatus;
- /* Look-ahead token as an internal (translated) token number. */
- int yytoken = 0;
-#if YYERROR_VERBOSE
- /* Buffer for error messages, and its allocated size. */
- char yymsgbuf[128];
- char *yymsg = yymsgbuf;
- YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
-#endif
-
- /* Three stacks and their tools:
- `yyss': related to states,
- `yyvs': related to semantic values,
- `yyls': related to locations.
+ /* Number of syntax errors so far. */
+ int yynerrs;
- Refer to the stacks thru separate pointers, to allow yyoverflow
- to reallocate them elsewhere. */
+ int yystate;
+ /* Number of tokens to shift before error messages enabled. */
+ int yyerrstatus;
- /* The state stack. */
- yytype_int16 yyssa[YYINITDEPTH];
- yytype_int16 *yyss = yyssa;
- yytype_int16 *yyssp;
+ /* The stacks and their tools:
+ `yyss': related to states.
+ `yyvs': related to semantic values.
- /* The semantic value stack. */
- YYSTYPE yyvsa[YYINITDEPTH];
- YYSTYPE *yyvs = yyvsa;
- YYSTYPE *yyvsp;
+ Refer to the stacks thru separate pointers, to allow yyoverflow
+ to reallocate them elsewhere. */
+ /* The state stack. */
+ yytype_int16 yyssa[YYINITDEPTH];
+ yytype_int16 *yyss;
+ yytype_int16 *yyssp;
+ /* The semantic value stack. */
+ YYSTYPE yyvsa[YYINITDEPTH];
+ YYSTYPE *yyvs;
+ YYSTYPE *yyvsp;
-#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
-
- YYSIZE_T yystacksize = YYINITDEPTH;
+ YYSIZE_T yystacksize;
+ int yyn;
+ int yyresult;
+ /* Lookahead token as an internal (translated) token number. */
+ int yytoken;
/* The variables used to return semantic value and location from the
action routines. */
YYSTYPE yyval;
+#if YYERROR_VERBOSE
+ /* Buffer for error messages, and its allocated size. */
+ char yymsgbuf[128];
+ char *yymsg = yymsgbuf;
+ YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
+#endif
+
+#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
/* The number of symbols on the RHS of the reduced rule.
Keep to zero when no symbol should be popped. */
int yylen = 0;
+ yytoken = 0;
+ yyss = yyssa;
+ yyvs = yyvsa;
+ yystacksize = YYINITDEPTH;
+
YYDPRINTF ((stderr, "Starting parse\n"));
yystate = 0;
yyerrstatus = 0;
yynerrs = 0;
- yychar = YYEMPTY; /* Cause a token to be read. */
+ yychar = YYEMPTY; /* Cause a token to be read. */
/* Initialize stack pointers.
Waste one element of value and location stack
so that they stay on the same level as the state stack.
The wasted elements are never initialized. */
-
yyssp = yyss;
yyvsp = yyvs;
@@ -1214,7 +1211,6 @@ int yynerrs;
YYSTYPE *yyvs1 = yyvs;
yytype_int16 *yyss1 = yyss;
-
/* Each stack pointer address is followed by the size of the
data in use in that stack, in bytes. This used to be a
conditional around just the two extra args, but that might
@@ -1222,7 +1218,6 @@ int yynerrs;
yyoverflow (YY_("memory exhausted"),
&yyss1, yysize * sizeof (*yyssp),
&yyvs1, yysize * sizeof (*yyvsp),
-
&yystacksize);
yyss = yyss1;
@@ -1245,9 +1240,8 @@ int yynerrs;
(union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
if (! yyptr)
goto yyexhaustedlab;
- YYSTACK_RELOCATE (yyss);
- YYSTACK_RELOCATE (yyvs);
-
+ YYSTACK_RELOCATE (yyss_alloc, yyss);
+ YYSTACK_RELOCATE (yyvs_alloc, yyvs);
# undef YYSTACK_RELOCATE
if (yyss1 != yyssa)
YYSTACK_FREE (yyss1);
@@ -1258,7 +1252,6 @@ int yynerrs;
yyssp = yyss + yysize - 1;
yyvsp = yyvs + yysize - 1;
-
YYDPRINTF ((stderr, "Stack size increased to %lu\n",
(unsigned long int) yystacksize));
@@ -1268,6 +1261,9 @@ int yynerrs;
YYDPRINTF ((stderr, "Entering state %d\n", yystate));
+ if (yystate == YYFINAL)
+ YYACCEPT;
+
goto yybackup;
/*-----------.
@@ -1276,16 +1272,16 @@ int yynerrs;
yybackup:
/* Do appropriate processing given the current state. Read a
- look-ahead token if we need one and don't already have one. */
+ lookahead token if we need one and don't already have one. */
- /* First try to decide what to do without reference to look-ahead token. */
+ /* First try to decide what to do without reference to lookahead token. */
yyn = yypact[yystate];
if (yyn == YYPACT_NINF)
goto yydefault;
- /* Not known => get a look-ahead token if don't already have one. */
+ /* Not known => get a lookahead token if don't already have one. */
- /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */
+ /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
if (yychar == YYEMPTY)
{
YYDPRINTF ((stderr, "Reading a token: "));
@@ -1317,20 +1313,16 @@ yybackup:
goto yyreduce;
}
- if (yyn == YYFINAL)
- YYACCEPT;
-
/* Count tokens shifted since error; after three, turn off error
status. */
if (yyerrstatus)
yyerrstatus--;
- /* Shift the look-ahead token. */
+ /* Shift the lookahead token. */
YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
- /* Discard the shifted token unless it is eof. */
- if (yychar != YYEOF)
- yychar = YYEMPTY;
+ /* Discard the shifted token. */
+ yychar = YYEMPTY;
yystate = yyn;
*++yyvsp = yylval;
@@ -1370,30 +1362,40 @@ yyreduce:
switch (yyn)
{
case 2:
+
+/* Line 1455 of yacc.c */
#line 53 "Grammar.y"
{
;}
break;
case 3:
+
+/* Line 1455 of yacc.c */
#line 56 "Grammar.y"
{
;}
break;
case 4:
+
+/* Line 1455 of yacc.c */
#line 64 "Grammar.y"
{
;}
break;
case 5:
+
+/* Line 1455 of yacc.c */
#line 67 "Grammar.y"
{
;}
break;
case 6:
+
+/* Line 1455 of yacc.c */
#line 75 "Grammar.y"
{
parser->usage();
@@ -1401,6 +1403,8 @@ yyreduce:
break;
case 7:
+
+/* Line 1455 of yacc.c */
#line 79 "Grammar.y"
{
return 0;
@@ -1408,6 +1412,8 @@ yyreduce:
break;
case 8:
+
+/* Line 1455 of yacc.c */
#line 83 "Grammar.y"
{
parser->list(false);
@@ -1415,6 +1421,8 @@ yyreduce:
break;
case 9:
+
+/* Line 1455 of yacc.c */
#line 87 "Grammar.y"
{
parser->list(true);
@@ -1422,6 +1430,8 @@ yyreduce:
break;
case 10:
+
+/* Line 1455 of yacc.c */
#line 91 "Grammar.y"
{
parser->createFile((yyvsp[(2) - (2)]));
@@ -1429,6 +1439,8 @@ yyreduce:
break;
case 11:
+
+/* Line 1455 of yacc.c */
#line 95 "Grammar.y"
{
parser->createDir((yyvsp[(2) - (2)]));
@@ -1436,6 +1448,8 @@ yyreduce:
break;
case 12:
+
+/* Line 1455 of yacc.c */
#line 99 "Grammar.y"
{
parser->pwd();
@@ -1443,6 +1457,8 @@ yyreduce:
break;
case 13:
+
+/* Line 1455 of yacc.c */
#line 103 "Grammar.y"
{
parser->cd("/");
@@ -1450,6 +1466,8 @@ yyreduce:
break;
case 14:
+
+/* Line 1455 of yacc.c */
#line 107 "Grammar.y"
{
parser->cd((yyvsp[(2) - (2)]).front());
@@ -1457,6 +1475,8 @@ yyreduce:
break;
case 15:
+
+/* Line 1455 of yacc.c */
#line 111 "Grammar.y"
{
parser->cat((yyvsp[(2) - (2)]).front());
@@ -1464,6 +1484,8 @@ yyreduce:
break;
case 16:
+
+/* Line 1455 of yacc.c */
#line 115 "Grammar.y"
{
parser->write((yyvsp[(2) - (2)]));
@@ -1471,6 +1493,8 @@ yyreduce:
break;
case 17:
+
+/* Line 1455 of yacc.c */
#line 119 "Grammar.y"
{
parser->destroy((yyvsp[(2) - (2)]));
@@ -1478,6 +1502,8 @@ yyreduce:
break;
case 18:
+
+/* Line 1455 of yacc.c */
#line 123 "Grammar.y"
{
parser->usage();
@@ -1486,12 +1512,16 @@ yyreduce:
break;
case 19:
+
+/* Line 1455 of yacc.c */
#line 128 "Grammar.y"
{
;}
break;
case 20:
+
+/* Line 1455 of yacc.c */
#line 136 "Grammar.y"
{
(yyval) = (yyvsp[(2) - (2)]);
@@ -1500,6 +1530,8 @@ yyreduce:
break;
case 21:
+
+/* Line 1455 of yacc.c */
#line 141 "Grammar.y"
{
(yyval) = (yyvsp[(1) - (1)]);
@@ -1507,8 +1539,9 @@ yyreduce:
break;
-/* Line 1267 of yacc.c. */
-#line 1512 "Grammar.tab.c"
+
+/* Line 1455 of yacc.c */
+#line 1545 "Grammar.tab.c"
default: break;
}
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
@@ -1519,7 +1552,6 @@ yyreduce:
*++yyvsp = yyval;
-
/* Now `shift' the result of the reduction. Determine what state
that goes to, based on the state we popped back to and the rule
number reduced by. */
@@ -1584,7 +1616,7 @@ yyerrlab:
if (yyerrstatus == 3)
{
- /* If just tried and failed to reuse look-ahead token after an
+ /* If just tried and failed to reuse lookahead token after an
error, discard it. */
if (yychar <= YYEOF)
@@ -1601,7 +1633,7 @@ yyerrlab:
}
}
- /* Else will try to reuse look-ahead token after shifting the error
+ /* Else will try to reuse lookahead token after shifting the error
token. */
goto yyerrlab1;
@@ -1658,9 +1690,6 @@ yyerrlab1:
YY_STACK_PRINT (yyss, yyssp);
}
- if (yyn == YYFINAL)
- YYACCEPT;
-
*++yyvsp = yylval;
@@ -1685,7 +1714,7 @@ yyabortlab:
yyresult = 1;
goto yyreturn;
-#ifndef yyoverflow
+#if !defined(yyoverflow) || YYERROR_VERBOSE
/*-------------------------------------------------.
| yyexhaustedlab -- memory exhaustion comes here. |
`-------------------------------------------------*/
@@ -1696,7 +1725,7 @@ yyexhaustedlab:
#endif
yyreturn:
- if (yychar != YYEOF && yychar != YYEMPTY)
+ if (yychar != YYEMPTY)
yydestruct ("Cleanup: discarding lookahead",
yytoken, &yylval);
/* Do not reclaim the symbols of the rule which action triggered
@@ -1722,6 +1751,8 @@ yyreturn:
}
+
+/* Line 1675 of yacc.c */
#line 146 "Grammar.y"