private int skipToStatementStart(boolean danglingElse,boolean isInBlock){
  final int NOTHING=0;
  final int READ_PARENS=1;
  final int READ_IDENT=2;
  int mayBeMethodBody=NOTHING;
  boolean isTypeBody=false;
  while (true) {
    nextToken();
    if (isInBlock) {
switch (fToken) {
case Symbols.TokenIF:
case Symbols.TokenELSE:
case Symbols.TokenCATCH:
case Symbols.TokenDO:
case Symbols.TokenWHILE:
case Symbols.TokenFINALLY:
case Symbols.TokenFOR:
case Symbols.TokenTRY:
case Symbols.TokenCOLON:
        return fPosition;
case Symbols.TokenSTATIC:
      mayBeMethodBody=READ_IDENT;
    break;
case Symbols.TokenSYNCHRONIZED:
  if (mayBeMethodBody != READ_IDENT)   return fPosition;
break;
case Symbols.TokenCLASS:
case Symbols.TokenINTERFACE:
case Symbols.TokenENUM:
isTypeBody=true;
break;
case Symbols.TokenSWITCH:
fIndent=fPrefs.prefCaseIndent;
return fPosition;
}
}
switch (fToken) {
case Symbols.TokenLPAREN:
case Symbols.TokenLBRACE:
case Symbols.TokenLBRACKET:
case Symbols.TokenSEMICOLON:
case Symbols.TokenEOF:
if (isInBlock) fIndent=getBlockIndent(mayBeMethodBody == READ_IDENT,isTypeBody);
return fPreviousPos;
case Symbols.TokenCOLON:
int pos=fPreviousPos;
if (!isConditional()) return pos;
break;
case Symbols.TokenRBRACE:
pos=fPreviousPos;
if (skipScope() && looksLikeArrayInitializerIntro()) {
continue;
}
 else {
if (isInBlock) fIndent=getBlockIndent(mayBeMethodBody == READ_IDENT,isTypeBody);
return pos;
}
case Symbols.TokenRPAREN:
if (isInBlock) mayBeMethodBody=READ_PARENS;
case Symbols.TokenRBRACKET:
case Symbols.TokenGREATERTHAN:
pos=fPreviousPos;
if (skipScope()) break;
 else return pos;
case Symbols.TokenIF:
if (danglingElse) return fPosition;
 else break;
case Symbols.TokenELSE:
pos=fPosition;
if (skipNextIF()) break;
 else return pos;
case Symbols.TokenDO:
return fPosition;
case Symbols.TokenWHILE:
pos=fPosition;
if (hasMatchingDo()) {
break;
}
 else {
fPosition=pos;
break;
}
case Symbols.TokenIDENT:
if (mayBeMethodBody == READ_PARENS) mayBeMethodBody=READ_IDENT;
break;
default :
}
}
}

private int skipToStatementStart ( boolean danglingElse , boolean isInBlock ) { final int NOTHING = 0 ; final int READ_PARENS = 1 ; final int READ_IDENT = 2 ; int mayBeMethodBody = NOTHING ; boolean isTypeBody = false ; while ( true ) { nextToken ( ) ; if ( isInBlock ) { switch ( fToken ) { case Symbols . TokenIF : case Symbols . TokenELSE : case Symbols . TokenCATCH : case Symbols . TokenDO : case Symbols . TokenWHILE : case Symbols . TokenFINALLY : case Symbols . TokenFOR : case Symbols . TokenTRY : case Symbols . TokenCOLON : return fPosition ; case Symbols . TokenSTATIC : mayBeMethodBody = READ_IDENT ; break ; case Symbols . TokenSYNCHRONIZED : if ( mayBeMethodBody != READ_IDENT ) return fPosition ; break ; case Symbols . TokenCLASS : case Symbols . TokenINTERFACE : case Symbols . TokenENUM : isTypeBody = true ; break ; case Symbols . TokenSWITCH : fIndent = fPrefs . prefCaseIndent ; return fPosition ; } } switch ( fToken ) { case Symbols . TokenLPAREN : case Symbols . TokenLBRACE : case Symbols . TokenLBRACKET : case Symbols . TokenSEMICOLON : case Symbols . TokenEOF : if ( isInBlock ) fIndent = getBlockIndent ( mayBeMethodBody == READ_IDENT , isTypeBody ) ; return fPreviousPos ; case Symbols . TokenCOLON : int pos = fPreviousPos ; if ( ! isConditional ( ) ) return pos ; break ; case Symbols . TokenRBRACE : pos = fPreviousPos ; if ( skipScope ( ) && looksLikeArrayInitializerIntro ( ) ) { continue ; } else { if ( isInBlock ) fIndent = getBlockIndent ( mayBeMethodBody == READ_IDENT , isTypeBody ) ; return pos ; } case Symbols . TokenRPAREN : if ( isInBlock ) mayBeMethodBody = READ_PARENS ; case Symbols . TokenRBRACKET : case Symbols . TokenGREATERTHAN : pos = fPreviousPos ; if ( skipScope ( ) ) break ; else return pos ; case Symbols . TokenIF : if ( danglingElse ) return fPosition ; else break ; case Symbols . TokenELSE : pos = fPosition ; if ( skipNextIF ( ) ) break ; else return pos ; case Symbols . TokenDO : return fPosition ; case Symbols . TokenWHILE : pos = fPosition ; if ( hasMatchingDo ( ) ) { break ; } else { fPosition = pos ; break ; } case Symbols . TokenIDENT : if ( mayBeMethodBody == READ_PARENS ) mayBeMethodBody = READ_IDENT ; break ; default : } } }
skips to the start of a statement that ends at the current position .
