bash

package
v0.0.0-...-5998bd7 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2019 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidReceiver = fmt.Errorf("receiver must be compatible with *File")

ErrInvalidReceiver is raised when an invalid receiver is provided

View Source
var ErrNullReceiver = fmt.Errorf("receiver must not be null")

ErrNullReceiver is raised when a null receiver is provided

Functions

This section is empty.

Types

type Decoder

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

Decoder implements parser.Decoder

func NewDecoder

func NewDecoder(r io.Reader) *Decoder

NewDecoder implements parser.T

func (*Decoder) Decode

func (d *Decoder) Decode(v interface{}) error

Decode is the main function of the parser.Decoder interface

type Encoder

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

Encoder implements parser.Encoder

func NewEncoder

func NewEncoder(w io.Writer) *Encoder

NewEncoder implements parser.T

func (*Encoder) Encode

func (e *Encoder) Encode(v interface{}) error

Encode is the main function of the parser.Encoder interface

type File

type File struct {
	Lines []*Line
}

File represents a bash file

type Line

type Line struct {
	// Type of line
	Type LineType

	// Components of the line
	//
	// When Type = ASSIGNMENT :
	//  [0] = indentation (spaces and tabs)
	//  [1] = variable name
	//  [2] = variable value
	//  [3] = comment (optional)
	Components []string
}

Line represents a meaningful line

type LineError

type LineError struct {
	Line int
	Err  error
}

LineError wraps errors with a line index

func (LineError) Error

func (le LineError) Error() string

Error implements Error

type LineType

type LineType byte

LineType enumerates available line types

const (
	// ANY is the default line type (all except assignments)
	ANY LineType = iota
	// ASSIGNMENT line
	ASSIGNMENT
)

Jump to

Keyboard shortcuts

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