Documentation ¶
Index ¶
- type Input
- type Output
- type Parser
- func All(parsers ...Parser) Parser
- func Any(parsers ...Parser) Parser
- func Between(begin Parser, end Parser, match Parser) Parser
- func Collect(parsers ...Parser) Parser
- func Ident() Parser
- func Identifier() Parser
- func InComment() Parser
- func Lexeme(match Parser) Parser
- func Many(match Parser) Parser
- func Many1(match Parser) Parser
- func MultiLineComment() Parser
- func NoneOf(cs string) Parser
- func OneLineComment() Parser
- func OneOf(cs string) Parser
- func Parens(match Parser) Parser
- func Satisfy(check func(c rune) bool) Parser
- func SepBy(delim Parser, match Parser) Parser
- func Skip(match Parser) Parser
- func String(str string) Parser
- func Symbol(str string) Parser
- func Token() Parser
- func Try(match Parser) Parser
- func Whitespace() Parser
- type Position
- type Spec
- type State
- type StringInput
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Parser ¶
A Parser is a function that takes a Input and returns any matches (Output) and whether or not the match was valid and any error
func All ¶
Match all parsers, returning the final result. If one fails, it stops. NOTE: Consumes input on failure. Wrap calls in Try(...) to avoid.
func Collect ¶
Match all parsers, collecting their outputs into a vector. If one parser fails, the whole thing fails. NOTE: Consumes input on failure. Wrap calls in Try(...) to avoid.
func Identifier ¶
func Identifier() Parser
func MultiLineComment ¶
func MultiLineComment() Parser
func OneLineComment ¶
func OneLineComment() Parser
func SepBy ¶
Match a parser seperated by another parser 0 or more times. Trailing delimeters are valid.
type Spec ¶
type Spec struct { CommentStart string CommentEnd string CommentLine Parser NestedComments bool IdentStart Parser IdentLetter Parser ReservedNames []string }
Specifications for the parser
type StringInput ¶
type StringInput struct {
// contains filtered or unexported fields
}
Basic string Input for parsing over a string input.
func NewStringInput ¶
func NewStringInput(s string) *StringInput
func (*StringInput) Begin ¶
func (s *StringInput) Begin()
func (*StringInput) End ¶
func (s *StringInput) End(rollback bool)
func (*StringInput) Next ¶
func (s *StringInput) Next() (rune, error)
func (*StringInput) Pop ¶
func (s *StringInput) Pop(i int)
func (*StringInput) Position ¶
func (s *StringInput) Position() Position
Click to show internal directories.
Click to hide internal directories.