Craig A. Berry [Fri, 31 Aug 2012 16:21:58 +0000 (11:21 -0500)]
Make new File::Copy test case insensitive.
On VMS with default setttings, the filename is reported as copy.t,
not Copy.t, so make the regex allow that.
Craig A. Berry [Fri, 31 Aug 2012 12:47:07 +0000 (07:47 -0500)]
Files ending in .eg are also non-pod.
Aristotle Pagaltzis [Fri, 31 Aug 2012 15:45:37 +0000 (08:45 -0700)]
[perl #114498] Document (0)[1,2] better
Tony Cook [Fri, 31 Aug 2012 12:41:47 +0000 (22:41 +1000)]
correct -Dmad skip count for tests introduced in
2d85e411 and
4dc843bc
Nicholas Clark [Thu, 30 Aug 2012 16:25:53 +0000 (18:25 +0200)]
Remove the VM/ESA port.
VM/ESA was a mainframe OS. IBM ended service on it in June 2003. It was
superseded by Z/VM.
Steffen Mueller [Mon, 13 Aug 2012 08:29:39 +0000 (10:29 +0200)]
Silence ParseXS warning about abusing the CODE section
See RT #114198. DynaLoader was warning about somewhat dubious use of
RETVAL with a CODE section but without an OUTPUT section. This fixes
that problem, but I have obviously not been able to test on all affected
operating systems.
Tony Cook [Thu, 30 Aug 2012 14:43:19 +0000 (00:43 +1000)]
[perl #112776] avoid warning on an initialized non-parameter
A initialized non-parameter in the parameter block would warn
when $^W was set, and Module::Build sets $^W.
Tony Cook [Fri, 31 Aug 2012 10:07:58 +0000 (20:07 +1000)]
[perl #112776] TODO test for warning
Father Chrysostomos [Fri, 31 Aug 2012 06:27:43 +0000 (23:27 -0700)]
Stop calling get-magic twice in sprintf "%.1s", $utf8
Father Chrysostomos [Fri, 31 Aug 2012 06:19:56 +0000 (23:19 -0700)]
Stop calling get-magic twice in sprintf "%1s", $utf8
Father Chrysostomos [Fri, 31 Aug 2012 06:06:14 +0000 (23:06 -0700)]
Stop calling get-magic twice in pack "u", $utf8
Father Chrysostomos [Fri, 31 Aug 2012 05:34:38 +0000 (22:34 -0700)]
Stop calling get-magic twice when reading lvalue substr($utf8)
Father Chrysostomos [Fri, 31 Aug 2012 05:30:26 +0000 (22:30 -0700)]
Stop calling get-magic twice when reading lvalue substr($utf8)
Father Chrysostomos [Fri, 31 Aug 2012 05:26:33 +0000 (22:26 -0700)]
Stop calling get-magic twice for lvalue pos($utf8)
Father Chrysostomos [Fri, 31 Aug 2012 05:08:43 +0000 (22:08 -0700)]
Stop substr($utf8) from calling get-magic twice
By calling get-magic twice, it could cause its string buffer to be
reallocated, resulting in incorrect and random return values.
Father Chrysostomos [Fri, 31 Aug 2012 01:01:27 +0000 (18:01 -0700)]
[perl #114410] Reset utf8 pos cache on get
If a scalar is gmagical, then the string buffer could change without
the utf8 pos cache being updated.
So it should respond to get-magic, not just set-magic. Actually add-
ing get-magic to the utf8 magic vtable would cause all scalars with
this magic to be flagged gmagical. Instead, in magic_get, we can call
magic_setutf8.
Father Chrysostomos [Thu, 30 Aug 2012 23:42:30 +0000 (16:42 -0700)]
utf8cache.t: Skip only the XS-dependent test
Father Chrysostomos [Thu, 30 Aug 2012 23:40:48 +0000 (16:40 -0700)]
test.pl: Add skip_without_dynamic_extension
Father Chrysostomos [Thu, 30 Aug 2012 23:09:58 +0000 (16:09 -0700)]
Break s//3}->{3/e
This should never have worked:
%_=(_,"Just another ");
$_="Perl hacker,\n";
s//_}->{_/e;print
Father Chrysostomos [Thu, 30 Aug 2012 22:57:18 +0000 (15:57 -0700)]
Fix two minor s//.../e parsing bugs
It may be an odd place to allow comments, but s//"" # hello/e has\
always worked, *unless* there happens to be a null before the first #.
scan_subst in toke.c wraps the replacement text in do { ... } when the
/e flag is present.
It was adding a line break before the final } if the replacement text
contained #, because otherwise the } would be commented out.
But to find the # it was using strchr, which stops at the first null.
So eval "s//'\0'#/e" would fail.
It makes little sense to me to check whether the replacement contains
# before adding the line break. It would be faster just to add the
line break without checking.
But then I discovered this bug:
s//"#" . <<END/e;
foo
END
__END__
Can't find string terminator "END" anywhere before EOF at - line 1.
So now I have two bugs to fix.
The easiest solution seems to be to omit the line break and make the
comment parser skip the } at the end of a s///e replacement.
Father Chrysostomos [Thu, 30 Aug 2012 20:34:14 +0000 (13:34 -0700)]
toke.c: PL_in_eval purge
Many uses of PL_in_eval in toke.c are redundant.
PL_in_eval indicates not that we are parsing a string eval, but that
we are being called from an eval, whether stringy on not. Even if
PL_in_eval were only for string eval, it would still not indicate that
we are parsing a string eval, because of eval 'require'.
This commit removes redundant uses of it (making things theoretically
slightly faster).
Father Chrysostomos [Thu, 30 Aug 2012 05:35:27 +0000 (22:35 -0700)]
toke.c:scan_heredoc: comments, comments
Father Chrysostomos [Thu, 30 Aug 2012 05:07:18 +0000 (22:07 -0700)]
toke.c:scan_heredoc: Merge similar code
The code for looking in outer lexing scopes was mostly identical to
the code for looking in PL_linestr.
Father Chrysostomos [Thu, 30 Aug 2012 03:43:05 +0000 (20:43 -0700)]
toke.c:scan_heredoc: Remove incorrect part of comment
I missed this in
60f40a3895 when I stopped abusing IVX and NVX.
Father Chrysostomos [Thu, 30 Aug 2012 03:41:09 +0000 (20:41 -0700)]
toke.c:scan_heredoc: Merge two adjacent #ifdefs
Father Chrysostomos [Thu, 30 Aug 2012 03:39:55 +0000 (20:39 -0700)]
toke.c:scan_heredoc: Remove unnecessary assignment
Updating PL_bufend after lex_next_chunk is not necessary, as
lex_next_chunk itself does it.
Father Chrysostomos [Thu, 30 Aug 2012 03:37:44 +0000 (20:37 -0700)]
toke.c:scan_heredoc: less pointer fiddling; one less SV
The loop for reading lines of input to find the end of a here-doc has
always checked to see whether the cursor (s) was at the end of the
current buffer:
while (s >= PL_bufend) { /* multiple line string? */
(Actually, when it was added in perl 3.000, it was in scanstr and
that loop was not specific to here-docs, but also applied to multi-
line strings.)
The code inside the loop ends up fiddling with s by setting it explic-
itly to the end of the buffer or the end of the here-doc marker, minus
one to make sure it does not coincide with the end of the buffer.
This doesn’t make any sense, and it makes the rest of this function
more complicated.
Because the loop used to be outside the else block, it was also
reached for a here-doc inside a string eval, but the code for that
ensured the condition for the while loop was never true.
Since the while loop set s to one less than it needed to be set to,
in order to break out of it, it had to have s++ just after the loop.
That s++ was reached also by the eval code, which, consequently, had
to adjust its value of s.
That adjustment actually took place farther up in the function, where
the herewas SV was assigned to. (herewas contains the text after the
here-doc marker to the end of the line.) The beginning of herewas
would point to the last character of the here-doc marker inside an
eval, so that subtracting SvCUR(herewas) from the buffer end would
result in an adjusted pointer.
herewas is currently not actually used, except for the length. Until
recently, the text inside it would be copied back into PL_linestr to
recreate where the lexer needed to continue (because PL_linestr was
being clobbered). That no longer happens.
So we can get rid of herewas altogether. Since it is in an else
block, the stream-based parser does not need to fiddle pointers to
exit the loop. It can just break explicitly. So the s++ can also
go, requiring changes (and simplifications) to the eval code. The
comment about it being a multiline string is irrelevant and can go,
too. It dates from when that line was actually in scanstr and applied
to quoted strings containing line breaks.
Father Chrysostomos [Thu, 30 Aug 2012 00:58:33 +0000 (17:58 -0700)]
toke.c:S_scan_heredoc: put the croaking code in one spot
Father Chrysostomos [Wed, 29 Aug 2012 20:10:01 +0000 (13:10 -0700)]
Make eval "s//<<END/e" slightly faster
The code that peeks into an outer linestr buffer to find the heredoc
body has to modify that buffer and remove the heredoc body from it.
It copies the text after the quote-like operator up to the end of the
line into a new SV, concatenates the text after the heredoc body into
a new SV, and then copies it back to linestr right after the quote-
like operator.
So, in this example:
eval "s//<<END/e; # jiggles\nfoo\nEND\ndie;"
It ends up copying this:
"; # jiggles\ndie;\n;"
into this at the position shown:
eval "s//<<END/e; # jiggles\nfoo\nEND\ndie;\n;"
^
There is no need for two copies. And there is no need to copy the
rest of the line where the heredoc marker is.
Father Chrysostomos [Wed, 29 Aug 2012 19:49:56 +0000 (12:49 -0700)]
lex.t: Mangle obscenity (albeit euphemistic)
It is harder to hack on perl with someone looking over one’s shoulder
when there are comments like this, even when it is euphemistic in its
use of voiced dental stops instead of the voiceless kind.
Father Chrysostomos [Wed, 29 Aug 2012 19:47:32 +0000 (12:47 -0700)]
Fix here-doc body extraction in eval 's//<<END/'
Outside of string eval, this:
s//<<END/e; print "a
END
b\n";
prints this:
a
b
But when we have string eval involved,
eval 's//<<END/e; print "a
END
b\n"';
we get this:
a
b
Amazing!
The buggy code in question goes back to commit
0244c3a403.
Since PL_linestr only contains the contents of the replacement
("<<END"), it peeks into the outer lexing scope’s linestr buffer, mod-
ifying it in place to remove the here-doc body, by copying everything
after the here-doc back to the spot where the body begins.
It was off by one, however, and left an extra line break.
When the code in question is reached, the variables are set as follows:
bufptr = "; print \"a"... (just after the s///)
s = "\nb\\n\"" (newline after the heredoc terminator)
The herewas variable already contains everything after the quote-
like operator containing the <<heredoc marker to the end of the line
including the \n ("; print \"a\n").
But then we concatenate everything from s onwards. So we end up with
the \n before the here-doc body and the \n from after the here-doc
terminator juxtaposed.
So after using s to extract the re-eval string, we increment s so it
points afer the final newline.
Father Chrysostomos [Wed, 29 Aug 2012 19:35:49 +0000 (12:35 -0700)]
Finish fixing here-docs in re-evals
This commit fixes here-docs in single-line re-evals in files (as
opposed to evals) and here-docs in single-line quote-like operators
inside re-evals.
In both cases, the here-doc parser has to look into an outer
lexing scope to find the here-doc body. And in both cases it
was stomping on PL_linestr (the current line buffer) while
PL_sublex_info.re_eval_start was pointing to an offset in that buffer.
(re_eval_start is used to construct the string to include in the
regexp’s stringification once the lexer reaches the end of the
re-eval.)
Fixing this entails moving re_eval_start and re_eval_str to
PL_parser->lex_shared, making the pre-localised values visible.
This is so that the code that peeks into an outer linestr buffer to
steal the here-doc body can set up re_eval_str in the right scope.
(re_eval_str is used to store the re-eval text when the here-
oc parser has no choice but to modify linestr; see also commit
db4442662555874019.)
It also entails making the stream-based parser (i.e., that reads from
an input stream) leave PL_linestr alone, instead of clobbering it and
then reconstructing part of it afterwards.
Father Chrysostomos [Wed, 29 Aug 2012 15:41:41 +0000 (08:41 -0700)]
toke.c:S_scan_heredoc: Put stream-based parser in else block
We currently have the code laid out like this:
if (peek) {
... peek inside the parent linestr buffer
}
else if (eval) {
... grab the heredoc body from linestr ...
}
else
start with an empty string for the heredoc body
... parse the body of the heredoc from the input stream ...
The final bit is inside a while loop whose condition is never true
after either of the first two branches of the if/else has executed.
But the code is very hard to read, and it is difficult to fix bugs, as
code cannot be added before the while loop, and the while loop condi-
tion cannot change, without affecting heredocs in string eval.
So put the final parser inside the else. Future commits will
depend on this.
Father Chrysostomos [Wed, 29 Aug 2012 15:36:40 +0000 (08:36 -0700)]
Avoid uninit warning for qq|${\<<FOO}|
If a here-doc occurs inside a single-line quote-like operator inside
a file (as opposed to an eval), it produces an uninitialized warning.
The goto I added in commit
99bd9d90 wentto the wrong place.
Father Chrysostomos [Wed, 29 Aug 2012 05:37:10 +0000 (22:37 -0700)]
toke.c: S_scan_heredoc: prune dead code
This incorrect code (using a pointer after finding it to be null)
is the result of the refactoring in
60f40a3895. It was trying to
account for a string eval with no line break in it. But that can’t
happen as of
11076590 (if it could it would crash).
So remove it and add an assertion, along with a comment explaining the
assertion.
Nicholas Clark [Thu, 30 Aug 2012 13:34:33 +0000 (15:34 +0200)]
Refactor t/op/die.t to re-use the same $SIG{__DIE__} handler where possible.
Restore testing that the $SIG{__DIE__} handler is called for the case of
C<die bless [ 7 ], "Error";> which was removed by the previous refactoring.
Re-using the same $SIG{__DIE__} handler results in 4 more tests of isa_ok()
for an 'ARRAY' - this isn't going to hurt anyone.
Colin Kuskie [Wed, 18 Jul 2012 04:59:30 +0000 (21:59 -0700)]
Refactor t/op/die.t to use test.pl instead of making TAP by hand.
[With a few whitespace tweaks]
Jerry D. Hedden [Wed, 29 Aug 2012 14:55:12 +0000 (10:55 -0400)]
Fix Cygwin build warnings
Fixes the following build warnings under Cygwin:
cygwin.c: In function 'do_spawn':
cygwin.c:132:5: warning: assignment from incompatible pointer type
cygwin.c: In function 'XS_Cygwin_posix_to_win_path':
cygwin.c:346:9: warning: 'err' may be used uninitialized in this function
cygwin.c: In function 'XS_Cygwin_win_to_posix_path':
cygwin.c:257:9: warning: 'err' may be used uninitialized in this function
Nicholas Clark [Wed, 29 Aug 2012 20:23:19 +0000 (22:23 +0200)]
Remove a no-longer needed lexical from t/op/lop.t
Jim Keenan spotted the commented out code referencing the variable $test.
Turns out that it is completely redundant, so its declaration can go too.
Colin Kuskie [Sat, 11 Aug 2012 03:24:09 +0000 (20:24 -0700)]
Document the last five tests of t/op/lop.t
Colin Kuskie [Sat, 28 Jul 2012 21:14:45 +0000 (14:14 -0700)]
Update t/op/lop.t to use test.pl instead of making TAP by hand.
Colin Kuskie [Thu, 19 Jul 2012 01:35:19 +0000 (18:35 -0700)]
Refactor t/uni/case.pl to use test.pl instead of making TAP by hand.
Colin Kuskie [Wed, 18 Jul 2012 05:21:21 +0000 (22:21 -0700)]
Refactor t/porting/checkcase.t to use test.pl instead of making TAP by hand.
Colin Kuskie [Wed, 18 Jul 2012 05:07:54 +0000 (22:07 -0700)]
Refactor t/re/no_utf8_pt.t to use test.pl instead of making TAP by hand.
Nicholas Clark [Tue, 28 Aug 2012 19:22:51 +0000 (21:22 +0200)]
Add /\.gif\z/ files to the non-Pod exceptions in t/porting/podcheck.t
Nicholas Clark [Tue, 28 Aug 2012 19:09:24 +0000 (21:09 +0200)]
t/porting/podcheck.t now passes no_chdir to File::Find::find().
File::Find::find() can call warn::warnif(), which in turn attempts to lazy
load Carp, which doesn't work for a test using relative paths in @INC with
the current directory changed.
Nicholas Clark [Tue, 28 Aug 2012 15:23:10 +0000 (17:23 +0200)]
t/porting/dual-life.t now passes no_chdir to File::Find::find().
File::Find::find() can call warn::warnif(), which in turn attempts to lazy
load Carp, which doesn't work for a test using relative paths in @INC with
the current directory changed.
Nicholas Clark [Tue, 28 Aug 2012 15:14:37 +0000 (17:14 +0200)]
t/porting/exec-bit.t isn't using File::{Basename,Find,Spec::Functions}.
No point loading modules that it uses nothing from.
Nicholas Clark [Tue, 28 Aug 2012 15:05:18 +0000 (17:05 +0200)]
t/porting/checkcase.t now passes no_chdir to File::Find::find().
This avoids the test occasionally aborting due to File::Find::find() calling
warn::warnif(), which in turn attempts to lazy load Carp, which doesn't work
for a test using relative paths in @INC with the current directory changed.
Nicholas Clark [Tue, 28 Aug 2012 20:01:19 +0000 (22:01 +0200)]
Refactor t/porting/filenames.t to shrink the code and the TAP generated.
Fold the function validate_file_name() into its only caller. Put the tested
pathname into each test description to avoid a call to note() - this halves
the size of the TAP generated. Fold the chained tests into a chained
if/elsif/else sequence. Eliminate the use of File::Spec, as all platforms
can cope internally with F<../MANIFEST>.
Karl Williamson [Tue, 28 Aug 2012 21:37:22 +0000 (15:37 -0600)]
regexec.c: White-space only
This outdents a block whose enclosing braces have been removed, and
reflows things to correspond.
Karl Williamson [Tue, 28 Aug 2012 21:29:42 +0000 (15:29 -0600)]
Avoid duplicate table look ups.
These two spots both are matching 'c+' where 'c' is some character
against a Unicode table. Prior to this patch, if it matched a single
'c', it would fall into a while loop, where it matches that same 'c'
again. Simply increment the pointer past the first match, and the while loop
will start looking for succeeding matches starting with the next
character in the input.
Karl Williamson [Tue, 28 Aug 2012 21:25:48 +0000 (15:25 -0600)]
Refactor \X regex handling to avoid a typical case table lookup
Prior to this commit 98.4% of Unicode code points that went through \X
had to be looked up to see if they begin a grapheme cluster; then looked
up again to find that they didn't require special handling. This commit
refactors things so only one look-up is required for those 98.4%. It
changes the table generated by mktables to accomplish this, and hence
the name of it, and references to it are changed to correspond.
Karl Williamson [Tue, 28 Aug 2012 03:50:03 +0000 (21:50 -0600)]
regexec.c: Remove no longer needed comments
These comments gave the derivation of the published Unicode algorithm
for determining what goes into \X to how it is actually implemented.
The new version of the Unicode text will be much more like what we've
implemented, so the derivation is no longer necessary; and is about to
be obsolete because of the Unicode document, and some changes to how we
process.
Steve Hay [Tue, 28 Aug 2012 17:32:14 +0000 (18:32 +0100)]
perldelta for
43ddfa5614 and
39b80fd98d.
Steve Hay [Tue, 28 Aug 2012 10:33:00 +0000 (11:33 +0100)]
Revert File::Copy::copy() to fail when copying a file onto itself
Copying a file onto itself was made a fatal error by
96a91e0163.
This was changed in
754f2cd0b9 from an undesirable croak() to return 1,
but the documentation was never changed from it being a fatal error.
It should probably have remained an error as per the documentation (but
updated not to say fatal) for consistency with cases of copying a file
onto itself via symbolic links or hard links.
Steve Hay [Mon, 27 Aug 2012 17:09:11 +0000 (18:09 +0100)]
Fix File::Copy test failure on Windows
Failure was introduced by
43ddfa5614 which looks for a warning message from
code that isn't run on Windows.
Father Chrysostomos [Tue, 28 Aug 2012 17:22:04 +0000 (10:22 -0700)]
note CPAN pod link target; regen pod issues
Father Chrysostomos [Tue, 28 Aug 2012 17:18:12 +0000 (10:18 -0700)]
perldtrace.pod: typo
Father Chrysostomos [Tue, 28 Aug 2012 17:15:08 +0000 (10:15 -0700)]
perldtrace.pod: Remove a stray =item
Father Chrysostomos [Tue, 28 Aug 2012 17:11:00 +0000 (10:11 -0700)]
Add another address for Shawn Moore to checkAUTHORS.pl
Father Chrysostomos [Tue, 28 Aug 2012 17:09:21 +0000 (10:09 -0700)]
Add t/run/dtrace.pl to MANIFEST
Shawn M Moore [Sun, 19 Aug 2012 15:12:27 +0000 (17:12 +0200)]
"loading-file" and "loaded-file" DTrace probes
Shawn M Moore [Fri, 24 Aug 2012 08:35:08 +0000 (10:35 +0200)]
"op-entry" DTrace probe
Father Chrysostomos [Tue, 28 Aug 2012 08:22:13 +0000 (01:22 -0700)]
op.c: Two more boolean %hash optimisations
In commit
c8fe3bdf72 I used the wrong flag for ?:, causing it to slow
down unless the ?: was in void context.
OP_NOT has been sensitive to void context all along, which was never
necessary.
These two should be just as fast. The second should not be slower:
!%hash;
!!%hash;
Father Chrysostomos [Tue, 28 Aug 2012 08:11:30 +0000 (01:11 -0700)]
Use PL_parser->lex_shared instead of Sv[IN]VX(PL_linestr)
Unfortunately, PL_parser->linestr and PL_parser->bufptr are both
part of the API, so we can’t just move them to PL_parser->lex_shared.
Instead, we have to copy them in sublex_push, to make them visible to
inner lexing scopes.
This allows the SvIVX(PL_linestr) and SvNVX(PL_linestr) hack to
be removed.
It should also speed things up slightly. We are already allocating
PL_parser->lex_shared in sublex_push, so there should be no need to
upgrade PL_linestr to SvNVX as well.
I was pleasantly surprised to see how the here-doc code seemed to
shrink all by itself when modified to account.
PL_sublex_info.super_bufptr is also superseded by the addition of
->ls_bufptr to the LEXSHARED struct. Its old values when localised
were not visible, being stashed away on the savestack, so it was
harder to use.
Father Chrysostomos [Tue, 28 Aug 2012 07:51:27 +0000 (00:51 -0700)]
caller.t: Fix ‘Caller’ test
This string eval was always failing, leaving @c with its previous
value, which just happened to be what we were expecting.
Father Chrysostomos [Tue, 28 Aug 2012 06:03:36 +0000 (23:03 -0700)]
Stop here-docs from gutting (caller $n)[6]
(caller $n)[6] returns the text of the eval. Actually, it would
return, not the text of the eval, but the text with all the here-doc
bodies missing.
In this commit, I’m abusing the SvSCREAM flag to indicate that the
eval text stored in the context stack is refcounted.
Father Chrysostomos [Tue, 28 Aug 2012 05:38:57 +0000 (22:38 -0700)]
Stop (caller $n)[6] from including final "\n;"
String eval appends "\n;" to the string before evaluating it.
(caller $n)[6], which returns the text of the eval, was giving the
modified string, rather than the original.
In fact, it was returning the actual string buffer that the parser
uses. This commit changes it to create a new mortal SV from that
string buffer, but without the last two characters.
It unfortunately breaks this JAPH:
eval'BEGIN{${\(caller 2)[6]}=~y< !"$()+\-145=ACHMT^acfhinrsty{}>
<nlrhta"o Pe e,\nkrcrJ uthspeia">}say if+chr(1) -int"145"!=${^MATCH}'
Father Chrysostomos [Tue, 28 Aug 2012 01:26:11 +0000 (18:26 -0700)]
Fix eval 'q;;'
The parser expects a semicolon at the end of every statement, so the
lexer provides one. It was not doing so for evals ending with a
semicolon, even if that semicolon was not a statement-terminating
semicolon.
Father Chrysostomos [Tue, 28 Aug 2012 01:19:24 +0000 (18:19 -0700)]
Revert "smoke-me diag"
This reverts commit
372a31d8f53707bcfa9c233ce02a93f778b7bb4b.
I missed this when I was merging that branch. It should never have
made its way into blead. It was to find out why the Windows smokes
were temporarily failing, by dumping Config_heavy.pl in the logs.
This was what led to
0ee364945bd.
Father Chrysostomos [Tue, 28 Aug 2012 01:19:12 +0000 (18:19 -0700)]
parser.h: Document copline with more detail
It took me a while to figure this out, so here it is for
future readers.
Father Chrysostomos [Tue, 28 Aug 2012 01:16:34 +0000 (18:16 -0700)]
Fix line numbers inside here-docs
A previous commit put the number of lines in a here-doc in a separ-
ate parser field, which was added on to the line number at the next
CopLINE_inc (actually COPLINE_INC_WITH_HERELINES, now used through-
out toke.c).
Code interpolated inside the here-doc was picking up that value,
throwing line numbers off.
Before that, they were already off by one.
This commit fixes both.
I removed the CLINE from S_scan_heredoc and stopped using TERM (which
uses CLINE) for here-docs. CLINE sets PL_copline, which is used to
pass a specific line number to newSTATEOP, which may or may not be the
same number as CopLINE(PL_curcop). newSTATEOP grabs that number and
sets PL_copline to -1 (aka NOLINE). I assume this was used to make
the statement containing the <<foo marker have the right line number.
But it didn’t fully work out, as subsequent statements on the same
line had the wrong number. That I fixed a few commits ago when I
introduced herelines, making CopLINE(PL_curcop) have the right line
number for that line. So the CLINE is not actually necessary anymore.
It was causing a problem also with the first statement inside the
heredoc (in ${...}), which would ‘steal’ the line number of the
<<foo marker.
This also means that <FH> and <.*> no longer do CLINE, but it is not
necessary, as they cannot span multiple lines.
Father Chrysostomos [Mon, 27 Aug 2012 21:56:52 +0000 (14:56 -0700)]
op.c: newSTATEOP: don’t check PL_parser after using it
If it is null, we would already have crashed when reaching this
statement.
Father Chrysostomos [Mon, 27 Aug 2012 16:18:29 +0000 (09:18 -0700)]
Add PL_parser->lex_shared struct; move herelines into it
PL_parser->herelines needs to be visible to inner lexing scopes, which
also need to have their own copy of it, so that the here-doc parser
can modify the right herelines variable corresponding to the
PL_linestr from which it is stealing its body. (A subsequent commit
will take take of that.)
Father Chrysostomos [Mon, 27 Aug 2012 06:46:09 +0000 (23:46 -0700)]
Stop invalid y/// ranges from leaking
Father Chrysostomos [Mon, 27 Aug 2012 06:27:45 +0000 (23:27 -0700)]
toke.c: Merge KEY_tr and KEY_y
Father Chrysostomos [Mon, 27 Aug 2012 06:10:28 +0000 (23:10 -0700)]
Stop unterminated here-docs from leaking memory
Father Chrysostomos [Mon, 27 Aug 2012 00:51:37 +0000 (17:51 -0700)]
[perl #114070] Fix lines nums after <<foo
The line numbers for operators after a here-doc marker on the same
line were off by the length of the here-doc.
This is because the here-doc parser would artificially increase the
line number as it went, because it was stealing lines out of the
input stream.
Instead, we can record the number of lines in the here-doc, and add it
to the line number the next time we need to increment it.
This also fixes the line numbers after s//<<END/e to the end of the
file, which were off because the line number adjusted by the <<END was
localised to the s///.
Since herelines is visible to inner lexing scopes, the outer lexing
scope can see changes made by the inner one.
The lack of localisation does cause problems with line numbers inside
quote-like operators (but they were off by one already), which will be
addressed in subsequent commits.
Karl Williamson [Mon, 27 Aug 2012 02:26:37 +0000 (20:26 -0600)]
Add utility and .h for character's UTF-8
This add regen/utf8_strings.pl takes Unicode characters and generates
utf8_strings.h to contains #defines for macros that translate from the
name to the UTF-8. This is needed in a few places, where previously
things were manually figured out and hard-coded in. Doing this instead
makes this easier, and removes EBCDIC dependencies/bugs, as the file
would simply be regen'd on an EBCDIC platform.
Karl Williamson [Thu, 16 Aug 2012 04:48:47 +0000 (22:48 -0600)]
regen/regcharclass.pl: Comment out obsolete code
Tricky folds have been removed from the code, so the removed #defines
are obsolete. I'm leaving this in, in so it can conveniently be
referred to in case we ever need it again.
Father Chrysostomos [Sun, 26 Aug 2012 19:34:43 +0000 (12:34 -0700)]
Opcode.pm: wrap long pod lines
Father Chrysostomos [Sun, 26 Aug 2012 19:29:07 +0000 (12:29 -0700)]
Increase $Opcode::VERSION to 1.24
Father Chrysostomos [Sun, 26 Aug 2012 19:28:45 +0000 (12:28 -0700)]
Remove boolkeys op
Father Chrysostomos [Sun, 26 Aug 2012 18:59:19 +0000 (11:59 -0700)]
pp_hot.c: pp_rv2av: Squash repetitive code
The LVRET that I removed (in the if(SvTYPE(sv) == type) block) actu-
ally never evaluates to true, because that block is only entered for
%hash->{elem} or @array->[elem], in which the parent op is helem or
aelem, not leavesublv or return. LVRET only returns true if the cur-
rent op is the last op in an lvalue sub. Likewise, the OPpMAYBE_LVSUB
flag is never set in that case, so checking it now is harmless (the
cases that used to enter the if(SvTyPE(sv)==type) block now fall
through to the OPpMAYBE_LVSUB check).
(Using LVRET in pp_rv2av is actually incorrect, and I corrected most instances in
40c94d11, but this one remained.)
Father Chrysostomos [Sun, 26 Aug 2012 18:10:18 +0000 (11:10 -0700)]
Croak for \local %{\%foo}
See the previous commit.
When I moved the check for local %$ref earlier, I didn’t move it
early enough.
Father Chrysostomos [Sun, 26 Aug 2012 18:06:39 +0000 (11:06 -0700)]
Restore ‘Can’t localize through ref’ to lv subs
In commit
40c94d11, I put an if statement inside an if statement,
skipping the else that followed if the outer if was true:
if (...) {
}
else if {
became
if (...) {
...
if (...) {
...
}
}
else if {
The result was that ‘Can’t localize through a reference’ no longer
happened if the operator (%{} or @{}) was the last thing in an lvalue
sub, if the lvalue sub was not called in lvalue context.
$ perl5.14.0 -e 'sub foo :lvalue { local %{\%foo} } foo(); print "ok\n"'
Can't localize through a reference at -e line 1.
$ perl5.16.0 -e 'sub foo :lvalue { local %{\%foo} } foo(); print "ok\n"'
ok
If the sub is called in lvalue context, the bug exists there, too, but
is much older (probably
82d039840b9):
$ perl5.6.2 -e 'sub f :lvalue { local %{\%foo} } (f()) =3; print "ok\n"'
Can't localize through a reference at -e line 1.
$ perl5.8.1 -e 'sub f :lvalue { local %{\%foo} } (f()) =3; print "ok\n"'
ok
The simplest solution is to change the order of the conditions. If
the rv2hv or rv2av op is passed a reference, and has ‘local’ in front
of it (OPf_MOD && OPpLVAL_INTRO), that should die, regardless of
whether it is the last thing in an lvalue sub.
Karl Williamson [Sun, 26 Aug 2012 17:49:26 +0000 (11:49 -0600)]
Use new Unicode 6.2 beta
These supposedly are the final data files for 6.2. Earlier changes
originally proposed for 6.2 have been deferred until a later release.
Thus there is no change in the general category of ASCII characters in
these files from what they were in 6.1 and earlier, unlike what had been
proposed.
Unlike the previous experimental beta, code is now in place in Perl to
handle the revised definition of \X in 6.2. The current working draft
of that definition is at http://unicode.org/draft/reports/tr29/tr29.html
Karl Williamson [Sun, 26 Aug 2012 17:25:13 +0000 (11:25 -0600)]
Prepare for Unicode 6.2
This changes code to be able to handle Unicode 6.2, while continuing to
handle all prevrious releases.
The major change was a new definition of \X, which adds a property to
its calculation. Unfortunately \X is hard-coded into regexec.c, and so
has to revised whenever there is a change of this magnitude in Unicode,
which fortunately isn't all that often. I refactored the code in
mktables to make it easier next time there is a change like this one.
Karl Williamson [Sun, 26 Aug 2012 15:47:48 +0000 (09:47 -0600)]
mktables: Re-order some code, change comments
Unicode 6.2 is changing some of these things; this re-ordering will make
that more convenient.
Karl Williamson [Sun, 26 Aug 2012 15:29:13 +0000 (09:29 -0600)]
mktables: Correct generated table comment
Karl Williamson [Sat, 18 Aug 2012 17:44:09 +0000 (11:44 -0600)]
lib/unicore/README.perl: Make usablea s shell script
This adds comment symbols and redirects error messages to /dev/null for
likely things that will fail
Karl Williamson [Sat, 18 Aug 2012 16:01:07 +0000 (10:01 -0600)]
Revert "Experimentally Use Unicode 6.2 beta"
This reverts commit
5435c3759c4567a1bb51384f6641c04822ec6391.
A new beta has been released, and so we should use that instead.
Karl Williamson [Sun, 26 Aug 2012 17:30:57 +0000 (11:30 -0600)]
perldelta for Unicode property performance gains
Steve Hay [Sun, 26 Aug 2012 13:34:22 +0000 (14:34 +0100)]
Upgrade Socket from 2.004 to 2.006
H.Merijn Brand [Sun, 26 Aug 2012 12:52:26 +0000 (14:52 +0200)]
Add Configure probe for ip_mreq_source
Needed to upgrade Socket from CPAN
Father Chrysostomos [Sun, 26 Aug 2012 05:27:33 +0000 (22:27 -0700)]
Correct typo in flag name
Father Chrysostomos [Sun, 26 Aug 2012 01:48:46 +0000 (18:48 -0700)]
Banish boolkeys
Since
6ea72b3a1, rv2hv and padhv have had the ability to return boo-
leans in scalar context, instead of bucket stats, if flagged the right
way. sub { %hash || ... } is optimised to take advantage of this. If
the || is in unknown context at compile time, the %hash is flagged as
being maybe a true boolean. When flagged that way, it returns a bool-
ean if block_gimme() returns G_VOID.
If rv2hv and padhv can already do this, then we don’t need the
boolkeys op any more. We can just flag the rv2hv to return a boolean.
In all the cases where boolkeys was used, we know at compile time that
it is true boolean context, so we add a new flag for that.
Karl Williamson [Tue, 21 Aug 2012 14:17:51 +0000 (08:17 -0600)]
regexec.c: White-space only
Indent inside newly formed block
Karl Williamson [Tue, 21 Aug 2012 04:03:22 +0000 (22:03 -0600)]
regex: Speed up \X processing
For most Unicode releases, GCB=prepend matches absolutely nothing. And
that appears to be the case going forward, as they added things to it,
and removed them later based on field experience.
An earlier commit has improved the performance of this significantly by
using a binary search of an empty array instead of a swash hash.
However, that search requires several layers of function calls to
discover that it is empty, which this commit avoids.
This patch will use whatever swash_init() returns unless it is empty,
preserving backwards compatibility with older Unicode releases. But if
it is empty, the routine sets things up so that future calls will always
fail without further testing.