private static void verify ( char [ ] [ ] strings ) { int length = strings . length ; for ( int i = 0 ; i < length ; i ++ ) { char [ ] a = strings [ i ] ; inner : for ( int j = i + 1 ; j < length ; j ++ ) { char [ ] b = strings [ j ] ; if ( b . length < a . length ) continue ; for ( int k = 0 ; k < a . length ; k ++ ) { if ( a [ k ] != b [ k ] ) continue inner ; } String sa = ' ' + String . valueOf ( a ) + ' ' ; String sb = ' ' + String . valueOf ( b ) + ' ' ; String msg = a . length == b . length ? sa + " is specified twice in a FirstOf(String...)" : sa + " is a prefix of " + sb + " in a FirstOf(String...) and comes before " + sb + ", which prevents " + sb + " from ever matching! You should reverse the order of the two alternatives." ; throw new GrammarException ( msg ) ; } } }
but match in the fast implementation