func (p *Parser) SkipSpace() rune {
	return p.lex.skipSpace()
}
SkipSpace skips leading spaces, returning the rune that follows.
package lisp1_5
import (
	"fmt"
	"io"
	"log"
	"strings"
)
var printSExpr bool
func Config(alwaysPrintSExprs bool) {
	printSExpr = alwaysPrintSExprs
}
type Expr struct {
	car  *Expr
	atom *token
	cdr  *Expr
}
func (e *Expr) SExprString() string {
	if e == nil {
		return "nil"
	}
	if e.atom != nil {
		return e.atom.String()
	}
	str := "("
	str += e.car.SExprString()
	str += " . "
	str += e.cdr.SExprString()
	str += ")"
	return str
}
func (e *Expr) String() string {
	if printSExpr {
		return e.SExprString()
	}
	if e == nil {
		return "nil"
	}
	var b strings.Builder
	e.buildString(&b, true)
	return b.String()
}
func (e *Expr) buildString(b *strings.Builder, simplifyQuote bool) {
	if e == nil {
		b.WriteString("nil")
		return
	}
	if e.atom != nil {
		e.atom.buildString(b)
		return
	}
	if simplifyQuote && Car(e).getAtom() == tokQuote {
		b.WriteByte('\'')
		Car(Cdr(e)).buildString(b, simplifyQuote)
		return
	}
	b.WriteByte('(')
	for {
		car, cdr := e.car, e.cdr
		car.buildString(b, simplifyQuote)
		if cdr == nil {
			break
		}
		if cdr.atom != nil {
			if cdr.atom.text == "nil" {
				break
			}
			b.WriteString(" . ")
			cdr.buildString(b, simplifyQuote)
			break
		}
		b.WriteByte(' ')
		e = cdr
	}
	b.WriteByte(')')
}
type Parser struct {
	lex     *lexer
	peekTok *token
}
func NewParser(r io.RuneReader) *Parser {
	return &Parser{
		lex:     newLexer(r),
		peekTok: nil,
	}
}