lexer

package
v0.5.0-beta4 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2020 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const EOF rune = -1

Variables

This section is empty.

Functions

func Lex

func Lex(ctx context.Context, input string) chan Token

Types

type Space added in v0.2.1

type Space struct {
	String          string
	ContainsNewline bool
}

type Token

type Token struct {
	Type  TokenType
	Value interface{}
	ast.Range
}

func (Token) Is

func (t Token) Is(ty TokenType) bool

func (Token) IsString added in v0.2.1

func (t Token) IsString(ty TokenType, s string) bool

type TokenType

type TokenType uint8
const (
	TokenError TokenType = iota
	TokenEOF
	TokenSpace
	TokenBinaryLiteral
	TokenOctalLiteral
	TokenDecimalLiteral
	TokenHexadecimalLiteral
	TokenFixedPointLiteral
	TokenIdentifier
	TokenString
	TokenPlus
	TokenMinus
	TokenStar
	TokenSlash
	TokenPercent
	TokenDoubleQuestionMark
	TokenParenOpen
	TokenParenClose
	TokenBraceOpen
	TokenBraceClose
	TokenBracketOpen
	TokenBracketClose
	TokenQuestionMark
	TokenQuestionMarkDot
	TokenComma
	TokenColon
	TokenDot
	TokenSemicolon
	TokenLeftArrow
	TokenLeftArrowExclamation
	TokenSwap
	TokenLess
	TokenLessEqual
	TokenLessLess
	TokenGreater
	TokenGreaterEqual
	TokenGreaterGreater
	TokenEqual
	TokenEqualEqual
	TokenExclamationMark
	TokenNotEqual
	TokenBlockCommentStart
	TokenBlockCommentEnd
	TokenBlockCommentContent
	TokenLineComment
	TokenAmpersand
	TokenAmpersandAmpersand
	TokenCaret
	TokenVerticalBar
	TokenVerticalBarVerticalBar
	TokenAt
	TokenAsExclamationMark
	TokenAsQuestionMark
	// NOTE: not an actual token, must be last item
	TokenMax
)

func (TokenType) String

func (t TokenType) String() string

Jump to

Keyboard shortcuts

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