loxer

package
v0.0.0-...-a8e4d9d Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2020 License: AGPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DisplayNone       = -1
	DisplayReset      = 0
	DisplayBright     = 1
	DisplayDim        = 2
	DisplayUnderscore = 4
	DisplayBlink      = 5
	DisplayReverse    = 7
	DisplayHidden     = 8
)

Variables

View Source
var EOF = NewEofEvent("", 0)

Functions

func NewLexer

func NewLexer(h func(Event)) *lexer

Types

type CursorAction

type CursorAction int
const (
	CursorSave CursorAction = 1 + iota
	CursorRestore
	CursorSaveWithAttributes
	CursorRestoreWithAttributes
	CursorHome
	CursorForce
	CursorUp
	CursorDown
	CursorForward
	CursorBackward

	CursorBell
	CursorBackspace
	CursorCarriageReturn
	CursorFormFeed
	CursorHorizontalTab
	CursorLineFeed
	CursorVerticalTab
)

func (CursorAction) MarshalJSON

func (a CursorAction) MarshalJSON() ([]byte, error)

func (CursorAction) String

func (a CursorAction) String() string

type CursorEvent

type CursorEvent struct {
	EventData
	Action CursorAction `json:"action"`
	Count  int          `json:"count"`
	Row    int          `json:"row"`
	Column int          `json:"col"`
}

type DeviceAction

type DeviceAction int
const (
	DeviceActionReset DeviceAction = 1 + iota
	DeviceEnableLineWrap
	DeviceDisableLineWrap
	DeviceQueryCode
	DeviceCode
	DeviceQueryStatus
	DeviceStatus
	DeviceQueryCursor
	DeviceCursor
)

func (DeviceAction) MarshalJSON

func (d DeviceAction) MarshalJSON() ([]byte, error)

func (DeviceAction) String

func (d DeviceAction) String() string

type DeviceEvent

type DeviceEvent struct {
	EventData

	LineWrap bool `json:"lineWrap"`
	StatusOK bool `json:"statusOk"`
	Code     int  `json:"code"`

	Row    int `json:"row"`
	Column int `json:"col"`
}

type DisplayAttribute

type DisplayAttribute int

func (DisplayAttribute) MarshalJSON

func (a DisplayAttribute) MarshalJSON() ([]byte, error)

func (DisplayAttribute) String

func (a DisplayAttribute) String() string

type DisplayEvent

type DisplayEvent struct {
	EventData

	Attribute DisplayAttribute `json:"attr"`

	// Foreground is the foreground color to use.  If it is 0, the
	// foreground color doesn't change.  If it is greater than
	// zero it is the index into the color palette + 1
	Foreground int `json:"fg"`
	// Background is the background color to use.  If it is 0, the
	// background color doesn't change.  If it is greater than
	// zero it is the index into the color palette + 1
	Background int `json:"bg"`
}

type EofEvent

type EofEvent struct {
	EventData
}

func (EofEvent) EventType

func (self EofEvent) EventType() string

type EraseEvent

type EraseEvent struct {
	EventData

	Target EraseTarget `json:"target"`
}

type EraseTarget

type EraseTarget int
const (
	EraseToEOL EraseTarget = 1 + iota
	EraseToBOL
	EraseLine
	EraseDown
	EraseUp
	EraseScreen
)

func (EraseTarget) MarshalJSON

func (t EraseTarget) MarshalJSON() ([]byte, error)

func (EraseTarget) String

func (t EraseTarget) String() string

type Event

type Event interface {
	EventType() string
}

func NewCursorEvent

func NewCursorEvent(text string, offset int) Event

func NewDeviceEvent

func NewDeviceEvent(text string, offset int) Event

func NewDisplayEvent

func NewDisplayEvent(text string, offset int) Event

func NewEofEvent

func NewEofEvent(text string, offset int) Event

func NewEraseEvent

func NewEraseEvent(text string, offset int) Event

func NewFoldEvent

func NewFoldEvent(text string, offset int) Event

func NewFontEvent

func NewFontEvent(text string, offset int) Event

func NewNotImplementedEvent

func NewNotImplementedEvent(text string, offset int) Event

func NewPrintEvent

func NewPrintEvent(text string, offset int) Event

func NewScrollEvent

func NewScrollEvent(text string, offset int) Event

func NewTabEvent

func NewTabEvent(text string, offset int) Event

func NewTextEvent

func NewTextEvent(text string, offset int) Event

type EventData

type EventData struct {
	Type   string `json:"type"`
	Text   string `json:"raw"`
	Offset int    `json:"offset"`
}

func (*EventData) EventType

func (self *EventData) EventType() string

type FoldAction

type FoldAction int
const (
	FoldOpen FoldAction = 1 + iota
	FoldClose
)

func (FoldAction) MarshalJSON

func (self FoldAction) MarshalJSON() ([]byte, error)

func (FoldAction) String

func (self FoldAction) String() string

type FoldEvent

type FoldEvent struct {
	EventData

	Action FoldAction `json:"action"`
	Title  string     `json:"title"`
}

type FontEvent

type FontEvent struct {
	EventData

	Font int `json:"font"`
}

type LexerEvent

type LexerEvent struct {
	Fd uintptr
	T  int64
	Event
}

func (*LexerEvent) MarshalJSON

func (self *LexerEvent) MarshalJSON() ([]byte, error)

type NotImplementedEvent

type NotImplementedEvent struct {
	EventData
}

type PrintAction

type PrintAction int
const (
	PrintScreen PrintAction = 1 + iota
	PrintLine
	PrintStartLog
	PrintStopLog
)

func (PrintAction) MarshalJSON

func (a PrintAction) MarshalJSON() ([]byte, error)

func (PrintAction) String

func (a PrintAction) String() string

type PrintEvent

type PrintEvent struct {
	EventData

	Action PrintAction `json:"action"`
}

type ScrollAction

type ScrollAction int
const (
	ScrollDown ScrollAction = 1 + iota
	ScrollUp
	ScrollScreen
	ScrollRegion
)

func (ScrollAction) MarshalJSON

func (a ScrollAction) MarshalJSON() ([]byte, error)

func (ScrollAction) String

func (a ScrollAction) String() string

type ScrollEvent

type ScrollEvent struct {
	EventData

	Action ScrollAction `json:"action"`
	Start  int          `json:"start"`
	End    int          `json:"end"`
}

type SerializedEvent

type SerializedEvent struct {
	Inner Event
}

func (*SerializedEvent) MarshalJSON

func (self *SerializedEvent) MarshalJSON() ([]byte, error)

func (*SerializedEvent) UnmarshalJSON

func (self *SerializedEvent) UnmarshalJSON(data []byte) error

type TabAction

type TabAction int
const (
	TabSetCurrent TabAction = 1 + iota
	TabClearCurrent
	TabClearAll
)

func (TabAction) MarshalJSON

func (t TabAction) MarshalJSON() ([]byte, error)

func (TabAction) String

func (t TabAction) String() string

type TabEvent

type TabEvent struct {
	EventData
	Action TabAction `json:"action"`
}

type TextEvent

type TextEvent struct {
	EventData
}

type TextRenderer

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

func NewTextRenderer

func NewTextRenderer() *TextRenderer

func (*TextRenderer) Handle

func (self *TextRenderer) Handle(event Event)

func (*TextRenderer) String

func (self *TextRenderer) String() string

Directories

Path Synopsis
examples
cmd

Jump to

Keyboard shortcuts

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