Documentation
¶
Overview ¶
Package Parser provides utilities to automate common text file parsing and editing tasks. It is designed to be used with MemFile, the in memory file system.
The main interface is Parser which implements Parse() (string, error):
type Parser interface { Parse() (string, error) }
Once all options are set, Parse does the work and returns the data as a string. Any other file or data handling structures may choose to implement Parser to gain access the functionality of this package.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Caser ¶
func NewCaseStringer ¶
type Cases ¶
type Cases byte
const (
Pascal Cases // NowIsTheTimeForALLGoodMenToComeToTheAidOfTheirCountry.
)
type GetSetter ¶
GetSetter implements basic generic get and set methods. May be used to wrap a dictionary, INI config file, TOML file, JSON config file, struct, etc ...
type Parameter ¶
Parameter stores a single parameter and returns the name, value, and functionality as needed. Any type may be stored as a parameter, including functions that provide custom functionality.
e.g. a parameter named "newline" might return the string that is used as a linebreak in the text.
nl.Name() // "newline" nl.Function() func() { return "\n" }
a parameter named "upper" might return the function that is used to change text to upper case.
upper.Name() // "UpperCase" upper.Function() func(s string) string { return strings.ToUpper(s) }
type ParseOptioner ¶
type ParseOptioner interface { GetSetter }
type ParserFunctionMap ¶
type ParserFunctionMap map[string]func()
type ParserOptions ¶
type ParserOptions struct {
// contains filtered or unexported fields
}
ParserOptions contains the configuration information for the Parser.
These fields are only used if the behavior is desired, otherwise they should not be set.
If lineseps are provided, they will be converted to the default linesep (or nl if it is given)
type StringFunction ¶
StringFunction takes a string and returns a string