question: public static int findEndOfString ( String str , int loc , int line ) throws ParseAlgorithmException { int pos = loc + 1 ; boolean found = false ; while ( ( ! found ) && ( pos < str . length ( ) ) ) { char c = str . charAt ( pos ) ; if ( c == '"' ) { found = true ; } else if ( c == '\\' && ( pos < str . length ( ) - 1 ) ) { pos ++ ; } pos ++ ; } if ( ! found ) { throw new ParseAlgorithmException ( "Unterminated string begun at line " + "\n    line " + ( line + 1 ) + ", column " + ( loc + 1 ) ) ; } return pos ; }
target:  This method assumes that str is a string whose character at position loc is a quote (").  It returns the position immediately after the matching quote that ends a TLA+ string.  If there is no matching quote, then it throws a ParseAlgorithmException, reporting the error at line line+1, column loc+1