lexer

package
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EOF = iota + 1
	BANG
	QUESTION
	DOLLAR
	PAREN_L
	PAREN_R
	SPREAD
	COLON
	EQUALS
	STAR
	AT
	BRACKET_L
	BRACKET_R
	BRACE_L
	PIPE
	BRACE_R
	NAME
	NS
	INT
	FLOAT
	STRING
	BLOCK_STRING
	AMP
)
View Source
const (
	NAMESPACE = "namespace"
	IMPORT    = "import"
	ALIAS     = "alias"
	TYPE      = "type"
	FUNC      = "func"
	INTERFACE = "interface"
	UNION     = "union"
	ENUM      = "enum"
	DIRECTIVE = "directive"
)

NAME -> keyword relationship

Variables

View Source
var TokenKind map[int]int

Functions

func GetTokenDesc

func GetTokenDesc(token Token) string

func GetTokenKindDesc

func GetTokenKindDesc(kind int) string

Types

type Lexer

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

func Lex

func Lex(s *source.Source) Lexer

type Token

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

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

Jump to

Keyboard shortcuts

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