private void checkNoCharactersMissing(int totalLength,List<Token> tokens){
  if (!tokens.isEmpty() && tokens.get(tokens.size() - 1).right != totalLength) {
    String error=String.format("Lengths don't match: %s instead of %s",tokens.get(tokens.size() - 1).right,totalLength);
    throw new RuntimeException(error);
  }
  int start=0;
  for (int i=0; i < tokens.size(); i++) {
    Token token=tokens.get(i);
    if (token.left != start) {
      throw new RuntimeException("Gap/inconsistency at: " + start);
    }
    start=token.right;
  }
}

private void checkNoCharactersMissing ( int totalLength , List < Token > tokens ) { if ( ! tokens . isEmpty ( ) && tokens . get ( tokens . size ( ) - 1 ) . right != totalLength ) { String error = String . format ( "Lengths don't match: %s instead of %s" , tokens . get ( tokens . size ( ) - 1 ) . right , totalLength ) ; throw new RuntimeException ( error ) ; } int start = 0 ; for ( int i = 0 ; i < tokens . size ( ) ; i ++ ) { Token token = tokens . get ( i ) ; if ( token . left != start ) { throw new RuntimeException ( "Gap/inconsistency at: " + start ) ; } start = token . right ; } }
temporary debugging code . we need to tokenize every character in the input string .
