protected void recoverFile() throws IOException {
  while (true) {
switch (token) {
case CLASS:
case INTERFACE:
      return;
case LBRACE:
    match(LBRACE,RBRACE);
  scan();
break;
case LPAREN:
match(LPAREN,RPAREN);
scan();
break;
case LSQBRACKET:
match(LSQBRACKET,RSQBRACKET);
scan();
break;
case EOF:
return;
default :
scan();
break;
}
}
}

protected void recoverFile ( ) throws IOException { while ( true ) { switch ( token ) { case CLASS : case INTERFACE : return ; case LBRACE : match ( LBRACE , RBRACE ) ; scan ( ) ; break ; case LPAREN : match ( LPAREN , RPAREN ) ; scan ( ) ; break ; case LSQBRACKET : match ( LSQBRACKET , RSQBRACKET ) ; scan ( ) ; break ; case EOF : return ; default : scan ( ) ; break ; } } }
recover after a syntax error in the file . this involves discarding tokens until an eof or a possible legal continuation is encountered .
