operator

package
v0.0.0-...-3129ee8 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package operator defines Operator type and constants for Nu Custom Value support.

It is used by the github.com/ainvaltin/nu-plugin to support implementing CustomValue.

Index

Constants

View Source
const (
	Comparison = iota << 16
	Math
	Boolean
	Bits
	Assignment
)

Operator "Classes"

Variables

This section is empty.

Functions

This section is empty.

Types

type Operator

type Operator uint32

Operator is argument type for the Operation CustomValueOp call.

https://docs.rs/nu-protocol/latest/nu_protocol/ast/enum.Operator.html

const (
	Boolean_Or  Operator = Boolean + iota
	Boolean_Xor          // xor
	Boolean_And          // and
)
const (
	Bits_Or         Operator = Bits + iota
	Bits_Xor                 // bit-xor
	Bits_And                 // bit-and
	Bits_ShiftLeft           // bit-shl
	Bits_ShiftRight          // bit-shr
)
const (
	Assignment_Assign      Operator = Assignment + iota // plain assignment
	Assignment_Add                                      // +=
	Assignment_Subtract                                 // -=
	Assignment_Multiply                                 // *=
	Assignment_Divide                                   // /=
	Assignment_Concatenate                              // +=
)
const (
	Comparison_Equal    Operator = Comparison + iota // ==
	Comparison_NotEqual                              // !=
	Comparison_LessThan
	Comparison_GreaterThan
	Comparison_LessThanOrEqual
	Comparison_GreaterThanOrEqual
	Comparison_RegexMatch    // =~ or like
	Comparison_NotRegexMatch // !~ or not-like
	Comparison_In            // in
	Comparison_NotIn         // not-in
	Comparison_Has           // has
	Comparison_NotHas        // not-has
	Comparison_StartsWith    // starts-with
	Comparison_EndsWith      // ends-with
)
const (
	Math_Add         Operator = Math + iota // +
	Math_Subtract                           // -
	Math_Multiply                           // *
	Math_Divide                             // /
	Math_FloorDivide                        // //
	Math_Modulo                             // mod
	Math_Pow                                // **
	Math_Concatenate
)

func (Operator) Class

func (op Operator) Class() int

Class returns Comparison, Math, Boolean, Bits or Assignment

func (*Operator) DecodeMsgpack

func (op *Operator) DecodeMsgpack(dec *msgpack.Decoder) error

func (Operator) String

func (op Operator) String() string

Jump to

Keyboard shortcuts

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