common

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package common represents common types that is to be used by all frontend packages.

Index

Constants

View Source
const (
	RootStateName = "__Root__"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CaptureData

type CaptureData struct {
	Trigger   string
	Condition string

	Frontend_Index      int
	Frontend_KeywordPos *files.LoadedFilePosition
	Frontend_TriggerPos *files.LoadedFilePosition
}

CaptureData represents captures, which "capture" a trigger and do things with them.

func (*CaptureData) Index

func (cd *CaptureData) Index() int

func (*CaptureData) Position

func (cd *CaptureData) Position() *files.LoadedFilePosition

type CommentData

type CommentData struct {
	Comment string

	Frontend_Index    int
	Frontend_Position *files.LoadedFilePosition
}

CommentData represents a comment line within the code. Note that comments can be inlined in the same line as another entry.

func (*CommentData) Index

func (cd *CommentData) Index() int

func (*CommentData) Position

func (cd *CommentData) Position() *files.LoadedFilePosition

type FrontendEntry

type FrontendEntry interface {
	// Index is the frontend order in which they appeared in the frontend file.
	// This is comparison to other FrontendEntries.
	Index() int

	// Position is the location of this entry in the *original* source file.
	Position() *files.LoadedFilePosition
}

type GochartData

type GochartData struct {
	Name string

	Options []*OptionData

	Triggers    []*TriggerData
	Root        *StateData
	States      []*StateData
	Transitions []*TransitionData

	Comments []*CommentData

	Frontend_Index      int
	Frontend_KeywordPos *files.LoadedFilePosition
	Frontend_NamePos    *files.LoadedFilePosition
}

GochartData is all the information a frontend needs to output about a gochart. This will be consumed by the |ir| package and validated.

func (*GochartData) Index

func (sd *GochartData) Index() int

func (*GochartData) Position

func (sd *GochartData) Position() *files.LoadedFilePosition

type OptionData

type OptionData struct {
	Name  string
	Kind  OptionValueKind
	Value string

	Frontend_NamePos *files.LoadedFilePosition
}

type OptionValueKind

type OptionValueKind int
const (
	OptionValueKind_Boolean OptionValueKind = iota
	OptionValueKind_String
	OptionValueKind_Integer
)

func (OptionValueKind) String

func (ovk OptionValueKind) String() string

type ReactionData

type ReactionData struct {
	Trigger string

	Frontend_Index      int
	Frontend_KeywordPos *files.LoadedFilePosition
	Frontend_TriggerPos *files.LoadedFilePosition
}

ReactionData represents entries for "reactions" to triggers. This is mostly enter/exit statements.

func (*ReactionData) Index

func (rd *ReactionData) Index() int

func (*ReactionData) Position

func (rd *ReactionData) Position() *files.LoadedFilePosition

type StateData

type StateData struct {
	Name   string
	Parent string

	Options []*OptionData

	EnterReactions []*ReactionData
	ExitReactions  []*ReactionData
	Captures       []*CaptureData
	Comments       []*CommentData

	Frontend_Index      int
	Frontend_KeywordPos *files.LoadedFilePosition
	Frontend_NamePos    *files.LoadedFilePosition
}

StateData is all the information the frontend has about a state definition.

func (*StateData) Index

func (sd *StateData) Index() int

func (*StateData) Position

func (sd *StateData) Position() *files.LoadedFilePosition

type TransitionData

type TransitionData struct {
	From      string
	To        string
	Trigger   string
	Condition string
	Action    string

	Frontend_Index      int
	Frontend_KeywordPos *files.LoadedFilePosition
	Frontend_TriggerPos *files.LoadedFilePosition
	Frontend_TargetPos  *files.LoadedFilePosition
}

TransitionData represents a transition, which, like captures, hold a trigger and perform a transition to another state within the gochart.

func (*TransitionData) Index

func (td *TransitionData) Index() int

func (*TransitionData) Position

func (td *TransitionData) Position() *files.LoadedFilePosition

func (*TransitionData) String

func (tdata *TransitionData) String() string

type TriggerData

type TriggerData struct {
	Name       string
	ArgsString string

	Frontend_Index      int
	Frontend_KeywordPos *files.LoadedFilePosition
	Frontend_NamePos    *files.LoadedFilePosition
	Frontend_ArgsPos    *files.LoadedFilePosition
}

TriggerData is all the information the frontend has about a trigger definition.

func (*TriggerData) Index

func (td *TriggerData) Index() int

func (*TriggerData) Position

func (td *TriggerData) Position() *files.LoadedFilePosition

Jump to

Keyboard shortcuts

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