lib

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2023 License: GPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Hooks map[string][]*zygo.SexpSymbol

needs to be global because we can't feed an cfg object to AddHook() which is being called from user lisp code

Functions

func AddHook added in v1.0.17

func AddHook(env *zygo.Zlisp, name string, args []zygo.Sexp) (zygo.Sexp, error)

AddHook() (called addhook from lisp code) can be used by the user to add a function to one of the available hooks provided by tablizer.

func HookExists added in v1.0.17

func HookExists(key string) bool

Check if a hook exists

func LoadFile added in v1.0.17

func LoadFile(env *zygo.Zlisp, path string) error

* Basic sanity checks and load lisp file

func PrepareColumns

func PrepareColumns(c *cfg.Config, data *Tabdata) error

parse columns list given with -c, modifies config.UseColumns based on eventually given regex

func ProcessFiles

func ProcessFiles(c *cfg.Config, args []string) error

func RegisterLib added in v1.0.17

func RegisterLib(env *zygo.Zlisp)

func RunFilterHooks added in v1.0.17

func RunFilterHooks(c cfg.Config, line string) (bool, error)

Execute every user lisp function registered as filter hook.

Each function is given the current line as argument and is expected to return a boolean. True indicates to keep the line, false to skip it.

If there are multiple such functions registered, then the first one returning false wins, that is if each function returns true the line will be kept, if at least one of them returns false, it will be skipped.

func SetupLisp added in v1.0.17

func SetupLisp(c *cfg.Config) error

* Setup lisp interpreter environment

func Splice2SexpList added in v1.0.17

func Splice2SexpList(list []string) zygo.Sexp

func String2Int added in v1.0.17

func String2Int(env *zygo.Zlisp, name string, args []zygo.Sexp) (zygo.Sexp, error)

func StringReSplit added in v1.0.17

func StringReSplit(env *zygo.Zlisp, name string, args []zygo.Sexp) (zygo.Sexp, error)

Types

type Tabdata

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

contains a whole parsed table

func Parse added in v1.0.12

func Parse(c cfg.Config, input io.Reader) (Tabdata, error)

Parser switch

func RunProcessHooks added in v1.0.17

func RunProcessHooks(c cfg.Config, data Tabdata) (Tabdata, bool, error)

These hooks get the data (Tabdata) readily processed by tablizer as argument. They are expected to return a SexpPair containing a boolean denoting if the data has been modified and the actual modified data. Columns must be the same, rows may differ. Cells may also have been modified.

Replaces the internal data structure Tabdata with the user supplied version.

Only one process hook function is supported.

The somewhat complicated code is being caused by the fact, that we need to convert our internal structure to a lisp variable and vice versa afterwards.

Jump to

Keyboard shortcuts

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