/** * Returns the length of a matching string starting at the * specified position. The number of matches to skip can also * be specified, but numbers higher than zero (0) cause a * failed match for any element that doesn't attempt to * combine other elements. * * @param m the matcher being used * @param buffer the input character buffer to match * @param start the starting position * @param skip the number of matches to skip * * @return the length of the longest matching string, or * -1 if no match was found * * @throws IOException if an I/O error occurred */ public override int Match(Matcher m, ReaderBuffer buffer, int start, int skip) { int c; if (skip != 0) { return(-1); } for (int i = 0; i < value.Length; i++) { c = buffer.Peek(start + i); if (c < 0) { m.SetReadEndOfString(); return(-1); } if (m.IsCaseInsensitive()) { c = (int)Char.ToLower((char)c); } if (c != (int)value[i]) { return(-1); } } return(value.Length); }
/** * Returns the length of a matching string starting at the * specified position. The number of matches to skip can also be * specified, but numbers higher than zero (0) cause a failed * match for any element that doesn't attempt to combine other * elements. * * @param m the matcher being used * @param buffer the input character buffer to match * @param start the starting position * @param skip the number of matches to skip * * @return the length of the matching string, or * -1 if no match was found * * @throws IOException if an I/O error occurred */ public override int Match(Matcher m, ReaderBuffer buffer, int start, int skip) { int c; if (skip != 0) { return(-1); } c = buffer.Peek(start); if (c < 0) { m.SetReadEndOfString(); return(-1); } if (m.IsCaseInsensitive()) { c = (int)Char.ToLower((char)c); } return(InSet((char)c) ? 1 : -1); }
/** * Returns the length of a matching string starting at the * specified position. The number of matches to skip can also be * specified, but numbers higher than zero (0) cause a failed * match for any element that doesn't attempt to combine other * elements. * * @param m the matcher being used * @param buffer the input character buffer to match * @param start the starting position * @param skip the number of matches to skip * * @return the length of the matching string, or * -1 if no match was found * * @throws IOException if an I/O error occurred */ public override int Match(Matcher m, ReaderBuffer buffer, int start, int skip) { int c; if (skip != 0) { return -1; } c = buffer.Peek(start); if (c < 0) { m.SetReadEndOfString(); return -1; } if (m.IsCaseInsensitive()) { c = (int) Char.ToLower((char) c); } return InSet((char) c) ? 1 : -1; }
/** * Returns the length of a matching string starting at the * specified position. The number of matches to skip can also * be specified, but numbers higher than zero (0) cause a * failed match for any element that doesn't attempt to * combine other elements. * * @param m the matcher being used * @param buffer the input character buffer to match * @param start the starting position * @param skip the number of matches to skip * * @return the length of the longest matching string, or * -1 if no match was found * * @throws IOException if an I/O error occurred */ public override int Match(Matcher m, ReaderBuffer buffer, int start, int skip) { int c; if (skip != 0) { return -1; } for (int i = 0; i < value.Length; i++) { c = buffer.Peek(start + i); if (c < 0) { m.SetReadEndOfString(); return -1; } if (m.IsCaseInsensitive()) { c = (int) Char.ToLower((char) c); } if (c != (int) value[i]) { return -1; } } return value.Length; }