constant

package
v0.0.0-...-94861f8 Latest Latest
Warning

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

Go to latest
Published: May 3, 2017 License: BSD-3-Clause, Unlicense Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Compare

func Compare(x Value, op scan.Type, y Value) bool

Compare compares two values.

Types

type Type

type Type int

Type is a valid constant type.

const (
	Unknown Type = iota
	Int
	String
)

Various types.

type Value

type Value interface {
	Type() Type     // The type of the value.
	String() string // The value itself in form of a string.
}

Value represents a constant value.

func BinaryOp

func BinaryOp(x Value, op scan.Type, y Value) (Value, error)

BinaryOp does a binary operation on two constant values.

func MakeFromLiteral

func MakeFromLiteral(lit string, tok scan.Type, prec uint) Value

MakeFromLiteral creates a constant value from a string.

func MakeInt64

func MakeInt64(x int64) Value

MakeInt64 creates a constant value out of a int64.

func MakeUint64

func MakeUint64(x uint64) Value

MakeUint64 creates a constant value out of a uint64.

func Shift

func Shift(x Value, op scan.Type, s uint) (Value, error)

Shift applies a left or right shift on a constant value.

func UnaryOp

func UnaryOp(op scan.Type, y Value, prec uint) Value

UnaryOp does a unary operation on a unary expression.

Jump to

Keyboard shortcuts

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