Documentation
¶
Overview ¶
Package flex reads tell files that are sectioned into alternating blocks of structured and plain text sections. The plain text sections are wrapped with commands and merged into the structured sections. The plain text sections can also "jump out" into structured sections on lines ending with colons.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ReadPlainText ¶ added in v0.24.8
func ReadPlainText(file string, lineOffset int, runes io.RuneReader) ([]story.StoryStatement, error)
Translate plain-text tell into StoryNote(s) and DeclareStatement(s). Each DeclareStatment can contain an Assignment, parsed from an indented sub-document. Because this wants to find those boundaries between comments and statements this doesn't package the whole section into a single declaration for later parsing.
func ReadStorySource ¶ added in v0.24.8
func ReadStorySource(source string, in Unreader) (ret []story.StoryStatement, err error)
Types ¶
type PlainText ¶
type PlainText struct {
// contains filtered or unexported fields
}
func (*PlainText) Decoded ¶
func (pt *PlainText) Decoded(tv match.TokenValue) (err error)
collects incoming tokens reconstructs the original text and parses tell sub-documents into assignments ie. for `Instead of jumping: - Say: "Hey, no way."`
func (*PlainText) Finalize ¶
func (pt *PlainText) Finalize() (ret []story.StoryStatement, err error)
func (*PlainText) Read ¶ added in v0.24.8
func (pt *PlainText) Read(runes io.RuneReader) (ret []story.StoryStatement, err error)
consumes all text until eof ( and eats the eof error )
type Section ¶
type Section struct { Source string StartingLine int // newline count at start of section // contains filtered or unexported fields }
read a structured block until it hits a structured ending.
func MakeSection ¶
return a reader that ends and restarts on every dashed divider in a flex document. must call "NextSection" to start reading.
func (*Section) NextSection ¶
valid at the start of a document or the after ReadRune() has returned eof; otherwise, panics. returns false at the end of a document.
type Unreader ¶
type Unreader interface { io.RuneReader UnreadRune() error }