scanner

package
v0.0.0-...-e0b5347 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2023 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package scanner implements a tokeniser for lua. Inspired by https://talks.golang.org/2011/lex.slide#1

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option func(*Scanner)

func ForNumber

func ForNumber() Option

Specializes in scanning a number, used in file:read("n")

func WithStartLine

func WithStartLine(l int) Option

type Scanner

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

Scanner holds the state of the scanner.

func New

func New(name string, input []byte, opts ...Option) *Scanner

New creates a new scanner for the input string.

func (*Scanner) ErrorMsg

func (l *Scanner) ErrorMsg() string

ErrorMsg returns the current error message or an empty string if there is none.

func (*Scanner) Scan

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

Scan returns the next item from the input (or nil)

Jump to

Keyboard shortcuts

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