Package parser implements a Rosewood file and command parsers
cmd_parser.go convert.go errors.go file_parser.go io.go parse_table_cmd.go run_set.go
const (
ErrGeneric int = iota
ErrSyntaxError
ErrEmpty
ErrUnknown
)var RWSyntaxVdotzero1 = RWSyntax{
Version: "v0.1",
SectionSeparator: "---",
ColumnSeparator: "|",
}RWSyntaxVdotzero1 syntax for Rosewood v0.1
var RWSyntaxVdotzero2 = RWSyntax{
Version: "v0.2",
SectionSeparator: "+++",
ColumnSeparator: "|",
}RWSyntaxVdotzero2 syntax for Rosewood v0.2
func CheckFileVersion(r io.ReadSeeker) (version string, err error)func ConvertToCurrentVersion(settings *types.RosewoodSettings, oldSyntax RWSyntax, in io.Reader, out io.Writer) errorConvertToCurrentVersion utility to convert two current Rosewood version
func ConvertVersion(settings *types.RosewoodSettings, newSyntax RWSyntax, oldSyntax RWSyntax, in io.Reader) ([]string, error)ConvertVersion utility to convert between two Rosewood versions
func GetFileVersion(header string) stringGetFileVersion returns Rosewood file version based on header info
type CommandParser struct {
// contains filtered or unexported fields
}CommandParser specialized parser for format commands
func NewCommandParser(settings *types.RosewoodSettings) *CommandParserNewCommandParser initializes and returns a CommandParser
func (p *CommandParser) ErrorText(index int) stringErrorText returns a \n separated list of errors if index =-1, otherwise returns the indexth error;
func (p *CommandParser) Errors() *errors.ErrorListErrors returns a list of parsing errors
func (p *CommandParser) ParseCommandLines(s *types.Section) ([]*types.Command, error)ParseCommandLines parses a list of strings into list of commands
func (p *CommandParser) Pos() PositionPos returns the current position in the source
type EmError struct {
Type int
Position
Message string
}A EmError is a generic error returned for parsing errors.
func NewError(etype int, pos Position, msg string) *EmErrorNewError returns a pointer to a new EmError
func (e EmError) Error() stringEmError implements the error interface
type File struct {
FileName string
// contains filtered or unexported fields
}File holds information on currently parsed Rosewood file
func NewFile(fileName string, settings *types.RosewoodSettings) *FileNewFile returns a Rosewood File
func (f *File) Err() errorErr returns a list of parsing errors
func (f *File) Errors() *errors.ErrorListErrors returns a list of parsing errors
func (f *File) Parse(r io.ReadSeeker) errorParse parses an io.ReadSeeker streaming a Rosewood file and returns any found tables
func (f *File) SectionCount() intSectionCount returns the number of sections found in the file
func (f *File) TableCount() intTableCount returns the number of prased tables in the file
func (f *File) Tables() []*types.TableTables returns an array of pointers to parsed Tables
type Position = scanner.PositionPosition is an alias of scanner.Position
type RWSyntax struct {
Version string
SectionSeparator string
ColumnSeparator string
}RWSyntax holds info on syntax differences in each Rosewood version
Generated by godoc2md