True if the cursor matches the character buffer

If match fails, return the pointer to its original.
969604
public boolean regionMatches(char []cb, int offset, int length)
  {
    int pos = getIndex();

    char ch = current();
    for (int i = 0; i < length; i++) {
      if (cb[i + offset] != ch) {
        setIndex(pos);
        return false;
      }
      ch = next();
    }

    return true;
  }
843720
boolean checkPrefix(char[] chars, int[] cursor) {
    if (prefix == null)
      return true;
    else
      return matchClause(prefix, chars, cursor);
  }
1056156
def hasNext(self):
        
        cursor_pos = self.cursorpos + 1

        try:
            self.cursordat[cursor_pos]
            return True
        except IndexError:
            return False
303659
public static CharMatcher is(final char match) {
    return new FastMatcher() {
      @Override public boolean matches(char c) {
        return c == match;
      }

      @Override public String replaceFrom(CharSequence sequence, char replacement) {
        return sequence.toString().replace(match, replacement);
      }

      @Override public CharMatcher and(CharMatcher other) {
        return other.matches(match) ? this : NONE;
      }

      @Override public CharMatcher or(CharMatcher other) {
        return other.matches(match) ? other : super.or(other);
      }

      @Override public CharMatcher negate() {
        return isNot(match);
      }

      @Override public String toString() {
        return "CharMatcher.is('" + showCharacter(match) + "')";
      }
    };
  }
817826
def get_right_character(self, cursor=None):
        
        next_char = self.get_right_word(cursor=cursor)
        if len(next_char):
            next_char = next_char[0]
        else:
            next_char = None
        return next_char
875423
def expect_re(regexp, buf, pos):
    """"""
    match = regexp.match(buf, pos)
    if not match:
        return None, len(buf)
    return buf[match.start(1):match.end(1)], match.end(0)
769957
public char match(ISense source, ISense target) throws MatcherLibraryException {
        List<ISense> sourceList = getAncestors(source, depth);
        List<ISense> targetList = getAncestors(target, depth);
        targetList.retainAll(sourceList);
        if (targetList.size() > 0)
            return IMappingElement.EQUIVALENCE;
        else
            return IMappingElement.IDK;
    }
249725
private static int findStart( char[] buffer, int start, int end )
    {
        int pos, cp;
        for ( pos = start; pos < end && isWhitespace( cp = codePointAt( buffer, pos ) ); pos += charCount( cp ) )
        {
            if ( cp == '\n' )
            {
                start = pos + 1;
            }
        }
        return pos >= end ? end : start;
    }
1356034
def chars_before(chars, match):
    
    if match.start <= 0:
        return True
    return match.input_string[match.start - 1] in chars
200509
def check(self, pointer, expected, raise_onerror=False):
        
        obj = self.document
        for token in Pointer(pointer):
            try:
                obj = token.extract(obj, bypass_ref=True)
            except ExtractError as error:
                if raise_onerror:
                    raise Error(*error.args)
                logger.exception(error)
                return False
        return obj == expected
844170
private boolean processChar(char c) {
		if(inTextArea) {
			if(
				c==TrimFilterWriter.textarea_close[readCharMatchCount]
				|| c==TrimFilterWriter.TEXTAREA_CLOSE[readCharMatchCount]
			) {
				readCharMatchCount++;
				if(readCharMatchCount>=TrimFilterWriter.textarea_close.length) {
					inTextArea=false;
					readCharMatchCount=0;
				}
			} else {
				readCharMatchCount=0;
			}
			return true;
		} else if(inPre) {
			if(
				c==TrimFilterWriter.pre_close[preReadCharMatchCount]
				|| c==TrimFilterWriter.PRE_CLOSE[preReadCharMatchCount]
			) {
				preReadCharMatchCount++;
				if(preReadCharMatchCount>=TrimFilterWriter.pre_close.length) {
					inPre=false;
					preReadCharMatchCount=0;
				}
			} else {
				preReadCharMatchCount=0;
			}
			return true;
		} else {
			if(c=='\r') {
				readCharMatchCount = 0;
				preReadCharMatchCount = 0;
				// Carriage return only output when no longer at the beginning of the line
				return !atLineStart;
			} else if(c=='\n') {
				readCharMatchCount = 0;
				preReadCharMatchCount = 0;
				// Newline only output when no longer at the beginning of the line
				if(!atLineStart) {
					atLineStart = true;
					return true;
				} else {
					return false;
				}
			} else if(c==' ' || c=='\t') {
				readCharMatchCount = 0;
				preReadCharMatchCount = 0;
				// Space and tab only output when no longer at the beginning of the line
				return !atLineStart;
			} else {
				atLineStart = false;
				if(
					c==TrimFilterWriter.textarea[readCharMatchCount]
					|| c==TrimFilterWriter.TEXTAREA[readCharMatchCount]
				) {
					readCharMatchCount++;
					if(readCharMatchCount>=TrimFilterWriter.textarea.length) {
						inTextArea=true;
						readCharMatchCount=0;
					}
				} else {
					readCharMatchCount=0;
				}
				if(
					c==TrimFilterWriter.pre[preReadCharMatchCount]
					|| c==TrimFilterWriter.PRE[preReadCharMatchCount]
				) {
					preReadCharMatchCount++;
					if(preReadCharMatchCount>=TrimFilterWriter.pre.length) {
						inPre=true;
						preReadCharMatchCount=0;
					}
				} else {
					preReadCharMatchCount=0;
				}
				return true;
			}
		}
	}
1341106
def forward_char(event):
    "  "
    buff = event.current_buffer
    buff.cursor_position += buff.document.get_cursor_right_position(count=event.arg)
46822
def compare_pointer(self, data):
        '''
        
        '''
        if self.old_pointed != data:
            self.old_pointed = data
            return True
        return False
680499
def is_pointer(type_):
    """"""
    return does_match_definition(type_,
                                 cpptypes.pointer_t,
                                 (cpptypes.const_t, cpptypes.volatile_t)) \
        or does_match_definition(type_,
                                 cpptypes.pointer_t,
                                 (cpptypes.volatile_t, cpptypes.const_t))
4933
private int matchTail(int base, int index, String key) {
        int positionInTailArr = base - TAIL_OFFSET;

        int keyLength = key.length();
        for (int i = 0; i < keyLength; i++) {
            if (key.charAt(i) != tailBuffer.get(positionInTailArr + i)) {
                return -1;
            }
        }
        return tailBuffer.get(positionInTailArr + keyLength) == TERMINATING_CHARACTER ? index : 0;
    }
742681
def contains_cursor(self, cursor):
        
        start = self.cursor.selectionStart()
        end = self.cursor.selectionEnd()
        if cursor.atBlockEnd():
            end -= 1
        return start <= cursor.position() <= end
506078
def match_main(self, text, pattern, loc):
    
    # Check for null inputs.
    if text == None or pattern == None:
      raise ValueError("Null inputs. (match_main)")

    loc = max(0, min(loc, len(text)))
    if text == pattern:
      # Shortcut (potentially not guaranteed by the algorithm)
      return 0
    elif not text:
      # Nothing to match.
      return -1
    elif text[loc:loc + len(pattern)] == pattern:
      # Perfect match at the perfect spot!  (Includes case of null pattern)
      return loc
    else:
      # Do a fuzzy compare.
      match = self.match_bitap(text, pattern, loc)
      return match