lexer

package
v0.0.0-...-15fdc45 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2018 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrMatchExp    = errors.New("error while matching at expression level")
	ErrMatchParams = errors.New("error while matching at parameters level")
	ErrMatchParam  = errors.New("error while matching at parameter level")
)

errors

View Source
var (
	ErrIlQuoteCharInID       = errors.New(`illegal character " in identifier-value`)
	ErrIlQuoteCharInParamID  = errors.New(`illegal character " in parameter-identifier-value`)
	ErrIlQuoteCharInParamVal = errors.New(`illegal character " in parameter-value`)
)

errors

Functions

func WriteAll

func WriteAll(w Writer, es []*Expression) error

WriteAll processes all expressions and writes the according text-represenation

Types

type Expression

type Expression struct {
	// mandatory
	Identifier string
	Value      []byte
	// optional
	Parameters Parameters
}

Expression can hold any iCalendar expression

func LexAll

func LexAll(l Lexer) ([]*Expression, error)

LexAll processes all lines and returns the according Expressions

func ReadLine

func ReadLine(l []byte) (ex Expression, err error)

ReadLine takes a string and tries to map it to an Expression

type Lexer

type Lexer interface {
	Next() (*Expression, error)
}

Lexer processes a iCalendar document provided as an io.Reader line by line

func NewLexer

func NewLexer(r io.Reader) Lexer

NewLexer returns a pointer to this package's implementation of a lexer.Lexer

type Parameters

type Parameters map[string][][]byte

Parameters holds a set of parameters for an Expression

type Writer

type Writer interface {
	Write(*Expression) (int, error)
}

Writer takes an []*Expression and writes the given expression's text-representation in iCalendar format to the underlying io.Writer when the Write() function is called

func NewWriter

func NewWriter(w io.Writer) Writer

NewWriter returns a pointer to this package's implementation of a lexer.Writer

Jump to

Keyboard shortcuts

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