summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* Improve -Dr output of bracketed char classesKarl Williamson2014-08-255-92/+202
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* regcomp.c: Use symbolic constant instead of numberKarl Williamson2014-08-251-1/+5
| | | | This is in preparation for it to be used in more than one place.
* regcomp.c: Add 'const' to parameterKarl Williamson2014-08-253-3/+3
|
* perldiag: Add clarification.Karl Williamson2014-08-251-1/+2
|
* regen/unicode_constants.pl: Find max ascii print cpKarl Williamson2014-08-252-0/+11
| | | | | | | 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
* handy.h, regcomp.c: Add, clarify commentsKarl Williamson2014-08-252-7/+8
|
* regcomp.c: Extract some code into a macroKarl Williamson2014-08-251-1/+6
| | | | This is in preparation for it to be used in more than one place
* regcomp.c: white-space onlyKarl Williamson2014-08-251-5/+2
| | | | Bring two case statements into line with their peers
* regcomp.c: Use available mnemonics for dumping regexKarl Williamson2014-08-251-0/+2
| | | | | Perl supports \e and \b (in bracketed character classes). Use these on outputting like we do \t and \n, instead of a hex value
* sv.c: Silence VMS compiler warningKarl Williamson2014-08-251-1/+1
| | | | | The result of this must be at least 0 as the type is unsigned, so the compiler gives a warning.
* embed.fnc: Clarify m flag behavior commentKarl Williamson2014-08-251-1/+1
|
* perlfunc: Improve the pointer from "elseif" to "elsif"Ævar Arnfjörð Bjarmason2014-08-251-2/+9
| | | | | | | | | | | | | | 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.
* toke.c: Remove unnecessary conditionFather Chrysostomos2014-08-241-1/+1
| | | | | | | | | | | | | | | 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
* Stop ck_rvconst from treating GV constants as stringsFather Chrysostomos2014-08-242-2/+11
| | | | | | | | | | | | | | | | | | 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.
* Remove compile-time checking of rv2?v with const kidFather Chrysostomos2014-08-243-26/+19
| | | | | | | | | | | | | | | | | | | | | | | 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.
* Test fpclassify() with full compile.Jarkko Hietaniemi2014-08-241-6/+24
| | | | | | inlibc test is no good since it is likely to be a macro. Also fix typo in fp_classify(). Yes, both exist.
* Reorder the *fp*class* in preference order, add comments.Jarkko Hietaniemi2014-08-241-38/+52
| | | | | | Most importantly, try C99 fpclassify() first. Use fp_classify() and fp_classl().
* Configure scan for fp_classl().Jarkko Hietaniemi2014-08-2415-2/+39
|
* Configure scan for fp_classify().Jarkko Hietaniemi2014-08-2415-2/+49
|
* More is_inf() et alia dance.Jarkko Hietaniemi2014-08-241-17/+36
| | | | | | | Too many almost similar interfaces. Most importantly go for isinf() and isnan() if available, instead of going for the labyrinth of *fp*class* interfaces.
* More robust inf/nan recognition and generation.Jarkko Hietaniemi2014-08-242-87/+121
| | | | | | | | | | | | | | | 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.
* [Merge] Eliminate PL_lex_expect; fix one bug; other clean-upFather Chrysostomos2014-08-249-1180/+1142
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
| * In perly.y, change PL_parser to parserFather Chrysostomos2014-08-244-63/+63
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
| * Set PL_expect only once after curly subscriptsFather Chrysostomos2014-08-245-163/+145
| | | | | | | | | | | | | | | | | | | | | | | | 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.
| * parser.h: Comment that lex_expect is unusedFather Chrysostomos2014-08-241-1/+1
| | | | | | | | | | | | | | 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.
| * toke.c: Remove PL_lex_expect defineFather Chrysostomos2014-08-241-1/+0
| | | | | | | | This is no longer used.
| * Stop setting PL_lex_expectFather Chrysostomos2014-08-242-2/+0
| | | | | | | | As of two commits ago, nothing uses its value any more.
| * toke.c: Consolidate some PL_expect assignmentsFather Chrysostomos2014-08-241-5/+3
| | | | | | | | | | The previous commit allows these settings of PL_expect to be combined. We no longer need one before force_next in each instance.
| * Stop using the value of PL_expectFather Chrysostomos2014-08-241-3/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | 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.
| * toke.c: For plugins, don’t set PL_expect if PL_nexttokeFather Chrysostomos2014-08-241-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
| * toke.c: Touch PL_expect less for implicit [.,] in quotesFather Chrysostomos2014-08-241-5/+5
| | | | | | | | | | | | | | | | | | 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.
| * [perl #80368] Fix implicit assignop in qq"a\U="Father Chrysostomos2014-08-242-2/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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).
| * toke.c: Correct S_ao descriptionFather Chrysostomos2014-08-241-2/+2
| | | | | | | | | | It applies not just to control flow assignment operators, but to all ‘x=’-style operators.
| * toke.c: Skip PL_expect assignment under KEY_requireFather Chrysostomos2014-08-241-1/+1
| | | | | | | | | | | | | | | | | | | | | | 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.
| * toke.c: Rework LOOPX macroFather Chrysostomos2014-08-241-11/+5
| | | | | | | | | | | | | | | | 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.)
| * toke.c:S_lop: Don’t set PL_expect if PL_nexttokeFather Chrysostomos2014-08-241-1/+1
| | | | | | | | | | | | | | 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.
| * Expand a comment in toke.c (eliminate ‘why?’)Father Chrysostomos2014-08-241-1/+4
| |
| * Set PL_expect less often when parsing semicolonsFather Chrysostomos2014-08-246-995/+979
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.)
| * toke.c: Don’t set PL_expect when emitting USE tokensFather Chrysostomos2014-08-241-2/+2
|/ | | | | | | | | | 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.
* Update Module-CoreList for 5.20.1Steve Hay2014-08-254-2/+66
| | | | | | | (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.)
* Add new pumpkin keeper victim following release of 5.21.3Steve Hay2014-08-252-1/+3
|
* perlxs: Add text about dealing with locales, etcKarl Williamson2014-08-242-11/+93
| | | | | | | 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.
* Make eval_pv documentation more preciseTadeusz Sośnierz2014-08-242-1/+2
|
* Increase $_charnames::VERSION to 1.42Father Chrysostomos2014-08-231-1/+1
|
* Partial minitest fix-upFather Chrysostomos2014-08-238-8/+8
| | | | | | | | | | | | | | 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 :-).
* perldiag grammar tweaksFather Chrysostomos2014-08-231-3/+3
|
* Explicitly cast to MANTISSATYPE since some compilers worry.Jarkko Hietaniemi2014-08-231-1/+1
|
* Fix bad quoting.Jarkko Hietaniemi2014-08-231-1/+1
|
* Update HTTP-Tiny to CPAN version 0.048Chris 'BinGOs' Williams2014-08-233-23/+31
| | | | | | | | | | [DELTA] 0.048 2014-08-21 13:19:51-04:00 America/New_York [FIXED] - Protected proxy tests from ALL_PROXY in the environment
* Update ExtUtils-CBuilder version for CPAN releaseChris 'BinGOs' Williams2014-08-231-1/+1
|