@Override public String expect(Pattern pattern){
  final String token=read(pattern);
  if (token == null) {
    throw new ParserException("Expected pattern '" + pattern.pattern() + "' was not encountered in document: "+ document);
  }
  return token;
}

@ Override public String expect ( Pattern pattern ) { final String token = read ( pattern ) ; if ( token == null ) { throw new ParserException ( "Expected pattern '" + pattern . pattern ( ) + "' was not encountered in document: " + document ) ; } return token ; }
this will attempt to read string matching the given pattern from the document at the current point indicated by the cursor . if failed to do so , the method will be expected to throw an exception or take corrective measures .
