Documentation
¶
Index ¶
- func Unmarshal(input []byte, dest interface{}, ctx Context) error
- func UnmarshalFile(fileName string, dest interface{}, ctx Context) error
- type Code
- type CodeComment
- type CodeList
- type Comment
- type CommentCode
- type Context
- func (c Context) Get(key string) (value interface{}, ok bool)
- func (c Context) GetString(key string, d string) string
- func (c Context) MustGet(key string) interface{}
- func (c Context) New() Context
- func (c Context) Set(key string, value interface{})
- func (c Context) Steady(key string, value interface{})
- type Decodable
- type Decoder
- type FullTokenizer
- type Locatable
- type LocatedError
- type Location
- type MDTokenizer
- type Manual
- type RawStorage
- func (rs *RawStorage) Boolean(lin, col, xcol int, value string)
- func (rs *RawStorage) Data() []Locatable
- func (rs *RawStorage) Err() []error
- func (rs *RawStorage) Header(lin, col, xcol int, value string)
- func (rs *RawStorage) ValueNumber(lin, col, xcol int, value string)
- func (rs *RawStorage) ValueString(lin, col, xcol int, value string)
- type String
- type Tokenizer
- type Unmarshaler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Unmarshal ¶
Unmarshal unmarshals data from input with context ctx provided into a dest object. Return error != nil on error. err may be of type mad.LocatedError what provides positional information in (line, column) pair as well as error message.
func UnmarshalFile ¶
UnmarshalFile unmarshals data right from the input file and returns error message in the form of <file>:<lin>:<col>: <msg>
Types ¶
type CodeComment ¶
CodeComment for code prolonged by comment
type CodeList ¶
type CodeList struct {
// contains filtered or unexported fields
}
CodeList is a list of codes that requires at least one peace of code in a least
type CommentCode ¶
CommentCode is for code preceded with comment
type Context ¶
type Context struct {
// contains filtered or unexported fields
}
Context context provides generational generic storage
func (Context) Get ¶
Get gets a value of key from context. Returns value and ok = true in case if a key exists in one of generations and value = nil, ok = false otherwise
func (Context) GetString ¶
GetString gets a string of a key if it exists. Raise assertion panic if key exists but not a string. Returns d(efault) when the key is absent
func (Context) MustGet ¶
MustGet gets a value from context using the Get. It replicates the Get except it raises the panic if no key has been found
type Decodable ¶
Decodable is a type that can decode itself using source decoder d, optionally using context ctx And nullify is a handle for setting the object into nil which is the case for optionals
type Decoder ¶
type Decoder struct {
// contains filtered or unexported fields
}
Decoder decodes sequence of tokens into destination object
func NewDecoder ¶
NewDecoder returns a new decoder that reads from r
type FullTokenizer ¶
type FullTokenizer struct {
// contains filtered or unexported fields
}
FullTokenizer expands fenced blocks for `raw` syntax into the sequence of header:Value items and 'normalizes' levels. Example of normalization, the following tree structure
1.
5. 2. 2. 4.
will be translated into
1.
2. 2. 2. 3.
func (*FullTokenizer) Confirm ¶
func (f *FullTokenizer) Confirm()
Confirm confirms confirmation in a confirmative way
type LocatedError ¶
LocatedError points to a error position
func TokenError ¶
func TokenError(token Locatable, err error) LocatedError
TokenError returns LocatedError using token to find Lin and Col position
func TokenErrorf ¶
func TokenErrorf(token Locatable, format string, a ...interface{}) LocatedError
TokenErrorf returns formatted LocatedError using TokenError
type MDTokenizer ¶
type MDTokenizer struct {
// contains filtered or unexported fields
}
MDTokenizer is a markdown level tokenizer
func (*MDTokenizer) Next ¶
func (ts *MDTokenizer) Next() bool
Next moves underlying tokenizer to its next
func (*MDTokenizer) Token ¶
func (ts *MDTokenizer) Token() Locatable
Token returns token from underlying tokenizer
type Manual ¶
type Manual interface {
Decode(dest interface{}, header String, d *Decoder, ctx Context) (Manual, error)
// Required must be static function, i.e. must be able to execute on zero instance of a type implementing Manual
Required() bool
}
Manual types command their processing themselves
type RawStorage ¶
type RawStorage struct {
// contains filtered or unexported fields
}
RawStorage storage for raw parser output
func (*RawStorage) Boolean ¶
func (rs *RawStorage) Boolean(lin, col, xcol int, value string)
Boolean consumes value as boolean
func (*RawStorage) Header ¶
func (rs *RawStorage) Header(lin, col, xcol int, value string)
Header consumes header
func (*RawStorage) ValueNumber ¶
func (rs *RawStorage) ValueNumber(lin, col, xcol int, value string)
ValueNumber consumes value as number
func (*RawStorage) ValueString ¶
func (rs *RawStorage) ValueString(lin, col, xcol int, value string)
ValueString consumes value as string
type Unmarshaler ¶
Unmarshaler is implemented by types that can unmarshal text, identifier, unsinged, integer, numeric, inline_string or boolean.