Documentation
¶
Index ¶
- Constants
- func AvailableFormats() []string
- func StrToFormat(s string) format
- type GNparser
- func (gnp *GNparser) Build() string
- func (gnp *GNparser) Debug(s string) []byte
- func (gnp *GNparser) OutputFormat() string
- func (gnp *GNparser) Parse(s string)
- func (gnp *GNparser) ParseAndFormat(s string) (string, error)
- func (gnp *GNparser) ParseStream(in <-chan string, out chan<- *ParseResult, opts ...Option)
- func (gnp *GNparser) ParsedName() string
- func (of GNparser) String() string
- func (gnp *GNparser) ToJSON() ([]byte, error)
- func (gnp *GNparser) ToPrettyJSON() ([]byte, error)
- func (gnp *GNparser) ToSlice() []string
- func (gnp *GNparser) Version() string
- func (gnp *GNparser) WorkersNum() int
- type Option
- type ParseResult
Constants ¶
const ( Compact format = iota Pretty Simple Debug )
Variables ¶
This section is empty.
Functions ¶
func AvailableFormats ¶
func AvailableFormats() []string
AvailableFormats function returns a string representation of supported output formats.
func StrToFormat ¶
func StrToFormat(s string) format
StrToFormat function creates an internal type of a supported format out of string.
Types ¶
type GNparser ¶
type GNparser struct {
// contains filtered or unexported fields
}
GNparser is responsible for parsing operations.
func NewGNparser ¶
NewGNparser constructor function takes options and returns configured GNparser.
func (*GNparser) OutputFormat ¶
OutputForat returns string representation of the current output format for GNparser
func (*GNparser) Parse ¶
Parse function parses input using GNparser's supplied options. The abstract syntax tree formed by the parser is stored in an `gnp.parser.SN` field.
func (*GNparser) ParseAndFormat ¶
ParseAndFormat function parses input and formats results according to format setting of GNparser.
func (*GNparser) ParseStream ¶
func (gnp *GNparser) ParseStream(in <-chan string, out chan<- *ParseResult, opts ...Option)
ParseStream function takes input/output channels to do concurrent parsing jobs. Output is pushed as ParseResult objects.
func (*GNparser) ParsedName ¶
ParsedName returns the string of parsed result without a tail.
func (*GNparser) ToPrettyJSON ¶
ToPrettyJSON function creates pretty JSON output out of parsed results.
func (*GNparser) WorkersNum ¶
type Option ¶
type Option func(*GNparser)
Option is a function that creates a new option for GNparser.
func WorkersNum ¶
WorkersNum Option sets the quantity of workers to run parsing jobs.
type ParseResult ¶
ParseResult structure contains parsing output and/or error generated by the parser.