...

Package lexer

import "github.com/zylisp/zylisp/core/lexer"
Overview
Index

Overview ▾

Constants

Lexer-specific errors

const (
    UnsupportedRuneError          string = "Don't know what to do with rune: %q"
    UnterminatedQuotedStringError string = "Unterminated quoted string"
    BadNumberSyntax               string = "Bad number syntax: %q"
)

General lexer constants

const (
    EOF = -1
)

Variables

AdditionalAlphaNumRunes rune vars

var AdditionalAlphaNumRunes = map[rune]bool{
    '>': true,
    '<': true,
    '=': true,
    '-': true,
    '+': true,
    '*': true,
    '&': true,
    '_': true,
    '/': true,
    '?': true,
}

func AtomName

func AtomName(atomType AtomType) string

AtomName returns the name of the atom for a given atom value

type Atom

Atom object

type Atom struct {
    Type  AtomType
    Pos   Pos
    Value string
}

type AtomType

AtomType atom type

type AtomType int

Lexer atom constants

const (
    AtomError AtomType = iota
    AtomEOF

    AtomLeftParen
    AtomRightParen
    AtomLeftVect
    AtomRightVect

    AtomIdent
    AtomString
    AtomChar
    AtomFloat
    AtomInt
    AtomComplex

    // Ok, these aren't really atoms but ...
    AtomQuote
    AtomQuasiQuote
    AtomUnquote
    AtomUnquoteSplice
)

type Lexer

Lexer object

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

func Lex

func Lex(name, input string) *Lexer

Lex returns a lexer constructor

func (*Lexer) NextAtom

func (l *Lexer) NextAtom() Atom

NextAtom method

func (*Lexer) PrintAtoms

func (l *Lexer) PrintAtoms()

PrintAtoms prints the value of String()

func (*Lexer) String

func (l *Lexer) String() string

type Pos

Pos position type

type Pos int