lex

package
v0.0.0-...-04e5504 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2021 License: Apache-2.0 Imports: 10 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")

func Parse

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

Parse runs the Go parser against the given package name.

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