diff options
author | David Mitchell <davem@iabyn.com> | 2016-12-04 08:10:27 +0000 |
---|---|---|
committer | David Mitchell <davem@iabyn.com> | 2016-12-05 11:54:03 +0000 |
commit | 0f8490d1d7ad76cac844fc2ae882994e38aaf2ef (patch) | |
tree | 25fea4e29ac14105e7b8cc46b37d7c90142c05a3 /perly.y | |
parent | b2c9b6ee5d402c923568f214f2e2606287c912d3 (diff) | |
download | perl-0f8490d1d7ad76cac844fc2ae882994e38aaf2ef.tar.gz |
yyparse: only calculate yytoken on yychar change
yytoken is a translated (via lookup table) version of parser->yychar.
So we only need to recalculate it when yychar changes (usually by
assigning the result of yylex() to it). This means when multiple
reductions are done without shifting another token, we skip the extra
overhead each time.
Diffstat (limited to 'perly.y')
-rw-r--r-- | perly.y | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -143,7 +143,7 @@ grammar : GRAMPROG PL_eval_root = $3; $$ = 0; yyunlex(); - parser->yychar = YYEOF; + parser->yychar = yytoken = YYEOF; } | GRAMBARESTMT { @@ -155,7 +155,7 @@ grammar : GRAMPROG PL_eval_root = $3; $$ = 0; yyunlex(); - parser->yychar = YYEOF; + parser->yychar = yytoken = YYEOF; } | GRAMFULLSTMT { @@ -167,7 +167,7 @@ grammar : GRAMPROG PL_eval_root = $3; $$ = 0; yyunlex(); - parser->yychar = YYEOF; + parser->yychar = yytoken = YYEOF; } | GRAMSTMTSEQ { |