Package ideah.psi.api.util

Source Code of ideah.psi.api.util.HaskellIdentNamesValidator

package ideah.psi.api.util;

import com.intellij.lang.refactoring.NamesValidator;
import com.intellij.openapi.project.Project;
import ideah.lexer.HaskellLexer;
import ideah.lexer.HaskellTokenTypes;
import ideah.lexer.LexedIdentifier;

public final class HaskellIdentNamesValidator implements NamesValidator {

    public boolean isKeyword(String name, Project project) {
        return HaskellLexer.getKeywords().contains(name);
    }

    public boolean isIdentifier(String name, Project project) {
        LexedIdentifier identifier = LexedIdentifier.parse(name);
        if (identifier == null)
            return false;
        return HaskellTokenTypes.IDS.contains(identifier.type) && !isKeyword(name, project);
    }
}
TOP

Related Classes of ideah.psi.api.util.HaskellIdentNamesValidator

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.