lexer

package
v0.0.0-...-04021c2 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2018 License: MIT Imports: 7 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 struct {
	*ast.Source
	// contains filtered or unexported fields
}

Lexer turns graphql request and schema strings into tokens

func New

func New(src *ast.Source) Lexer

func (*Lexer) ReadToken

func (s *Lexer) ReadToken() (token Token, err *gqlerror.Error)

ReadToken gets the next token from the source starting at the given position.

This skips over whitespace and comments until it finds the next lexable token, then lexes punctuators immediately or calls the appropriate helper function for more complicated tokens.

type Token

type Token struct {
	Kind  Type         // The token type.
	Value string       // The literal value consumed.
	Pos   ast.Position // The file and line this token was read from
}

func (Token) String

func (t Token) String() string

type Type

type Type int

Kind represents a type of token. The types are predefined as constants.

const (
	Invalid Type = iota
	EOF
	Bang
	Dollar
	Amp
	ParenL
	ParenR
	Spread
	Colon
	Equals
	At
	BracketL
	BracketR
	BraceL
	BraceR
	Pipe
	Name
	Int
	Float
	String
	BlockString
	Comment
)

func (Type) Name

func (t Type) Name() string

func (Type) String

func (t Type) String() string

Jump to

Keyboard shortcuts

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