コード例 #1
0
 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;
   }
 }
コード例 #2
0
 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;
   }
 }