This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Add OP_IS_INFIX_BIT
authorFather Chrysostomos <sprout@cpan.org>
Sun, 4 Jan 2015 06:34:28 +0000 (22:34 -0800)
committerFather Chrysostomos <sprout@cpan.org>
Sun, 1 Feb 2015 06:03:51 +0000 (22:03 -0800)
A convenience macro that a forthcoming commit will use.

opnames.h
regen/opcode.pl
regen/opcodes

index e68c8ca..c225ac4 100644 (file)
--- a/opnames.h
+++ b/opnames.h
@@ -436,4 +436,7 @@ typedef enum opcode {
 #define OP_IS_DIRHOP(op)       \
        ((op) >= OP_READDIR && (op) <= OP_CLOSEDIR)
 
+#define OP_IS_INFIX_BIT(op)    \
+       ((op) >= OP_BIT_AND && (op) <= OP_SBIT_OR)
+
 /* ex: set ro: */
index 765816f..fe10584 100755 (executable)
@@ -1136,6 +1136,7 @@ my %OP_IS_FILETEST;       # /F-/
 my %OP_IS_FT_ACCESS;   # /F-+/
 my %OP_IS_NUMCOMPARE;  # /S</
 my %OP_IS_DIRHOP;      # /Fd/
+my %OP_IS_INFIX_BIT;   # /S\|/
 
 my $OCSHIFT = 8;
 my $OASHIFT = 12;
@@ -1165,8 +1166,9 @@ for my $op (@ops) {
            $OP_IS_FILETEST{$op} = $opnum{$op} if $arg =~ s/-//;
            $OP_IS_FT_ACCESS{$op} = $opnum{$op} if $arg =~ s/\+//;
         }
-       elsif ($arg =~ /^S</) {
+       elsif ($arg =~ /^S./) {
            $OP_IS_NUMCOMPARE{$op} = $opnum{$op} if $arg =~ s/<//;
+           $OP_IS_INFIX_BIT {$op} = $opnum{$op} if $arg =~ s/\|//;
        }
        my $argnum = ($arg =~ s/\?//) ? 8 : 0;
         die "op = $op, arg = $arg\n"
@@ -1206,6 +1208,7 @@ gen_op_is_macro( \%OP_IS_FILETEST, 'OP_IS_FILETEST');
 gen_op_is_macro( \%OP_IS_FT_ACCESS, 'OP_IS_FILETEST_ACCESS');
 gen_op_is_macro( \%OP_IS_NUMCOMPARE, 'OP_IS_NUMCOMPARE');
 gen_op_is_macro( \%OP_IS_DIRHOP, 'OP_IS_DIRHOP');
+gen_op_is_macro( \%OP_IS_INFIX_BIT, 'OP_IS_INFIX_BIT');
 
 sub gen_op_is_macro {
     my ($op_is, $macname) = @_;
index 614a54c..cbf38dc 100644 (file)
@@ -31,7 +31,7 @@
 # scalar      - S            list     - L            array     - A
 # hash        - H            sub (CV) - C            file      - F
 # socket      - Fs           filetest - F-           filetest_access - F-+
-# num-compare - S<           dirhandle - DF
+# num-compare - S<           dirhandle - DF          infix bitwise   - S|
 
 # reference - R
 # "?" denotes an optional operand.
@@ -162,15 +162,15 @@ seq               string eq               ck_null         ifs2    S S
 sne            string ne               ck_null         ifs2    S S
 scmp           string comparison (cmp) ck_null         ifsT2   S S
 
-bit_and                bitwise and (&)         ck_bitop        fst2    S S
-bit_xor                bitwise xor (^)         ck_bitop        fst2    S S
-bit_or         bitwise or (|)          ck_bitop        fst2    S S
-nbit_and       numeric bitiwse and (&) ck_bitop        fsT2    S S
-nbit_xor       numeric bitwise xor (^) ck_bitop        fsT2    S S
-nbit_or                numeric bitwise or (|)  ck_bitop        fsT2    S S
-sbit_and       string bitiwse and (&)  ck_bitop        fst2    S S
-sbit_xor       string bitwise xor (^)  ck_bitop        fst2    S S
-sbit_or                string bitwise or (|)   ck_bitop        fst2    S S
+bit_and                bitwise and (&)         ck_bitop        fst2    S S|
+bit_xor                bitwise xor (^)         ck_bitop        fst2    S S|
+bit_or         bitwise or (|)          ck_bitop        fst2    S S|
+nbit_and       numeric bitiwse and (&) ck_bitop        fsT2    S S|
+nbit_xor       numeric bitwise xor (^) ck_bitop        fsT2    S S|
+nbit_or                numeric bitwise or (|)  ck_bitop        fsT2    S S|
+sbit_and       string bitiwse and (&)  ck_bitop        fst2    S S|
+sbit_xor       string bitwise xor (^)  ck_bitop        fst2    S S|
+sbit_or                string bitwise or (|)   ck_bitop        fst2    S S|
 
 negate         negation (-)            ck_null         Ifst1   S
 i_negate       integer negation (-)    ck_null         ifst1   S