| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This adds (?^...) to signify to use the default regex modifiers for the
cluster or embedded pattern-match modifier change. The major purpose of
this is to simplify regex stringification, so that "^" is output in
place of "-xism". As a result, the stringification will not change in
the future when new regex modifiers are added, so tests, etc. that rely
on a particular stringification will have to change now, but never
again.
Code that needs to work properly with both old- and new-style regexes
can use something like the following:
# Accept both old and new-style stringification
my $modifiers = (qr/foobar/ =~ /\Q(?^/) ? '^' : '-xism';
This construct is Ben Morrow's idea.
|
|
|
|
|
|
|
|
|
|
| |
8 and 9 are not treated as alphas in parsing as opposed to illegal
octals.
This also adds tests to verify that 1-3 digits work in char classes.
I created an isOCTAL macro in case that lookup gets moved to a bit
field, as I plan to do later, for speed.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Change the &Internals::* functions that use references in their
prototypes to check if the argument is SvROK() before calling SvRV().
If the function is called as Internals::FOO() perl does this check for
us, but prototypes are bypassed on &Internals::FOO() so we still have
to check this manually.
This fixes [perl #77776], this bug was present in 5.10.x, 5.12.x, and
probably all earlier perl versions that had these functions, but I
haven't tested that.
I'm adding a new test file (t/lib/universal.t) to test universal.c
functions as part of this patch. The testing for Internal::* in t/ was
and is very sparse, but before universal.t there was no obvious place
to put these tests.
Signed-off-by: Ævar Arnfjörð Bjarmason <avar@cpan.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
1. &warnings::register is added as the public mechanism for adding
new warning categories, rather than warnings::register::import
knowing about warnings's internals
2. warnings::register::import is updated to use &warnings::register
3. warnings::register::import can take a list of subcategories
The upshot is that you can now write:
package MyTool;
use warnings::register qw(io typos);
warnings::warnif('MyTool::io', $message);
...and tools that register new warnings categories do not need to cargo cult
code from warnings/register.pm
|
|
|
|
|
|
|
|
|
|
| |
This makes a qw(...) list literal a distinct token type for the
parser, where previously it was munged into a "(",THING,")" sequence.
The change means that qw(...) can't accidentally supply parens to parts
of the grammar that want real parens. Due to many bits of code taking
advantage of that by "foreach my $x qw(...) {}", this patch also includes
a hack to coerce qw(...) to the old-style parenthesised THING, emitting
a deprecation warning along the way.
|
|
|
|
| |
Not every operating system has /proc/self/exe
|
|
|
|
|
|
|
| |
Commit 8f776eae73090661 turned out to be a bit optimistic with
"should be capable of running in parallel", as the temporary files and
modules written out by the various test scripts have clashing names.
Hence run each test a private subdirectory.
|
|
|
|
| |
This makes sure the fix for RT#74404 is working.
|
|
|
|
|
| |
Warn about list assignment to $[, as in "($[)=1", in addition to scalar
assignment such as "$[=1".
|
|
|
|
|
|
| |
If "use charnames ()" are the only usages of this pragma in a program,
it fails due to the pragma's import method not getting called. This
fixes that.
|
|\
| |
| |
| |
| | |
Conflicts:
pod/perl5133delta.pod
|
| |
| |
| |
| | |
This makes this more immune to ENV differences
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This was done by moving what could to %^H. Because data structures in
%^H get stringified at runtime, new serialized entries for them had to
be created and then unserialized on each runtime call. Also, because
%^H is read-only at runtime, some data structures couldn't be moved to
it. Things were set up so that these contain only things invariant
under scoping, and looked at only when the same scoped options are in
effect as when they were created. Further comments at declaration of
%full_names_cache.
I was well into this patch when it dawned on me that it was doing
unnecessary tests, so that
if (! a) { conditionally set a }
if (! a) {}
could be implemented more efficiently as
if (! a) {
conditionally set a }
if (! a) {}
}
so I changed it, which messes up leading indentation for the diffs.
|
| |
| |
| |
| | |
The previous return value where NULL meant OK is outside-the-norm.
|
|/
|
|
|
|
|
|
|
|
| |
This commit adds the new construct \o{} to express a character constant
by its octal ordinal value, along with ancillary tests and
documentation.
A function to handle this is added to util.c, and it is called from the
3 parsing places it could occur. The function is a candidate for
in-lining, though I doubt that it will ever be used frequently.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
# New Ticket Created by karl williamson
# Please include the string: [perl #76398]
# in the subject line of all future correspondence about this issue.
# <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=76398 >
See attached patches
>From 275169a8df5851331669da2dd791483379c3fc5e Mon Sep 17 00:00:00 2001
From: Karl Williamson <khw@khw-desktop.(none)>
Date: Tue, 6 Jul 2010 09:20:42 -0600
Subject: [PATCH] t/lib/common.pl: localize changing $/
$/ changes should not affect callers.
Signed-off-by: H.Merijn Brand <h.m.brand@xs4all.nl>
|
|
|
|
|
|
|
| |
This avoids needing to use a variable in package main to pass in information.
Also, remove an unnecessary $ENV{PERL5LIB} assignment cargo-culted into most
users of t/lib/common,pl, and remove the BEGIN block as the code it contained
doesn't need to run at BEGIN time.
|
| |
|
| |
|
| |
|
|
|
|
|
| |
Pattern replacements need to have the deprecation added; the prior patch
on this ticket only changed m/a/keyword; this adds the s/a/b/keyword
|
|
|
|
|
|
|
| |
This patch raises a deprecated warning on constructs like
$result = $a =~ m/$foo/sand $bar;
which means
$result = $a =~ m/$foo/s and $bar;
|
|
|
|
|
| |
the original patch included a fix, but this problem was fixed in
faee19b5, so only apply the test.
|
|
|
|
|
|
|
| |
This reverts commit 6fb472bab4fadd0ae2ca9624b74596afab4fb8cb.
Zefram asked me to revert this as he's going to be doing something more
pluggable
|
|
|
|
|
|
|
|
|
| |
last change"
This reverts commit c4deb7365787eb01845a9d0e371e343169530659.
Zefram asked me to revert this as he's going to be doing something more
pluggable
|
|
|
|
|
|
|
| |
This reverts commit 1183a10042af0734ee65e252f15bd820b7bbe686.
Zefram asked me to revert this as he's going to be doing something more
pluggable
|
|\
| |
| |
| |
| | |
Conflicts:
pp_ctl.c
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Makes the G_KEEPERR logic more consistent, and in particular make it
sensibly handle non-string exceptions. An exception in a destructor
is now always emitted as a warning, and never copied or merged into
$@ of the surrounding context. No more clobbering exceptions being
handled elsewhere, and no more double reporting. This fixes the rest of
[perl #74538].
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Some improvements to the deprecation added in commit
6fb472bab4fadd0ae2ca9624b74596afab4fb8cb:
- warning message includes the word "deprecated"
- warning is in "syntax" category as well as "deprecated"
- more systematic tests
- dot detected more efficiently by incorporation into existing switch
- small doc rewording
- avoid the warning in t/op/taint.t
|
| | |
|
|/ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The message ‘Variable "%s" is not imported’ cannot be suppressed, even
with -X (local $SIG{__WARN__}=sub{} is what I have to use):
perl -Xle '$foo;use strict; eval q/$foo/ or die "---$@---"'
Variable "$foo" is not imported at (eval 1) line 2.
---Global symbol "$foo" requires explicit package name at (eval 1) line 2.
--- at -e line 1.
This is because we have what appears to the user to be a multi-line
error message. It is in fact a warning ‘Variable...’ followed by an
error ‘Global symbol...’.
The attached patch assigns a warning category to the warning.
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
make regen embed.fnc
needs to be run on this patch.
This patch fixes Bugs #56444 and #62056.
Hopefully we have finally gotten this right. The parser used to handle
all the escaped constants, expanding \x2e to its single byte equivalent.
The problem is that for regexp patterns, this is a '.', which is a
metacharacter and has special meaning that \x2e does not. So things
were changed so that the parser didn't expand things in patterns. But
this causes problems for \N{NAME}, when the pattern doesn't get
evaluated until runtime, as for example when it has a scalar reference
in it, like qr/$foo\N{NAME}/. We want the value for \N{NAME} that was
in effect at the point during the parsing phase that this regex was
encountered in, but we don't actually look at it until runtime, when
these bug reports show that it is gone. The solution is for the
tokenizer to parse \N{NAME}, but to compile it into an intermediate
value that won't ever be considered a metacharacter. We have chosen to
compile NAME to its equivalent code point value, and express it in the
already existing \N{U+...} form. This indicates to the regex compiler
that the original input was a named character and retains the value it
had at that point in the parse.
This means that \N{U+...} now always must imply Unicode semantics for
the string or pattern it appeared in. Previously there was an
inconsistency, where effectively \N{NAME} implied Unicode semantics, but
\N{U+...} did not necessarily. So now, any string or pattern that has
either of these forms is utf8 upgraded.
A complication is that a charnames handler can return a sequence of
multiple characters instead of just one. To deal with this case, the
tokenizer will generate a constant of the form \N{U+c1.c2.c2...}, where
c1 etc are the individual characters. Perhaps this will be made a
public interface someday, but I decided to not expose it externally as
far as possible for now in case we find reason to change it. It is
possible to defeat this by passing it in a single quoted string to the
regex compiler, so the documentation will be changed to discourage that.
A further complication is that \N can have an additional meaning: to
match a non-newline. This means that the two meanings have to be
disambiguated.
embed.fnc was changed to make public the function regcurly() in
regcomp.c so that it could be referred to in toke.c to see if the ... in
\N{...} is a legal quantifier like {2,}. This is used in the
disambiguation.
toke.c was changed to update some out-dated relevant comments.
It now parses \N in patterns. If it determines that it isn't a named
sequence, it passes it through unchanged. This happens when there is no
brace after the \N, or no closing brace, or if the braces enclose a
legal quantifier. Previously there has been essentially no restriction
on what can come between the braces so that a custom translator can
accept virtually anything. Now, legal quantifiers are assumed to mean
that the \N is a "match non-newline that quantity of times".
I removed the #ifdef'd out code that had been left in in case pack U
reverted to earlier behavior. I did this because it complicated things,
and because the change to pack U has been in long enough and shown that
it is correct so it's not likely to be reverted.
\N meaning a named character is handled differently depending on whether
this is a pattern or not. In all cases, the output will be upgraded to
utf8 because a named character implies Unicode semantics. If not a
pattern, the \N is parsed into a utf8 string, as before. Otherwise it
will be parsed into the intermediate \N{U+...} form. If the original
was already a valid \N{U+...} constant, it is passed through unchanged.
I now check that the sequence returned by the charnames handler is not
malformed, which was lacking before.
The code in regcomp.c which dealt with interfacing with the charnames
handler has been removed. All the values should be determined by the
time regcomp.c gets involved. The affected subroutine is necessarily
restructured.
An EXACT-type node is generated for the character sequence. Such a node
has a capacity of 255 bytes, and so it is possible to overflow it. This
wasn't checked for before, but now it is, and a warning issued and the
overflowing characters are discarded.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This turns on the unicode semantics for uc/lc/ucfirst/lcfirst
operations on strings without the UTF8 bit set but with ASCII
characters higher than 127. This replaces the "legacy" pragma
experiment.
Note that currently this feature sets both a bit in $^H and
a (unused) key in %^H. The bit in $^H could be replaced by
a flag on the uc/lc/etc op. It's probably not feasible to
test a key in %^H in pp_uc in friends each time we want to
know which semantics to apply.
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
An accident of Perl's parser meant that my $pi := 4; was parsed as an empty
attribute list. Empty attribute lists are ignored, hence the above is
equivalent to my $pi = 4; However, the fact that it is currently valid syntax
means that := cannot be used as new token, without silently changing the
meaning of existing code.
Hence it is now deprecated, so that it can subsequently be removed, allowing
the possibility of := to be used as a new token with new semantics.
|
|
|
|
|
|
| |
Wasted a few minutes more than necessary trying to work out why the
string was truncated when in fact it was the error message that was
truncating the string.
|
|
|
|
|
| |
Tk has been fixed, and no longer uses defined %stash:: to determine if a package
has been loaded.
|
| |
|
|
|
|
|
|
|
|
| |
lines - Fix for RT#68916
Subject: overload::import resets the setting of 'fallback'
Date: Tue, 04 Aug 2009 17:54:34 -0700
From: "Geoffrey T. Dairiki" <dairiki at dairiki.org>
|
| |
|
|
|
|
|
| |
That now reads "Unicode non-character is illegal in interchange" and the
perldiag documentation is expanded a bit.
|
| |
|
| |
|