question: @ 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 ; }
target:  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.