lex

package
v0.0.0-...-f2f0c14 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2017 License: Apache-2.0 Imports: 4 Imported by: 2

Documentation

Index

Constants

View Source
const (
	ILLEGAL = "ILLEGAL"
	EOF     = "EOF"
)

Variables

This section is empty.

Functions

func IsAlpha

func IsAlpha(r rune) bool

func IsDigit

func IsDigit(r rune) bool

func IsEndOfLine

func IsEndOfLine(r rune) bool

func IsSpace

func IsSpace(r rune) bool

Types

type Lexer

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

func New

func New(input string, startState StateFn) *Lexer

func (*Lexer) Accept

func (l *Lexer) Accept(valid string) bool

func (*Lexer) AcceptAlpha

func (l *Lexer) AcceptAlpha()

func (*Lexer) AcceptDigits

func (l *Lexer) AcceptDigits()

func (*Lexer) AcceptRun

func (l *Lexer) AcceptRun(valid string)

func (*Lexer) AcceptSequence

func (l *Lexer) AcceptSequence(sequence string) bool

func (*Lexer) Backup

func (l *Lexer) Backup()

func (*Lexer) CurrentInput

func (l *Lexer) CurrentInput() string

func (*Lexer) Emit

func (l *Lexer) Emit(tokenType TokenType)

func (*Lexer) Errorf

func (l *Lexer) Errorf(format string, args ...interface{}) StateFn

func (*Lexer) Ignore

func (l *Lexer) Ignore()

func (*Lexer) IgnoreWhitespace

func (l *Lexer) IgnoreWhitespace()

func (*Lexer) Next

func (l *Lexer) Next() (r rune)

func (*Lexer) NextToken

func (l *Lexer) NextToken() Token

func (*Lexer) Peek

func (l *Lexer) Peek() rune

type StateFn

type StateFn func(*Lexer) StateFn

type Token

type Token struct {
	Type    TokenType
	Literal string
}

func (*Token) TokenLiteral

func (t *Token) TokenLiteral() string

type TokenType

type TokenType string

Jump to

Keyboard shortcuts

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