public synchronized boolean isIdentifier(@NotNull final String name, final Project project) { try { ourLexer.start(name); if (ourLexer.getTokenType() != PyTokenTypes.IDENTIFIER) { return false; } ourLexer.advance(); return ourLexer.getTokenType() == null; } catch (StringIndexOutOfBoundsException e) { return false; } }
public synchronized boolean isKeyword(@NotNull final String name, final Project project) { try { ourLexer.start(name); if (!PythonDialectsTokenSetProvider.INSTANCE .getKeywordTokens() .contains(ourLexer.getTokenType())) { return false; } ourLexer.advance(); return ourLexer.getTokenType() == null; } catch (StringIndexOutOfBoundsException e) { return false; } }