Commit 211739ec authored by Jason Rhinelander's avatar Jason Rhinelander
Browse files

Binary codepoints never worked: removed them

"0b1" is a valid hex value, and was interpreted as such, so the binary
input value regular expression subgroup never matched.
parent a3b1faac
......@@ -36,10 +36,6 @@ my $arg = qr{
[D0]\+ \d+ (?:[_ ]\d+)* # Decimal, such as 0+8253 or D+82_53
)
|
(
0?b[01]+(?:[_ ][01]+)* # Binary, such as: 0b100000_00111101, b00100000_00111101, b10000000111101, etc. single _'s allowed.
)
|
_?(\X) # Any old unicode character (or character composition), prefixable with _ (so that _e show U+0065 instead of U+000E)
}six;
......@@ -140,27 +136,20 @@ if ($opts{search} or $opts{regex}) {
my @chars;
for (@ARGV) {
if (/^($arg)(?:-($arg))?\z/) {
my ($char, $to) = ($1, $7);
my ($char, $to) = ($1, $6);
if (defined $to and (
$6 and length($6) > 1
$5 and length($5) > 1
or
$12 and length($12) > 1
$10 and length($10) > 1
)) {
# $6 or $12 is a literal character, but if its length is greater than 1 its a composed character,
# and in such case a range does not make any sense, so error out
# $5 or $10 is a literal character, but if its length is greater than 1 it's a composed
# character, and in such case a range does not make any sense, so error out
my $error = "Invalid range $_ specified: ";
if ($6 and length($6) > 1) {
$error .= "$6";
if ($12 and length($12) > 1) {
$error .= " and $12 are both multiple codepoint composed character sequences!";
}
else {
$error .= " is a composed character sequence!";
}
}
else {
$error .= "$12 is a composed character sequence!";
}
my $plural = ($5 and length($5) > 1 and $10 and length($10) > 1);
$error .= $plural ? "$5 and $10 are both" : ($5 and length($5) > 1) ? "$5 is" : "$10 is";
$error .= "multiple codepoint composed character sequence";
$error .= "s" if $plural;
$error .= "!";
}
push @chars, defined $to
? (codepoint($char) .. codepoint($to))
......@@ -322,12 +311,11 @@ Usage: $0 [OPTION]... [FROM-TO]... [CHARACTER]...
Displays UTF-8 characters from FROM to TO, or from each character in the list
provided. FROM, TO and CHARACTER can be hexadecimal numbers (optionally
beginning with 0x or the unicode-style U+ prefix), binary numbers (beginning
with 0b), decimal numbers prefixed with "0+" or "D+", or single UTF-8
characters, optionally prefixed with an underscore (required for literal
characters 0-9, a-f, and A-F, to avoid being interpreted as a hexademical
character). If no FROM-TO pairs nor CHARACTERs are specified, characters from
0 to 255 are displayed.
beginning with 0x or the unicode-style U+ prefix), decimal numbers prefixed
with "0+" or "D+", or single UTF-8 characters, optionally prefixed with an
underscore (required for literal characters 0-9, a-f, and A-F, to avoid being
interpreted as a hexademical character). If no FROM-TO pairs nor CHARACTERs
are specified, characters from 0 to 255 are displayed.
Recognized options:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment