Documentation ¶
Overview ¶
Player input parsing.
Index ¶
- Variables
- func Register(reg func(any))
- type Action
- type Action_Slice
- type ChooseOne
- type ChooseOne_Slice
- type Directive
- type Directive_Slice
- type Focus
- type Focus_Slice
- type Noun
- type Noun_Slice
- type Refine
- type Refine_Slice
- type Reverse
- type Reverse_Slice
- type ScannerMaker
- type ScannerMaker_Slot
- type ScannerMaker_Slots
- type Sequence
- type Sequence_Slice
- type Words
- type Words_Slice
Constants ¶
This section is empty.
Variables ¶
var Z_Types = typeinfo.TypeSet{ Name: "grammar", Comment: []string{ "Player input parsing.", }, Slot: z_slot_list, Flow: z_flow_list, Signatures: z_signatures, }
package listing of type data
var Zt_Action typeinfo.Flow
action, a type of flow.
var Zt_ChooseOne typeinfo.Flow
choose_one, a type of flow.
var Zt_Directive typeinfo.Flow
directive, a type of flow.
var Zt_Focus typeinfo.Flow
focus, a type of flow.
var Zt_Noun typeinfo.Flow
noun, a type of flow.
var Zt_Refine typeinfo.Flow
refine, a type of flow.
var Zt_Reverse typeinfo.Flow
reverse, a type of flow.
var Zt_ScannerMaker = typeinfo.Slot{ Name: "scanner_maker", Markup: map[string]any{ "--": "Commands which interpret player input.", }, }
scanner_maker, a type of slot.
var Zt_Sequence typeinfo.Flow
sequence, a type of flow.
var Zt_Words typeinfo.Flow
words, a type of flow.
Functions ¶
Types ¶
type Action ¶
type Action struct { ActionName string Arguments []call.Arg Markup map[string]any `json:",omitempty"` }
Run a script defined action. The action will be parameterized with the actor performing the action, and up to two other nouns. The actor is always the player's, the nouns are whichever were matched by Noun. This command usually appears last in a series of sub-scanners, after all of the earlier scanners have successfully matched.
func (*Action) GetMarkup ¶
Implements typeinfo.Markup
func (*Action) MakeScanner ¶
type Action_Slice ¶
type Action_Slice []Action
Holds a slice of type Action.
func (*Action_Slice) Repeats ¶
func (op *Action_Slice) Repeats() bool
Implements typeinfo.Repeats for a slice of Action.
func (*Action_Slice) TypeInfo ¶
func (*Action_Slice) TypeInfo() typeinfo.T
Implements typeinfo.Instance for a slice of Action.
type ChooseOne ¶
type ChooseOne struct { Options []ScannerMaker Markup map[string]any `json:",omitempty"` }
Attempts to match exactly one of its sub-scanners. Its sub-scanners are evaluated in the order listed; stopping after the first successful match has occurred.
func (*ChooseOne) GetMarkup ¶
Implements typeinfo.Markup
func (*ChooseOne) MakeScanner ¶
type ChooseOne_Slice ¶
type ChooseOne_Slice []ChooseOne
Holds a slice of type ChooseOne.
func (*ChooseOne_Slice) Repeats ¶
func (op *ChooseOne_Slice) Repeats() bool
Implements typeinfo.Repeats for a slice of ChooseOne.
func (*ChooseOne_Slice) TypeInfo ¶
func (*ChooseOne_Slice) TypeInfo() typeinfo.T
Implements typeinfo.Instance for a slice of ChooseOne.
type Directive ¶
type Directive struct { Name string Series []ScannerMaker Markup map[string]any `json:",omitempty"` }
Starts a parser scanner. This is generated by story statement "DefineNamedGrammar" so that grammar doesn't have to import weave.
func (*Directive) GetMarkup ¶
Implements typeinfo.Markup
func (*Directive) MakeScanners ¶
acts as AllOf{Words, ... }
type Directive_Slice ¶
type Directive_Slice []Directive
Holds a slice of type Directive.
func (*Directive_Slice) Repeats ¶
func (op *Directive_Slice) Repeats() bool
Implements typeinfo.Repeats for a slice of Directive.
func (*Directive_Slice) TypeInfo ¶
func (*Directive_Slice) TypeInfo() typeinfo.T
Implements typeinfo.Instance for a slice of Directive.
type Focus ¶
type Focus struct { Player string Series []ScannerMaker Markup map[string]any `json:",omitempty"` }
Select a specific set of bounds for the scanner to use when matching nouns. Currently, the set of scanners is defined in golang, and cannot be extended by script. They are:
- "" - the empty string for the current locale ( the default bounds )
- "compass" - for nouns of kind "directions" ( north, east, etc. )
- "player" - for the player's inventory
- "debugging" - for all objects of kind "objects"
see: https://pkg.go.dev/git.sr.ht/~ionous/tapestry/support/play#Survey
func (*Focus) GetMarkup ¶
Implements typeinfo.Markup
func (*Focus) MakeScanner ¶
tbd: i wonder if this should have children ( like any/one of ) rather than being "inline"
type Focus_Slice ¶
type Focus_Slice []Focus
Holds a slice of type Focus.
func (*Focus_Slice) Repeats ¶
func (op *Focus_Slice) Repeats() bool
Implements typeinfo.Repeats for a slice of Focus.
func (*Focus_Slice) TypeInfo ¶
func (*Focus_Slice) TypeInfo() typeinfo.T
Implements typeinfo.Instance for a slice of Focus.
type Noun ¶
Attempt to find a noun matching one or more words entered by the player. Out of all the nouns in a game world the specific nouns matched will, by default, depend on what objects are visible to the player.
func (*Noun) GetMarkup ¶
Implements typeinfo.Markup
func (*Noun) MakeScanner ¶
type Noun_Slice ¶
type Noun_Slice []Noun
Holds a slice of type Noun.
func (*Noun_Slice) Repeats ¶
func (op *Noun_Slice) Repeats() bool
Implements typeinfo.Repeats for a slice of Noun.
func (*Noun_Slice) TypeInfo ¶
func (*Noun_Slice) TypeInfo() typeinfo.T
Implements typeinfo.Instance for a slice of Noun.
type Refine ¶
type Refine struct { Series []ScannerMaker Markup map[string]any `json:",omitempty"` }
Uses the last noun in a series of sub-scanners as a source for finding for the first noun in the series. For example, in the phrase "take book from table" if there was one book on a table, and many books on a bookshelf, refine would ensure that the book on the table was selected.
func (*Refine) GetMarkup ¶
Implements typeinfo.Markup
func (*Refine) MakeScanner ¶
type Refine_Slice ¶
type Refine_Slice []Refine
Holds a slice of type Refine.
func (*Refine_Slice) Repeats ¶
func (op *Refine_Slice) Repeats() bool
Implements typeinfo.Repeats for a slice of Refine.
func (*Refine_Slice) TypeInfo ¶
func (*Refine_Slice) TypeInfo() typeinfo.T
Implements typeinfo.Instance for a slice of Refine.
type Reverse ¶
type Reverse struct { Reverses []ScannerMaker Markup map[string]any `json:",omitempty"` }
Assuming that the first and last sub-scanners in a set match nouns, reverse the order of those nouns when sending them to an action.
func (*Reverse) GetMarkup ¶
Implements typeinfo.Markup
func (*Reverse) MakeScanner ¶
type Reverse_Slice ¶
type Reverse_Slice []Reverse
Holds a slice of type Reverse.
func (*Reverse_Slice) Repeats ¶
func (op *Reverse_Slice) Repeats() bool
Implements typeinfo.Repeats for a slice of Reverse.
func (*Reverse_Slice) TypeInfo ¶
func (*Reverse_Slice) TypeInfo() typeinfo.T
Implements typeinfo.Instance for a slice of Reverse.
type ScannerMaker ¶
ScannerMaker - creates parser scanners
type ScannerMaker_Slot ¶
type ScannerMaker_Slot struct{ Value ScannerMaker }
Holds a single slot.
func (*ScannerMaker_Slot) TypeInfo ¶
func (*ScannerMaker_Slot) TypeInfo() typeinfo.T
Implements typeinfo.Instance for a single slot.
type ScannerMaker_Slots ¶
type ScannerMaker_Slots []ScannerMaker
Holds a slice of slots.
func (*ScannerMaker_Slots) Repeats ¶
func (op *ScannerMaker_Slots) Repeats() bool
Implements typeinfo.Repeats for a slice of slots.
func (*ScannerMaker_Slots) TypeInfo ¶
func (*ScannerMaker_Slots) TypeInfo() typeinfo.T
Implements typeinfo.Instance for a slice of slots.
type Sequence ¶
type Sequence struct { Series []ScannerMaker Markup map[string]any `json:",omitempty"` }
Require that all of its sub-scanners match.
func (*Sequence) GetMarkup ¶
Implements typeinfo.Markup
func (*Sequence) MakeScanner ¶
type Sequence_Slice ¶
type Sequence_Slice []Sequence
Holds a slice of type Sequence.
func (*Sequence_Slice) Repeats ¶
func (op *Sequence_Slice) Repeats() bool
Implements typeinfo.Repeats for a slice of Sequence.
func (*Sequence_Slice) TypeInfo ¶
func (*Sequence_Slice) TypeInfo() typeinfo.T
Implements typeinfo.Instance for a slice of Sequence.
type Words ¶
Match text exactly as typed by the player. To match two words that must appear together use a Sequence containing two separate word commands. For example, to match the phrase "take off", use:
Sequence: - One word: "take" - One word: "off"
func (*Words) GetMarkup ¶
Implements typeinfo.Markup
func (*Words) MakeScanner ¶
type Words_Slice ¶
type Words_Slice []Words
Holds a slice of type Words.
func (*Words_Slice) Repeats ¶
func (op *Words_Slice) Repeats() bool
Implements typeinfo.Repeats for a slice of Words.
func (*Words_Slice) TypeInfo ¶
func (*Words_Slice) TypeInfo() typeinfo.T
Implements typeinfo.Instance for a slice of Words.