tokenizer

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package tokenizer provides a struct that handles tokenisation of a string.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type NumberFlags

type NumberFlags byte

NumberFlags represents the type of number being parsed.

const (
	// NumberFlagFloat represents a floating point number.
	NumberFlagFloat NumberFlags = 1 << iota
	// NumberFlagExponent represents an exponent number.
	NumberFlagExponent
)

type Tokenizer

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

Tokenizer defines the tokenizer itself.

func NewTokenizer

func NewTokenizer(exp string) *Tokenizer

NewTokenizer creates a new instance of the Tokenizer struct.

func (*Tokenizer) GetNext

func (t *Tokenizer) GetNext() (rune, error)

GetNext gets the next character in the expression.

func (*Tokenizer) Peek

func (t *Tokenizer) Peek() (rune, error)

Peek gets the char of the expression at the current index without advancing it.

func (*Tokenizer) Tokenize

func (t *Tokenizer) Tokenize() ([]*token.Token, error)

Tokenize analyzes the expression string and turns it into tokens.

Jump to

Keyboard shortcuts

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