Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type LineKeeper ¶
type LineKeeper struct { EOLLocations []int // end-of-line locations // contains filtered or unexported fields }
LineKeeper keeps track of line numberson a textual source file and can map character location to the relevant `code.Position`
func (*LineKeeper) GetPositionFromCharacterIndex ¶
func (lk *LineKeeper) GetPositionFromCharacterIndex(pos int64) code.Position
GetPositionFromCharacterIndex returns the `code.Position` given the index of the character in the file
type PathConsumer ¶
type PathConsumer interface { ConsumePath(path string) diagnostics.ExclusionProvider }
PathConsumer is a sink for paths and URIs
type PathMultiplexer ¶
type PathMultiplexer interface { SetPathConsumers(consumers ...PathConsumer) ConsumePath(path string) }
PathMultiplexer interface defines an aggregator of analysers that can consume filesystem paths and URIs and process them
func NewPathMultiplexer ¶
func NewPathMultiplexer(consumers ...PathConsumer) PathMultiplexer
NewPathMultiplexer creates a choreographer that orchestrates the consumption of paths by consumers
type PositionProvider ¶
PositionProvider provides a "global" view of code location, given an arbitrary character index.
type ResourceConsumer ¶
type ResourceConsumer interface { //Consume allows a source processor receive `source` data streamed in "chunks", with `startIndex` indicating the //character location of the first character in the stream Consume(startIndex int64, source string) //ConsumePath allows resource consumers that process filepaths directly to analyse files on disk ConsumePath(filePath string) SetLineKeeper(*LineKeeper) //ShouldProvideSourceInDiagnostics toggles whether source evidence should be provided with diagnostics, defaults to false ShouldProvideSourceInDiagnostics(bool) //used to signal to the consumer that the source stream has ended End() }
ResourceConsumer is a sink for streaming source
type ResourceMultiplexer ¶
type ResourceMultiplexer interface { //SetSource is the source reader to multiplex to multiple consumers, which will be provided with a copy of the source data as it is being streamed in from the source SetResourceAndConsumers(filePath string, source *io.Reader, provideSourceInDiagnostics bool, consumers ...ResourceConsumer) }
ResourceMultiplexer interface defines a path or source reader that can be multiplexed to multiple consumers. It provides additional utility such as mapping a source index to the line and character, i.e. the `code.Position` in the source
func NewResourceMultiplexer ¶
func NewResourceMultiplexer(filePath string, source *io.Reader, provideSource bool, consumers ...ResourceConsumer) ResourceMultiplexer
NewResourceMultiplexer creates a source multiplexer over an input reader