utils

package
v0.0.0-...-209b98f Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2019 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppendCode

func AppendCode(slice []string, args ...interface{}) []string

AppendCode is a variadic function which takes multiple strings as arguments and appends them to a slice of IR codes.

func SplitAndSanitize

func SplitAndSanitize(str string, sep string) (retVal []string)

SplitAndSanitize creates a slice after splitting a string at a separator. The entries in resulting slice are trimmed of any whitespace and the resulting entries which are empty are removed (originally containing only whitspaces).

func Tac

func Tac(s string) []string

Tac simulates the shell utility tac(1), only difference being that it returns a slice of strings splitted by newline.

Types

type Item

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

Item defines a single element of the stack.

type Stack

type Stack struct {
	Len int
	// contains filtered or unexported fields
}

func CreateStack

func CreateStack() *Stack

CreateStack creates a new empty stack.

func (*Stack) Peek

func (stk *Stack) Peek() interface{}

Peek returns the value on top of the stack.

func (*Stack) Pop

func (stk *Stack) Pop() interface{}

Pop removes and returns the value on top of the stack.

func (*Stack) Push

func (stk *Stack) Push(val interface{})

Push pushes a value of any type on top of the stack.

Jump to

Keyboard shortcuts

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