This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
toke.c: Quit now if error at end of input
authorKarl Williamson <khw@cpan.org>
Tue, 14 Feb 2017 02:18:38 +0000 (19:18 -0700)
committerKarl Williamson <khw@cpan.org>
Tue, 14 Feb 2017 04:24:11 +0000 (21:24 -0700)
In these two cases, we know we are at the end of the input, and that we
have an error.  There is no need to try to patch things up so we can
continue to parse looking for other errors; there's nothing left to
parse.  So skip having to deal with patching up.

toke.c

diff --git a/toke.c b/toke.c
index 547e67a..06a3544 100644 (file)
--- a/toke.c
+++ b/toke.c
@@ -3652,7 +3652,7 @@ S_scan_const(pTHX_ char *start)
                    } else {
                        yyerror("Missing right brace on \\N{} or unescaped left brace after \\N");
                    }
-                   continue;
+                    yyquit(); /* Have exhausted the input. */
                }
 
                /* Here it looks like a named character */
@@ -3938,6 +3938,7 @@ S_scan_const(pTHX_ char *start)
                }
                else {
                    yyerror("Missing control char name in \\c");
+                   yyquit();   /* Are at end of input, no sense continuing */
                }
 #ifdef EBCDIC
                 non_portable_endpoint++;