ts

package
v0.1.11 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2023 License: Apache-2.0 Imports: 4 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CommentFromCUEGroup added in v0.1.0

func CommentFromCUEGroup(cg Comment) ast.Comment

CommentFromCUEGroup creates an ast.CommentList from a Comment.

Original line breaks are preserved, in keeping with principles of semantic line breaks.

func CommentFromString added in v0.1.0

func CommentFromString(s string, lim int, jsdoc bool) ast.Comment

CommentFromString takes a string input and formats it as an ast.CommentList.

Line breaks are automatically inserted to minimize raggedness, with a loose width limit the provided lim.

If the jsdoc param is true, the resulting comment will be formatted with JSDoc ( /** ... */ )-style. Otherwise, ordinary comment leader ( // ... ) will be used.

The returned ast.CommentList will have the default CommentAbove position.

func Ident

func Ident(name string) ast.Ident

func Names

func Names(names ...string) ast.Names

Types

type Comment added in v0.1.7

type Comment struct {
	Text      string
	Multiline bool
	JSDoc     bool
}

type Decl

type Decl = ast.Decl

type Expr

type Expr = ast.Expr

func Bool

func Bool(b bool) Expr

func Float

func Float(f float64) Expr

func Int

func Int(i int64) Expr

TODO: replace with generic num?

func List

func List(elems ...Expr) Expr

func Null

func Null() Expr

func Object

func Object(fields map[string]Expr) Expr

func Str

func Str(s string) Expr

func Union

func Union(elems ...Expr) Expr

type File

type File = ast.File

type Node

type Node = ast.Node

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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