parser

package
v1.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 2, 2019 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Lexer

type Lexer interface {
	SetTypeSystemInput(input []byte) error
	SetExecutableInput(input []byte) error
	Read() (tok token.Token)
	Peek(ignoreWhitespace bool) keyword.Keyword
	ByteSlice(reference document.ByteSliceReference) document.ByteSlice
	TextPosition() position.Position
}

Lexer is the interface used by the Parser to lex tokens

type Option

type Option func(options *Options)

func WithMinimumSliceSize

func WithMinimumSliceSize(size int) Option

func WithPoolSize

func WithPoolSize(poolSize int) Option

type Options

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

type ParsedDefinitions

type ParsedDefinitions struct {
	TypeSystemDefinition document.TypeSystemDefinition
	ExecutableDefinition document.ExecutableDefinition

	OperationDefinitions       document.OperationDefinitions
	FragmentDefinitions        document.FragmentDefinitions
	VariableDefinitions        document.VariableDefinitions
	Fields                     document.Fields
	InlineFragments            document.InlineFragments
	FragmentSpreads            document.FragmentSpreads
	Arguments                  document.Arguments
	ArgumentSets               []document.ArgumentSet
	Directives                 document.Directives
	DirectiveSets              []document.DirectiveSet
	EnumTypeDefinitions        document.EnumTypeDefinitions
	ArgumentsDefinitions       document.ArgumentsDefinitions
	EnumValuesDefinitions      document.EnumValueDefinitions
	FieldDefinitions           document.FieldDefinitions
	InputValueDefinitions      document.InputValueDefinitions
	InputObjectTypeDefinitions document.InputObjectTypeDefinitions
	DirectiveDefinitions       document.DirectiveDefinitions
	InterfaceTypeDefinitions   document.InterfaceTypeDefinitions
	ObjectTypeDefinitions      document.ObjectTypeDefinitions
	ScalarTypeDefinitions      document.ScalarTypeDefinitions
	UnionTypeDefinitions       document.UnionTypeDefinitions
	InputFieldsDefinitions     document.InputFieldsDefinitions
	Values                     []document.Value
	ListValues                 []document.ListValue
	ObjectValues               []document.ObjectValue
	ObjectFields               document.ObjectFields
	Types                      document.Types
	SelectionSets              []document.SelectionSet

	ByteSliceReferences []document.ByteSliceReference
	Integers            []int32
	Floats              []float32
	Booleans            [2]bool
}

ParsedDefinitions contains all parsed definitions to avoid deeply nested data structures while parsing

type Parser

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

Parser holds the lexer and a buffer for writing literals

func NewParser

func NewParser(withOptions ...Option) *Parser

NewParser returns a new parser using a buffered runestringer

func (*Parser) ByteSlice

func (p *Parser) ByteSlice(reference document.ByteSliceReference) document.ByteSlice

func (*Parser) CachedByteSlice

func (p *Parser) CachedByteSlice(i int) document.ByteSlice

func (*Parser) InitDirectiveSet

func (p *Parser) InitDirectiveSet(set *document.DirectiveSet)

func (*Parser) ParseExecutableDefinition

func (p *Parser) ParseExecutableDefinition(input []byte) (err error)

ParseExecutableDefinition parses an ExecutableDefinition from an io.Reader

func (*Parser) ParseTypeSystemDefinition

func (p *Parser) ParseTypeSystemDefinition(input []byte) (err error)

ParseTypeSystemDefinition parses a TypeSystemDefinition from an io.Reader

func (*Parser) TextPosition

func (p *Parser) TextPosition() position.Position

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL