// If current position matches input string, consumes it and returns true (else false)
975205
func (l *lex) match(m string) bool {
	if !l.matchNoConsume(m) {
		return false
	}

	l.p += len(m)
	return true
}
736573
func (pg *GoEvtxMap) RegexMatch(path *GoEvtxPath, pattern *regexp.Regexp) bool {
	s, err := pg.GetString(path)
	if err != nil {
		return false
	}
	return pattern.MatchString(s)
}
836207
func RegexMatch(regexStr string) gopter.Gen {
	regexSyntax, err1 := syntax.Parse(regexStr, syntax.Perl)
	regex, err2 := regexp.Compile(regexStr)
	if err1 != nil || err2 != nil {
		return Fail(reflect.TypeOf(""))
	}
	return regexMatchGen(regexSyntax.Simplify()).SuchThat(func(v string) bool {
		return regex.MatchString(v)
	}).WithShrinker(StringShrinker)
}
1097178
func (l *StringLexer) Current() (r rune) {
	r, _ = utf8.DecodeRuneInString(l.input[l.pos:])
	return r
}
1323055
func isSafeString(value interface{}) bool {
	if _, ok := value.(SafeString); ok {
		return true
	}
	return false
}
1350664
func (this *AndPredicate) Match(start int) (int, *Result) {
	// Ignore the new position
	_, result := this.Expression.Match(start)
	if result.Valid {
		return start, this.Parser.pass(start, 0, this, []*Result{result})
	}	
	return start, this.Parser.fail(start, 0, this, []*Result{result})
}
1203376
func (s *scanner) peekPos() int {
	if s.readPos >= len(s.stateRecord){
		return  s.cacheRecord.pos// peek can be called when the array is over , only if unmarshal error occured, so return last read position 
	}
	if !s.cached {
		s.cached = true
		s.cacheRecord = s.stateRecord[s.readPos]
	}
	return s.cacheRecord.pos
}
320096
func (p *Pattern) FirstMatch(data string, pos int) (pat *Pattern, ret textmate.MatchObject) {
	startIdx := -1
	for i := 0; i < len(p.cachedPatterns); {
		ip, im := p.cachedPatterns[i].Cache(data, pos)
		// If it wasn't found now, it'll never be found,
		// so the pattern can be popped from the cache
		if im == nil {
			copy(p.cachedPatterns[i:], p.cachedPatterns[i+1:])
			p.cachedPatterns = p.cachedPatterns[:len(p.cachedPatterns)-1]
			continue
		}
		// ???: what is startIdx > im[0] for?
		if startIdx < 0 || startIdx > im[0] {
			startIdx, pat, ret = im[0], ip, im
			// This match is right at the start, we're not
			// going to find a better pattern than this,
			// so stop the search
			if im[0] == pos {
				break
			}
		}
		i++
	}
	return
}
842642
func (i ifCond) matchFunc(a, b string) bool {
	return i.rex.MatchString(a)
}
1088307
func ContainsString(array []string, element string) bool {
	for _, e := range array {
		if element == e {
			return true
		}
	}
	return false
}
168591
func (l *ReaderLexer) PeekString(word string) bool {
	guard := Mark(fmt.Sprintf("PeekString '%s'", word))
	defer guard()
	return AcceptString(l, word, true)
}
500775
func check(sl []string, s string) bool {
	var check bool
	for _, str := range sl {
		if str == s {
			check = true
			break
		}
	}
	return check
}
1310938
func ParsePosition(flavor, value string) (rp Position, err error) {
	parser := gtidSetParsers[flavor]
	if parser == nil {
		return rp, vterrors.Errorf(vtrpc.Code_INTERNAL, "parse error: unknown GTIDSet flavor %#v", flavor)
	}
	gtidSet, err := parser(value)
	if err != nil {
		return rp, err
	}
	rp.GTIDSet = gtidSet
	return rp, err
}
920749
func (h *Hook) matchesCurrent() (bool, error) {
	file, err := os.Open(h.Path())
	if err != nil {
		return false, err
	}

	by, err := ioutil.ReadAll(io.LimitReader(file, 1024))
	file.Close()
	if err != nil {
		return false, err
	}

	contents := strings.TrimSpace(tools.Undent(string(by)))
	if contents == h.Contents || len(contents) == 0 {
		return true, nil
	}

	for _, u := range h.upgradeables {
		if u == contents {
			return true, nil
		}
	}

	return false, fmt.Errorf("Hook already exists: %s\n\n%s\n", string(h.Type), tools.Indent(contents))
}
758528
func ValidateString(input string, regex string) (bool, error) {
	re, err := regexp.Compile(regex)
	if err != nil {
		return false, fmt.Errorf("invalid regex '%s'", regex)
	}

	if !re.MatchString(input) {
		return false, fmt.Errorf("input does not match '%s'", regex)
	}

	return true, nil
}
812001
func (f JSONPointerFormatChecker) IsFormat(input interface{}) bool {
	asString, ok := input.(string)
	if !ok {
		return false
	}

	return rxJSONPointer.MatchString(asString)
}
1130160
func (l *Lexer) consumeWhitespace() bool {
	c := l.r.Peek(0)
	if c == ' ' || c == '\t' || c == '\v' || c == '\f' {
		l.r.Move(1)
		return true
	} else if c >= 0xC0 {
		if r, n := l.r.PeekRune(0); r == '\u00A0' || r == '\uFEFF' || unicode.Is(unicode.Zs, r) {
			l.r.Move(n)
			return true
		}
	}
	return false
}