lexer

package
v0.0.0-...-1c3f125 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const EOF rune = 65533

Variables

This section is empty.

Functions

This section is empty.

Types

type Lexer

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

func NewLexerFromString

func NewLexerFromString(inputPath string) *Lexer

func (*Lexer) FindTokens

func (lexer *Lexer) FindTokens() []*token.Token

func (*Lexer) Position

func (lexer *Lexer) Position() token.Pos

type Scanner

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

func NewScanner

func NewScanner(tokens []*token.Token) *Scanner

func (*Scanner) Scan

func (s *Scanner) Scan() *token.Token

type StateFunction

type StateFunction func(lexer *Lexer) StateFunction

type Token

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

func NewToken

func NewToken(tokenType TokenType, value string) Token

func (*Token) ToString

func (token *Token) ToString() string

type TokenType

type TokenType = int
const (
	TokenError TokenType = iota
	TokenEOF
	TokenIdentifier
	TokenKeyword
	TokenOperator
	TokenPunctuation
	TokenLiteral
	TokenConnector
)

Jump to

Keyboard shortcuts

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