summaryrefslogtreecommitdiff
path: root/regcomp.c
diff options
context:
space:
mode:
authorDagfinn Ilmari Mannsåker <ilmari@ilmari.org>2016-11-14 20:05:31 +0100
committerDagfinn Ilmari Mannsåker <ilmari@ilmari.org>2016-11-14 20:12:03 +0100
commitff4e2b11ab19d0c806a3dc09308d1b393971b8aa (patch)
tree4b48e5ab8e282432e4b35b4a841096b4dcab5775 /regcomp.c
parent16d1d8bdaf1e7c1c3ad11abc246622d1e5c3b26a (diff)
downloadperl-ff4e2b11ab19d0c806a3dc09308d1b393971b8aa.tar.gz
Fix error message for unclosed \N{ in regcomp
An unclosed \N{ that made it through to the regex engine rather than being handled by the lexer would erroneously trigger the error for "\N{NAME} must be resolved by the lexer". This separates the check for the missing trailing } and issues the correct error message for this.
Diffstat (limited to 'regcomp.c')
-rw-r--r--regcomp.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/regcomp.c b/regcomp.c
index ac664326f0..332cf00482 100644
--- a/regcomp.c
+++ b/regcomp.c
@@ -12005,13 +12005,15 @@ S_grok_bslash_N(pTHX_ RExC_state_t *pRExC_state,
RExC_parse++; /* Skip past the '{' */
- if (! (endbrace = strchr(RExC_parse, '}')) /* no trailing brace */
- || ! (endbrace == RExC_parse /* nothing between the {} */
+ if (! (endbrace = strchr(RExC_parse, '}'))) { /* no trailing brace */
+ vFAIL2("Missing right brace on \\%c{}", 'N');
+ }
+ else if(!(endbrace == RExC_parse /* nothing between the {} */
|| (endbrace - RExC_parse >= 2 /* U+ (bad hex is checked... */
&& strnEQ(RExC_parse, "U+", 2)))) /* ... below for a better
error msg) */
{
- if (endbrace) RExC_parse = endbrace; /* position msg's '<--HERE' */
+ RExC_parse = endbrace; /* position msg's '<--HERE' */
vFAIL("\\N{NAME} must be resolved by the lexer");
}