Branch: refs/heads/blead Home: https://github.com/Perl/perl5 Commit: bde20b6f8c43b9b9df96a49e7cd1ed03a638a301 https://github.com/Perl/perl5/commit/bde20b6f8c43b9b9df96a49e7cd1ed03a638a301 Author: Karl Williamson <k...@cpan.org> Date: 2023-08-07 (Mon, 07 Aug 2023)
Changed paths: M toke.c Log Message: ----------- toke.c: Rmv useless 'else' and outdent The 'else' functioned only to allow declarations in C89. Now that we are on C99, it isn't needed, and gives us more room on the line and makes it clear there is nothing to follow at the end of the else. Commit: 81c34b67bb519f6369e4f2a7b23fb4a39be01f46 https://github.com/Perl/perl5/commit/81c34b67bb519f6369e4f2a7b23fb4a39be01f46 Author: Karl Williamson <k...@cpan.org> Date: 2023-08-07 (Mon, 07 Aug 2023) Changed paths: M toke.c Log Message: ----------- toke.c: S_intuit_more: simplify 1-2 digit case The way the code worked before this commit when the input is one or two digits enclosed in [] was: Originally, the weight is set to 2. Then if the first byte is a digit, it gets modified to one of: a) If a single digit: 2 - 100 = -98 b) If precisely 2 digits: 2 - 10 = -8 The code previously then executes the loop with the weight set as above. It sets un_char to the first digit, and last_un_char to 255, which is not a \w in ASCII nor is it a \w ASCII equivalent in any of the EBCDIC character sets ever recognized by Perl. The loop then executes a switch(); the digit input causes default: to be taken, none of whose conditionals match, so it subtracts 0 from the weight (since the character hasn't been seen before, as this is the first loop iteration). For the case of the input being a single digit, the loop doesn't execute again, and the weight is still -98, so it returns TRUE: this is a subscript. For the case of the input being precisely two digits, the loop is executed again, looking at the second digit. Again default: is chosen and the weight is: a) changed to -8 + 5 = -3 if the second digit is +1 wrt the first digit. b) changed to -8 - 1 = -7 if the two digits are the same; a) unchanged at -8 otherwise In all cases above, the result is negative, and the function returns that this is a subscript. Thus this function always returns TRUE when the input is precisely one or two digits. By replacing the current special case by a different special case that just returns 'TRUE for these inputs, the code is simplified, and opens the prospect of future simplifications. This commit moves the 1-2 digit special case to before the weight declaration, as the weights are now not needed until later; and it also prefers pointer subtraction over a memory access. Commit: 104ca0121545c90b5011c24e93128c42b93791a0 https://github.com/Perl/perl5/commit/104ca0121545c90b5011c24e93128c42b93791a0 Author: Karl Williamson <k...@cpan.org> Date: 2023-08-07 (Mon, 07 Aug 2023) Changed paths: M toke.c Log Message: ----------- S_intuit_more: Add comments; slight simplification Commit: e784e2ade024c1b29b6017ca0ec14b466af69f6e https://github.com/Perl/perl5/commit/e784e2ade024c1b29b6017ca0ec14b466af69f6e Author: Karl Williamson <k...@cpan.org> Date: 2023-08-07 (Mon, 07 Aug 2023) Changed paths: M toke.c Log Message: ----------- toke.c: Move some declarations closer to their use To enhance readability Commit: 23d54dfaa7c83039e50cf1f497fbb1f6f91b45cc https://github.com/Perl/perl5/commit/23d54dfaa7c83039e50cf1f497fbb1f6f91b45cc Author: Karl Williamson <k...@cpan.org> Date: 2023-08-07 (Mon, 07 Aug 2023) Changed paths: M toke.c Log Message: ----------- toke.c: S_intuit_more: Use DeMorgan's laws to clarify Commit: 57ae1f3a8e669082e3d5ec6a8cdffbdc39d87bee https://github.com/Perl/perl5/commit/57ae1f3a8e669082e3d5ec6a8cdffbdc39d87bee Author: Karl Williamson <k...@cpan.org> Date: 2023-08-07 (Mon, 07 Aug 2023) Changed paths: M toke.c Log Message: ----------- toke.c: S_intuit_more: Comments, white-space I went through this "terrifying" code and analyzed it, adding comments, and white space to clarify what it is doing Commit: eb05ffbd4078e3c9f856bad3729c45e22a9ca820 https://github.com/Perl/perl5/commit/eb05ffbd4078e3c9f856bad3729c45e22a9ca820 Author: Karl Williamson <k...@cpan.org> Date: 2023-08-07 (Mon, 07 Aug 2023) Changed paths: M toke.c Log Message: ----------- toke.c: S_intuit_more: Don't use in-band sentinels Instead, use a flag to indicate the first time through the loop The sentinels previously used were unlikely to occur in the input, but the probability is certainly non-zero; this code may have been written before Unicode came along. It's just better to avoid all possible collisions, and it removes the unclear hack to change a value to 254 in order to avoid it being the same as the previous value. Commit: 0ec50ab68c1717b60d68a69f1b612161adfb181f https://github.com/Perl/perl5/commit/0ec50ab68c1717b60d68a69f1b612161adfb181f Author: Karl Williamson <k...@cpan.org> Date: 2023-08-07 (Mon, 07 Aug 2023) Changed paths: M toke.c Log Message: ----------- toke.c:S_intuit_more: Sort list This makes it easier to see what's in and what's out. Commit: fd8e427d5d362e902113b7784803d921f635598a https://github.com/Perl/perl5/commit/fd8e427d5d362e902113b7784803d921f635598a Author: Karl Williamson <k...@cpan.org> Date: 2023-08-07 (Mon, 07 Aug 2023) Changed paths: M toke.c Log Message: ----------- toke.c:S_intuit_more: *s -> s[0] This makes it consistent with other references to 's' Suggested by ilmari Commit: 47266b783b62155d6b67be46e0d49f403fb80c78 https://github.com/Perl/perl5/commit/47266b783b62155d6b67be46e0d49f403fb80c78 Author: Karl Williamson <k...@cpan.org> Date: 2023-08-07 (Mon, 07 Aug 2023) Changed paths: M toke.c Log Message: ----------- toke.c:S_intuit_more: Change variable name 'last' is ambiguous. What is meant here is 'previous' Commit: 55fa0195ce60ac3283d741b9f1ae5d62349a481f https://github.com/Perl/perl5/commit/55fa0195ce60ac3283d741b9f1ae5d62349a481f Author: Karl Williamson <k...@cpan.org> Date: 2023-08-07 (Mon, 07 Aug 2023) Changed paths: M toke.c Log Message: ----------- toke.c:S_intuit_more: Avoid repeating conditionals There are two cases that begin with '->'. Combine them. Commit: c3f72fd8485dbe5b3d9d903fe80b0bdcad097984 https://github.com/Perl/perl5/commit/c3f72fd8485dbe5b3d9d903fe80b0bdcad097984 Author: Karl Williamson <k...@cpan.org> Date: 2023-08-07 (Mon, 07 Aug 2023) Changed paths: M toke.c Log Message: ----------- S_intuit_more: Allow for EBCDIC Before comparing EBCDIC code points, one needs to place them in ASCII order, as not all letters in EBCDIC are contiguous. Commit: 7ec8faed577ce6e81198c84353f0f2aba5059b5e https://github.com/Perl/perl5/commit/7ec8faed577ce6e81198c84353f0f2aba5059b5e Author: Karl Williamson <k...@cpan.org> Date: 2023-08-07 (Mon, 07 Aug 2023) Changed paths: M toke.c Log Message: ----------- S_intuit_more: Add commentary Instead of making changes, this comments on where I think such changes could be profitable. Compare: https://github.com/Perl/perl5/compare/4f06424962ba...7ec8faed577c