Documentation ¶
Overview ¶
Package internal exposes some cue internals to other packages.
A better name for this package would be technicaldebt.
Index ¶
- Constants
- Variables
- func ConstraintToken(f *ast.Field) (t token.Token, ok bool)
- func DecorateError(info error, err errors.Error) errors.Error
- func EmbedStruct(s *ast.StructLit) *ast.EmbedDecl
- func FileComment(f *ast.File) *ast.CommentGroup
- func GenPath(root string) string
- func IsDef(s string) bool
- func IsDefOrHidden(s string) bool
- func IsDefinition(label ast.Label) bool
- func IsEllipsis(x ast.Decl) bool
- func IsHidden(s string) bool
- func IsRegularField(f *ast.Field) bool
- func ListEllipsis(n *ast.ListLit) (elts []ast.Expr, e *ast.Ellipsis)
- func NewAttr(name, str string) *ast.Attribute
- func NewComment(isDoc bool, s string) *ast.CommentGroup
- func PackageInfo(f *ast.File) (p *ast.Package, name string, tok token.Pos)deprecated
- func SetConstraint(f *ast.Field, t token.Token)
- func SetPackage(f *ast.File, name string, overwrite bool)
- func ToExpr(n ast.Node) ast.Expr
- func ToFile(n ast.Node) *ast.File
- func Version(minor, patch int) int
- type Attr
- type AttrKind
- type Context
- type Decimal
- type EvaluatorVersion
- type KeyValue
- type PkgInfo
Constants ¶
const ( MinorCurrent = 5 MinorSupported = 4 PatchSupported = 0 )
const MaxDepth = 20
MaxDepth indicates the maximum evaluation depth. This is there to break cycles in the absence of cycle detection.
It is registered in a central place to make it easy to find all spots where cycles are broken in this brute-force manner.
TODO(eval): have cycle detection.
Variables ¶
var APIVersionSupported = Version(MinorSupported, PatchSupported)
APIVersionSupported is the back version until which deprecated features are still supported.
var BaseContext = Context{*apd.BaseContext.WithPrecision(34)}
BaseContext is used as CUE's default context for arbitrary-precision decimals.
var ErrIncomplete = errors.New("incomplete value")
ErrIncomplete can be used by builtins to signal the evaluation was incomplete.
var ErrInexact = errors.New("inexact subsumption")
var MakeInstance func(value interface{}) (instance interface{})
MakeInstance makes a new instance from a value.
Functions ¶
func ConstraintToken ¶ added in v0.6.0
ConstraintToken reports which constraint token (? or !) is associated with a field (if any), taking into account compatibility of deprecated fields.
func FileComment ¶ added in v0.2.0
func FileComment(f *ast.File) *ast.CommentGroup
func IsDefOrHidden ¶ added in v0.2.0
func IsDefinition ¶ added in v0.2.0
func IsEllipsis ¶ added in v0.1.0
IsEllipsis reports whether the declaration can be represented as an ellipsis.
func IsRegularField ¶ added in v0.2.0
func ListEllipsis ¶ added in v0.0.6
ListEllipsis reports the list type and remaining elements of a list. If we ever relax the usage of ellipsis, this function will likely change. Using this function will ensure keeping correct behavior or causing a compiler failure.
func NewComment ¶ added in v0.1.0
func NewComment(isDoc bool, s string) *ast.CommentGroup
NewComment creates a new CommentGroup from the given text. Each line is prefixed with "//" and the last newline is removed. Useful for ASTs generated by code other than the CUE parser.
func SetConstraint ¶ added in v0.6.0
SetConstraints sets both the main and deprecated fields of f according to the given constraint token.
func ToExpr ¶ added in v0.1.0
ToExpr converts a node to an expression. If it is a file, it will return it as a struct. If is an expression, it will return it as is. Otherwise it panics.
Types ¶
type Attr ¶ added in v0.1.0
type Attr struct { Name string // e.g. "json" or "protobuf" Body string Kind AttrKind Fields []KeyValue Err errors.Error }
Attr holds positional information for a single Attr.
func NewNonExisting ¶ added in v0.1.0
NewNonExisting creates a non-existing attribute.
func (*Attr) Flag ¶ added in v0.1.0
Flag reports whether an entry with the given name exists at position pos or onwards or an error if the attribute is invalid or if the first pos-1 entries are not defined.
func (*Attr) Int ¶ added in v0.1.0
Int reports the integer at the given position or an error if the attribute is invalid, the position does not exist, or the value at the given position is not an integer.
type AttrKind ¶ added in v0.3.0
type AttrKind uint8
AttrKind indicates the location of an attribute within CUE source.
type Context ¶ added in v0.6.0
type Context struct {
apd.Context
}
Context wraps apd.Context for CUE's custom logic.
Note that it avoids pointers to make it easier to make copies.
func (Context) WithPrecision ¶ added in v0.6.0
WithPrecision mirrors upstream, but returning our type without a pointer.
type Decimal ¶ added in v0.0.5
type Decimal = apd.Decimal
A Decimal is an arbitrary-precision binary-coded decimal number.
Right now Decimal is aliased to apd.Decimal. This may change in the future.
type EvaluatorVersion ¶ added in v0.8.0
type EvaluatorVersion int
const ( DefaultVersion EvaluatorVersion = iota // The DevVersion is used for new implementations of the evaluator that // do not cover all features of the CUE language yet. DevVersion )
type PkgInfo ¶ added in v0.3.0
func GetPackageInfo ¶ added in v0.3.0
func (*PkgInfo) IsAnonymous ¶ added in v0.3.1
IsAnonymous reports whether the package is anonymous.
Directories ¶
Path | Synopsis |
---|---|
cmd
|
|
cue-ast-print
cue-ast-print parses a CUE file and prints its syntax tree, for example:
|
cue-ast-print parses a CUE file and prints its syntax tree, for example: |
Package copy provides utilities to copy files and directories.
|
Package copy provides utilities to copy files and directories. |
core
|
|
adt
Package adt represents partially and fully evaluated CUE types.
|
Package adt represents partially and fully evaluated CUE types. |
convert
Package convert allows converting to and from Go values and Types.
|
Package convert allows converting to and from Go values and Types. |
debug
Package debug prints a given ADT node.
|
Package debug prints a given ADT node. |
dep
Package dep analyzes dependencies between values.
|
Package dep analyzes dependencies between values. |
path
Package path provides utilities for converting cue.Selectors and cue.Paths to internal equivalents.
|
Package path provides utilities for converting cue.Selectors and cue.Paths to internal equivalents. |
subsume
Package subsume defines various subsumption relations.
|
Package subsume defines various subsumption relations. |
validate
Package validate collects errors from an evaluated Vertex.
|
Package validate collects errors from an evaluated Vertex. |
walk
walk provides functions for visiting the nodes of an ADT tree.
|
walk provides functions for visiting the nodes of an ADT tree. |
Package cueimports provides support for reading the import section of a CUE file without needing to read the rest of it.
|
Package cueimports provides support for reading the import section of a CUE file without needing to read the rest of it. |
Package testing is a helper package for test packages in the CUE project.
|
Package testing is a helper package for test packages in the CUE project. |
Package maps defines various functions useful with maps of any type.
|
Package maps defines various functions useful with maps of any type. |
mod
|
|
internal/par
Package par implements parallel execution helpers.
|
Package par implements parallel execution helpers. |
module
Package module defines the module.Version type along with support code.
|
Package module defines the module.Version type along with support code. |
modzip
Package modzip provides functions for creating and extracting module zip files.
|
Package modzip provides functions for creating and extracting module zip files. |
mvs
Package mvs implements Minimal Version Selection.
|
Package mvs implements Minimal Version Selection. |
semver
Package semver implements comparison of semantic version strings.
|
Package semver implements comparison of semantic version strings. |
Package source contains utility functions that standardize reading source bytes across cue packages.
|
Package source contains utility functions that standardize reading source bytes across cue packages. |
Package str provides string manipulation utilities.
|
Package str provides string manipulation utilities. |
Package task provides a registry for tasks to be used by commands.
|
Package task provides a registry for tasks to be used by commands. |
Package tdtest provides support for table-driven testing.
|
Package tdtest provides support for table-driven testing. |
third_party
|
|
yaml
Package yaml implements YAML support for the Go language.
|
Package yaml implements YAML support for the Go language. |
Package value contains functions for converting values to internal types and various other Value-related utilities.
|
Package value contains functions for converting values to internal types and various other Value-related utilities. |