Documentation
¶
Overview ¶
package common defines types common to parsing and other diagnostics.
package common defines elements common to parsing and other diagnostics.
package common defines types common to parsing and other diagnostics.
package common defines types common to parsing and other diagnostics.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Errors ¶
type Errors struct {
// contains filtered or unexported fields
}
Errors type which contains a list of errors observed during parsing.
func (*Errors) ReportError ¶
Report an error at a source location.
type Location ¶
type Location interface { GetLine() int // 1-based line number within source. GetColumn() int // 0-based column number within source. }
Interface to represent a location within Source.
type RawLocation ¶
type RawLocation struct {
// contains filtered or unexported fields
}
Helper type to manually construct a location.
func (*RawLocation) GetColumn ¶
func (l *RawLocation) GetColumn() int
func (*RawLocation) GetLine ¶
func (l *RawLocation) GetLine() int
type Source ¶
type Source interface { // The source content represented as a string, for example a single file, // textbox field, or url parameter. Content() string // Brief description of the source, such as a file name or ui element. Description() string // The character offsets at which lines occur. The zero-th entry should // refer to the break between the first and second line, or EOF if there // is only one line of source. LineOffsets() []int32 // The raw character offset at which the a location exists given the // location line and column. // Returns the line offset and whether the location was found. CharacterOffset(location Location) (int32, bool) // Return a line of content from the source and whether the line was found. Snippet(line int) (string, bool) }
Interface for filter source contents.
func NewStringSource ¶
Return a new Source given the string contents and description.
type StringSource ¶
type StringSource struct {
// contains filtered or unexported fields
}
StringSource type implementation of the Source interface.
func (*StringSource) CharacterOffset ¶
func (s *StringSource) CharacterOffset(location Location) (int32, bool)
func (*StringSource) Content ¶
func (s *StringSource) Content() string
func (*StringSource) Description ¶
func (s *StringSource) Description() string
func (*StringSource) LineOffsets ¶
func (s *StringSource) LineOffsets() []int32