diff options
author | Karl Williamson <khw@cpan.org> | 2018-10-18 19:02:51 -0600 |
---|---|---|
committer | Karl Williamson <khw@cpan.org> | 2018-10-20 00:09:56 -0600 |
commit | a3ff97cf29e5b9d0f9c6bb019c9680b6f7575bd6 (patch) | |
tree | cf7d190baaad9dcc6885bb9739f45b6c3c0cb6a4 | |
parent | ac43b77faf512e40fbeef1bb4332b0052d20ced0 (diff) | |
download | perl-a3ff97cf29e5b9d0f9c6bb019c9680b6f7575bd6.tar.gz |
regcomp.c: Test for having /u earlier for \p{}
When \p{} or \p{} are encountered during parsing, that indicates that
the pattern should be compiled not under /d, but under /u, as these are
Unicode constructs. This commit moves the test for that to somewhat
earlier. This saves only a little work currently, but in a future
commit it saves a lot more wasted work.
-rw-r--r-- | regcomp.c | 7 |
1 files changed, 4 insertions, 3 deletions
@@ -16856,6 +16856,10 @@ S_regclass(pTHX_ RExC_state_t *pRExC_state, I32 *flagp, U32 depth, |_CORE_SWASH_INIT_ACCEPT_INVLIST; SvREFCNT_dec(swash); /* Free any left-overs */ + + /* \p means they want Unicode semantics */ + REQUIRE_UNI_RULES(flagp, 0); + if (RExC_parse >= RExC_end) vFAIL2("Empty \\%c", (U8)value); if (*RExC_parse == '{') { @@ -17101,9 +17105,6 @@ S_regclass(pTHX_ RExC_state_t *pRExC_state, I32 *flagp, U32 depth, RExC_parse = e + 1; namedclass = ANYOF_UNIPROP; /* no official name, but it's named */ - - /* \p means they want Unicode semantics */ - REQUIRE_UNI_RULES(flagp, 0); } break; case 'n': value = '\n'; break; |