📄 wnparse.tab.c
字号:
yyerror("Opened a '[' in the middle of a cluster somewhere above here\n");
(yyval.ss)=(yyvsp[0].ss);
;}
break;
case 63:
#line 466 "wnparse.y"
{
(yyval.ss) = MakeSynset(ADJ, InsertSynonym((yyvsp[-4].s), (yyvsp[-5].s)), (yyvsp[-3].p), NULL, (yyvsp[-2].tx), (yyvsp[0].number));
;}
break;
case 64:
#line 470 "wnparse.y"
{
(yyval.ss) = MakeSynset(ADJ, InsertSynonym((yyvsp[-3].s), (yyvsp[-4].s)), NULL, NULL, (yyvsp[-2].tx), (yyvsp[0].number));
;}
break;
case 65:
#line 477 "wnparse.y"
{
wdcnt = 1;
(yyval.s) = CreateSynonym((yyvsp[0].sym),
(unsigned char)wsense,
-wdcnt,
(unsigned char)aclass,
NULL);
headword = FALSE;
aclass = 0;
;}
break;
case 66:
#line 488 "wnparse.y"
{
MakeSyngroup((yyvsp[-1].p), NULL);
wdcnt = 1;
(yyval.s) = CreateSynonym((yyvsp[-2].sym),
(unsigned char)wsense,
-wdcnt,
(unsigned char)aclass,
NULL);
headword = FALSE;
aclass = 0;
;}
break;
case 67:
#line 502 "wnparse.y"
{
(yyval.sym) = CreateSymbol(strlower((yyvsp[-1].tx)));
wsense = 0;
aclass = (yyvsp[0].number);
headword = TRUE;
;}
break;
case 68:
#line 509 "wnparse.y"
{
(yyval.sym) = CreateSymbol(strlower((yyvsp[-2].tx)));
wsense = (yyvsp[-1].number);
aclass = (yyvsp[0].number);
headword = TRUE;
;}
break;
default: break;
}
/* Line 1126 of yacc.c. */
#line 1891 "wnparse.tab.c"
yyvsp -= yylen;
yyssp -= yylen;
YY_STACK_PRINT (yyss, yyssp);
*++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. */
yyn = yyr1[yyn];
yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
yystate = yytable[yystate];
else
yystate = yydefgoto[yyn - YYNTOKENS];
goto yynewstate;
/*------------------------------------.
| yyerrlab -- here on detecting error |
`------------------------------------*/
yyerrlab:
/* If not already recovering from an error, report this error. */
if (!yyerrstatus)
{
++yynerrs;
#if YYERROR_VERBOSE
yyn = yypact[yystate];
if (YYPACT_NINF < yyn && yyn < YYLAST)
{
int yytype = YYTRANSLATE (yychar);
YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
YYSIZE_T yysize = yysize0;
YYSIZE_T yysize1;
int yysize_overflow = 0;
char *yymsg = 0;
# define YYERROR_VERBOSE_ARGS_MAXIMUM 5
char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
int yyx;
#if 0
/* This is so xgettext sees the translatable formats that are
constructed on the fly. */
YY_("syntax error, unexpected %s");
YY_("syntax error, unexpected %s, expecting %s");
YY_("syntax error, unexpected %s, expecting %s or %s");
YY_("syntax error, unexpected %s, expecting %s or %s or %s");
YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
#endif
char *yyfmt;
char const *yyf;
static char const yyunexpected[] = "syntax error, unexpected %s";
static char const yyexpecting[] = ", expecting %s";
static char const yyor[] = " or %s";
char yyformat[sizeof yyunexpected
+ sizeof yyexpecting - 1
+ ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
* (sizeof yyor - 1))];
char const *yyprefix = yyexpecting;
/* Start YYX at -YYN if negative to avoid negative indexes in
YYCHECK. */
int yyxbegin = yyn < 0 ? -yyn : 0;
/* Stay within bounds of both yycheck and yytname. */
int yychecklim = YYLAST - yyn;
int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
int yycount = 1;
yyarg[0] = yytname[yytype];
yyfmt = yystpcpy (yyformat, yyunexpected);
for (yyx = yyxbegin; yyx < yyxend; ++yyx)
if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
{
if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
{
yycount = 1;
yysize = yysize0;
yyformat[sizeof yyunexpected - 1] = '\0';
break;
}
yyarg[yycount++] = yytname[yyx];
yysize1 = yysize + yytnamerr (0, yytname[yyx]);
yysize_overflow |= yysize1 < yysize;
yysize = yysize1;
yyfmt = yystpcpy (yyfmt, yyprefix);
yyprefix = yyor;
}
yyf = YY_(yyformat);
yysize1 = yysize + yystrlen (yyf);
yysize_overflow |= yysize1 < yysize;
yysize = yysize1;
if (!yysize_overflow && yysize <= YYSTACK_ALLOC_MAXIMUM)
yymsg = (char *) YYSTACK_ALLOC (yysize);
if (yymsg)
{
/* Avoid sprintf, as that infringes on the user's name space.
Don't have undefined behavior even if the translation
produced a string with the wrong number of "%s"s. */
char *yyp = yymsg;
int yyi = 0;
while ((*yyp = *yyf))
{
if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
{
yyp += yytnamerr (yyp, yyarg[yyi++]);
yyf += 2;
}
else
{
yyp++;
yyf++;
}
}
yyerror (yymsg);
YYSTACK_FREE (yymsg);
}
else
{
yyerror (YY_("syntax error"));
goto yyexhaustedlab;
}
}
else
#endif /* YYERROR_VERBOSE */
yyerror (YY_("syntax error"));
}
if (yyerrstatus == 3)
{
/* If just tried and failed to reuse look-ahead token after an
error, discard it. */
if (yychar <= YYEOF)
{
/* Return failure if at end of input. */
if (yychar == YYEOF)
YYABORT;
}
else
{
yydestruct ("Error: discarding", yytoken, &yylval);
yychar = YYEMPTY;
}
}
/* Else will try to reuse look-ahead token after shifting the error
token. */
goto yyerrlab1;
/*---------------------------------------------------.
| 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 (0)
goto yyerrorlab;
yyvsp -= yylen;
yyssp -= yylen;
yystate = *yyssp;
goto yyerrlab1;
/*-------------------------------------------------------------.
| yyerrlab1 -- common code for both syntax error and YYERROR. |
`-------------------------------------------------------------*/
yyerrlab1:
yyerrstatus = 3; /* Each real token shifted decrements this. */
for (;;)
{
yyn = yypact[yystate];
if (yyn != YYPACT_NINF)
{
yyn += YYTERROR;
if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
{
yyn = yytable[yyn];
if (0 < yyn)
break;
}
}
/* Pop the current state because it cannot handle the error token. */
if (yyssp == yyss)
YYABORT;
yydestruct ("Error: popping", yystos[yystate], yyvsp);
YYPOPSTACK;
yystate = *yyssp;
YY_STACK_PRINT (yyss, yyssp);
}
if (yyn == YYFINAL)
YYACCEPT;
*++yyvsp = yylval;
/* Shift the error token. */
YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
yystate = yyn;
goto yynewstate;
/*-------------------------------------.
| yyacceptlab -- YYACCEPT comes here. |
`-------------------------------------*/
yyacceptlab:
yyresult = 0;
goto yyreturn;
/*-----------------------------------.
| yyabortlab -- YYABORT comes here. |
`-----------------------------------*/
yyabortlab:
yyresult = 1;
goto yyreturn;
#ifndef yyoverflow
/*-------------------------------------------------.
| yyexhaustedlab -- memory exhaustion comes here. |
`-------------------------------------------------*/
yyexhaustedlab:
yyerror (YY_("memory exhausted"));
yyresult = 2;
/* Fall through. */
#endif
yyreturn:
if (yychar != YYEOF && yychar != YYEMPTY)
yydestruct ("Cleanup: discarding lookahead",
yytoken, &yylval);
while (yyssp != yyss)
{
yydestruct ("Cleanup: popping",
yystos[*yyssp], yyvsp);
YYPOPSTACK;
}
#ifndef yyoverflow
if (yyss != yyssa)
YYSTACK_FREE (yyss);
#endif
return yyresult;
}
#line 518 "wnparse.y"
static void AddToSynList();
static G_Synset MakeSynset(int, Synonym, Pointer, Framelist, char *, int);
static Synonym AddSynonym(Synonym, Synonym);
static Pointer AddPointer(Pointer, Pointer);
static Synonym InsertSynonym(Synonym, Synonym);
static void AddSynset(G_Synset);
static void AddToSynList(G_Synset);
static void MakeSyngroup(Pointer, Framelist);
static Pointer DoPointer(Symbol, int);
static int UniqueSynonym(Synonym, Synonym);
static int UniquePointer(Pointer, Pointer);
static int UniqueSynSense(Synonym, int);
static int UniqueFanSynonym(Synonym, int, int);
static char *UseLabel(char *);
static G_Synset MakeSynset(int type, Synonym syns, Pointer ptrs,
Framelist frames, char *defn, int key)
{
register Synonym syn;
register Pointer p;
G_Synset ss;
Framelist f;
wdcnt = 0; /* reset word counter for next synset */
lastsyn = NULL; /* reset pointer to last synonym */
if (!syns) {
yywarn("No valid synonyms: synset discarded\n");
return(NULL);
} else if (type == VERB && !frames) {
yyerror("No frame list in verb synset: synset discarded\n");
return(NULL);
} else if (type == NOUN && foundhyper == FALSE) {
yywarn("No hypernyms in synset\n");
if (verifyflag)
errcount--; /* don't count as real error */
}
foundhyper = FALSE;
/* Link in any pointers and frame lists found in syngroups. */
if (ptrlist) {
if (ptrs) {
for (p = ptrs; p->pnext; p = p->pnext);
p->pnext = ptrlist;
} else {
ptrs = ptrlist;
}
ptrlist = NULL;
}
if (frlist) {
if (frames)
frames->fnext = frlist;
else
frames = frlist;
frlist = NULL;
}
ss = CreateSynset((unsigned char)type, syns, ptrs, frames, defn, key,
yylineno, curfilenum());
/* Add pointer to the synset to each synonym in it. Make sure
that the synonym is unique (using sense number) within the file. */
for (syn = syns; syn; syn = syn->synnext) {
if ((type != SATELLITE && !UniqueSynSense(syn, FALSE)) ||
(type == SATELLITE && (curfilenum() != 0) &&
!UniqueSynSense(syn, TRUE))) {
if (syn->sensenum)
sprintf(buf,
"Synonym \"%s%d\" is not unique in file\n",
syn->word->label, syn->sensenum);
else
sprintf(buf,
"Synonym \"%s\" is not unique in file\n",
syn->word->label);
yyerror(buf);
}
syn->ss = ss;
syn->infanss = (type == SATELLITE) ? TRUE : FALSE;
}
return(ss);
}
static Synonym AddSynonym(Synonym syns, Synonym newsyn)
{
register Synonym s;
/* Add synonym to end of list. First make sure this synonym
is unique within the synset. */
if (UniqueSynonym(syns, newsyn)) {
if (syns) {
for (s = syns; s->synnext; s = s->synnext); /* find end of list */
s->synnext = newsyn;
} else
syns = newsyn;
lastsyn = newsyn; /* save last synonym in synset for errors */
} else {
if (newsyn->sensenum)
sprintf(buf,
"Synonym \"%s%d\" is not unique in synset\n",
newsyn->word->label, newsyn->sensenum);
else
sprintf(buf,
"Synony
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -