parse

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2016 License: GPL-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package parse provides low-level tools for parsing Silk files.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Detail

type Detail struct {
	Key   string
	Value *Value
}

func (*Detail) String

func (d *Detail) String() string

type ErrLine

type ErrLine struct {
	N   int
	Err error
}

func (ErrLine) Error

func (e ErrLine) Error() string

type Group

type Group struct {
	Filename string
	Title    []byte
	Requests []*Request
	Details  Lines
}

func Parse

func Parse(filename string, r io.Reader) ([]*Group, error)

func ParseFile

func ParseFile(files ...string) ([]*Group, error)

type Line

type Line struct {
	Number int
	Type   LineType
	Bytes  []byte
	Regexp *regexp.Regexp
	// contains filtered or unexported fields
}

Line represents a single line.

func ParseLine

func ParseLine(n int, text []byte) (*Line, error)

ParseLine makes a new Line with the given data.

func (*Line) Detail

func (l *Line) Detail() *Detail

func (*Line) String

func (l *Line) String() string

type LineType

type LineType int8

LineType represents the type of a line.

const (
	LineTypePlain LineType = iota
	LineTypeGroupHeading
	LineTypeRequest
	LineTypeCodeBlock
	LineTypeDetail
	LineTypeSeparator
	LineTypeParam
)

LineTypes

func (LineType) String

func (l LineType) String() string

type Lines

type Lines []*Line

func (Lines) Join

func (l Lines) Join() []byte

func (Lines) Number

func (l Lines) Number() int

Number gets the line number of the first line.

func (Lines) Reader

func (l Lines) Reader() io.Reader

Reader gets an io.Reader that will read every line.

func (Lines) String

func (l Lines) String() string

type Request

type Request struct {
	Path    []byte
	Method  []byte
	Details Lines
	Params  Lines
	Body    Lines

	ExpectedBody    Lines
	ExpectedDetails Lines
}

type Value

type Value struct {
	Data interface{}
}

func ParseValue

func ParseValue(src []byte) *Value

func (Value) Equal

func (v Value) Equal(val interface{}) bool

Equal gets whether the Data and specified value are equal. Supports regexp values.

func (Value) String

func (v Value) String() string

func (Value) Type

func (v Value) Type() string

Jump to

Keyboard shortcuts

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