Return true if the next token matches the specified keyword
358926
function matchKeyword(keyword) {
        var token = lookahead();
        return token.type === Token.Keyword && token.value === keyword;
    }
228506
function getNextWhile(tokens, index, direction, matcher) {
		var count = 1, 
			token;
		
		direction = direction || 1;
		while (token = tokens[index + (direction * count++)]) {
			if (!matcher(token)) {
				return token;
			}
		}
		
		return undefined;
	}
459936
private boolean setToKeywordStart() {
        for (int i = index; i < id.length; ++i) {
            if (id[i] == KEYWORD_SEPARATOR) {
                if (canonicalize) {
                    for (int j = ++i; j < id.length; ++j) { // increment i past separator for return
                        if (id[j] == KEYWORD_ASSIGN) {
                            index = i;
                            return true;
                        }
                    }
                } else {
                    if (++i < id.length) {
                        index = i;
                        return true;
                    }
                }
                break;
            }
        }
        return false;
    }
830875
function validateCurlyBeforeKeyword(curlyToken) {
         const keywordToken = sourceCode.getTokenAfter(curlyToken);

         if (style === '1tbs' && !astUtils.isTokenOnSameLine(curlyToken, keywordToken)) {
            context.report({
               node: curlyToken,
               messageId: 'nextLineClose',
               fix: removeNewlineBetween(curlyToken, keywordToken),
            });
         }

         if (style !== '1tbs' && astUtils.isTokenOnSameLine(curlyToken, keywordToken)) {
            context.report({
               node: curlyToken,
               messageId: 'sameLineClose',
               fix: (fixer) => fixer.insertTextAfter(curlyToken, '\n'),
            });
         }
      }
549990
def match_token(token, tok_type, tok_str=None):
  """"""
  return token.type == tok_type and (tok_str is None or token.string == tok_str)
808656
def _checker(keywords):
    """"""
    def _(v):
        """Check a given value matches to keywords."""
        for k in keywords:
            if k in v:
                return False
        return True
    return _
1212960
def match_msequence(self, tokens, item):
        """"""
        series_type, head_matches, middle, _, last_matches = tokens
        self.add_check("_coconut.isinstance(" + item + ", _coconut.abc.Sequence)")
        self.add_check("_coconut.len(" + item + ") >= " + str(len(head_matches) + len(last_matches)))
        if middle != wildcard:
            if len(head_matches) and len(last_matches):
                splice = "[" + str(len(head_matches)) + ":" + str(-len(last_matches)) + "]"
            elif len(head_matches):
                splice = "[" + str(len(head_matches)) + ":]"
            elif len(last_matches):
                splice = "[:" + str(-len(last_matches)) + "]"
            else:
                splice = ""
            self.assign_to_series(middle, series_type, item + splice)
        self.match_all_in(head_matches, item)
        for i, match in enumerate(last_matches):
            self.match(match, item + "[" + str(i - len(last_matches)) + "]")
79069
function processKeywords() {
    var nodes = []
    var lastIndex
    var keyword
    var node
    var submatch

    if (!top.keywords) {
      return addText(modeBuffer, nodes)
    }

    lastIndex = 0

    top.lexemesRe.lastIndex = 0

    keyword = top.lexemesRe.exec(modeBuffer)

    while (keyword) {
      addText(modeBuffer.substring(lastIndex, keyword.index), nodes)

      submatch = keywordMatch(top, keyword)

      if (submatch) {
        relevance += submatch[1]

        node = build(submatch[0], [])

        nodes.push(node)

        addText(keyword[0], node.children)
      } else {
        addText(keyword[0], nodes)
      }

      lastIndex = top.lexemesRe.lastIndex
      keyword = top.lexemesRe.exec(modeBuffer)
    }

    addText(modeBuffer.substr(lastIndex), nodes)

    return nodes
  }
454068
private Token lookahead(int n) {
        Token current = token;
        for (int i = 0; i < n; i++) {
            if (current.next == null) {
                current.next = token_source.getNextToken();
            }
            current = current.next;
        }
        return current;
    }
641138
public boolean match(ParserTokenType expected) {
      ParserToken next = lookAhead(0);
      if (next == null || !next.type.isInstance(expected)) {
         return false;
      }
      consume();
      return true;
   }
855708
static int matchTokens(Tokens src, Tokens dst, int dstStartIndex) {
    for (int srcStartIndex = 0; srcStartIndex < src.size(); srcStartIndex++) {
      TokensIterator srcTokensIterator = TokensIterator.of(src, srcStartIndex);
      TokensIterator dstTokensIterator = TokensIterator.of(dst, dstStartIndex);
      StringIterator srcStrIterator = StringIterator.of(srcTokensIterator.next());
      StringIterator dstStrIterator = StringIterator.of(dstTokensIterator.next());
      while (srcStrIterator.hasNext() || srcStrIterator.hasNext()) {
        if (!matchToken(srcStrIterator, dstStrIterator))
          break;
        if (!srcStrIterator.hasNext() && !dstStrIterator.hasNext())
          return dstTokensIterator.pos() - dstStartIndex + 1;
        if (!srcStrIterator.hasNext() && !srcTokensIterator.hasNext())
          break;
        if (!dstStrIterator.hasNext() && !dstTokensIterator.hasNext())
          break;
        if (!srcStrIterator.hasNext() && srcTokensIterator.hasNext())
          srcStrIterator = StringIterator.of(srcTokensIterator.next());
        if (!dstStrIterator.hasNext() && dstTokensIterator.hasNext())
          dstStrIterator = StringIterator.of(dstTokensIterator.next());
      }
    }

    return 0;
  }
209983
function tokenExists(username, token, done) {
  return getTokenHashes(username, function(getTokensErr, hashes) {
    if (getTokensErr) {
      return done(getTokensErr);
    }

    if (!hashes || !hashes.length) {
      return done(null, false);
    }

    let index = 0;
    let found = false;

    async.until(() => found || (index >= hashes.length), function(next) {
      bcrypt.compare(token, hashes[index++].uuid, function(err, match) {
        found = match;
        return next(err);
      });
    }, (err) => done(err, found ? hashes[index - 1] : undefined));
  });
}
1248000
function isKeyword(id) {
		switch (id.length) {
			case 2:
				return 'do' == id || 'if' == id || 'in' == id || 'or' == id;
			case 3:
				return 'and' == id || 'end' == id || 'for' == id || 'nil' == id ||
					'not' == id;
			case 4:
				return 'else' == id || 'goto' == id || 'then' == id || 'true' == id;
			case 5:
				return 'break' == id || 'false' == id || 'local' == id ||
					'until' == id || 'while' == id;
			case 6:
				return 'elseif' == id || 'repeat' == id || 'return' == id;
			case 8:
				return 'function' == id;
		}
		return false;
	}
1030495
private boolean isStringTokenMatched(AnalyzedToken token) {
    String testToken = getTestToken(token);
    if (stringRegExp) {
      Matcher m = pattern.matcher(new InterruptibleCharSequence(testToken));
      return m.matches();
    }
    if (caseSensitive) {
      return stringToken.equals(testToken);
    }
    return stringToken.equalsIgnoreCase(testToken);
  }
140895
public static boolean match(String keyword, String query) {
		if (query.indexOf(keyword) != -1) { // match found!
			return true;
		}
		return false;
	}
1154859
def keyword(self, text):
        """"""
        cls = self.KEYWORDS[text]
        self.push_token(cls(text, self.lineno, self.offset))
716828
def _MatchDirective(token):
    """"""
    # Tokens below must start with '.'
    if token.startswith('.'):
        token = token[1:]
    else:
        return None, None
    
    if token == 'end':
        return END_TOKEN, None
    
    if token == 'alternates with':
        return ALTERNATES_TOKEN, token
    
    if token.startswith('or'):
        if token.strip() == 'or':
            return OR_TOKEN, None
        else:
            pred_str = token[2:].strip()
            return OR_TOKEN, pred_str
    
    match = _SECTION_RE.match(token)
    if match:
        repeated, section_name = match.groups()
        if repeated:
            return REPEATED_SECTION_TOKEN, section_name
        else:
            return SECTION_TOKEN, section_name
    
    if token.startswith('template '):
        return SUBST_TEMPLATE_TOKEN, token[9:].strip()
    if token.startswith('define '):
        return DEF_TOKEN, token[7:].strip()
    
    if token.startswith('if '):
        return IF_TOKEN, token[3:].strip()
    if token.endswith('?'):
        return PREDICATE_TOKEN, token
    
    return None, None