diff options
author | Karl Williamson <khw@cpan.org> | 2018-10-14 12:52:07 -0600 |
---|---|---|
committer | Karl Williamson <khw@cpan.org> | 2018-10-20 00:09:55 -0600 |
commit | 0a0ee7b8b14e71974adcfd6457c0d0a5486c28aa (patch) | |
tree | 4acc572af0835b5d29c58ae26842fa4b6dc535e3 | |
parent | d62e749e81cccfc8041202ebef35e45449134bf8 (diff) | |
download | perl-0a0ee7b8b14e71974adcfd6457c0d0a5486c28aa.tar.gz |
regcomp.c: Omit warning if error about to be raised
This commit changes the code to skip a warning when it knows an error is
about to happen. Currently this doesn't matter, as the warning would be
emitted only in a later pass, and the error would actually happen first,
so the warning doesn't get output at all. But future commits will
change that, so this commit is in preparation for that.
-rw-r--r-- | regcomp.c | 12 |
1 files changed, 7 insertions, 5 deletions
@@ -13886,11 +13886,13 @@ S_regatom(pTHX_ RExC_state_t *pRExC_state, I32 *flagp, U32 depth) /* FALLTHROUGH */ default: if (isALPHANUMERIC(*p)) { - /* Include any left brace following the alpha to emphasize - * that it could be part of an escape at some point - * in the future */ - int len = (isALPHA(*p) && *(p + 1) == '{') ? 2 : 1; - ckWARN3reg(p + len, "Unrecognized escape \\%.*s passed through", len, p); + /* An alpha followed by '{' is going to fail next + * iteration, so don't output this warning in that + * case */ + if (! isALPHA(*p) || *(p + 1) != '{') { + ckWARN2reg(p + 1, "Unrecognized escape \\%.1s" + " passed through", p); + } } goto normal_default; } /* End of switch on '\' */ |