📄 parser.tab.c
字号:
goto yydefault;
yyn = yytable[yyn];
/* yyn is what to do for this token type in this state.
Negative => reduce, -yyn is rule number.
Positive => shift, yyn is new state.
New state is final state => don't bother to shift,
just return success.
0, or most negative number => error. */
if (yyn < 0)
{
if (yyn == YYFLAG)
goto yyerrlab;
yyn = -yyn;
goto yyreduce;
}
else if (yyn == 0)
goto yyerrlab;
if (yyn == YYFINAL)
YYACCEPT;
/* Shift the lookahead token. */
YYDPRINTF ((stderr, "Shifting token %d (%s), ",
yychar, yytname[yychar1]));
/* Discard the token being shifted unless it is eof. */
if (yychar != YYEOF)
yychar = YYEMPTY;
*++yyvsp = yylval;
#if YYLSP_NEEDED
*++yylsp = yylloc;
#endif
/* Count tokens shifted since error; after three, turn off error
status. */
if (yyerrstatus)
yyerrstatus--;
yystate = yyn;
goto yynewstate;
/*-----------------------------------------------------------.
| yydefault -- do the default action for the current state. |
`-----------------------------------------------------------*/
yydefault:
yyn = yydefact[yystate];
if (yyn == 0)
goto yyerrlab;
goto yyreduce;
/*-----------------------------.
| yyreduce -- Do a reduction. |
`-----------------------------*/
yyreduce:
/* yyn is the number of a rule to reduce with. */
yylen = yyr2[yyn];
/* If YYLEN is nonzero, implement the default value of the action:
`$$ = $1'.
Otherwise, the following line sets YYVAL to the semantic value of
the lookahead token. This behavior is undocumented and Bison
users should not rely upon it. Assigning to YYVAL
unconditionally makes the parser a bit smaller, and it avoids a
GCC warning that YYVAL may be used uninitialized. */
yyval = yyvsp[1-yylen];
#if YYLSP_NEEDED
/* Similarly for the default location. Let the user run additional
commands if for instance locations are ranges. */
yyloc = yylsp[1-yylen];
YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen);
#endif
#if YYDEBUG
/* We have to keep this `#if YYDEBUG', since we use variables which
are defined only if `YYDEBUG' is set. */
if (yydebug)
{
int yyi;
YYFPRINTF (stderr, "Reducing via rule %d (line %d), ",
yyn, yyrline[yyn]);
/* Print the symbols being reduced, and their result. */
for (yyi = yyprhs[yyn]; yyrhs[yyi] > 0; yyi++)
YYFPRINTF (stderr, "%s ", yytname[yyrhs[yyi]]);
YYFPRINTF (stderr, " -> %s\n", yytname[yyr1[yyn]]);
}
#endif
switch (yyn) {
case 3:
#line 127 "parser.y"
{ exit(1); ;
break;}
case 9:
#line 135 "parser.y"
{ config->NT = yyvsp[0].integer; ;
break;}
case 10:
#line 136 "parser.y"
{ config->seed = (long)yyvsp[0].integer; ;
break;}
case 11:
#line 137 "parser.y"
{ strncpy(config->segFile, yyvsp[0].string, FILENMLEN); ;
break;}
case 12:
#line 138 "parser.y"
{ config->frequency = yyvsp[0].real; ;
break;}
case 13:
#line 139 "parser.y"
{ config->v0 = yyvsp[0].real; ;
break;}
case 14:
#line 140 "parser.y"
{ config->Tmin = yyvsp[0].real; ;
break;}
case 15:
#line 141 "parser.y"
{ config->stepT = yyvsp[0].real; ;
break;}
case 16:
#line 142 "parser.y"
{ config->nTstep = (int)yyvsp[0].real; ;
break;}
case 17:
#line 143 "parser.y"
{ config->Ixmin=(yyvsp[0].ipointer)[0]; config->Ixmax=(yyvsp[0].ipointer)[1]; ;
break;}
case 18:
#line 144 "parser.y"
{ config->Iymin=(yyvsp[0].ipointer)[0]; config->Iymax=(yyvsp[0].ipointer)[1]; ;
break;}
case 19:
#line 145 "parser.y"
{ config->Izmin=(yyvsp[0].ipointer)[0]; config->Izmax=(yyvsp[0].ipointer)[1]; ;
break;}
case 20:
#line 146 "parser.y"
{ config->xstep = yyvsp[0].real; ;
break;}
case 21:
#line 147 "parser.y"
{ config->ystep = yyvsp[0].real; ;
break;}
case 22:
#line 148 "parser.y"
{ config->zstep = yyvsp[0].real; ;
break;}
case 23:
#line 149 "parser.y"
{ config->nxstep=(int)yyvsp[0].real; ;
break;}
case 24:
#line 150 "parser.y"
{ config->nystep=(int)yyvsp[0].real; ;
break;}
case 25:
#line 151 "parser.y"
{ config->nzstep=(int)yyvsp[0].real; ;
break;}
case 27:
#line 154 "parser.y"
{ if (yyvsp[0].integer == 1)
printf("\t!Config set 2pt flag\n");
else
printf("\t!Config set no-2pt flag\n");
config->flags.gen_twopt = yyvsp[0].integer; ;
break;}
case 28:
#line 159 "parser.y"
{ if (yyvsp[0].integer == 1)
printf("\t!Config set src move flag\n");
else
printf("\t!Config set no-src move flag\n");
config->flags.source_move = yyvsp[0].integer; ;
break;}
case 29:
#line 164 "parser.y"
{ if (yyvsp[0].integer == 1)
printf("\t!Config set det move flag\n");
else
printf("\t!Config set no-det move flag\n");
config->flags.detector_move = yyvsp[0].integer; ;
break;}
case 30:
#line 169 "parser.y"
{ if (yyvsp[0].integer == 1)
printf("\t!Config set exit move flag\n");
else
printf("\t!Config set no-exit move flag\n");
config->flags.exiting_move = yyvsp[0].integer; ;
break;}
case 31:
#line 174 "parser.y"
{ if (yyvsp[0].integer == 1)
printf("\t!Config set exit time flag\n");
else
printf("\t!Config set exit bin flag\n");
config->flags.exact_exit_time = yyvsp[0].integer; ;
break;}
case 32:
#line 179 "parser.y"
{ if (yyvsp[0].integer == 1)
printf("\t!Config set matlab order flag\n");
else
printf("\t!Config set C order flag\n");
config->flags.matlab_order = yyvsp[0].integer; ;
break;}
case 33:
#line 184 "parser.y"
{ if (yyvsp[0].integer == 1)
printf("\t!Config set mirror BC flag\n");
else
printf("\t!Config set no-mirror BC flag\n");
config->flags.mirror = yyvsp[0].integer; ;
break;}
case 34:
#line 190 "parser.y"
{ tmpmus = -1; tmpmua = -1;
tmpn = -1; tmpg = -1; ;
break;}
case 36:
#line 193 "parser.y"
{ if ((tmpmus == -1) || (tmpmua == -1) ||
(tmpg == -1) || (tmpn == -1)) {
yyerror("Incompletely initialized tissue type\n");
YYABORT;
}
add_tissue(tmpmus, tmpmua, tmpg, tmpn);
;
break;}
case 37:
#line 202 "parser.y"
{ tmppos[0] = tmppos[1] = tmppos[2] = -998;
tmpdir[0] = tmpdir[1] = tmpdir[2] = 0.0;
tmprad = -1.0;
tmpna = 1.0; ;
break;}
case 39:
#line 207 "parser.y"
{ add_detector(tmppos, tmpdir, tmprad, tmpna);
tmprad = -1; ;
break;}
case 40:
#line 210 "parser.y"
{ tmppos[0] = tmppos[1] = tmppos[2] = -998;
tmpdir[0] = tmpdir[1] = tmpdir[2] = 0.0;
tmprad = 0.0;
tmpna = 0.0; ;
break;}
case 42:
#line 215 "parser.y"
{ add_source(tmppos, tmpdir, tmprad, tmpna);
tmprad = -1; ;
break;}
case 43:
#line 218 "parser.y"
{ tmpmus = yyvsp[0].real; ;
break;}
case 44:
#line 219 "parser.y"
{ tmpmua = yyvsp[0].real; ;
break;}
case 45:
#line 220 "parser.y"
{ tmpg = yyvsp[0].real; ;
break;}
case 46:
#line 221 "parser.y"
{ tmpn = yyvsp[0].real; ;
break;}
case 47:
#line 223 "parser.y"
{ tmprad = yyvsp[0].real; ;
break;}
case 48:
#line 224 "parser.y"
{ tmpna = yyvsp[0].real; ;
break;}
case 49:
#line 225 "parser.y"
{ memcpy(tmppos, (double *)yyvsp[0].rpointer, sizeof(tmppos));
free((double *)yyvsp[0].rpointer); ;
break;}
case 50:
#line 227 "parser.y"
{ memcpy(tmpdir, (double *)yyvsp[0].rpointer, sizeof(tmpdir));
free((double *)yyvsp[0].rpointer); ;
break;}
case 51:
#line 230 "parser.y"
{
double *rvec = (double *)malloc(3*sizeof(double));
#if (HAVE_ASSERT_H)
assert(rvec != NULL);
#endif
rvec[0] = yyvsp[-3].real; rvec[1] = yyvsp[-2].real; rvec[2] = yyvsp[-1].real;
yyval.rpointer = rvec;
;
break;}
case 52:
#line 240 "parser.y"
{
static int drange[2];
drange[0] = yyvsp[-1].integer; drange[1] = yyvsp[0].integer;
yyval.ipointer = drange;
;
break;}
case 53:
#line 247 "parser.y"
{ if (yyvsp[0].integer == 0) /* Boolean from integer */
{ yyval.integer = 0; }
else
{ yyval.integer = 1; } ;
break;}
case 54:
#line 252 "parser.y"
{ yyval.real = yyvsp[0].real; ;
break;}
case 55:
#line 253 "parser.y"
{ yyval.real = (double)yyvsp[0].integer; /* type promotion */ ;
break;}
}
#line 705 "/usr/share/bison/bison.simple"
yyvsp -= yylen;
yyssp -= yylen;
#if YYLSP_NEEDED
yylsp -= yylen;
#endif
#if YYDEBUG
if (yydebug)
{
short *yyssp1 = yyss - 1;
YYFPRINTF (stderr, "state stack now");
while (yyssp1 != yyssp)
YYFPRINTF (stderr, " %d", *++yyssp1);
YYFPRINTF (stderr, "\n");
}
#endif
*++yyvsp = yyval;
#if YYLSP_NEEDED
*++yylsp = yyloc;
#endif
/* 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 - YYNTBASE] + *yyssp;
if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
yystate = yytable[yystate];
else
yystate = yydefgoto[yyn - YYNTBASE];
goto yynewstate;
/*------------------------------------.
| yyerrlab -- here on detecting error |
`------------------------------------*/
yyerrlab:
/* If not already recovering from an error, report this error. */
if (!yyerrstatus)
{
++yynerrs;
#ifdef YYERROR_VERBOSE
yyn = yypact[yystate];
if (yyn > YYFLAG && yyn < YYLAST)
{
YYSIZE_T yysize = 0;
char *yymsg;
int yyx, yycount;
yycount = 0;
/* Start YYX at -YYN if negative to avoid negative indexes in
YYCHECK. */
for (yyx = yyn < 0 ? -yyn : 0;
yyx < (int) (sizeof (yytname) / sizeof (char *)); yyx++)
if (yycheck[yyx + yyn] == yyx)
yysize += yystrlen (yytname[yyx]) + 15, yycount++;
yysize += yystrlen ("parse error, unexpected ") + 1;
yysize += yystrlen (yytname[YYTRANSLATE (yychar)]);
yymsg = (char *) YYSTACK_ALLOC (yysize);
if (yymsg != 0)
{
char *yyp = yystpcpy (yymsg, "parse error, unexpected ");
yyp = yystpcpy (yyp, yytname[YYTRANSLATE (yychar)]);
if (yycount < 5)
{
yycount = 0;
for (yyx = yyn < 0 ? -yyn : 0;
yyx < (int) (sizeof (yytname) / sizeof (char *));
yyx++)
if (yycheck[yyx + yyn] == yyx)
{
const char *yyq = ! yycount ? ", expecting " : " or ";
yyp = yystpcpy (yyp, yyq);
yyp = yystpcpy (yyp, yytname[yyx]);
yycount++;
}
}
yyerror (yymsg);
YYSTACK_FREE (yymsg);
}
else
yyerror ("parse error; also virtual memory exhausted");
}
else
#endif /* defined (YYERROR_VERBOSE) */
yyerror ("parse error");
}
goto yyerrlab1;
/*--------------------------------------------------.
| yyerrlab1 -- error raised explicitly by an action |
`--------------------------------------------------*/
yyerrlab1:
if (yyerrstatus == 3)
{
/* If just tried and failed to reuse lookahead token after an
error, discard it. */
/* return failure if at end of input */
if (yychar == YYEOF)
YYABORT;
YYDPRINTF ((stderr, "Discarding token %d (%s).\n",
yychar, yytname[yychar1]));
yychar = YYEMPTY;
}
/* Else will try to reuse lookahead token after shifting the error
token. */
yyerrstatus = 3; /* Each real token shifted decrements this */
goto yyerrhandle;
/*-------------------------------------------------------------------.
| yyerrdefault -- current state does not do anything special for the |
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -