flex

package
v0.24.5 Latest Latest
Warning

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

Go to latest
Published: May 15, 2024 License: BSD-3-Clause Imports: 12 Imported by: 0

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 ReadStory

func ReadStory(in Unreader) (ret []story.StoryStatement, err error)

func ReadText

func ReadText(runes io.RuneReader) (ret []story.StoryStatement, err error)

consumes all text until eof ( and eats the eof error ) fix: allow line number offset

Types

type PlainText

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

translate a plain text section to paragraphs of commands containing comments and jess Declare statements.

func (*PlainText) Decoded

func (pt *PlainText) Decoded(tv match.TokenValue) (err error)

handler for match tokenizer;

func (*PlainText) Finalize

func (pt *PlainText) Finalize() (ret []story.StoryStatement, err error)

type Section

type Section struct {
	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

func MakeSection(r Unreader) Section

return a reader that ends and restarts on every dashed divider in a flex document. must call "NextSection" to start reading.

func (*Section) NextSection

func (k *Section) NextSection() bool

valid at the start of a document or the after ReadRune() has returned eof; otherwise, panics. returns false at the end of a document.

func (*Section) ReadRune

func (k *Section) ReadRune() (r rune, n int, err error)

read the next rune unless the next rune is a dash. this buffers the dashes, counting them to search for an end of section

type Unreader

type Unreader interface {
	io.RuneReader
	UnreadRune() error
}

Jump to

Keyboard shortcuts

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