summaryrefslogtreecommitdiff
path: root/proto.h
diff options
context:
space:
mode:
authorKarl Williamson <khw@cpan.org>2014-06-12 21:50:29 -0600
committerKarl Williamson <khw@cpan.org>2014-06-12 22:32:32 -0600
commit412f55bbce575aecc79b1ca79fd2856893dd8738 (patch)
treea033fdcf6ed906fa1b4170fea5d491e635d32724 /proto.h
parent4a7e65afe24af2e709b485d8bb4a67fe3d047ada (diff)
downloadperl-412f55bbce575aecc79b1ca79fd2856893dd8738.tar.gz
Deprecate unescaped literal "{" in regex patterns
This commit also causes escaped (by a backslash) "(", "[", and "{" to be considered literally. In the previous 2 Perl versions, the escaping was ignored, and a (default-on) deprecation warning was raised. Now that we have warned for 2 release cycles, we can change the meaning.of escaping to actually do something Warning when a literal left brace is not escaped by a backslash, will allow us to eventually use this character in more contexts as being meta, allowing us to extend the language. For example, the lower limit of a quantifier could be omited, and better error checking instituted, or things like \w could be followed by a {...} indicating some special word character, like \w{Greek} to restrict to just Greek word characters. We tried to do this in v5.16, and many CPAN modules changed to backslash their left braces at that time. However we had to back out that change before 5.16 shipped because it turned out that escaping a left brace in some contexts didn't work, namely when the brace would normally be a metacharacter (for example surrounding a quantifier), and the pattern delimiters were { }. Instead we raised the useless backslash warning mentioned above, which has now been there for the requisite 2 cycles. This patch partially reverts 2 patches. The first, e62d0b1335a7959680be5f7e56910067d6f33c1f, partially reverted the deprecation of unescaped literal left brace. The other, 4d68ffa0f7f345bc1ae6751744518ba4bc3859bd, instituted the deprecation of the useless left-characters. Note that, as in the original attempt to deprecate, we don't raise a warning if the left brace is the first character in the pattern. This is because in that position it can't be a metacharacter, so we don't require any disambiguation, and we found that if we did raise an error, there were quite a few places where this occurred.
Diffstat (limited to 'proto.h')
-rw-r--r--proto.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/proto.h b/proto.h
index fb5d5b3e73..8dde508138 100644
--- a/proto.h
+++ b/proto.h
@@ -7150,7 +7150,7 @@ PERL_STATIC_INLINE bool S_grok_bslash_x(pTHX_ char** s, UV* uv, const char** err
#define PERL_ARGS_ASSERT_GROK_BSLASH_X \
assert(s); assert(uv); assert(error_msg)
-PERL_STATIC_INLINE I32 S_regcurly(pTHX_ const char *s, const bool rbrace_must_be_escaped)
+PERL_STATIC_INLINE I32 S_regcurly(pTHX_ const char *s)
__attribute__warn_unused_result__
__attribute__pure__
__attribute__nonnull__(pTHX_1);
@@ -7629,7 +7629,7 @@ STATIC char* S_scan_pat(pTHX_ char *start, I32 type)
#define PERL_ARGS_ASSERT_SCAN_PAT \
assert(start)
-STATIC char* S_scan_str(pTHX_ char *start, int keep_quoted, int keep_delims, int re_reparse, bool deprecate_escaped_matching, char **delimp)
+STATIC char* S_scan_str(pTHX_ char *start, int keep_quoted, int keep_delims, int re_reparse, char **delimp)
__attribute__warn_unused_result__
__attribute__nonnull__(pTHX_1);
#define PERL_ARGS_ASSERT_SCAN_STR \