lex

package
v6.5.0 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Camel

func Camel(s string) string

Camel converts to camel case ("foo_bar" -> "FooBar").

func Capital

func Capital(s string) string

Capital capitalizes the given string ("foo" -> "Foo").

func Element

func Element(typ string) string

Element is the reverse of Slice, returning the element type name the slice with given type.

func KeyValue

func KeyValue(s string) (string, string, error)

KeyValue extracts the key and value encoded in the given string and separated by '=' (foo=bar -> foo, bar).

func Minuscule

func Minuscule(s string) string

Minuscule turns the first character to lower case ("Foo" -> "foo") or the whole word if it is all uppercase ("UUID" -> "uuid").

func Parse

func Parse(dir string) (*ast.Package, error)

Parse runs the Go parser against the given package directory.

func Plural

func Plural(s string) string

Plural converts to plural form ("foo" -> "foos").

func Singular

func Singular(s string) string

Singular converts to singular form ("foos" -> "foo").

func Slice

func Slice(typ string) string

Slice returns the type name of a slice of items of the given type.

func Snake

func Snake(name string) string

Snake converts to snake case ("FooBar" -> "foo_bar").

func Star

func Star(s string) string

Star adds a "*" prefix to the given string.

Types

type MethodSignature

type MethodSignature struct {
	Comment  string    // Method comment
	Name     string    // Method name
	Receiver VarDecl   // Receiver name and type
	Args     []VarDecl // Method arguments
	Return   []string  // Return type
}

MethodSignature holds information about a method signature.

type VarDecl

type VarDecl struct {
	Name string
	Expr string
}

VarDecl holds information about a variable declaration.

func (VarDecl) String

func (d VarDecl) String() string

Jump to

Keyboard shortcuts

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