diff options
author | Karl Williamson <khw@khw-desktop.(none)> | 2010-02-18 15:06:51 -0700 |
---|---|---|
committer | Rafael Garcia-Suarez <rgs@consttype.org> | 2010-02-19 10:10:46 +0100 |
commit | 0a96133fa53fe1b2ee03b5cce4cdd9c7c96a0867 (patch) | |
tree | b016da4794f891725cf23111af55d1a5f5261d52 /toke.c | |
parent | ff3f963aa0f95ea53996b6a3842b824504b57c79 (diff) | |
download | perl-0a96133fa53fe1b2ee03b5cce4cdd9c7c96a0867.tar.gz |
Make a missing right brace on \N{ fatal
It was decided that this should be a fatal error instead of a warning.
Also some comments were updated..
Diffstat (limited to 'toke.c')
-rw-r--r-- | toke.c | 33 |
1 files changed, 9 insertions, 24 deletions
@@ -2968,10 +2968,10 @@ S_scan_const(pTHX_ char *start) * errors and upgrading to utf8) is: * Further disambiguate between the two meanings of \N, and if * not a charname, go process it elsewhere - * If of form \N{U+...}, pass it through if a pattern; otherwise - * convert to utf8 - * Otherwise must be \N{NAME}: convert to \N{U+c1.c2...} if a pattern; - * otherwise convert to utf8 */ + * If of form \N{U+...}, pass it through if a pattern; + * otherwise convert to utf8 + * Otherwise must be \N{NAME}: convert to \N{U+c1.c2...} if a + * pattern; otherwise convert to utf8 */ /* Here, s points to the 'N'; the test below is guaranteed to * succeed if we are being called on a pattern as we already @@ -2985,27 +2985,14 @@ S_scan_const(pTHX_ char *start) } s++; - /* If there is no matching '}', it is an error outside of a - * pattern, or ambiguous inside. */ + /* If there is no matching '}', it is an error. */ if (! (e = strchr(s, '}'))) { if (! PL_lex_inpat) { yyerror("Missing right brace on \\N{}"); - continue; - } - else { - - /* A missing brace means it can't be a legal character - * name, and it could be a legal "match non-newline". - * But it's kind of weird without an unescaped left - * brace, so warn. */ - if (ckWARN(WARN_SYNTAX)) { - Perl_warner(aTHX_ packWARN(WARN_SYNTAX), - "Missing right brace on \\N{} or unescaped left brace after \\N. Assuming the latter"); - } - s -= 3; /* Backup over cur char, {, N, to the '\' */ - *d++ = NATIVE_TO_NEED(has_utf8,'\\'); - goto default_action; + } else { + yyerror("Missing right brace on \\N{} or unescaped left brace after \\N."); } + continue; } /* Here it looks like a named character */ @@ -3053,9 +3040,7 @@ S_scan_const(pTHX_ char *start) /* Pass through to the regex compiler unchanged. The * reason we evaluated the number above is to make sure - * there wasn't a syntax error. It also makes sure - * that the syntax created below, \N{Uc1.c2...}, is - * internal-only */ + * there wasn't a syntax error. */ s -= 5; /* Include the '\N{U+' */ Copy(s, d, e - s + 1, char); /* 1 = include the } */ d += e - s + 1; |