Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type File ¶
type File struct {
Lines []Line // logical lines
Warnings []string // warnings or errors encounted during the last parse
JoinLines bool // if set to true, lines ending in \ will be joined
Includes bool // if set to true, files can include others
}
File contains the logical lines read from text files, errors that were encountered and options to control parsing.
type Line ¶
type Line struct {
Text string
Source LineSource
}
Line contains content and meta info of one logical line of text
func JoinLines ¶
JoinLines joins consecutive lines ending with the continuing character \ into a logical line. Leading whitespace will be stripped on continuing lines.
func LoadFile ¶
LoadFile parses the given file according to the rules specified in the options and returns a slice of Line, an error if the file could not be read and a slice of strings containing any other warnings or errors encountered during parsing.
func ParseText ¶
func ParseText(text string, file string, options map[string]interface{}) (result []Line, warnings []string)
ParseText parses the given text according to the rules specified in the options and returns a slice of Line and a slice of strings containing any errors or warnings encountered during parsing.
type LineSource ¶
LineSource contains the source file, line number and number of physical lines making up a logical line.
func (*LineSource) Text ¶
func (s *LineSource) Text() string
Text returns a string representation of the LineSource.