private byte parseBinaryLiteral ( Token input ) { String text = input . text ; if ( text . length ( ) > 11 ) { // FIXME: this will be deprecated! syntaxError ( "invalid binary literal (too long)" , input ) ; } int val = 0 ; // Start past 0b for ( int i = 2 ; i != text . length ( ) ; ++ i ) { char c = text . charAt ( i ) ; // Skip underscore if ( c == ' ' ) { continue ; } val = val << 1 ; if ( c == ' ' ) { val = val | 1 ; } else if ( c == ' ' ) { } else { syntaxError ( "invalid binary literal (invalid characters)" , input ) ; } } return ( byte ) val ; }
Parse a token representing a binary literal such as 0b0110 0b1111_0101 etc .