graveyard/tools/org/apache/axis/tools/common/Utils.java
/**
	 * Matches braces or quotes and is C-aware. 
	 * It skips characters in string literals and comments.
	 */
Matches braces or quotes and is C-aware.
It skips characters in string literals and comments.
Matches braces or quotes and is C - aware . It skips characters in string literals and comments .
static int findMatching(String s, char c1, char c2) {
		int depth = 0;
		for (int i = 0; i < s.length(); i++) {
			if (s.charAt(i) == c1)
				depth++;
			else if (s.charAt(i) == c2) {
				depth--;
				if (depth == 0)
					return i;
			} else {
				i = skip(s.substring(i), i);
				if (-1 == i)
					return -1;
			}
		}
		return -1;
	}
static int findMatching ( String s , char c1 , char c2 ) { int depth = 0 ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { if ( s . charAt ( i ) == c1 ) depth ++ ; else if ( s . charAt ( i ) == c2 ) { depth -- ; if ( depth == 0 ) return i ; } else { i = skip ( s . substring ( i ) , i ) ; if ( - 1 == i ) return - 1 ; } } return - 1 ; }
Matches braces or quotes and is C-aware.
Matches braces or quotes and is C - aware .