func (p *Parser) ParseWhitespace() error {
	tok, lit := p.Scan()
	if tok != lexer.TokenWhitespace {
		return fmt.Errorf("unexpected %v, expected space", lit)
	}
	return nil
}
ParseWhitespace scans a whitespace token returning nil, or error if the next token is not whitespace.
package parser
import (
	"fmt"
	"strconv"
	"github.com/ambientsound/visp/input/lexer"
)
type Token struct {
	Tok int
	Lit string
}
type buf struct {
	Token
	n int  
}
type Parser struct {
	S       *lexer.Scanner
	buf     buf
	scanned []Token
}
func New(r *lexer.Scanner) *Parser {
	return &Parser{S: r}
}
func (p *Parser) SetScanner(s *lexer.Scanner) {
	p.S = s
	p.buf.n = 0
}
func (p *Parser) Scanned() []Token {
	return p.scanned
}
func (p *Parser) Scan() (tok int, lit string) {
	if p.buf.n != 0 {
		p.buf.n = 0
		return p.buf.Tok, p.buf.Lit
	}
	tok, lit = p.S.Scan()
	if p.scanned == nil {
		p.scanned = make([]Token, 0)
	}
	p.scanned = append(p.scanned, Token{tok, lit})
	p.buf.Tok, p.buf.Lit = tok, lit
	return
}
func (p *Parser) ScanIgnoreWhitespace() (tok int, lit string) {
	tok, lit = p.Scan()
	if tok == lexer.TokenWhitespace {
		tok, lit = p.Scan()
	}
	return
}
func (p *Parser) ScanRemainderAsIdentifier() string {
	var s string
	var whitespace bool
	for {
		tok, lit := p.Scan()
		if tok == lexer.TokenWhitespace && !whitespace {
			whitespace = true
		} else if tok == lexer.TokenEnd {
			return s
		} else {
			s += lit
		}
	}
}
func (p *Parser) Unscan() { p.buf.n = 1 }