lexer

package
v0.0.14 Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2022 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package lexer contains the code to lex input-programs into a stream of tokens, such that they may be parsed.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Lexer

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

Lexer holds our object-state.

func New

func New(input string) *Lexer

New returns a Lexer instance for a given string input.

func NewWithOptions

func NewWithOptions(opts Opts) *Lexer

NewWithOptions returns a Lexer instance with the given options.

func (*Lexer) CurrentPosition

func (l *Lexer) CurrentPosition() token.Position

CurrentPosition returns a Position object for the current read position.

func (*Lexer) File

func (l *Lexer) File() string

The name of the file being read.

func (*Lexer) GetTokenLineText

func (l *Lexer) GetTokenLineText(t token.Token) string

func (*Lexer) NextToken

func (l *Lexer) NextToken() (token.Token, error)

NextToken to read next token, skipping the white space.

type Opts

type Opts struct {
	Input string
	File  string
}

Opts contains Lexer initialization options

Jump to

Keyboard shortcuts

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