B #3578: Update parsers

This commit is contained in:
Ruben S. Montero committed 2019-09-03 16:53:57 +02:00
1 parent 296cb5e41a
commit 90c83c41aa
2 files changed
+167 -126

No files matched your search

+156 -118
View File
@@ -1,8 +1,9 @@
/* A Bison parser, made by GNU Bison 3.1. */
/* A Bison parser, made by GNU Bison 3.4.1. */
/* Bison implementation for Yacc-like parsers in C
Copyright (C) 1984, 1989-1990, 2000-2015, 2018 Free Software Foundation, Inc.
Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2019 Free Software Foundation,
Inc.
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
@@ -40,11 +41,14 @@
define necessary library symbols; they are noted "INFRINGES ON
USER NAME SPACE" below. */
/* Undocumented macros, especially those whose name start with YY_,
are private implementation details. Do not rely on them. */
/* Identify Bison output. */
#define YYBISON 1
/* Bison version. */
#define YYBISON_VERSION "3.1"
#define YYBISON_VERSION "3.4.1"
/* Skeleton name. */
#define YYSKELETON_NAME "yacc.c"
@@ -67,8 +71,8 @@
#define yynerrs vm_var_nerrs
/* Copy the first part of user declarations. */
#line 39 "vm_var_syntax.y" /* yacc.c:339 */
/* First part of user prologue. */
#line 39 "vm_var_syntax.y"
#include "vm_var_syntax.h"
#include "vm_var_parser.h"
@@ -224,10 +228,38 @@ void get_network_attribute(VirtualMachine * vm,
}
}
if (vnet_id == -1)
vector<const VectorAttribute *> alias;
int alias_num = vm->get_template_attribute("NIC_ALIAS", alias);
if (vnet_id == -1 && alias_num == 0)
{
return;
}
else
{
for (int i=0; i < alias_num ;i++)
{
if ( alias[i]->vector_value(net_name.c_str()) == net_value )
{
if (alias[i]->vector_value("NETWORK_ID", vnet_id) != 0)
{
vnet_id = -1;
}
if (alias[i]->vector_value("AR_ID", ar_id) != 0)
{
vnet_id = -1;
}
break;
}
}
if (vnet_id == -1)
{
return;
}
}
// ----------------------------------------------
// Get the attribute template from the image
@@ -424,13 +456,17 @@ void insert_vector(VirtualMachine * vm,
/* -------------------------------------------------------------------------- */
#line 428 "vm_var_syntax.cc" /* yacc.c:339 */
#line 460 "vm_var_syntax.cc"
# ifndef YY_NULLPTR
# if defined __cplusplus && 201103L <= __cplusplus
# define YY_NULLPTR nullptr
# if defined __cplusplus
# if 201103L <= __cplusplus
# define YY_NULLPTR nullptr
# else
# define YY_NULLPTR 0
# endif
# else
# define YY_NULLPTR 0
# define YY_NULLPTR ((void*)0)
# endif
# endif
@@ -442,8 +478,8 @@ void insert_vector(VirtualMachine * vm,
# define YYERROR_VERBOSE 0
#endif
/* In a future release of Bison, this section will be replaced
by #include "vm_var_syntax.hh". */
/* Use api.header.include to #include this header
instead of duplicating it here. */
#ifndef YY_VM_VAR_VM_VAR_SYNTAX_HH_INCLUDED
# define YY_VM_VAR_VM_VAR_SYNTAX_HH_INCLUDED
/* Debug traces. */
@@ -454,7 +490,7 @@ void insert_vector(VirtualMachine * vm,
extern int vm_var_debug;
#endif
/* "%code requires" blocks. */
#line 17 "vm_var_syntax.y" /* yacc.c:355 */
#line 17 "vm_var_syntax.y"
#include <iostream>
#include <sstream>
@@ -476,7 +512,7 @@ typedef void * yyscan_t;
int vm_var_parse (VirtualMachine * vm, ostringstream * parsed, char ** errmsg,
yyscan_t scanner);
#line 480 "vm_var_syntax.cc" /* yacc.c:355 */
#line 516 "vm_var_syntax.cc"
/* Token type. */
#ifndef YYTOKENTYPE
@@ -497,18 +533,17 @@ int vm_var_parse (VirtualMachine * vm, ostringstream * parsed, char ** errmsg,
/* Value type. */
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
union YYSTYPE
{
#line 404 "vm_var_syntax.y" /* yacc.c:355 */
#line 432 "vm_var_syntax.y"
char * val_str;
int val_int;
char val_char;
#line 510 "vm_var_syntax.cc" /* yacc.c:355 */
};
#line 545 "vm_var_syntax.cc"
};
typedef union YYSTYPE YYSTYPE;
# define YYSTYPE_IS_TRIVIAL 1
# define YYSTYPE_IS_DECLARED 1
@@ -534,9 +569,7 @@ int vm_var_parse (mem_collector * mc, VirtualMachine * vm, ostringstream * parse
#endif /* !YY_VM_VAR_VM_VAR_SYNTAX_HH_INCLUDED */
/* Copy the second part of user declarations. */
#line 540 "vm_var_syntax.cc" /* yacc.c:358 */
#ifdef short
# undef short
@@ -611,15 +644,6 @@ typedef short yytype_int16;
# define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__))
#endif
#if !defined _Noreturn \
&& (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112)
# if defined _MSC_VER && 1200 <= _MSC_VER
# define _Noreturn __declspec (noreturn)
# else
# define _Noreturn YY_ATTRIBUTE ((__noreturn__))
# endif
#endif
/* Suppress unused-variable warnings by "using" E. */
#if ! defined lint || defined __GNUC__
# define YYUSE(E) ((void) (E))
@@ -647,6 +671,8 @@ typedef short yytype_int16;
#endif
#define YY_ASSERT(E) ((void) (0 && (E)))
#if ! defined yyoverflow || YYERROR_VERBOSE
/* The parser invokes alloca or malloc; define the necessary symbols. */
@@ -791,16 +817,16 @@ union yyalloc
/* YYNSTATES -- Number of states. */
#define YYNSTATES 18
/* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned
by yylex, with out-of-bounds checking. */
#define YYUNDEFTOK 2
#define YYMAXUTOK 266
/* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM
as returned by yylex, with out-of-bounds checking. */
#define YYTRANSLATE(YYX) \
((unsigned) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
/* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
as returned by yylex, without out-of-bounds checking. */
as returned by yylex. */
static const yytype_uint8 yytranslate[] =
{
0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
@@ -836,7 +862,7 @@ static const yytype_uint8 yytranslate[] =
/* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
static const yytype_uint16 yyrline[] =
{
0, 428, 428, 429, 432, 436, 449, 464
0, 456, 456, 457, 460, 464, 477, 492
};
#endif
@@ -948,22 +974,22 @@ static const yytype_uint8 yyr2[] =
#define YYRECOVERING() (!!yyerrstatus)
#define YYBACKUP(Token, Value) \
do \
if (yychar == YYEMPTY) \
{ \
yychar = (Token); \
yylval = (Value); \
YYPOPSTACK (yylen); \
yystate = *yyssp; \
goto yybackup; \
} \
else \
{ \
yyerror (&yylloc, mc, vm, parsed, errmsg, scanner, YY_("syntax error: cannot back up")); \
YYERROR; \
} \
while (0)
#define YYBACKUP(Token, Value) \
do \
if (yychar == YYEMPTY) \
{ \
yychar = (Token); \
yylval = (Value); \
YYPOPSTACK (yylen); \
yystate = *yyssp; \
goto yybackup; \
} \
else \
{ \
yyerror (&yylloc, mc, vm, parsed, errmsg, scanner, YY_("syntax error: cannot back up")); \
YYERROR; \
} \
while (0)
/* Error token number */
#define YYTERROR 1
@@ -1022,10 +1048,10 @@ do { \
/* Print *YYLOCP on YYO. Private, do not rely on its existence. */
YY_ATTRIBUTE_UNUSED
static unsigned
static int
yy_location_print_ (FILE *yyo, YYLTYPE const * const yylocp)
{
unsigned res = 0;
int res = 0;
int end_col = 0 != yylocp->last_column ? yylocp->last_column - 1 : 0;
if (0 <= yylocp->first_line)
{
@@ -1068,15 +1094,15 @@ do { \
} while (0)
/*----------------------------------------.
| Print this symbol's value on YYOUTPUT. |
`----------------------------------------*/
/*-----------------------------------.
| Print this symbol's value on YYO. |
`-----------------------------------*/
static void
yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp, mem_collector * mc, VirtualMachine * vm, ostringstream * parsed, char ** errmsg, yyscan_t scanner)
yy_symbol_value_print (FILE *yyo, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp, mem_collector * mc, VirtualMachine * vm, ostringstream * parsed, char ** errmsg, yyscan_t scanner)
{
FILE *yyo = yyoutput;
YYUSE (yyo);
FILE *yyoutput = yyo;
YYUSE (yyoutput);
YYUSE (yylocationp);
YYUSE (mc);
YYUSE (vm);
@@ -1087,26 +1113,26 @@ yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvalue
return;
# ifdef YYPRINT
if (yytype < YYNTOKENS)
YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
YYPRINT (yyo, yytoknum[yytype], *yyvaluep);
# endif
YYUSE (yytype);
}
/*--------------------------------.
| Print this symbol on YYOUTPUT. |
`--------------------------------*/
/*---------------------------.
| Print this symbol on YYO. |
`---------------------------*/
static void
yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp, mem_collector * mc, VirtualMachine * vm, ostringstream * parsed, char ** errmsg, yyscan_t scanner)
yy_symbol_print (FILE *yyo, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp, mem_collector * mc, VirtualMachine * vm, ostringstream * parsed, char ** errmsg, yyscan_t scanner)
{
YYFPRINTF (yyoutput, "%s %s (",
YYFPRINTF (yyo, "%s %s (",
yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]);
YY_LOCATION_PRINT (yyoutput, *yylocationp);
YYFPRINTF (yyoutput, ": ");
yy_symbol_value_print (yyoutput, yytype, yyvaluep, yylocationp, mc, vm, parsed, errmsg, scanner);
YYFPRINTF (yyoutput, ")");
YY_LOCATION_PRINT (yyo, *yylocationp);
YYFPRINTF (yyo, ": ");
yy_symbol_value_print (yyo, yytype, yyvaluep, yylocationp, mc, vm, parsed, errmsg, scanner);
YYFPRINTF (yyo, ")");
}
/*------------------------------------------------------------------.
@@ -1151,7 +1177,7 @@ yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, YYLTYPE *yylsp, int yyrule
YYFPRINTF (stderr, " $%d = ", yyi + 1);
yy_symbol_print (stderr,
yystos[yyssp[yyi + 1 - yynrhs]],
&(yyvsp[(yyi + 1) - (yynrhs)])
&yyvsp[(yyi + 1) - (yynrhs)]
, &(yylsp[(yyi + 1) - (yynrhs)]) , mc, vm, parsed, errmsg, scanner);
YYFPRINTF (stderr, "\n");
}
@@ -1255,7 +1281,10 @@ yytnamerr (char *yyres, const char *yystr)
case '\\':
if (*++yyp != '\\')
goto do_not_strip_quotes;
/* Fall through. */
else
goto append;
append:
default:
if (yyres)
yyres[yyn] = *yyp;
@@ -1273,7 +1302,7 @@ yytnamerr (char *yyres, const char *yystr)
if (! yyres)
return yystrlen (yystr);
return yystpcpy (yyres, yystr) - yyres;
return (YYSIZE_T) (yystpcpy (yyres, yystr) - yyres);
}
# endif
@@ -1351,10 +1380,10 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
yyarg[yycount++] = yytname[yyx];
{
YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]);
if (! (yysize <= yysize1
&& yysize1 <= YYSTACK_ALLOC_MAXIMUM))
if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)
yysize = yysize1;
else
return 2;
yysize = yysize1;
}
}
}
@@ -1378,9 +1407,10 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
{
YYSIZE_T yysize1 = yysize + yystrlen (yyformat);
if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)
yysize = yysize1;
else
return 2;
yysize = yysize1;
}
if (*yymsg_alloc < yysize)
@@ -1536,23 +1566,33 @@ YYLTYPE yylloc = yyloc_default;
yylsp[0] = yylloc;
goto yysetstate;
/*------------------------------------------------------------.
| yynewstate -- Push a new state, which is found in yystate. |
| yynewstate -- push a new state, which is found in yystate. |
`------------------------------------------------------------*/
yynewstate:
yynewstate:
/* In all cases, when you get here, the value and location stacks
have just been pushed. So pushing a state here evens the stacks. */
yyssp++;
yysetstate:
*yyssp = yystate;
/*--------------------------------------------------------------------.
| yynewstate -- set current state (the top of the stack) to yystate. |
`--------------------------------------------------------------------*/
yysetstate:
YYDPRINTF ((stderr, "Entering state %d\n", yystate));
YY_ASSERT (0 <= yystate && yystate < YYNSTATES);
*yyssp = (yytype_int16) yystate;
if (yyss + yystacksize - 1 <= yyssp)
#if !defined yyoverflow && !defined YYSTACK_RELOCATE
goto yyexhaustedlab;
#else
{
/* Get the current used size of the three stacks, in elements. */
YYSIZE_T yysize = yyssp - yyss + 1;
YYSIZE_T yysize = (YYSIZE_T) (yyssp - yyss + 1);
#ifdef yyoverflow
# if defined yyoverflow
{
/* Give user a chance to reallocate the stack. Use copies of
these so that the &'s don't force the real ones into
@@ -1570,15 +1610,11 @@ YYLTYPE yylloc = yyloc_default;
&yyvs1, yysize * sizeof (*yyvsp),
&yyls1, yysize * sizeof (*yylsp),
&yystacksize);
yyls = yyls1;
yyss = yyss1;
yyvs = yyvs1;
yyls = yyls1;
}
#else /* no yyoverflow */
# ifndef YYSTACK_RELOCATE
goto yyexhaustedlab;
# else
# else /* defined YYSTACK_RELOCATE */
/* Extend the stack our own way. */
if (YYMAXDEPTH <= yystacksize)
goto yyexhaustedlab;
@@ -1595,12 +1631,11 @@ YYLTYPE yylloc = yyloc_default;
YYSTACK_RELOCATE (yyss_alloc, yyss);
YYSTACK_RELOCATE (yyvs_alloc, yyvs);
YYSTACK_RELOCATE (yyls_alloc, yyls);
# undef YYSTACK_RELOCATE
# undef YYSTACK_RELOCATE
if (yyss1 != yyssa)
YYSTACK_FREE (yyss1);
}
# endif
#endif /* no yyoverflow */
yyssp = yyss + yysize - 1;
yyvsp = yyvs + yysize - 1;
@@ -1612,19 +1647,18 @@ YYLTYPE yylloc = yyloc_default;
if (yyss + yystacksize - 1 <= yyssp)
YYABORT;
}
YYDPRINTF ((stderr, "Entering state %d\n", yystate));
#endif /* !defined yyoverflow && !defined YYSTACK_RELOCATE */
if (yystate == YYFINAL)
YYACCEPT;
goto yybackup;
/*-----------.
| yybackup. |
`-----------*/
yybackup:
/* Do appropriate processing given the current state. Read a
lookahead token if we need one and don't already have one. */
@@ -1697,7 +1731,7 @@ yydefault:
/*-----------------------------.
| yyreduce -- Do a reduction. |
| yyreduce -- do a reduction. |
`-----------------------------*/
yyreduce:
/* yyn is the number of a rule to reduce with. */
@@ -1719,16 +1753,16 @@ yyreduce:
YY_REDUCE_PRINT (yyn);
switch (yyn)
{
case 4:
#line 433 "vm_var_syntax.y" /* yacc.c:1651 */
case 4:
#line 461 "vm_var_syntax.y"
{
(*parsed) << (yyvsp[0].val_str);
}
#line 1728 "vm_var_syntax.cc" /* yacc.c:1651 */
#line 1762 "vm_var_syntax.cc"
break;
case 5:
#line 437 "vm_var_syntax.y" /* yacc.c:1651 */
#line 465 "vm_var_syntax.y"
{
string name((yyvsp[-1].val_str));
@@ -1741,11 +1775,11 @@ yyreduce:
(*parsed) << (yyvsp[0].val_char);
}
}
#line 1745 "vm_var_syntax.cc" /* yacc.c:1651 */
#line 1779 "vm_var_syntax.cc"
break;
case 6:
#line 450 "vm_var_syntax.y" /* yacc.c:1651 */
#line 478 "vm_var_syntax.y"
{
string name((yyvsp[-4].val_str));
string vname((yyvsp[-2].val_str));
@@ -1760,11 +1794,11 @@ yyreduce:
(*parsed) << (yyvsp[0].val_char);
}
}
#line 1764 "vm_var_syntax.cc" /* yacc.c:1651 */
#line 1798 "vm_var_syntax.cc"
break;
case 7:
#line 465 "vm_var_syntax.y" /* yacc.c:1651 */
#line 493 "vm_var_syntax.y"
{
string name((yyvsp[-8].val_str));
string vname((yyvsp[-6].val_str));
@@ -1782,11 +1816,12 @@ yyreduce:
(*parsed) << (yyvsp[0].val_char);
}
}
#line 1786 "vm_var_syntax.cc" /* yacc.c:1651 */
#line 1820 "vm_var_syntax.cc"
break;
#line 1790 "vm_var_syntax.cc" /* yacc.c:1651 */
#line 1824 "vm_var_syntax.cc"
default: break;
}
/* User semantic actions sometimes alter yychar, and that requires
@@ -1812,14 +1847,13 @@ yyreduce:
/* 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. */
yyn = yyr1[yyn];
yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
yystate = yytable[yystate];
else
yystate = yydefgoto[yyn - YYNTOKENS];
{
const int yylhs = yyr1[yyn] - YYNTOKENS;
const int yyi = yypgoto[yylhs] + *yyssp;
yystate = (0 <= yyi && yyi <= YYLAST && yycheck[yyi] == *yyssp
? yytable[yyi]
: yydefgoto[yylhs]);
}
goto yynewstate;
@@ -1902,12 +1936,10 @@ yyerrlab:
| yyerrorlab -- error raised explicitly by YYERROR. |
`---------------------------------------------------*/
yyerrorlab:
/* Pacify compilers like GCC when the user code never invokes
YYERROR and the label yyerrorlab therefore never appears in user
code. */
if (/*CONSTCOND*/ 0)
goto yyerrorlab;
/* Pacify compilers when the user code never invokes YYERROR and the
label yyerrorlab therefore never appears in user code. */
if (0)
YYERROR;
/* Do not reclaim the symbols of the rule whose action triggered
this YYERROR. */
@@ -1974,6 +2006,7 @@ yyacceptlab:
yyresult = 0;
goto yyreturn;
/*-----------------------------------.
| yyabortlab -- YYABORT comes here. |
`-----------------------------------*/
@@ -1981,6 +2014,7 @@ yyabortlab:
yyresult = 1;
goto yyreturn;
#if !defined yyoverflow || YYERROR_VERBOSE
/*-------------------------------------------------.
| yyexhaustedlab -- memory exhaustion comes here. |
@@ -1991,6 +2025,10 @@ yyexhaustedlab:
/* Fall through. */
#endif
/*-----------------------------------------------------.
| yyreturn -- parsing is finished, return the result. |
`-----------------------------------------------------*/
yyreturn:
if (yychar != YYEMPTY)
{
@@ -2020,7 +2058,7 @@ yyreturn:
#endif
return yyresult;
}
#line 483 "vm_var_syntax.y" /* yacc.c:1910 */
#line 511 "vm_var_syntax.y"
void vm_var_error(
+11 -8
View File
@@ -1,8 +1,9 @@
/* A Bison parser, made by GNU Bison 3.1. */
/* A Bison parser, made by GNU Bison 3.4.1. */
/* Bison interface for Yacc-like parsers in C
Copyright (C) 1984, 1989-1990, 2000-2015, 2018 Free Software Foundation, Inc.
Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2019 Free Software Foundation,
Inc.
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
@@ -30,6 +31,9 @@
This special exception was added by the Free Software Foundation in
version 2.2 of Bison. */
/* Undocumented macros, especially those whose name start with YY_,
are private implementation details. Do not rely on them. */
#ifndef YY_VM_VAR_VM_VAR_SYNTAX_HH_INCLUDED
# define YY_VM_VAR_VM_VAR_SYNTAX_HH_INCLUDED
/* Debug traces. */
@@ -40,7 +44,7 @@
extern int vm_var_debug;
#endif
/* "%code requires" blocks. */
#line 17 "vm_var_syntax.y" /* yacc.c:1913 */
#line 17 "vm_var_syntax.y"
#include <iostream>
#include <sstream>
@@ -62,7 +66,7 @@ typedef void * yyscan_t;
int vm_var_parse (VirtualMachine * vm, ostringstream * parsed, char ** errmsg,
yyscan_t scanner);
#line 66 "vm_var_syntax.hh" /* yacc.c:1913 */
#line 70 "vm_var_syntax.hh"
/* Token type. */
#ifndef YYTOKENTYPE
@@ -83,18 +87,17 @@ int vm_var_parse (VirtualMachine * vm, ostringstream * parsed, char ** errmsg,
/* Value type. */
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
union YYSTYPE
{
#line 404 "vm_var_syntax.y" /* yacc.c:1913 */
#line 432 "vm_var_syntax.y"
char * val_str;
int val_int;
char val_char;
#line 96 "vm_var_syntax.hh" /* yacc.c:1913 */
};
#line 99 "vm_var_syntax.hh"
};
typedef union YYSTYPE YYSTYPE;
# define YYSTYPE_IS_TRIVIAL 1
# define YYSTYPE_IS_DECLARED 1