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) error
ConvertToCurrentVersion 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) string
GetFileVersion 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) *CommandParser
NewCommandParser initializes and returns a CommandParser
func (p *CommandParser) ErrorText(index int) string
ErrorText returns a \n separated list of errors if index =-1, otherwise returns the indexth error;
func (p *CommandParser) Errors() *errors.ErrorList
Errors 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() Position
Pos 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) *EmError
NewError returns a pointer to a new EmError
func (e EmError) Error() string
EmError 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) *File
NewFile returns a Rosewood File
func (f *File) Err() error
Err returns a list of parsing errors
func (f *File) Errors() *errors.ErrorList
Errors returns a list of parsing errors
func (f *File) Parse(r io.ReadSeeker) error
Parse parses an io.ReadSeeker streaming a Rosewood file and returns any found tables
func (f *File) SectionCount() int
SectionCount returns the number of sections found in the file
func (f *File) TableCount() int
TableCount returns the number of prased tables in the file
func (f *File) Tables() []*types.Table
Tables returns an array of pointers to parsed Tables
type Position = scanner.Position
Position 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