public static void gotoEndOfComment(Vector inputVec,IntPair curLoc) throws ParseAlgorithmException {
  IntPair originalLoc=curLoc;
  boolean found=false;
  String curLine=(String)inputVec.elementAt(curLoc.one);
  StringBuffer newLine=new StringBuffer(curLine.substring(0,curLoc.two));
  curLoc.two=curLoc.two + 2;
  while ((!found) && (curLoc.one < inputVec.size())) {
    while ((!found) && (curLoc.two < curLine.length())) {
      char c=curLine.charAt(curLoc.two);
      if ((c == '(') && (curLoc.two + 1 < curLine.length()) && (curLine.charAt(curLoc.two + 1) == '*')) {
        gotoEndOfComment(inputVec,curLoc);
        curLine=(String)inputVec.elementAt(curLoc.one);
      }
 else       if ((c == '*') && (curLoc.two + 1 < curLine.length()) && (curLine.charAt(curLoc.two + 1) == ')')) {
        curLoc.two=curLoc.two + 2;
        found=true;
      }
 else {
        curLoc.two++;
      }
    }
    if (!found) {
      curLoc.one++;
      curLoc.two=0;
      if (curLoc.one < inputVec.size()) {
        curLine=(String)inputVec.elementAt(curLoc.one);
      }
    }
  }
  if (!found) {
    throw new ParseAlgorithmException("Unterminated comment begun at line " + "\n    line " + (curLoc.one + 1) + ", column "+ (curLoc.two + 1));
  }
  return;
}

public static void gotoEndOfComment ( Vector inputVec , IntPair curLoc ) throws ParseAlgorithmException { IntPair originalLoc = curLoc ; boolean found = false ; String curLine = ( String ) inputVec . elementAt ( curLoc . one ) ; StringBuffer newLine = new StringBuffer ( curLine . substring ( 0 , curLoc . two ) ) ; curLoc . two = curLoc . two + 2 ; while ( ( ! found ) && ( curLoc . one < inputVec . size ( ) ) ) { while ( ( ! found ) && ( curLoc . two < curLine . length ( ) ) ) { char c = curLine . charAt ( curLoc . two ) ; if ( ( c == '(' ) && ( curLoc . two + 1 < curLine . length ( ) ) && ( curLine . charAt ( curLoc . two + 1 ) == '*' ) ) { gotoEndOfComment ( inputVec , curLoc ) ; curLine = ( String ) inputVec . elementAt ( curLoc . one ) ; } else if ( ( c == '*' ) && ( curLoc . two + 1 < curLine . length ( ) ) && ( curLine . charAt ( curLoc . two + 1 ) == ')' ) ) { curLoc . two = curLoc . two + 2 ; found = true ; } else { curLoc . two ++ ; } } if ( ! found ) { curLoc . one ++ ; curLoc . two = 0 ; if ( curLoc . one < inputVec . size ( ) ) { curLine = ( String ) inputVec . elementAt ( curLoc . one ) ; } } } if ( ! found ) { throw new ParseAlgorithmException ( "Unterminated comment begun at line " + "\n    line " + ( curLoc . one + 1 ) + ", column " + ( curLoc . two + 1 ) ) ; } return ; }
finds the end of a comment in the string vector inputvec , assuming that loc is the location of the " ( " in the " ( * " that begins the comment , and advances loc to the position just beyond the end of the closing " * ) " . see the comments above for an explanation of the arguments .
