Documentation ¶
Index ¶
- Constants
- Variables
- func Annotate(c Calc, format string, a ...any)
- func Clamp[T constraints.Ordered](v T, min T, max T) T
- func ErrDivisionByZero(c Calc)
- func ErrExpectedType(c Calc, t Type, val string)
- func ErrFeatureNotSupported(name string) error
- func ErrInfinity(c Calc, sign int)
- func ErrInvalidArgs(c Calc, reason string)
- func ErrInvalidFunc(c Calc, fn string, reason string)
- func ErrNoOpFor(c Calc, name string, args []string)
- func ErrNotANumber(c Calc)
- func ErrNotEnoughArgs(c Calc, op string, expected int)
- func ErrUnknownOp(name string) error
- func Format(a any) string
- func FormatStackItem(v string) string
- func IsValuePrefix(ch rune, next rune) bool
- func NoOp(c Calc)
- func PanicExpectedType(t Type, val string)
- func PopBigInt(c Calc) *big.Int
- func PopBool(c Calc) bool
- func PopComplex(c Calc) complex128
- func PopDMS(c Calc) types.DMS
- func PopDate(c Calc) time.Time
- func PopDateTime(c Calc) time.Time
- func PopDecimal(c Calc) types.Decimal
- func PopDuration(c Calc) time.Duration
- func PopFloat(c Calc) float64
- func PopInt(c Calc) int
- func PopInt32(c Calc) int32
- func PopInt64(c Calc) int64
- func PopRational(c Calc) *big.Rat
- func PopRune(c Calc) rune
- func PopString(c Calc) string
- func PopTime(c Calc) time.Time
- func PopUint(c Calc) uint
- func PopUint8(c Calc) uint8
- func PushBigInt(c Calc, r *big.Int)
- func PushBool(c Calc, r bool)
- func PushComplex(c Calc, r complex128)
- func PushDMS(c Calc, r types.DMS)
- func PushDate(c Calc, r time.Time)
- func PushDateTime(c Calc, r time.Time)
- func PushDecimal(c Calc, r types.Decimal)
- func PushDuration(c Calc, r time.Duration)
- func PushFloat(c Calc, r float64)
- func PushInt(c Calc, r int)
- func PushInt32(c Calc, r int32)
- func PushInt64(c Calc, r int64)
- func PushRational(c Calc, r *big.Rat)
- func PushRune(c Calc, r rune)
- func PushString(c Calc, r string)
- func PushTime(c Calc, r time.Time)
- func PushUint(c Calc, r uint)
- func PushUint8(c Calc, r uint8)
- func Quote(v string) string
- func RemoveAnnotation(v string) string
- func StackString(c Calc) string
- type BigIntType
- type BoolType
- type Calc
- type CalcFunc
- type CharType
- type ComplexType
- type DMSType
- type DateTimeType
- type DateType
- type DecimalType
- type DurationType
- type FloatType
- type FuncDecl
- type Int32Type
- type Int64Type
- type IntType
- type OpCall
- type OpDecl
- type RationalType
- type StrType
- type TimeType
- type Type
- type Uint8Type
- type UintType
Constants ¶
View Source
const ( AnnotationMarker = "#!(anno)" AnnotationSep = "#" )
View Source
const ProgName = "zc"
Variables ¶
View Source
var ( BigInt = BigIntType{} Bool = BoolType{} Char = CharType{} Complex = ComplexType{} Date = DateType{} DateTime = DateTimeType{} Decimal = DecimalType{} DMS = DMSType{} Duration = DurationType{} Float = FloatType{} Int = IntType{} Int64 = Int64Type{} Int32 = Int32Type{} Rational = RationalType{} Str = StrType{} Time = TimeType{} Uint = UintType{} Uint8 = Uint8Type{} Val = StrType{} )
View Source
var ( Version = "v5.2.1" BuildDate = "30 May 2023" )
View Source
var Now = func() time.Time { return time.Now() }
Functions ¶
func Clamp ¶
func Clamp[T constraints.Ordered](v T, min T, max T) T
func ErrDivisionByZero ¶
func ErrDivisionByZero(c Calc)
func ErrExpectedType ¶
func ErrFeatureNotSupported ¶
func ErrInfinity ¶
func ErrInvalidArgs ¶
func ErrInvalidFunc ¶
func ErrNoOpFor ¶
func ErrNotANumber ¶
func ErrNotANumber(c Calc)
func ErrNotEnoughArgs ¶
func ErrUnknownOp ¶
func FormatStackItem ¶
func IsValuePrefix ¶
func PanicExpectedType ¶
func PopComplex ¶
func PopComplex(c Calc) complex128
func PopDateTime ¶
func PopDecimal ¶
func PopDuration ¶
func PopRational ¶
func PushBigInt ¶
func PushComplex ¶
func PushComplex(c Calc, r complex128)
func PushDateTime ¶
func PushDecimal ¶
func PushDuration ¶
func PushRational ¶
func PushString ¶
func RemoveAnnotation ¶
func StackString ¶
Types ¶
type BigIntType ¶
type BigIntType struct{}
func (BigIntType) Is ¶
func (t BigIntType) Is(s string) bool
func (BigIntType) String ¶
func (t BigIntType) String() string
type Calc ¶
type Calc interface { Eval(string, ...any) error Stack() []string StackLen() int SetStack([]string) Peek(int) (string, bool) Pop() (string, bool) MustPop() string Push(string) Info() string SetInfo(string, ...any) Error() error SetError(error) Derive() Calc NewState(string, any) State(string) (any, bool) SetOp(string) SetArgs([]string) Op() OpCall OpNames() []string }
type ComplexType ¶
type ComplexType struct{}
func (ComplexType) Format ¶
func (t ComplexType) Format(v complex128) string
func (ComplexType) Is ¶
func (t ComplexType) Is(s string) bool
func (ComplexType) MustParse ¶
func (t ComplexType) MustParse(s string) complex128
func (ComplexType) Parse ¶
func (t ComplexType) Parse(s string) (complex128, bool)
func (ComplexType) String ¶
func (t ComplexType) String() string
type DateTimeType ¶
type DateTimeType struct{}
func (DateTimeType) Is ¶
func (t DateTimeType) Is(s string) bool
func (DateTimeType) String ¶
func (t DateTimeType) String() string
type DecimalType ¶
type DecimalType struct{}
func (DecimalType) Is ¶
func (t DecimalType) Is(s string) bool
func (DecimalType) String ¶
func (t DecimalType) String() string
type DurationType ¶
type DurationType struct{}
func (DurationType) Is ¶
func (t DurationType) Is(s string) bool
func (DurationType) String ¶
func (t DurationType) String() string
type RationalType ¶
type RationalType struct{}
func (RationalType) Is ¶
func (t RationalType) Is(s string) bool
func (RationalType) String ¶
func (t RationalType) String() string
Click to show internal directories.
Click to hide internal directories.