diagnostic

package
v0.2.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 24, 2020 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Error = Kind{
		Name:        "Error",
		Color:       color.New(color.FgRed),
		Description: "compiler can not succeed",
	}
	Info = Kind{
		Name:        "Info",
		Color:       color.New(color.FgGreen),
		Description: "compiler information",
	}
	Warning = Kind{
		Name:        "Warning",
		Color:       color.New(color.FgYellow),
		Description: "compiler can still succeed",
	}
)
View Source
var (
	LexicalAnalysis = Stage{
		Name:  "lexical analysis",
		Alias: "scanning",
	}
	SyntacticalAnalysis = Stage{
		Name:  "syntactical analysis",
		Alias: "grammar",
	}
	SemanticAnalysis = Stage{
		Name:  "semantic analysis",
		Alias: "analysis",
	}
)

Functions

This section is empty.

Types

type Bag

type Bag struct {
	// contains filtered or unexported fields
}

func NewBag

func NewBag() *Bag

func (*Bag) CreateDiagnostics

func (recorder *Bag) CreateDiagnostics(converter OffsetConversionFunction) *Diagnostics

func (*Bag) Record

func (recorder *Bag) Record(entry RecordedEntry)

type Diagnostics

type Diagnostics struct {
	// contains filtered or unexported fields
}

func (*Diagnostics) ListEntries

func (diagnostics *Diagnostics) ListEntries() (values []Entry)

type Entry

type Entry struct {
	Kind     *Kind
	Stage    *Stage
	Source   string
	Message  string
	UnitName string
	Position Position
	Error    *RichError
}

type InvalidIndentationError

type InvalidIndentationError struct {
	Expected string
	Received int
}

func (*InvalidIndentationError) Name

func (error *InvalidIndentationError) Name() string

type InvalidStatementError

type InvalidStatementError struct {
	Kind tree.NodeKind
}

func (*InvalidStatementError) Name

func (error *InvalidStatementError) Name() string

type Kind

type Kind struct {
	Name        string
	Color       *color.Color
	Description string
}

func (Kind) Write

func (kind Kind) Write(writer io.Writer)

type KnownError

type KnownError interface {
	Name() string
}

type OffsetConversionFunction

type OffsetConversionFunction func(input.Offset) input.Position

type Position

type Position struct {
	Begin input.Position
	End   input.Position
}

type Printer

type Printer interface {
	PrintFormatted(format string, arguments ...interface{})
	PrintLine(message string)
	Print(message string)
}

func NewFmtPrinter

func NewFmtPrinter() Printer

func NewTestPrinter

func NewTestPrinter(test *testing.T) Printer

type RecordedEntry

type RecordedEntry struct {
	Kind     *Kind
	Stage    *Stage
	Message  string
	UnitName string
	Error    *RichError
	Position RecordedPosition
}

type RecordedPosition

type RecordedPosition interface {
	Begin() input.Offset
	End() input.Offset
}

type RichError

type RichError struct {
	Error         KnownError
	CommonReasons []string
}

type SpecificError

type SpecificError struct {
	Message string
}

func (*SpecificError) Name

func (error *SpecificError) Name() string

type Stage

type Stage struct {
	Name  string
	Alias string
}

type UnexpectedTokenError

type UnexpectedTokenError struct {
	Expected string
	Received string
}

func (*UnexpectedTokenError) Name

func (error *UnexpectedTokenError) Name() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL