lexer

package
v1.5.2 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2019 License: GPL-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package lexer contains our simple lexer.

The lexer returns tokens from a (string) input, as a series of Token objects.

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 creates a Lexer instance from the given string

func (*Lexer) GetLine

func (l *Lexer) GetLine() int

GetLine returns the rough line-number of our current position.

This is used to report errors in a more humane manner.

func (*Lexer) NextToken

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

NextToken reads and returns the next token, skipping any white space.

Jump to

Keyboard shortcuts

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