scan

package
v0.0.0-...-8cefd3a Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2022 License: ISC Imports: 3 Imported by: 2

Documentation

Overview

Package scan implements a scanner for Lisp source.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Scanner

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

Scanner holds state of Lisp tokens.

func New

func New(r io.RuneReader) *Scanner

New initialises a scanner for tokenizing Lisp data from a reader.

func (*Scanner) Next

func (s *Scanner) Next() Token

Next reads the next token from the underlying reader.

If an error is encountered, an error token will be returned with a message as its text.

type Token

type Token struct {
	Type Type
	Text string
}

Token represents a token or literal

func (Token) String

func (t Token) String() string

type Type

type Type int

Type identifies the lexical token types of Lisp data.

const (
	Illegal Type = iota
	Error
	EOF

	Comment

	Atom
	LeftParen
	RightParen
)

func (Type) String

func (i Type) String() string

Jump to

Keyboard shortcuts

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