src/jdk/nashorn/internal/runtime/regexp/joni/OptAnchorInfo.java

changeset 1082
e1e27c4262be
parent 962
ac62e33a99b0
     1.1 --- a/src/jdk/nashorn/internal/runtime/regexp/joni/OptAnchorInfo.java	Mon Nov 03 07:29:46 2014 +0100
     1.2 +++ b/src/jdk/nashorn/internal/runtime/regexp/joni/OptAnchorInfo.java	Mon Nov 03 11:47:41 2014 +0100
     1.3 @@ -36,14 +36,20 @@
     1.4  
     1.5      void concat(final OptAnchorInfo left, final OptAnchorInfo right, final int leftLength, final int rightLength) {
     1.6          leftAnchor = left.leftAnchor;
     1.7 -        if (leftLength == 0) leftAnchor |= right.leftAnchor;
     1.8 +        if (leftLength == 0) {
     1.9 +            leftAnchor |= right.leftAnchor;
    1.10 +        }
    1.11  
    1.12          rightAnchor = right.rightAnchor;
    1.13 -        if (rightLength == 0) rightAnchor |= left.rightAnchor;
    1.14 +        if (rightLength == 0) {
    1.15 +            rightAnchor |= left.rightAnchor;
    1.16 +        }
    1.17      }
    1.18  
    1.19      boolean isSet(final int anchor) {
    1.20 -        if ((leftAnchor & anchor) != 0) return true;
    1.21 +        if ((leftAnchor & anchor) != 0) {
    1.22 +            return true;
    1.23 +        }
    1.24          return (rightAnchor & anchor) != 0;
    1.25      }
    1.26  
    1.27 @@ -77,14 +83,30 @@
    1.28      static String anchorToString(final int anchor) {
    1.29          final StringBuffer s = new StringBuffer("[");
    1.30  
    1.31 -        if ((anchor & AnchorType.BEGIN_BUF) !=0 ) s.append("begin-buf ");
    1.32 -        if ((anchor & AnchorType.BEGIN_LINE) !=0 ) s.append("begin-line ");
    1.33 -        if ((anchor & AnchorType.BEGIN_POSITION) !=0 ) s.append("begin-pos ");
    1.34 -        if ((anchor & AnchorType.END_BUF) !=0 ) s.append("end-buf ");
    1.35 -        if ((anchor & AnchorType.SEMI_END_BUF) !=0 ) s.append("semi-end-buf ");
    1.36 -        if ((anchor & AnchorType.END_LINE) !=0 ) s.append("end-line ");
    1.37 -        if ((anchor & AnchorType.ANYCHAR_STAR) !=0 ) s.append("anychar-star ");
    1.38 -        if ((anchor & AnchorType.ANYCHAR_STAR_ML) !=0 ) s.append("anychar-star-pl ");
    1.39 +        if ((anchor & AnchorType.BEGIN_BUF) !=0 ) {
    1.40 +            s.append("begin-buf ");
    1.41 +        }
    1.42 +        if ((anchor & AnchorType.BEGIN_LINE) !=0 ) {
    1.43 +            s.append("begin-line ");
    1.44 +        }
    1.45 +        if ((anchor & AnchorType.BEGIN_POSITION) !=0 ) {
    1.46 +            s.append("begin-pos ");
    1.47 +        }
    1.48 +        if ((anchor & AnchorType.END_BUF) !=0 ) {
    1.49 +            s.append("end-buf ");
    1.50 +        }
    1.51 +        if ((anchor & AnchorType.SEMI_END_BUF) !=0 ) {
    1.52 +            s.append("semi-end-buf ");
    1.53 +        }
    1.54 +        if ((anchor & AnchorType.END_LINE) !=0 ) {
    1.55 +            s.append("end-line ");
    1.56 +        }
    1.57 +        if ((anchor & AnchorType.ANYCHAR_STAR) !=0 ) {
    1.58 +            s.append("anychar-star ");
    1.59 +        }
    1.60 +        if ((anchor & AnchorType.ANYCHAR_STAR_ML) !=0 ) {
    1.61 +            s.append("anychar-star-pl ");
    1.62 +        }
    1.63          s.append("]");
    1.64  
    1.65          return s.toString();

mercurial