IElementType (final IElementType source, final int start, final int end, final CharSequence text, boolean checkLanguageLevel) { if (source == PyTokenTypes.IDENTIFIER && isWordAtPosition(text, start, end, TOK_AS)) { return PyTokenTypes.AS_KEYWORD; } else if ( // filter (myFutureImportPhase == Phase.FROM) && source == PyTokenTypes.IDENTIFIER && isWordAtPosition(text, start, end, TOK_FUTURE_IMPORT) ) { myFutureImportPhase = Phase.FUTURE; return source; } else if (source == PyTokenTypes.IDENTIFIER && isWordAtPosition(text, start, end, TOK_WITH)) { return PyTokenTypes.WITH_KEYWORD; } else if (hasPrintStatement() && source == PyTokenTypes.IDENTIFIER && isWordAtPosition(text, start, end, TOK_PRINT)) { return PyTokenTypes.PRINT_KEYWORD; } else if ((myContext.getLanguageLevel().isPy3K() || !checkLanguageLevel) && source == PyTokenTypes.IDENTIFIER) { if (isWordAtPosition(text, start, end, TOK_NONE)) { return PyTokenTypes.NONE_KEYWORD; } if (isWordAtPosition(text, start, end, TOK_TRUE)) { return PyTokenTypes.TRUE_KEYWORD; } if (isWordAtPosition(text, start, end, TOK_FALSE)) { return PyTokenTypes.FALSE_KEYWORD; } if (isWordAtPosition(text, start, end, TOK_DEBUG)) { return PyTokenTypes.DEBUG_KEYWORD; } if (isWordAtPosition(text, start, end, TOK_NONLOCAL)) { return PyTokenTypes.NONLOCAL_KEYWORD; } final LanguageLevel languageLevel = myContext.getLanguageLevel(); if (languageLevel.isAtLeast(LanguageLevel.PYTHON35) || !checkLanguageLevel) { if (isWordAtPosition(text, start, end, TOK_ASYNC)) { if (languageLevel.isAtLeast(LanguageLevel.PYTHON37) || myContext.getScope().isAsync() || myBuilder.lookAhead(1) == PyTokenTypes.DEF_KEYWORD) { return PyTokenTypes.ASYNC_KEYWORD; } } if (isWordAtPosition(text, start, end, TOK_AWAIT)) { if (languageLevel.isAtLeast(LanguageLevel.PYTHON37) || myContext.getScope().isAsync()) { return PyTokenTypes.AWAIT_KEYWORD; } } } } else if ((myContext.getLanguageLevel().isPython2() || !checkLanguageLevel) && source == PyTokenTypes.IDENTIFIER) { if (isWordAtPosition(text, start, end, TOK_EXEC)) { return PyTokenTypes.EXEC_KEYWORD; } } return source; }