chirp

package module
v0.0.0-...-0bd41fd Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2021 License: MIT Imports: 18 Imported by: 12

README

Chirp
================================================================================

Chirp is a dynamic language inspired by Tcl_ and written in Go_.

.. image:: https://drone.io/github.com/yak-labs/chirp-lang/status.png
   :alt: Build Status
   :target: https://drone.io/github.com/yak-labs/chirp-lang/latest
   :width: 80
   :height: 18

Building Chirp
--------------------------------------------------------------------------------

First, you'll need to download and install Git_.  Once you have Git installed,
make sure that the ``git`` command is available from the command line.  If not,
you'll need to add it to your ``PATH`` environment variable.

Next, you'll need to download and install Go_.  Once it's installed, you'll
need to create a workspace and set your ``GOPATH`` environment variable to your
workspace folder.  The Go documentation contains a great page explaining the
details on setting up your workspace titled, `How to Write Go Code`_.  There is
also a nice `screencast`_ available as well.

Once you've setup your workspace, open up a command line to your workspace
folder and run the following::

    go get github.com/yak-labs/chirp-lang
    cd src/github.com/yak-labs/chirp-lang/chirp
    go install

This will fetch the Chirp source code, ensure you're on the ``master`` branch,
and build the command line executable to run Chirp code.  If you've added ``GOPATH/bin`` to your ``PATH``, you should now be able to run ``chrip`` from your command line.

.. _Tcl: http://tcl.tk/
.. _Go: http://golang.org/
.. _Git: http://git-scm.com/
.. _How to Write Go Code: http://golang.org/doc/code.html
.. _screencast: http://youtu.be/XCsL89YtqCs

Documentation

Index

Constants

View Source
const (
	RETURN = StatusCode(iota + 2)
	BREAK
	CONTINUE
	USAGE // New in chirp; not in Tcl.
)

Variables

View Source
var AlphanumChars = "[A-Za-z0-9_]"
View Source
var BareWordPattern = "(" + InertChars + "+)"
View Source
var Debug [256]bool
View Source
var DumbDollarPattern = "[$](" + AlphanumChars + "+)"
View Source
var Empty = MkString("")
View Source
var False = Zero
View Source
var Float64Type R.Type = R.TypeOf(*new(float64))
View Source
var InertChars = "[!%-/0-9:<-@A-Z^_`a-z|~]"
View Source
var Int64Type R.Type = R.TypeOf(*new(int64))
View Source
var InvalidValue = *new(R.Value)
View Source
var MatchBareWord = regexp.MustCompile("^" + BareWordPattern + "$")
View Source
var MatchDumbDollar = regexp.MustCompile("^" + DumbDollarPattern + "$")
View Source
var MustFails int64
View Source
var MustMutex sync.Mutex
View Source
var MustSucceeds int64
View Source
var One = MkInt(1)
View Source
var Roots map[string]Applier = make(map[string]Applier)
View Source
var Safes map[string]Command

Safes are builtin commands that safe subinterps can call. Conventionally these contain no hyphen.

View Source
var SayPrefix = "Say" // TODO: Global Prefix WILL BREAK WITH goROUTINES.
View Source
var True = One
View Source
var TypeT = R.TypeOf(new(T)).Elem()
View Source
var TypeType = R.TypeOf(TypeT)
View Source
var Uint64Type R.Type = R.TypeOf(*new(uint64))
View Source
var Unsafes map[string]Command

Unsafes are commands that only the trusted, toplevel terp can call. Conventionally these contain a hyphen.

View Source
var Zero = MkInt(0)

Functions

func AdaptToValue

func AdaptToValue(fr *Frame, a T, ty R.Type) R.Value

func AdaptToValueInner

func AdaptToValueInner(fr *Frame, a T, ty R.Type) R.Value

func Arg0

func Arg0(argv []T)

func Arg1v

func Arg1v(argv []T) (T, []T)

func Arg2

func Arg2(argv []T) (T, T)

func Arg2v

func Arg2v(argv []T) (T, T, []T)

func Arg3

func Arg3(argv []T) (T, T, T)

func Arg3Usage

func Arg3Usage(argv []T, usage string) (T, T, T)

func Arg3v

func Arg3v(argv []T) (T, T, T, []T)

func Arg4

func Arg4(argv []T) (T, T, T, T)

func Arg5

func Arg5(argv []T) (T, T, T, T, T)

func Arg6

func Arg6(argv []T) (T, T, T, T, T, T)

func Arg7

func Arg7(argv []T) (T, T, T, T, T, T, T)

func ArgDash2v

func ArgDash2v(argv []T) ([]string, T, T, []T)

ArgDash2v expects args to be (1) dash arguments (2) two required args (3) possibly some optional args.

func ArgDash2vUsage

func ArgDash2vUsage(argv []T, usage string) ([]string, T, T, []T)

func CHECK

func CHECK(b bool, rest ...interface{})

func ClearAllCounters

func ClearAllCounters()

func DropSpaces

func DropSpaces(s string) string

func FollowedByGap

func FollowedByGap(lex *Lex) bool

func HtPeek

func HtPeek(ht HTML) string

func IfNilArgvThenUsage

func IfNilArgvThenUsage(argv []T, usage string)

func IsGlobal

func IsGlobal(name string) bool

Initial capital letter for a variable means Global.

func IsLocal

func IsLocal(name string) bool

Initial capital letter for a variable means local.

func Log

func Log(fr *Frame, levelStr string, message string)

func LogAllCounters

func LogAllCounters()

func Logf

func Logf(fmt string, args ...interface{})

func MkFloat

func MkFloat(a float64) terpFloat

func MkGenerator

func MkGenerator(readerChan <-chan Either) terpGenerator

func MkHash

func MkHash(h Hash) *terpHash

func MkInt

func MkInt(a int64) terpInt

func MkList

func MkList(a []T) terpList

func MkMulti

func MkMulti(s string) *terpMulti

func MkMultiFr

func MkMultiFr(fr *Frame, a *terpMulti) *terpMulti

func MkString

func MkString(a string) terpString

func MkStringList

func MkStringList(a []string) terpList

func MkUint

func MkUint(a uint64) terpInt

func MkValue

func MkValue(a R.Value) terpValue

func Must

func Must(a, b T)

Must takes 2 T values, and compares their Show()s.

func MustA

func MustA(a, b interface{})

MustA takes Any 2 values, and compares their Repr()s.

func MustB

func MustB(a, b byte)

MustB takes two bytes.

func MustNoSp

func MustNoSp(a, b interface{})

MustSp takes Any 2 values, and compares their Repr()s, without spaces.

func MustST

func MustST(a string, b T)

MustST takes a string and a T

func MustTok

func MustTok(a, b Token)

func NeedsOctalEscape

func NeedsOctalEscape(b byte) bool

func NonEmpty

func NonEmpty(v []string) []string

func OctalEscape

func OctalEscape(s string) string

func Regexp

func Regexp(exp string, nocase bool) *regexp.Regexp

func RegexpFindMatch

func RegexpFindMatch(exp, str string, nocase bool) (bool, string)

func RegexpFindSubmatch

func RegexpFindSubmatch(exp, str string, nocase bool) (bool, []string)

func RegexpMatch

func RegexpMatch(exp, str string, nocase bool) bool

func Repr

func Repr(a interface{}) string

func Say

func Say(args ...interface{})

Quick internal logging function that needs no Frame.

func Sayf

func Sayf(format string, args ...interface{})

func Show

func Show(a T) string

func ShowAllCounters

func ShowAllCounters() string

func ShowEnsembleItems

func ShowEnsembleItems(items []EnsembleItem) string

func ShowExprUnlessNull

func ShowExprUnlessNull(expr *PExpr) string

func ShowSeqUnlessNull

func ShowSeqUnlessNull(seq *PSeq) string

func Showv

func Showv(a []T) string

func SortListByString

func SortListByString(list []T)

SortListByString is used by smilax-web/db.

func SortedKeysOfHash

func SortedKeysOfHash(h Hash) []string

func StringMatch

func StringMatch(pattern, str string) bool

func SubstStringOrOrig

func SubstStringOrOrig(fr *Frame, s string) (z string)

func ToListElementString

func ToListElementString(s string) string

func Where

func Where() string

func White

func White(ch uint8) bool

func WhiteOrSemi

func WhiteOrSemi(ch uint8) bool

Types

type Applier

type Applier interface {
	Apply(fr *Frame, args []T) T
}

TODO: This interface could replace Command, or could Command replace this interface?

type BitsWord

type BitsWord uint32 // We cannot fit uint64 into the float -- until we support actual uint64, we must use shorter BitsWords.

type CmdNode

type CmdNode struct {
	Fn         Command
	MixinLevel int
	MixinName  string
	Next       *CmdNode
}

CmdNode makes a singly-linked-list of commands at different mixin levels, highest level first. A non-mixin command has level 0 and only one CmdNode.

type CmdScope

type CmdScope map[string]*CmdNode

type Command

type Command func(fr *Frame, argv []T) T

func MkEnsemble

func MkEnsemble(items []EnsembleItem) Command

type ConstRoot

type ConstRoot struct{ Const interface{} }

func (ConstRoot) Apply

func (r ConstRoot) Apply(fr *Frame, args []T) T

type Counter

type Counter struct {
	// contains filtered or unexported fields
}
var Counters *Counter
var EvalSeqWithErrorLocationCounter Counter
var MkBoolCounter Counter
var MkFloatCounter Counter
var MkGeneratorCounter Counter
var MkHackFloatCounter Counter
var MkHashCounter Counter
var MkIntCounter Counter
var MkListCounter Counter
var MkMultiCounter Counter
var MkNumCounter Counter
var MkStringCounter Counter
var MkStringListCounter Counter
var MkTCounter Counter
var MkUintCounter Counter
var MkValueCounter Counter
var MultiEvalExprCompileCounter Counter
var MultiEvalExprCounter Counter
var MultiEvalSeqCompileCounter Counter
var MultiEvalSeqCounter Counter
var NewFrameCounter Counter
var Parse2CmdCounter Counter
var Parse2CmdEvalCounter Counter
var Parse2DollarCounter Counter
var Parse2ExprEvalCounter Counter
var Parse2ExprTopCounter Counter
var Parse2QuoteCounter Counter
var Parse2SeqCounter Counter
var Parse2SeqEvalCounter Counter
var Parse2SquareCounter Counter
var Parse2WordEvalFastCounter0 Counter
var Parse2WordEvalFastCounter1 Counter
var Parse2WordEvalSlowCounter1 Counter
var Parse2WordEvalSlowCounter9 Counter
var ParseListCounter Counter
var SubstStringCounter Counter

func (*Counter) Incr

func (p *Counter) Incr()

func (*Counter) Register

func (p *Counter) Register(name string)

func (*Counter) Show

func (p *Counter) Show() string

type Either

type Either struct {
	Bad  interface{}
	Good T
}

Either Bad or Good value.

type EnsembleItem

type EnsembleItem struct {
	Name string
	Cmd  Command
	Doc  string
}

type Frame

type Frame struct {
	Mu   sync.Mutex
	Vars Scope // local variables
	Cred Hash  // credentials

	Prev *Frame
	G    *Global

	WriterChan chan<- Either // for yproc & yield
	MixinLevel int
	MixinName  string

	DebugName string
}

Frame is a local variable frame. There is one for the global variables in the Global struct, and a new one is created for each proc or yproc invocation (but not for every Command; non-proc commands do not make Frames).

func NewInterpreter

func NewInterpreter() *Frame

NewInterpreter() makes a new full interpreter.

func NewSafeInterpreter

func NewSafeInterpreter() *Frame

NewSafeInterpreter() makes a new safe interpreter.

func (*Frame) Apply

func (fr *Frame) Apply(argv []T) T

Apply a command with its arguments.

func (*Frame) DefineUpVar

func (fr *Frame) DefineUpVar(name string, remFr *Frame, remName string)

func (*Frame) Eval

func (fr *Frame) Eval(a T) (result T)

func (*Frame) EvalExpr

func (fr *Frame) EvalExpr(a T) (result T)

Takes a single word that represents an expression and returns the result.

func (*Frame) EvalSeqWithErrorLocation

func (fr *Frame) EvalSeqWithErrorLocation(seq *PSeq) (result T)

func (*Frame) EvalString

func (fr *Frame) EvalString(a string) (result T)

func (*Frame) FindCommand

func (fr *Frame) FindCommand(name T, callSuper bool) Command

func (*Frame) GetVar

func (fr *Frame) GetVar(name string) T

func (*Frame) GetVarScope

func (fr *Frame) GetVarScope(name string) Scope

func (*Frame) HasVar

func (fr *Frame) HasVar(name string) bool

func (*Frame) NewFrame

func (fr *Frame) NewFrame() *Frame

NewFrame makes a frame for calling another proc.

func (*Frame) SetVar

func (fr *Frame) SetVar(name string, x T)

func (*Frame) SubstString

func (fr *Frame) SubstString(s string, flags SubstFlags) string

type FuncRoot

type FuncRoot struct{ Func R.Value }

func (FuncRoot) Apply

func (r FuncRoot) Apply(fr *Frame, args []T) T

type Global

type Global struct {
	Cmds   CmdScope
	Macros MacroScope
	Fr     Frame // global scope

	MixinSerial         int    // Increment before defining Mixin.
	MixinNumberDefining int    // Set nonzero while defining Mixin.
	MixinNameDefining   string // Set nonempty while defining Mixin.
	IsSafe              bool   // Set true for safe subinterpreter.
	Logger              *log.Logger
	Verbosity           int    // Log if message level <= verbosity.
	LogName             string // for logging

	Mu sync.Mutex
}

Global holds the global state of an interpreter, mainly the Commands and global variables. It also knows if a Mixin is being defined. Mixins should be defined by main thread, after all overridable procs are defined, but before other goroutines start.

func (*Global) Clone

func (g *Global) Clone() *Global

Clone produces a copy of the receiving interpreter.

func (*Global) MintMixinSerial

func (g *Global) MintMixinSerial() int

type HTML

type HTML string

HTML contains properly formatted & escaped HTML

func HtCat

func HtCat(things []T) HTML

HtCat catenates its arguments, converting each to HTML if it is not already HTML.

func HtRaw

func HtRaw(s string) HTML

HtRaw trusts its input string is proper HTML, and casts it to HTML.

func Tag

func Tag(tag T, attrs []T, body T) HTML

Tag takes a HTML tag name, a slice of attr keys and values (stride is 2), and a body for the tag.

func (HTML) Html

func (p HTML) Html() string

In script: echo [go-send $ht Html]

type Hash

type Hash map[string]T

type Jump

type Jump struct {
	Status StatusCode
	Result T
}

Jump structs are panicked for return, break, and continue.

type Lex

type Lex struct {
	Str  string
	Len  int   // len(s)
	Next int   // next position to scan
	Pos  int   // position of token
	Tok  Token // type of token
}

func NewLex

func NewLex(s string) *Lex

func (*Lex) Advance

func (x *Lex) Advance()

func (*Lex) AdvanceCurly

func (x *Lex) AdvanceCurly() string

AdvanceCurly returns the string decoded from the Curly clause and leaves Next on the close-curly.

func (*Lex) AdvanceIfAlfaNum

func (x *Lex) AdvanceIfAlfaNum()

AdvanceIfAlfaNum will either take a TokAlfaNum (no white space first), or not advance.

func (*Lex) Current

func (x *Lex) Current() string

func (*Lex) PeekNext

func (x *Lex) PeekNext() byte

func (*Lex) Show

func (x *Lex) Show() string

func (*Lex) SkipComment

func (x *Lex) SkipComment()

func (*Lex) Stretch1

func (lex *Lex) Stretch1()

func (*Lex) StretchBackslashEscaped

func (lex *Lex) StretchBackslashEscaped() byte

StretchBackslashEscaped stretches the Next pointer across \C or \ooo for octal.

type Loc

type Loc interface {
	Has() bool
	Get() T
	Set(T)
}

Loc is protocol for a variable location.

type MacroNode

type MacroNode struct {
	Args []string
	Body *PSeq
}

Macros (for now) are not defined by mixins; they must be global.

type MacroScope

type MacroScope map[string]*MacroNode

type Opaque

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

Opaque is a new idea for things like credentials. Fields must be private.

type PCmd

type PCmd struct {
	Words []*PWord
}

One command made of one or more words.

func Parse2Cmd

func Parse2Cmd(lex *Lex) *PCmd

Returns next command, or else nil.

func (*PCmd) CloneAndSubst

func (me *PCmd) CloneAndSubst(params map[string][]*PWord) *PCmd

func (*PCmd) Eval

func (me *PCmd) Eval(fr *Frame) T

func (*PCmd) ExpandMacros

func (me *PCmd) ExpandMacros(fr *Frame, maxSubCompile int) []*PCmd

func (*PCmd) Show

func (me *PCmd) Show() string

type PExpr

type PExpr struct {
	Op      Token
	A, B, C *PExpr
	Word    *PWord // Op '"': for Primatives: "quoted", [square], 3.14 literal, {literal}, $var, $var(index).
}

An expr command

func Parse2ExprConjunction

func Parse2ExprConjunction(lex *Lex) *PExpr

func Parse2ExprDisjunction

func Parse2ExprDisjunction(lex *Lex) *PExpr

func Parse2ExprPrimative

func Parse2ExprPrimative(lex *Lex) *PExpr

func Parse2ExprProduct

func Parse2ExprProduct(lex *Lex) *PExpr

func Parse2ExprRelation

func Parse2ExprRelation(lex *Lex) *PExpr

func Parse2ExprStr

func Parse2ExprStr(s string) *PExpr

func Parse2ExprSum

func Parse2ExprSum(lex *Lex) *PExpr

func Parse2ExprTop

func Parse2ExprTop(lex *Lex) *PExpr

func Parse2ExprUnary

func Parse2ExprUnary(lex *Lex) *PExpr

func (*PExpr) Eval

func (me *PExpr) Eval(fr *Frame) T

func (*PExpr) Show

func (me *PExpr) Show() string

type PPart

type PPart struct {
	VarName string
	Multi   *terpMulti
	Word    *PWord // for DOLLAR2
	Seq     *PSeq  // for SQUARE
	Type    PartType
}

func Parse2Dollar

func Parse2Dollar(lex *Lex) *PPart

Parse a variable name after a '$', returning *PPart. Leaves Next immediately after the consumed part.

func Parse2Square

func Parse2Square(lex *Lex) *PPart

Parse Square Bracketed subcommand, returning result and new position

func (*PPart) CloneAndSubst

func (me *PPart) CloneAndSubst(params map[string][]*PWord) []*PPart

func (*PPart) Eval

func (me *PPart) Eval(fr *Frame) T

func (*PPart) ExpandMacros

func (me *PPart) ExpandMacros(fr *Frame, maxSubCompile int) *PPart

func (*PPart) Show

func (me *PPart) Show() string

type PSeq

type PSeq struct {
	Cmds []*PCmd
	Src  string
}

Any piece of tcl code, a sequence of commands.

func CompileSequence

func CompileSequence(fr *Frame, s string) *PSeq

func MaybeCompileSequence

func MaybeCompileSequence(fr *Frame, s string) (seq *PSeq)

func Parse2Seq

func Parse2Seq(lex *Lex) *PSeq

func Parse2SeqStr

func Parse2SeqStr(s string) *PSeq

func (*PSeq) CloneAndSubst

func (me *PSeq) CloneAndSubst(params map[string][]*PWord) *PSeq

func (*PSeq) Eval

func (me *PSeq) Eval(fr *Frame) T

func (*PSeq) ExpandMacros

func (me *PSeq) ExpandMacros(fr *Frame, maxSubCompile int) *PSeq

func (*PSeq) Show

func (me *PSeq) Show() string

type PWord

type PWord struct {
	Parts             []*PPart
	Multi             *terpMulti // If not null, value is fixed and precompiled.
	ExpandAsMultiWord bool
}

One words, composed of parts that may require substitions.

func Parse2Curly

func Parse2Curly(lex *Lex) *PWord

Parse nested curlies, returning contents.

func Parse2DollarKey

func Parse2DollarKey(lex *Lex) *PWord

Parse the Key for a Dollar with Parens, e.g. $x(key). Dollar, Square, and Backslash substitutions occur. White space and DQuotes are not special. Terminates with ")".

func Parse2Quote

func Parse2Quote(lex *Lex) *PWord

func Parse2Word

func Parse2Word(lex *Lex) *PWord

Parse a word, returning result and new position

func (*PWord) CloneAndSubst

func (me *PWord) CloneAndSubst(params map[string][]*PWord) []*PWord

func (*PWord) Eval

func (me *PWord) Eval(fr *Frame) (z T)

func (*PWord) ExpandMacros

func (me *PWord) ExpandMacros(fr *Frame, maxSubCompile int) *PWord

func (*PWord) Show

func (me *PWord) Show() string

type PartType

type PartType int
const (
	BARE    PartType = iota + 1 // Does not need substitions (backslash subs aready done).
	DOLLAR1                     // $x, variable subs without index
	DOLLAR2                     // $x(...), variable subs with index
	SQUARE                      // [...], subcommand eval and replace.
)

type SafeSubInterp

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

func (*SafeSubInterp) Alias

func (ssi *SafeSubInterp) Alias(masterFr *Frame, newcmdnameStr string, prefix T)

func (*SafeSubInterp) Clone

func (ssi *SafeSubInterp) Clone() *SafeSubInterp

func (*SafeSubInterp) CopyCredFrom

func (ssi *SafeSubInterp) CopyCredFrom(fr *Frame)

func (*SafeSubInterp) Eval

func (ssi *SafeSubInterp) Eval(script T) T

type Scope

type Scope map[string]Loc

type Shower

type Shower interface {
	Show() string
}

type Slot

type Slot struct {
	Elem T
}

Slot stores a variable value.

func (*Slot) Get

func (p *Slot) Get() T

func (*Slot) Has

func (p *Slot) Has() bool

func (*Slot) Set

func (p *Slot) Set(t T)

type SortListByStringTSlice

type SortListByStringTSlice []T

func (SortListByStringTSlice) Len

func (p SortListByStringTSlice) Len() int

func (SortListByStringTSlice) Less

func (p SortListByStringTSlice) Less(i, j int) bool

func (SortListByStringTSlice) Swap

func (p SortListByStringTSlice) Swap(i, j int)

type StatusCode

type StatusCode int

StatusCode are the same integers as Tcl/C uses for return, break, and continue.

type SubstFlags

type SubstFlags int
const (
	NoDollar SubstFlags = 1 << iota
	NoSquare
	NoBackslash
)

type T

type T interface {
	ChirpFlavor() string
	Raw() interface{}
	String() string
	Float() float64
	Int() int64
	Uint() uint64
	ListElementString() string
	IsQuickString() bool
	IsQuickList() bool
	IsQuickHash() bool
	Bool() bool    // Like Python, empty values and 0 values are false.
	IsEmpty() bool // Would String() return ""?
	List() []T
	IsPreservedByList() bool
	IsQuickInt() bool
	IsQuickNumber() bool
	HeadTail() (hd, tl T)
	Hash() (Hash, *sync.Mutex)
	GetAt(key T) T
	PutAt(value T, key T)
	QuickReflectValue() R.Value
	EvalSeq(fr *Frame) T
	EvalExpr(fr *Frame) T
	Apply(fr *Frame, args []T) T
}

T is an interface to any Tcl value. Use them only through these methods, or fix these methods.

func ApplyToReflectedValue

func ApplyToReflectedValue(fr *Frame, v R.Value, args []T, i int) T

ApplyToReflectedValue applies args, starting at i, to terpValue t.

func ApplyToType

func ApplyToType(fr *Frame, typ R.Type, args []T) T

func Arg0v

func Arg0v(argv []T) []T

func Arg1

func Arg1(argv []T) T

func Arg1Usage

func Arg1Usage(argv []T, usage string) T

func ConcatLists

func ConcatLists(lists []T) []T

func EvalOrApplyLists

func EvalOrApplyLists(fr *Frame, lists []T) T

func HtEntity

func HtEntity(entity string) T

func LookupRootAndApply

func LookupRootAndApply(fr *Frame, rootName string, args []T) T

func MkBool

func MkBool(a bool) T

func MkNum

func MkNum(s string) T

func MkT

func MkT(a interface{}) T

func Parse2EvalExprStr

func Parse2EvalExprStr(fr *Frame, s string) T

func Parse2EvalSeqStr

func Parse2EvalSeqStr(fr *Frame, s string) T

func ParseList

func ParseList(s string) []T

func ParseListOrRecover

func ParseListOrRecover(s string) (recs []T, err interface{})

func RemoveHeadDashArgs

func RemoveHeadDashArgs(argv []T) (dashes []string, newArgv []T)

RemoveHeadDashArgs removes dash args from argv (only if they are QuickString), returning the dash args and modified argv. Argv[0] is preserved.

type Token

type Token uint8
const (
	TokEnd Token = iota // end of string
	TokNewline
	TokAlfaNum
	TokNumber
	TokOther // Non-Ascii or not special.

	TokBoolOr  // ||
	TokBoolAnd // &&

	TokNumEq // ==
	TokNumNe
	TokNumLe
	TokNumGe

	TokStrEq // eq
	TokStrNe
	TokStrLt
	TokStrLe
	TokStrGt
	TokStrGe

	TokShiftLeft  // <<
	TokShiftRight // >>

	TokExpandSquare // {*}[
	TokExpandDollar // {*}$

)

type TypeRoot

type TypeRoot struct{ Type R.Type }

func (TypeRoot) Apply

func (r TypeRoot) Apply(fr *Frame, args []T) T

type UpSlot

type UpSlot struct {
	Fr         *Frame
	RemoteName string
}

UpSlot forwards a variable to another variable.

func (*UpSlot) Get

func (p *UpSlot) Get() T

func (*UpSlot) Has

func (p *UpSlot) Has() bool

func (*UpSlot) Set

func (p *UpSlot) Set(t T)

type VarRoot

type VarRoot struct{ Var R.Value }

func (VarRoot) Apply

func (r VarRoot) Apply(fr *Frame, args []T) T

Directories

Path Synopsis
cli
goapi
Simple LevelDB Key-Value storage for chirp.
Simple LevelDB Key-Value storage for chirp.

Jump to

Keyboard shortcuts

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