sym

package
v0.8.3 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package sym provides oh's symbol cell type.

Index

Constants

This section is empty.

Variables

View Source
var True cell.I //nolint:gochecknoglobals

True is a reference to the symbol for 'true' - the canonical oh value for true.

Functions

func Cache

func Cache(a bool)

Cache enables (or disables) caching of all symbols.

func Is

func Is(c cell.I) bool

Is returns true if c is a *T or *Plus.

func New

func New(v string) cell.I

New creates a sym cell.

func Token

func Token(t *token.T) cell.I

Token creates a Plus from a token.T.

Types

type Plus

type Plus struct {
	// contains filtered or unexported fields
}

Plus is a symbol plus its lexical location.

func (Plus) Equal

func (s Plus) Equal(c cell.I) bool

Equal returns true if c is a sym and wraps the same string.

func (Plus) Literal

func (s Plus) Literal() string

Literal returns the literal representation of the sym s.

func (Plus) Name

func (s Plus) Name() string

Name returns the type name for the sym s.

func (Plus) Rat

func (s Plus) Rat() *big.Rat

Rat returns the value of the sym as a big.Rat, if possible.

func (*Plus) Source

func (p *Plus) Source() *loc.T

Source returns the lexical location for a sym that has it.

func (Plus) String

func (s Plus) String() string

String returns the text of the sym s.

type T

type T string

T (sym) wraps Go's string type. Short and common strings are interned.

func To

func To(c cell.I) *T

To returns a *T if c is a *T or *Plus; Otherwise it panics.

Jump to

Keyboard shortcuts

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