Package org.jetbrains.plugins.clojure.utils

Source Code of org.jetbrains.plugins.clojure.utils.ClojureNamesUtil

package org.jetbrains.plugins.clojure.utils;

import com.intellij.openapi.application.ApplicationManager;
import com.intellij.lexer.Lexer;
import org.jetbrains.plugins.clojure.lexer.ClojureTokenTypes;
import org.jetbrains.plugins.clojure.lexer.ClojureFlexLexer;

/**
* @author ilyas
*/
public class ClojureNamesUtil {

  public static boolean isIdentifier(String text) {
    ApplicationManager.getApplication().assertReadAccessAllowed();
    if (text == null) return false;
    Lexer lexer = new ClojureFlexLexer();
    lexer.start(text, 0, text.length(), 0);
    if (lexer.getTokenType() != ClojureTokenTypes.symATOM) return false;
    lexer.advance();
    return lexer.getTokenType() == null;
  }

}
TOP

Related Classes of org.jetbrains.plugins.clojure.utils.ClojureNamesUtil

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.