script

package
v0.0.0-...-c07845e Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2015 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Escapes = map[rune]string{
	'a': "\a",
	'b': "\b",
	't': "\t",
	'n': "\n",
	'v': "\v",
	'f': "\f",
	'r': "\r",
	'e': "\x1B",
}

Functions

func EncodeRuneToString

func EncodeRuneToString(r rune) string

func IsChar

func IsChar(ch rune) func(rune) bool

func IsDQMeta

func IsDQMeta(r rune) bool

func IsHexDigit

func IsHexDigit(r rune) bool

func IsMeta

func IsMeta(r rune) bool

func IsNewline

func IsNewline(r rune) bool

func IsOctDigit

func IsOctDigit(r rune) bool

func IsSpace

func IsSpace(r rune) bool

func Not

func Not(pred func(rune) bool) func(rune) bool

func Parse

func Parse(r io.Reader) ([][]string, error)

Types

type LexError

type LexError uint8
const (
	ErrUnterminatedSQS LexError = iota
	ErrUnterminatedDQS
	ErrUnterminatedBS
)

func (LexError) Error

func (err LexError) Error() string

func (LexError) GoString

func (err LexError) GoString() string

func (LexError) String

func (err LexError) String() string

type Lexer

type Lexer struct {
	In []byte
}

func NewLexer

func NewLexer(in []byte) *Lexer

func (*Lexer) Go

func (l *Lexer) Go() <-chan Token

func (*Lexer) Lex

func (l *Lexer) Lex(ch chan<- Token)

func (*Lexer) LexDoubleQuotedString

func (l *Lexer) LexDoubleQuotedString() (string, error)

func (*Lexer) LexHexEscape

func (l *Lexer) LexHexEscape(n int) (rune, error)

func (*Lexer) LexOctalEscape

func (l *Lexer) LexOctalEscape() (rune, error)

func (*Lexer) Until

func (l *Lexer) Until(pred func(rune) bool) string

func (*Lexer) While

func (l *Lexer) While(pred func(rune) bool) string

type Token

type Token struct {
	Type  TokenType
	Value string
	Error error
}

type TokenType

type TokenType uint8
const (
	ErrorToken TokenType = iota
	WordToken
	CommentToken
	WhitespaceToken
	NewlineToken
)

func (TokenType) GoString

func (tt TokenType) GoString() string

func (TokenType) String

func (tt TokenType) String() string

Jump to

Keyboard shortcuts

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