pigeon: github.com/mna/pigeon/bootstrap Index | Files

package bootstrap

import "github.com/mna/pigeon/bootstrap"

Package bootstrap implements the scanner and parser to bootstrap the PEG parser generator.

It parses the PEG grammar into an ast that is then used to generate a parser generator based on this PEG grammar. The generated parser can then parse the grammar again, without the bootstrap package.

Index

Package Files

doc.go parser.go scan.go token.go

type Parser Uses

type Parser struct {
    // contains filtered or unexported fields
}

Parser holds the state to parse the PEG grammar into an abstract syntax tree (AST).

func NewParser Uses

func NewParser() *Parser

NewParser creates a new Parser.

func (*Parser) Parse Uses

func (p *Parser) Parse(filename string, r io.Reader) (*ast.Grammar, error)

Parse parses the data from the reader r and generates the AST or returns an error if it fails. The filename is used as information in the error messages.

type Scanner Uses

type Scanner struct {
    // contains filtered or unexported fields
}

Scanner tokenizes an input source for the PEG grammar.

func (*Scanner) Init Uses

func (s *Scanner) Init(filename string, r io.Reader, errh func(ast.Pos, error))

Init initializes the scanner to read and tokenize text from r.

func (*Scanner) Scan Uses

func (s *Scanner) Scan() (Token, bool)

Scan returns the next token, along with a boolean indicating if EOF was reached (false means no more tokens).

type Token Uses

type Token struct {
    // contains filtered or unexported fields
}

Token is a syntactic token generated by the scanner.

func (Token) String Uses

func (t Token) String() string

Package bootstrap imports 10 packages (graph). Updated 2019-08-29. Refresh now. Tools for package owners.