| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
I look at this output a lot to verify that patterns compiled correctly.
This commit makes them somewhat easier to read, while extending this to
also work on EBCDIC platforms (as yet untested).
In staring at these over time, I realized that punctuation literals are
mostly what contributes to being hard to read. [A-Z] is just as
readable as [A-Y], but [%!@\]~] is harder to read than if there were
fewer. Sometimes that can't be helped, but if many get output,
inverting the pattern [^...] can cause fewer to be output. This commit
employs heuristics to invert when it thinks that that would be more
legible. For example, it converts the output of [^"'] to be
ANYOF[^"'][{unicode_all}]
instead of
ANYOF[\x{00}-\x{1F} !#$%&()*+,\-./0-9:;<=>?@A-Z[\\\]\^_`a-z{|}~\x{7F}-\x{FF}][{unicode_all}]
Since it is a heuristic, it may not be the best under all circumstances,
and may need to be tweaked in the future.
If almost all the printables are to be output, it uses a hex range, as
that is probably more closely aligned with the intent of the pattern
than which individual printables are desired. Again this heuristic can
be tweaked.
And it prints a leading 0 on things it outputs as hex formerly as a
single digit \x{0A} now instead of \x{A} previously.
|
|
|
|
| |
This is in preparation for it to be used in more than one place.
|
| |
|
| |
|
|
|
|
|
|
|
| |
This creates a #define that gives the highest code point that is an
ASCII printable. On ASCII-ish platforms, this is 0x7E, but on EBCDIC
platforms it varies, and can be as high as 0xFF. This is in preparation
for needing this value in a future commit in regcomp.c
|
| |
|
|
|
|
| |
This is in preparation for it to be used in more than one place
|
|
|
|
| |
Bring two case statements into line with their peers
|
|
|
|
|
| |
Perl supports \e and \b (in bracketed character classes). Use these on
outputting like we do \t and \n, instead of a hex value
|
|
|
|
|
| |
The result of this must be at least 0 as the type is unsigned, so
the compiler gives a warning.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
A co-worker pointed out that the docs for "elsif" were quite confusing
because nothing when you "perldoc -f elseif" points out that it doesn't
exist, it just directs you to perlsyn where we only document "elsif".
Ricardo Signes added this aliasing back in v5.15.7-194-g8f0d6a6.
Improve this confusion, and also add a mention of the common "elif" and
"else if" variants while I'm at it. I was originally going to just alias
them, but t/porting/perlfunc.t started failing because we're missing
cross-references, and unlike "elseif" the other two aren't keywords,
even if the "elseif" one is only here to warn you about its use.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This code skips over a quoted string, handling escapes. And to han-
dle escapes it skips past the character following a backslash if that
character is itself a backslash or the quote character. Skipping past
the character after the backslash unconditionally, regardless of what
it is, has the same effect and uses less code.
This change shrunk the .o file.
Before:
-rw-r--r-- 1 sprout staff 671148 Aug 24 20:28 toke.o
After:
-rw-r--r-- 1 sprout staff 671100 Aug 24 22:37 toke.o
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
sub foo { 42 }
use constant bar => *foo;
BEGIN { undef *foo }
warn &{+bar};
warn bar->();
Obviously the last two lines should print the same thing, because they
both call the value of the ‘bar’ constant as a suroutine.
But op.c:ck_rvconst messes up the ‘bar->()’ at compile time, treating
the bar glob (a copy of the original *foo glob, and not the *foo glob
itself, which has since been undefined) as a string and using it to
look up a glob.
ck_rvconst should not do anything if the constant’s value is a glob.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
There was code in op.c:ck_rvconst (which runs when creating a derefer-
ence op, such as rv2sv, rv2av, etc.) that would check that a constant
kid holding a reference pointed to something of the right type. It
failed to take overloading into account.
The result was that these lines would fail to compile:
constant_reference_to_hash_with_coderef_overloading->();
constant_reference_to_sub_with_hashref_overloading->{key};
constant_reference_to_sub_with_arrayref_overloading->[0];
constant_reference_to_sub_with_scalarref_overloading->$*;
even though they should work.
Since the overloadedness could change any time, even checking for that
in op.c is incorrect. The only correct fix is to remove this compile-
time check. If something naughty gets through, it will be caught
at run time.
This fixes bugs #122607 and #69456.
|
|
|
|
|
|
| |
inlibc test is no good since it is likely to be a macro.
Also fix typo in fp_classify(). Yes, both exist.
|
|
|
|
|
|
| |
Most importantly, try C99 fpclassify() first.
Use fp_classify() and fp_classl().
|
| |
|
| |
|
|
|
|
|
|
|
| |
Too many almost similar interfaces.
Most importantly go for isinf() and isnan() if available,
instead of going for the labyrinth of *fp*class* interfaces.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Drop INFNAN_PEEK, premature optimization and hard to get right (it
basically imitates unrolled first half of grok_infnan). Just keep
grok_infan fast. (There is one spot in grok_number_flags() where we
peek at the next byte to avoid wasted work.)
If falling back (from not having NV_INF/NV_NAN) to the native strtod
(or similar), fake the input based on the grok_infnan result.
Add last-resort ways to generate inf/nan.
Recognize explicit unary plus, like "+Inf", and "INFINITE".
In tests use cmp_ok(), fix typos, add tests.
|
|\
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
PL_expect (PL_parser->expect) is what the lexer uses to keep track of
what type of thing to expect next. This (partly) determines whether
‘{’ begins a block, or an anonymous hash, or a subscript.
In numerous cases PL_expect was being set to the wrong value. There
were extra statements to set it back to the right value. There was
also a mechanism to save the value (force_next/PL_lex_expect) and
restore it later.
If we just set PL_expect to the correct values to begin with, we can
simplify things conceptually and reduce the amount of code.
I fixed bug #80368 in the process, since it got in the way.
I also fixed up some comments in toke.c and changed PL_parser to
parser in perly.y.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
All these code snippets are embedded inside a function
(perly.c:yyparse) that puts the current value of PL_parser in a local
variable named parser. So the two are equivalent, but the latter
only has to access a local variable.
Before:
$ ls -ld perly.o
-rw-r--r-- 1 sprout staff 94748 Aug 22 06:12 perly.o
After:
$ ls -ld perly.o
-rw-r--r-- 1 sprout staff 94340 Aug 22 06:15 perly.o
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
When curly subscripts are parsed, the lexer (toke.c:yylex) notes that
the value of PL_expect needs to be set to XSTATE (expecting a state-
ment) after the final brace. When the final brace is encountered,
PL_expect is set to that recorded value. But then the parser
(perly.y) sets it to XOPERATOR immediately thereafter.
This approach requires a plethora of identical statements in perly.y.
If we just set PL_expect to the right value to begin with, we can
avoid all those assignments.
|
| |
| |
| |
| |
| |
| |
| | |
There is at least one CPAN module (Data::Alias) that assigns to this.
Removing it won’t shrink the parser struct because of alignment, so
it doesn’t gain us anything. Just leave it for now. We can remove
it later if we have to.
|
| |
| |
| |
| | |
This is no longer used.
|
| |
| |
| |
| | |
As of two commits ago, nothing uses its value any more.
|
| |
| |
| |
| |
| | |
The previous commit allows these settings of PL_expect to be combined.
We no longer need one before force_next in each instance.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The changes in commits leading up to this one avoided unnecessary
PL_expect assignments that would soon be clobbered by this
‘PL_expect = PL_lex_expect’ that restores the previous value.
Hence, we no longer even need to read the value of PL_lex_expect since
PL_expect hasn’t changed.
Just one piece of code (KEY_package) was setting PL_lex_expect
directly instead of having force_next copy it from PL_expect, so this
commit changes it to set PL_expect to the correct value.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
When a parsing plugin finishes parsing its stuff, the lexer may have
emitted one more token than the construct it was parsing (if the
plugin called parsing API functions like parse_fullstmt). In such
cases, yyunlex has pushed that token on to the pending token stack
with force_next.
When the lexer is about to emit the plugin’s parsed statement or
expression, if there is a pending token, then it does not need to set
PL_expect, since the previous value will be restored anyway when the
pending token is emitted.
The next commit will disable that save-and-restore mechanism for
PL_expect, so we must not assign to it here.
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
When emitting implicit commas and cats, there is no need to set
PL_expect at the same time, since these code paths have already set
it to the correct value. Also, the two instances of Aop would check
the current parse position for an ‘=’ to make an assignment operator.
But that could never happen in these two code paths, so the check
was a waste.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The bug report explains it all:
> $ perl -e 'print "a\U="'
> Can't modify constant item in concatenation (.) or string at -e line 1, near "print "a\U=""
> Execution of -e aborted due to compilation errors.
>
> The "a\U=" string constant ought to generate ops corresponding roughly to
> "a".uc("=") (which would then be constant-folded). However, the "=" is
> being interpreted by the tokeniser as part of the concatenation operator,
> producing ops corresponding to "a".=uc("") (which generates the error).
>
> This happens because the implicit concatenation operator is generated
> in toke.c via the Aop() macro, which allows an addition-type operator
> to be mutated into an assignment operator if it is immediately followed
> by an "=". It should instead be generated via one of the other macros,
> or possibly a new macro, that doesn't allow for mutation to an assignment
> operator.
This commit does the latter.
> There are multiple sites in toke.c making the same mistake.
The other two instances are harmless, but the next commit will change
them for a different reason (avoiding unnecessary PL_expect assign-
ments with a view to eventually removing PL_lex_expect).
|
| |
| |
| |
| |
| | |
It applies not just to control flow assignment operators, but to all
‘x=’-style operators.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Only set PL_expect here when force_word has realised there is no word
there and has not called force_next. Setting PL_expect after a call
to force_next is useless, as force_next causes its saved value to be
restored when the next token is emitted.
Changing this may seem silly, as an unconditional assignment may even
be faster, but this will allow me to eliminate PL_lex_expect and make
PL_expect handling simpler than before.
|
| |
| |
| |
| |
| |
| |
| |
| | |
All its callers have the same two lines preceding it, so fold them
into the macro. Only assign to PL_expect after the force_word call if
force_word did not find a word. (If it did find one, then force_next
would have recorded the previous PL_expect value, which will clobber
the one we have just assigned.)
|
| |
| |
| |
| |
| |
| |
| | |
Don’t set PL_expect if we have a ‘next token’, because when it is
popped off the pending token stack PL_expect will be set to the
saved value, clobbering this assigned value. So the assignment is
unnecessary.
|
| | |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
As it worked before, the parser (perly.y) would set PL_expect to
XSTATE after encountering a statement-terminating semicolon.
Two functions in op.c--package and utilize--had to set the value to
XSTATE as a result.
Also, in the case of a closing brace, the lexer emits an implicit
semicolon followed by '}' (emitted via force_next). force_next
records the value of PL_expect and restores it when emitting the
token. So in this case the value of PL_expect was flipping back and
forth between two values.
Instead of having the parser set it to XSTATE, we can have the lexer
set it to XSTATE by default when emitting an explicit semicolon. (It
was setting it to XTERM.) The parser can set it to XTERM in the only
place that matters; viz., the header of a for-loop. This simplifies
things conceptually, and makes the code a whole line shorter.
(The diff stat shows more savings in line count, but that is because
the version of bison I used to regenerate the tables produces smaller
headers than what was already committed.)
|
|/
|
|
|
|
|
|
|
|
| |
This is a follow-up to 52d0e95bf.
It is not necessary to set PL_expect (via TERM or OPERATOR) since
tokenize_use has already done it. In 52d0e95bf I only changed one of
tokenize_use’s callers, and changed it the wrong way.
No behaviour changes.
|
|
|
|
|
|
|
| |
(Excluding %upstream and %bug_tracker portions, which involve modules that
are no longer in blead (e.g. Module-Build) and therefore are not suitable
for committing to blead and then cherry-picking to maint; they will be
committed directly to maint instead.)
|
| |
|
|
|
|
|
|
|
| |
This pod has been totally silent about monkey wrenches that could be
thrown by XS code doing things that can affect perl. Add a few
cautions, including some detailed information about one area where we
have been bitten: locales.
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
While minitest passes all its tests when everything has been
built, it is sometimes useful to run it when nothing has been
built but miniperl (especially when one is working on low-level
stuff that breaks miniperl). Many tests fail if things have
not been built yet because miniperl can’t find modules like
re.pm. This patch fixes up some tests to find those modules
and changes _charnames.pm to load File::Spec only when it
needs it.
There are still many more failures, but I’ll leave the rest
for another time (or another hacker :-).
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
| |
[DELTA]
0.048 2014-08-21 13:19:51-04:00 America/New_York
[FIXED]
- Protected proxy tests from ALL_PROXY in the environment
|
| |
|