parser

package
v0.0.0-...-b83a777 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2017 License: BSD-2-Clause Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EqualExpr

func EqualExpr(x, y expr.Expr) bool

func EqualStmt

func EqualStmt(x, y stmt.Stmt) bool

func ParseStmt

func ParseStmt(src []byte) (stmt stmt.Stmt, err error)

Types

type Error

type Error struct {
	Offset int
	Msg    string
}

func (Error) Error

func (e Error) Error() string

type Errors

type Errors []Error

func (Errors) Error

func (e Errors) Error() string

type Parser

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

func New

func New() *Parser

func (*Parser) Close

func (p *Parser) Close()

func (*Parser) ParseLine

func (p *Parser) ParseLine(line []byte) Result

type ParserState

type ParserState int
const (
	StateUnknown ParserState = iota
	StateStmt
	StateStmtPartial
	StateCmd
	StateCmdPartial
)

type Result

type Result struct {
	State ParserState
	Stmts []stmt.Stmt
	Cmds  []*expr.ShellList
	Errs  []Error
}

Result is the result of parsing a line of input. One of Stmts or Cmds will be non-nil (but may be empty).

type Scanner

type Scanner struct {
	// Current Token
	Line    int
	Offset  int
	Token   token.Token
	Literal interface{} // string, *big.Int, *big.Float
	// contains filtered or unexported fields
}

func (*Scanner) Next

func (s *Scanner) Next()

Jump to

Keyboard shortcuts

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