scanner

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2019 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func StripCR

func StripCR(b []byte, comment bool) []byte

StripCR removes carriage return characters.

Types

type ErrorHandler

type ErrorHandler func(pos source.FilePos, msg string)

ErrorHandler is an error handler for the scanner.

type Mode

type Mode int

Mode represents a scanner mode.

const (
	ScanComments Mode = 1 << iota
	DontInsertSemis
)

List of scanner modes.

type Scanner

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

Scanner reads the Tengo source text.

func NewScanner

func NewScanner(file *source.File, src []byte, errorHandler ErrorHandler, mode Mode) *Scanner

NewScanner creates a Scanner.

func (*Scanner) ErrorCount

func (s *Scanner) ErrorCount() int

ErrorCount returns the number of errors.

func (*Scanner) Scan

func (s *Scanner) Scan() (tok token.Token, literal string, pos source.Pos)

Scan returns a token, token literal and its position.

Jump to

Keyboard shortcuts

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