lexer

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2021 License: MIT Imports: 1 Imported by: 0

Documentation

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 converts a string input to produce tokens for the Monkey language. It always keeps track of the current position, the next readable position and the current character under examination. These tokens will be parsed by the parser, which constructs the abstract syntax-tree (AST).

func New

func New(input string) *Lexer

New creates a new Lexer for a given input It calls readChar a single time to initialize the first char to be examined, then sets the position and the next readPosition for the lexer

func (*Lexer) NextToken

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

NextToken looks at the current character under examination and returns a Token depending on which character it is.

Jump to

Keyboard shortcuts

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