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

package builder

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

Package builder generates the parser code for a given grammar. It makes no attempt to verify the correctness of the grammar.

Index

Package Files

builder.go generated_static_code.go generated_static_code_range_table.go static_code_range_table.go

func BasicLatinLookup Uses

func BasicLatinLookup(chars, ranges []rune, unicodeClasses []string, ignoreCase bool) (basicLatinChars [128]bool)

BasicLatinLookup calculates the decision results for the first 256 characters of the UTF-8 character set for a given set of chars, ranges and unicodeClasses to speedup the CharClassMatcher.

func BuildParser Uses

func BuildParser(w io.Writer, g *ast.Grammar, opts ...Option) error

BuildParser builds the PEG parser using the provider grammar. The code is written to the specified w.

type Option Uses

type Option func(*builder) Option

Option is a function that can set an option on the builder. It returns the previous setting as an Option.

func BasicLatinLookupTable Uses

func BasicLatinLookupTable(basicLatinLookupTable bool) Option

BasicLatinLookupTable returns an option that specifies the basicLatinLookup option If basicLatinLookup is true, a lookup slice for the first 128 chars of the Unicode table (Basic Latin) is generated for each CharClassMatcher to increase the character matching.

func Nolint Uses

func Nolint(nolint bool) Option

Nolint returns an option that specifies the nolint option If nolint is true, special '// nolint: ...' comments are added to the generated parser to suppress warnings by gometalinter.

func Optimize Uses

func Optimize(optimize bool) Option

Optimize returns an option that specifies the optimize option If optimize is true, the Debug and Memoize code is completely removed from the resulting parser

func ReceiverName Uses

func ReceiverName(nm string) Option

ReceiverName returns an option that specifies the receiver name to use for the current struct (which is the struct on which all code blocks except the initializer are generated).

Package builder imports 9 packages (graph) and is imported by 4 packages. Updated 2018-08-23. Refresh now. Tools for package owners.