// ExportedName = "@" ImportPath "." dotIdentifier .
329093
func (p *gc_parser) parse_exported_name() *ast.SelectorExpr {
	p.expect('@')
	pkg := p.parse_package()
	if pkg.Name == "" {
		pkg.Name = "!" + p.pfc.name + "!" + p.pfc.defalias
	} else {
		pkg.Name = p.path_to_name[pkg.Name]
	}
	p.expect('.')
	name := ast.NewIdent(p.parse_dot_ident())
	return &ast.SelectorExpr{X: pkg, Sel: name}
}
478141
func (f *file) lintImports() {
	for i, is := range f.f.Imports {
		_ = i
		if is.Name != nil && is.Name.Name == "." && !f.isTest() {
			f.errorf(is, 1, link(styleGuideBase+"#import-dot"), category("imports"), "should not use dot imports")
		}

	}
}
389814
func (c *Client) GetExportByName(
	ctx context.Context, name string) (Export, error) {

	exports, err := api.ExportsList(ctx, c.API)
	if err != nil {
		return nil, err
	}
	path := c.API.VolumePath(name)
	for _, ex := range exports {
		for _, p := range *ex.Paths {
			if p == path {
				return ex, nil
			}
		}
	}
	return nil, nil
}
887871
func (imp *Import) Name() Var {
	if len(imp.Alias) != 0 {
		return imp.Alias
	}
	switch v := imp.Path.Value.(type) {
	case Var:
		return v
	case Ref:
		if len(v) == 1 {
			return v[0].Value.(Var)
		}
		return Var(v[len(v)-1].Value.(String))
	}
	panic("illegal import")
}
1151150
func lookupNameAndComment(bctx build.Context, importPath, variableName string) (packageName, variableComment string, err error) {
	wd, err := os.Getwd()
	if err != nil {
		return "", "", err
	}
	bpkg, err := bctx.Import(importPath, wd, 0)
	if err != nil {
		return "", "", fmt.Errorf("can't import package %q: %v", importPath, err)
	}
	dpkg, err := computeDoc(bpkg)
	if err != nil {
		return "", "", fmt.Errorf("can't get godoc of package %q: %v", importPath, err)
	}
	for _, v := range dpkg.Vars {
		if len(v.Names) == 1 && v.Names[0] == variableName {
			variableComment = strings.TrimSuffix(v.Doc, "\n")
			break
		}
	}
	return bpkg.Name, variableComment, nil
}
1093311
func (t *UniversalTranslator) Import(format ImportExportFormat, dirnameOrFilename string) error {

	fi, err := os.Stat(dirnameOrFilename)
	if err != nil {
		return err
	}

	processFn := func(filename string) error {

		f, err := os.Open(filename)
		if err != nil {
			return err
		}
		defer f.Close()

		return t.ImportByReader(format, f)
	}

	if !fi.IsDir() {
		return processFn(dirnameOrFilename)
	}

	// recursively go through directory
	walker := func(path string, info os.FileInfo, err error) error {

		if info.IsDir() {
			return nil
		}

		switch format {
		case FormatJSON:
			// skip non JSON files
			if filepath.Ext(info.Name()) != ".json" {
				return nil
			}
		}

		return processFn(path)
	}

	return filepath.Walk(dirnameOrFilename, walker)
}
795678
func NewImport(name, path string) *ImportSpec {
	return &ImportSpec{Name: name, Path: path}
}
482587
func (s *Output) SetExportName(v string) *Output {
	s.ExportName = &v
	return s
}
606626
func (s *Statement) Dot(name string) *Statement {
	d := token{
		typ:     delimiterToken,
		content: ".",
	}
	t := token{
		typ:     identifierToken,
		content: name,
	}
	*s = append(*s, d, t)
	return s
}
855678
func resolvePackageName(p string) (string, error) {
	p, err := filepath.Abs(p)
	if err == nil {
		p = filepath.Base(p)
		_, err = format.Source([]byte("package " + p))
	}
	if err != nil {
		return "", errors.New("invalid package name " + p)
	}
	return p, nil
}
161541
func (p *testDataParser) ExtractName(line string) (string, bool) {
	// The test declaration pattern is technically a subset of the test conclusion pattern, and will therefore
	// match anything the test declaration pattern matches. The match from the test conclusion pattern is more
	// correct, if it exists, so we check the conclusion pattern first and return if we have a name candidate.
	if matches := p.testConclusionPattern.FindStringSubmatch(line); len(matches) > 3 && len(matches[3]) > 0 {
		return matches[3], true
	}

	if matches := p.testDeclarationPattern.FindStringSubmatch(line); len(matches) > 0 && len(matches[0]) > 0 {
		return matches[0], true
	}

	return "", false
}
183734
func (g *Generator) AddImport(path string, ident string) {
	if strings.HasPrefix(path, `"`) && strings.HasSuffix(path, `"`) {
		path = path[1 : len(path)-1]
	}
	g.RequiredImports = append(g.RequiredImports, &Import{Ident: ident, Path: path})
}
182327
func (d *FileDescriptor) goPackageOption() (impPath GoImportPath, pkg GoPackageName, ok bool) {
	opt := d.GetOptions().GetGoPackage()
	if opt == "" {
		return "", "", false
	}
	// A semicolon-delimited suffix delimits the import path and package name.
	sc := strings.Index(opt, ";")
	if sc >= 0 {
		return GoImportPath(opt[:sc]), cleanPackageName(opt[sc+1:]), true
	}
	// The presence of a slash implies there's an import path.
	slash := strings.LastIndex(opt, "/")
	if slash >= 0 {
		return GoImportPath(opt), cleanPackageName(opt[slash+1:]), true
	}
	return "", cleanPackageName(opt), true
}
287791
func WriteImportpath(w io.Writer, path ...string) (int, error) {
	return fmt.Fprintf(w, `"%s"`+"\n", strings.Join(path, "/"))
}
115311
func (cmd *ImportCommand) importPath(ctx context.Context, fieldType string, useColumnKeys, useRowKeys bool, path string) error {
	// If fieldType is `int`, treat the import data as values to be range-encoded.
	if fieldType == pilosa.FieldTypeInt {
		return cmd.bufferValues(ctx, useColumnKeys, path)
	}
	return cmd.bufferBits(ctx, useColumnKeys, useRowKeys, path)
}
358678
func RegisterUniquePackageName(pkg string, f *FileDescriptor) string {
	// Convert dots to underscores before finding a unique alias.
	pkg = strings.Map(badToUnderscore, pkg)

	var i = -1
	var ptr *FileDescriptor = nil
	for i, ptr = range pkgNamesInUse[pkg] {
		if ptr == f {
			if i == 0 {
				return pkg
			}
			return pkg + strconv.Itoa(i)
		}
	}

	pkgNamesInUse[pkg] = append(pkgNamesInUse[pkg], f)
	i += 1

	if i > 0 {
		pkg = pkg + strconv.Itoa(i)
	}

	if f != nil {
		uniquePackageName[f.FileDescriptorProto] = pkg
	}
	return pkg
}
693342
func (self *Commands) Export(name string) error {
	if !sliceutil.ContainsString(self.exported, name) {
		self.exported = append(self.exported, name)
	}

	return nil
}