ast

package
v0.15.0 Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2024 License: ISC Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EscapeToText added in v0.15.0

func EscapeToText(e string) string

EscapeToText returns the text corresponding to a given escape string (as passed for Escape inline type elements, without the backslash).

Types

type Block

type Block interface {
	GetLine() int
	// contains filtered or unexported methods
}

Block represents a macro line or a text block.

type Inline

type Inline struct {
	Type InlineType // Type of inline element (Escape, ArgEscape ...)
	Num  int32      // Numeric content (for ArgEscape)
	Text string     // Text content (for all types except ArgEscape)
}

Inline represents an inline element in a block, such as text or an escape.

func NewEscape added in v0.15.0

func NewEscape(s string) Inline

NewEscape is a short hand for an inline element of Escape type.

func NewText added in v0.15.0

func NewText(s string) Inline

NewText is a short hand for an inline element of Text type.

type InlineType added in v0.15.0

type InlineType int8

InlineType represents the various kinds of inline elements.

const (
	// Escape represents a regular escape sequence
	Escape InlineType = iota
	// ArgEscape represents an argument escape (\$N)
	ArgEscape
	// NamedArgEscape represents a named argument escape
	NamedArgEscape
	// NamedArgEscape represents a flag escape
	NamedFlagEscape
	// VarEscape represents a variable interpolation escape
	VarEscape
	// Text represents a bunch of inline text.
	Text
)

type Macro

type Macro struct {
	Name string
	Args [][]Inline
	Line int
}

Macro represents data associated with a macro line.

func (*Macro) GetLine

func (m *Macro) GetLine() int

type TextBlock

type TextBlock struct {
	Text []Inline
	Line int
}

TextBlock represents data associated with a text block.

func (*TextBlock) GetLine

func (t *TextBlock) GetLine() int

Jump to

Keyboard shortcuts

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