toolsgolang.org/x/tools/internal/tokeninternal Index | Files

package tokeninternal

import "golang.org/x/tools/internal/tokeninternal"

package tokeninternal provides access to some internal features of the token package.

Index

Functions

func AddExistingFiles

func AddExistingFiles(fset *token.FileSet, files []*token.File)

AddExistingFiles adds the specified files to the FileSet if they are not already present. It panics if any pair of files in the resulting FileSet would overlap.

TODO(adonovan): add this a method to FileSet; see https://github.com/golang/go/issues/73205

func CloneFileSet

func CloneFileSet(fset *token.FileSet) *token.FileSet

CloneFileSet creates a new FileSet holding all files in fset. It does not create copies of the token.Files in fset: they are added to the resulting FileSet unmodified.

func FileSetFor

func FileSetFor(files ...*token.File) *token.FileSet

FileSetFor returns a new FileSet containing a sequence of new Files with the same base, size, and line as the input files, for use in APIs that require a FileSet.

Precondition: the input files must be non-overlapping, and sorted in order of their Base.

Source Files

tokeninternal.go

Version
v0.32.0 (latest)
Published
Apr 8, 2025
Platform
linux/amd64
Imports
7 packages
Last checked
11 hours ago

Tools for package owners.