preprocessor

package
v0.0.0-...-02c76fb Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2020 License: Apache-2.0 Imports: 4 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Find

func Find(slice []string, f func(string) bool) (string, bool)

Find returns the first element of the string slice for which f returns true

func Inits

func Inits(in []string) [][]string

Inits returns a list of heads of the string, e.g. [1,2,3] -> [[1,2,3],[1,2],[1]]

func JoinTerms

func JoinTerms(s []string) string

JoinTerms takes a list of terms and joins them with '.'

func Prefixes

func Prefixes(in string) (out []string)

Prefixes returns a set of prefixes for a string, e.g. "a.b.c.d" will yield []string{"a.b.c.d","a.b.c","a.b.","a"}

func SplitTerms

func SplitTerms(in string) []string

SplitTerms takes a string and splits it on '.'

func TraverseUntilModule

func TraverseUntilModule(g *graph.Graph, id string) bool

TraverseUntilModule is a function intended to be used with VertexSplitTraverse and will cause vertex splitting to propogate upwards until it encounters a module

func VertexSplit

func VertexSplit(g *graph.Graph, s string) (string, string, bool)

VertexSplit takes a graph with a set of vertexes and a string, and returns the longest vertex id from the graph and the remainder of the string. If no matching vertex is found 'false' is returned.

func VertexSplitTraverse

func VertexSplitTraverse(g *graph.Graph, toFind string, startingNode string, stop func(*graph.Graph, string) bool, history map[string]struct{}) (string, string, bool)

VertexSplitTraverse will act like vertex split, looking for a prefix matching the current set of graph nodes, however unlike `VertexSplit`, if a node is not found at the current level it will look at the parent level to the provided starting node, unless stop(parent) returns true.

Types

This section is empty.

Jump to

Keyboard shortcuts

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