Documentation
¶
Index ¶
- type Parser
- type State
- func (s *State) And(ps ...Parser) Parser
- func (s *State) App(f func(interface{}) interface{}, p Parser) Parser
- func (s *State) Char(r rune) Parser
- func (s *State) Chars(cs string) Parser
- func (s *State) Exhaust(p Parser, f func(State) error) Parser
- func (s *State) Lazy(f func() Parser) Parser
- func (s *State) Line() string
- func (s *State) LineNumber() int
- func (s State) LinePosition() int
- func (s *State) Many(p Parser) Parser
- func (s *State) Many1(p Parser) Parser
- func (s *State) Maybe(p Parser) Parser
- func (s *State) None() Parser
- func (s *State) NotChar(r rune) Parser
- func (s *State) NotChars(str string) Parser
- func (s *State) Or(ps ...Parser) Parser
- func (s *State) Prefix(pre, p Parser) Parser
- func (s *State) String(str string) Parser
- func (s *State) Stringify(p Parser) Parser
- func (State) Void(p Parser) Parser
- func (s *State) Wrap(l, m, r Parser) Parser
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Parser ¶
type Parser func() (interface{}, error)
Parser is a type of parsers as a function which returns a parsing result or an error.
type State ¶
type State struct {
// contains filtered or unexported fields
}
State represents a parser state.
func (*State) Exhaust ¶
Exhaust creates a parser which fails when a source string is not exhausted after running a given parser.
func (*State) Lazy ¶
Lazy evaluates and runs a given parser constructor. This is useful to define recursive parsers.
func (*State) LineNumber ¶
LineNumber returns a current line number.
func (State) LinePosition ¶
LinePosition returns a position in a current line.
func (*State) Maybe ¶
Maybe creates a parser which runs a given parser or parses nothing when it fails.
func (*State) NotChar ¶
NotChar creates a parser parsing a character which is not one of an argument.
func (*State) Prefix ¶
Prefix creates a parser with a prefix parser and content parser and returns the latter's result.
func (*State) Stringify ¶
Stringify creates a parser which returns a string converted from a result of a given parser. The result of a given parser must be a rune, a string or a sequence of them in []interface{}.