lexer

package
v0.7.9 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FRAGMENT     = "fragment"
	QUERY        = "query"
	MUTATION     = "mutation"
	SUBSCRIPTION = "subscription"
	SCHEMA       = "schema"
	SCALAR       = "scalar"
	TYPE         = "type"
	INTERFACE    = "interface"
	UNION        = "union"
	ENUM         = "enum"
	INPUT        = "input"
	EXTEND       = "extend"
	DIRECTIVE    = "directive"
)

NAME -> keyword relationship

Variables

This section is empty.

Functions

func GetTokenDesc

func GetTokenDesc(token Token) string

Types

type Lexer

type Lexer func(resetPosition int) (Token, error)

func Lex

func Lex(s *source.Source) Lexer

type Token

type Token struct {
	Kind  TokenKind
	Start int
	End   int
	Value string
}

Token is a representation of a lexed Token. Value only appears for non-punctuation tokens: NAME, INT, FLOAT, and STRING.

type TokenKind

type TokenKind int
const (
	EOF TokenKind = iota + 1
	BANG
	DOLLAR
	PAREN_L
	PAREN_R
	SPREAD
	COLON
	EQUALS
	AT
	BRACKET_L
	BRACKET_R
	BRACE_L
	PIPE
	BRACE_R
	NAME
	INT
	FLOAT
	STRING
	BLOCK_STRING
	AMP
)

func (TokenKind) String

func (kind TokenKind) String() string

Jump to

Keyboard shortcuts

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