Documentation ¶
Index ¶
- Variables
- func Asset(name string) ([]byte, error)
- func AssetDir(name string) ([]string, error)
- func AssetInfo(name string) (os.FileInfo, error)
- func AssetNames() []string
- func Format(name, version string) []byte
- func Formats() []string
- func GenerateUUID(data []byte) int
- func MustAsset(name string) []byte
- func ReadFormat(name string) ([]byte, error)
- func RestoreAsset(dir, name string) error
- func RestoreAssets(dir, name string) error
- func SplitFormat(s string) (name, version string)
- func StripFormatVersion(format string) string
- func TransitionsDestinations(a []*Transition) []string
- func TransitionsErrorState(a []*Transition) string
- func Walk(v Visitor, node Node)
- type Action
- type ActionBlock
- type Arg
- type Document
- type Node
- type Parser
- type Pos
- type Scanner
- type SyntaxError
- type Token
- type Transition
- func ChooseTransitions(a []*Transition, rand *rand.Rand) []*Transition
- func FilterErrorTransitions(a []*Transition) []*Transition
- func FilterNonErrorTransitions(a []*Transition) []*Transition
- func FilterProbableTransitions(a []*Transition) []*Transition
- func FilterTransitionsByDestination(a []*Transition, name string) []*Transition
- func FilterTransitionsBySource(a []*Transition, name string) []*Transition
- type Visitor
- type VisitorFunc
Constants ¶
This section is empty.
Variables ¶
var FormatVersions = []string{"20150701", "20150702"}
Functions ¶
func Asset ¶
Asset loads and returns the asset for the given name. It returns an error if the asset could not be found or could not be loaded.
func AssetDir ¶
AssetDir returns the file names below a certain directory embedded in the file by go-bindata. For example if you run go-bindata on data/... and data contains the following hierarchy:
data/ foo.txt img/ a.png b.png
then AssetDir("data") would return []string{"foo.txt", "img"} AssetDir("data/img") would return []string{"a.png", "b.png"} AssetDir("foo.txt") and AssetDir("notexist") would return an error AssetDir("") will return []string{"data"}.
func AssetInfo ¶
AssetInfo loads and returns the asset info for the given name. It returns an error if the asset could not be found or could not be loaded.
func Format ¶
Format returns the contents of the named embedded MAR file. If the verison is not specified then latest version is returned. Returns nil if the format does not exist.
func Formats ¶
func Formats() []string
Formats returns a list of available built-in formats. Excludes formats that are only to be spawned by other formats.
func GenerateUUID ¶
func MustAsset ¶
MustAsset is like Asset but panics when Asset would return an error. It simplifies safe initialization of global variables.
func ReadFormat ¶
ReadFormat returns a built-in format, if it exists, or reads from a file.
func RestoreAsset ¶
RestoreAsset restores an asset under the given directory
func RestoreAssets ¶
RestoreAssets restores an asset under the given directory recursively
func SplitFormat ¶
SplitFormat splits a fully qualified format name into it's name and version parts.
func StripFormatVersion ¶
StripFormatVersion removes any version specified on a format.
func TransitionsDestinations ¶
func TransitionsDestinations(a []*Transition) []string
TransitionsDestinations returns the destination state names from the transitions.
func TransitionsErrorState ¶
func TransitionsErrorState(a []*Transition) string
TransitionsErrorState returns the first error state in a list of transitions.
Types ¶
type Action ¶
type Action struct { Party string PartyPos Pos Module string ModulePos Pos Dot Pos Method string MethodPos Pos Lparen Pos Args []*Arg Rparen Pos If Pos RegexMatchIncoming Pos RegexMatchIncomingLparen Pos Regex string RegexPos Pos RegexMatchIncomingRparen Pos }
func FilterActionsByParty ¶
FilterActionsByParty returns a slice of actions matching party.
type ActionBlock ¶
type Document ¶
type Document struct { UUID int Format string Connection Pos Lparen Pos Transport string TransportPos Pos Comma Pos Port string PortPos Pos Rparen Pos Colon Pos Transitions []*Transition ActionBlocks []*ActionBlock }
func (*Document) ActionBlock ¶
func (doc *Document) ActionBlock(name string) *ActionBlock
ActionBlock returns an action block by name.
func (*Document) FirstSender ¶
FirstSender returns the party that initiates the protocol.
func (*Document) HasTransition ¶
HasTransition returns true if there is a transition between src and dst.
type Node ¶
type Node interface {
// contains filtered or unexported methods
}
Node represents a node within the AST.
type Parser ¶
type Parser struct {
// contains filtered or unexported fields
}
Parser represents a Marionette DSL parser.
The parser will automatically convert certain actions to their complement depending on the party that is parsing the document. No transformation is performed if the party is blank.
type Pos ¶
Pos specifies the line and character position of a token. The Char and Line are both zero-based indexes.
type Scanner ¶
type Scanner struct {
// contains filtered or unexported fields
}
Scanner is a marionette DSL tokenizer.
func NewScanner ¶
NewScanner returns a new instance of Scanner.
func (*Scanner) PeekIgnoreWhitespace ¶
PeekIgnoreWhitespace returns the next non-whitespace, non-comment token without moving the scanner forward.
type SyntaxError ¶
func (*SyntaxError) Error ¶
func (e *SyntaxError) Error() string
type Transition ¶
type Transition struct { Source string SourcePos Pos Destination string DestinationPos Pos ActionBlock string ActionBlockPos Pos Probability float64 ProbabilityPos Pos IsErrorTransition bool }
func ChooseTransitions ¶
func ChooseTransitions(a []*Transition, rand *rand.Rand) []*Transition
func FilterErrorTransitions ¶
func FilterErrorTransitions(a []*Transition) []*Transition
func FilterNonErrorTransitions ¶
func FilterNonErrorTransitions(a []*Transition) []*Transition
func FilterProbableTransitions ¶
func FilterProbableTransitions(a []*Transition) []*Transition
func FilterTransitionsByDestination ¶
func FilterTransitionsByDestination(a []*Transition, name string) []*Transition
func FilterTransitionsBySource ¶
func FilterTransitionsBySource(a []*Transition, name string) []*Transition
type VisitorFunc ¶
type VisitorFunc func(node Node)
VisitorFunc implements a type to use a function as a Visitor.
func (VisitorFunc) Visit ¶
func (fn VisitorFunc) Visit(node Node) Visitor