diff options
author | David Mitchell <davem@iabyn.com> | 2016-12-03 16:00:58 +0000 |
---|---|---|
committer | David Mitchell <davem@iabyn.com> | 2016-12-05 11:54:03 +0000 |
commit | 5019c3ae02ccf325d3fd2246619613ab90090c35 (patch) | |
tree | ce788058caa4048029560f6e9a25431b15309ecd /perly.c | |
parent | 3c217e575b5dd35db3bc7ab880483c03fb323ba1 (diff) | |
download | perl-5019c3ae02ccf325d3fd2246619613ab90090c35.tar.gz |
yyparse: eliminate yyreduce label
Makes things slightly simpler.
Diffstat (limited to 'perly.c')
-rw-r--r-- | perly.c | 30 |
1 files changed, 15 insertions, 15 deletions
@@ -293,7 +293,11 @@ Perl_yyparse (pTHX_ int gramtype) `------------------------------------------------------------*/ yynewstate: + while (1) { + + /* shift a token, or quit when it's possible to reduce */ + yystate = ps->state; YYDPRINTF ((Perl_debug_log, "Entering state %d\n", yystate)); @@ -327,7 +331,7 @@ Perl_yyparse (pTHX_ int gramtype) yyn = yypact[yystate]; if (yyn == YYPACT_NINF) - break; + goto yydefault; /* Not known => get a lookahead token if don't already have one. */ @@ -360,15 +364,21 @@ Perl_yyparse (pTHX_ int gramtype) * Casting yyn to unsigned allows a >=0 test to be included as * part of the <=YYLAST test for speed */ yyn += yytoken; - if ((unsigned int)yyn > YYLAST || yycheck[yyn] != yytoken) - break; + if ((unsigned int)yyn > YYLAST || yycheck[yyn] != yytoken) { + yydefault: + /* do the default action for the current state. */ + yyn = yydefact[yystate]; + if (yyn == 0) + goto yyerrlab; + break; /* time to reduce */ + } yyn = yytable[yyn]; if (yyn <= 0) { if (yyn == 0 || yyn == YYTABLE_NINF) goto yyerrlab; yyn = -yyn; - goto yyreduce; + break; /* time to reduce */ } if (yyn == YYFINAL) @@ -397,18 +407,8 @@ Perl_yyparse (pTHX_ int gramtype) } + /* Do a reduction */ - /*-----------------------------------------------------------. - | do the default action for the current state. | - `-----------------------------------------------------------*/ - yyn = yydefact[yystate]; - if (yyn == 0) - goto yyerrlab; - - /*-----------------------------. - | yyreduce -- Do a reduction. | - `-----------------------------*/ - yyreduce: /* yyn is the number of a rule to reduce with. */ parser->yylen = yyr2[yyn]; |