private File resolve(String name, String path) {
        File file = new File(sourceDirectory, path + name + ".g4");

        if (file.exists())
            return file;

        file = new File(libDirectory, name + ".g4");

        if (file.exists())
            return file;

        return new File(libDirectory, name + ".tokens");
    }
Resolves the given grammar name.

@param   name  the name.
@param   path  the relative path.

@return  the grammar file.
antlr4-maven-plugin/src/main/java/org/antlr/mojo/antlr4/GrammarDependencies.java