Skip to content

Commit

Permalink
Re: \N{...} in regular expression [PATCH]
Browse files Browse the repository at this point in the history
Message-ID: <9b18b3110609181637m796d6c16o1b2741edc5f09eb2@mail.gmail.com>

p4raw-id: //depot/perl@28868
  • Loading branch information
demerphq authored and H.Merijn Brand committed Sep 19, 2006
1 parent a7ae1e4 commit fc8cd66
Show file tree
Hide file tree
Showing 10 changed files with 448 additions and 48 deletions.
1 change: 1 addition & 0 deletions MANIFEST
Expand Up @@ -3177,6 +3177,7 @@ t/io/through.t See if pipe passes data intact
t/io/utf8.t See if file seeking works
t/japh/abigail.t Obscure tests
t/lib/1_compile.t See if the various libraries and extensions compile
t/lib/Cname.pm Test charnames in regexes (op/pat.t)
t/lib/common.pl Helper for lib/{warnings,feature}.t
t/lib/commonsense.t See if configuration meets basic needs
t/lib/compmod.pl Helper for 1_compile.t
Expand Down
1 change: 1 addition & 0 deletions embed.fnc
Expand Up @@ -1308,6 +1308,7 @@ Es |regnode*|regclass |NN struct RExC_state_t *state|U32 depth
ERsn |I32 |regcurly |NN const char *
Es |regnode*|reg_node |NN struct RExC_state_t *state|U8 op
Es |regnode*|regpiece |NN struct RExC_state_t *state|NN I32 *flagp|U32 depth
Es |regnode*|reg_namedseq |NN struct RExC_state_t *state|NULLOK UV *valuep
Es |void |reginsert |NN struct RExC_state_t *state|U8 op|NN regnode *opnd
Es |void |regtail |NN struct RExC_state_t *state|NN regnode *p|NN const regnode *val|U32 depth
Es |U32 |join_exact |NN struct RExC_state_t *state|NN regnode *scan|NN I32 *min|U32 flags|NULLOK regnode *val|U32 depth
Expand Down
2 changes: 2 additions & 0 deletions embed.h
Expand Up @@ -1312,6 +1312,7 @@
#define regcurly S_regcurly
#define reg_node S_reg_node
#define regpiece S_regpiece
#define reg_namedseq S_reg_namedseq
#define reginsert S_reginsert
#define regtail S_regtail
#define join_exact S_join_exact
Expand Down Expand Up @@ -3500,6 +3501,7 @@
#define regcurly S_regcurly
#define reg_node(a,b) S_reg_node(aTHX_ a,b)
#define regpiece(a,b,c) S_regpiece(aTHX_ a,b,c)
#define reg_namedseq(a,b) S_reg_namedseq(aTHX_ a,b)
#define reginsert(a,b,c) S_reginsert(aTHX_ a,b,c)
#define regtail(a,b,c,d) S_regtail(aTHX_ a,b,c,d)
#define join_exact(a,b,c,d,e,f) S_join_exact(aTHX_ a,b,c,d,e,f)
Expand Down
15 changes: 15 additions & 0 deletions pod/perldiag.pod
Expand Up @@ -1334,6 +1334,14 @@ specified in the C<\N{...}> escape. Perhaps you forgot to load the
corresponding C<overload> or C<charnames> pragma? See L<charnames> and
L<overload>.

=item Constant(%s)%s: %s in regex; marked by <-- HERE in m/%s/

(F) The parser found inconsistencies while attempting to find
the character name specified in the C<\N{...}> escape. Perhaps you
forgot to load the corresponding C<charnames> pragma?
See L<charnames>.


=item Constant is not %s reference

(F) A constant value (perhaps declared using the C<use constant> pragma)
Expand Down Expand Up @@ -1841,6 +1849,13 @@ about 250 characters for simple names, and somewhat more for compound
names (like C<$A::B>). You've exceeded Perl's limits. Future versions
of Perl are likely to eliminate these arbitrary limitations.

=item Ignoring %s in character class in regex; marked by <-- HERE in m/%s/

(W) Named unicode character escapes (\N{...}) may return multi-char
or zero length sequences. When such an escape is used in a character class
its behaviour is not well defined. Check that the correct escape has
been used, and the correct charname handler is in scope.

=item Illegal binary digit %s

(F) You used a digit other than 0 or 1 in a binary number.
Expand Down
3 changes: 3 additions & 0 deletions proto.h
Expand Up @@ -3565,6 +3565,9 @@ STATIC regnode* S_regpiece(pTHX_ struct RExC_state_t *state, I32 *flagp, U32 dep
__attribute__nonnull__(pTHX_1)
__attribute__nonnull__(pTHX_2);

STATIC regnode* S_reg_namedseq(pTHX_ struct RExC_state_t *state, UV *valuep)
__attribute__nonnull__(pTHX_1);

STATIC void S_reginsert(pTHX_ struct RExC_state_t *state, U8 op, regnode *opnd)
__attribute__nonnull__(pTHX_1)
__attribute__nonnull__(pTHX_3);
Expand Down

0 comments on commit fc8cd66

Please sign in to comment.