types

package
v1.2.2 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2023 License: Apache-2.0 Imports: 4 Imported by: 1

Documentation

Overview

* * Copyright 2022 indentlang authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. *

* * Copyright 2022 indentlang authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. *

* * Copyright 2022 indentlang authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. *

* * Copyright 2022 indentlang authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. *

* * Copyright 2022 indentlang authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. *

Index

Constants

This section is empty.

Variables

View Source
var None = NoneType{}

Functions

func ForEach

func ForEach(it Iterable, action func(Object) bool)

If the action func return false that break the loop.

Types

type Appliable

type Appliable interface {
	Object
	Apply(Environment, Iterable) Object
	ApplyWithData(any, Environment, Iterable) Object
}

type BaseEnvironment

type BaseEnvironment struct {
	NoneType
	// contains filtered or unexported fields
}

func MakeBaseEnvironment

func MakeBaseEnvironment() BaseEnvironment

func (BaseEnvironment) CopyTo

func (b BaseEnvironment) CopyTo(other Environment)

func (BaseEnvironment) Delete

func (b BaseEnvironment) Delete(key Object)

func (BaseEnvironment) DeleteStr

func (b BaseEnvironment) DeleteStr(key string)

func (BaseEnvironment) Iter

func (b BaseEnvironment) Iter() Iterator

func (BaseEnvironment) Load

func (b BaseEnvironment) Load(key Object) Object

func (BaseEnvironment) LoadStr

func (b BaseEnvironment) LoadStr(key string) (Object, bool)

func (BaseEnvironment) Size

func (b BaseEnvironment) Size() int

func (BaseEnvironment) Store

func (b BaseEnvironment) Store(key, value Object)

func (BaseEnvironment) StoreStr

func (b BaseEnvironment) StoreStr(key string, value Object)

type Boolean

type Boolean bool

func (Boolean) Eval

func (b Boolean) Eval(env Environment) Object

func (Boolean) WriteTo

func (b Boolean) WriteTo(w io.Writer) (int64, error)

type ConvertString

type ConvertString func(string) (Object, bool)

type DataEnvironment

type DataEnvironment struct {
	Environment
	// contains filtered or unexported fields
}

func MakeDataEnvironment added in v1.0.1

func MakeDataEnvironment(data any, env Environment) DataEnvironment

func (DataEnvironment) Load

func (d DataEnvironment) Load(key Object) Object

func (DataEnvironment) LoadStr

func (d DataEnvironment) LoadStr(key string) (Object, bool)

type Environment

type Environment interface {
	Object
	Storable
	Delete(Object)
	StringLoadable
	StoreStr(string, Object)
	DeleteStr(string)
	CopyTo(Environment)
}

type Float

type Float float64

func (Float) Eval

func (f Float) Eval(env Environment) Object

func (Float) WriteTo

func (f Float) WriteTo(w io.Writer) (int64, error)

type Identifier

type Identifier string

func (Identifier) Eval

func (i Identifier) Eval(env Environment) Object

func (Identifier) WriteTo

func (i Identifier) WriteTo(w io.Writer) (int64, error)

type Integer

type Integer int64

func (Integer) Eval

func (i Integer) Eval(env Environment) Object

func (Integer) WriteTo

func (i Integer) WriteTo(w io.Writer) (int64, error)

type Iterable

type Iterable interface {
	Object
	Iter() Iterator
}

type Iterator

type Iterator interface {
	Iterable
	Next() (Object, bool)
	Close()
}

type List

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

func NewList

func NewList(objects ...Object) *List

func (*List) Add

func (l *List) Add(value Object)

func (*List) AddAll

func (l *List) AddAll(it Iterable) *List

func (*List) AddCategory

func (l *List) AddCategory(category string)

func (*List) CopyCategories

func (l *List) CopyCategories() map[string]NoneType

func (*List) Eval

func (l *List) Eval(env Environment) Object

func (*List) HasCategory

func (l *List) HasCategory(category string) bool

func (*List) ImportCategories

func (l *List) ImportCategories(other *List)

func (*List) Iter

func (l *List) Iter() Iterator

func (*List) Load

func (l *List) Load(key Object) Object

func (*List) LoadInt

func (l *List) LoadInt(index int) Object

func (*List) Size

func (l *List) Size() int

func (*List) Store

func (l *List) Store(key Object, value Object)

func (*List) WriteTo

func (l *List) WriteTo(w io.Writer) (int64, error)

type LoadWrapper

type LoadWrapper struct {
	NoneType
	// contains filtered or unexported fields
}

func (LoadWrapper) Load

func (w LoadWrapper) Load(key Object) Object

func (LoadWrapper) LoadStr

func (w LoadWrapper) LoadStr(s string) (Object, bool)

type Loadable

type Loadable interface {
	Load(Object) Object
}

type LocalEnvironment

type LocalEnvironment struct {
	BaseEnvironment
	// contains filtered or unexported fields
}

func MakeLocalEnvironment added in v1.0.1

func MakeLocalEnvironment(env Environment) LocalEnvironment

func (LocalEnvironment) Load

func (l LocalEnvironment) Load(key Object) Object

func (LocalEnvironment) LoadStr

func (l LocalEnvironment) LoadStr(key string) (Object, bool)

type MergeEnvironment

type MergeEnvironment struct {
	NoneType
	// contains filtered or unexported fields
}

Read only : all non Load* methods ore no-op.

func MakeMergeEnvironment added in v1.0.1

func MakeMergeEnvironment(creationEnv, callEnv Environment) MergeEnvironment

func (MergeEnvironment) CopyTo

func (m MergeEnvironment) CopyTo(other Environment)

func (MergeEnvironment) Delete

func (m MergeEnvironment) Delete(key Object)

func (MergeEnvironment) DeleteStr

func (m MergeEnvironment) DeleteStr(key string)

func (MergeEnvironment) Load

func (m MergeEnvironment) Load(key Object) Object

func (MergeEnvironment) LoadStr

func (m MergeEnvironment) LoadStr(key string) (Object, bool)

func (MergeEnvironment) Store

func (m MergeEnvironment) Store(key, value Object)

func (MergeEnvironment) StoreStr

func (m MergeEnvironment) StoreStr(key string, value Object)

type NativeAppliable

type NativeAppliable struct {
	NoneType
	// contains filtered or unexported fields
}

func MakeNativeAppliable

func MakeNativeAppliable(f func(Environment, Iterator) Object) NativeAppliable

func (NativeAppliable) Apply

func (n NativeAppliable) Apply(env Environment, it Iterable) Object

func (NativeAppliable) ApplyWithData

func (n NativeAppliable) ApplyWithData(data any, env Environment, it Iterable) Object

type NoneType

type NoneType struct{}

func (NoneType) Eval

func (n NoneType) Eval(env Environment) Object

func (NoneType) WriteTo

func (n NoneType) WriteTo(w io.Writer) (int64, error)

type Object

type Object interface {
	io.WriterTo
	Eval(Environment) Object
}

func Load

func Load(env StringLoadable, key Object) Object

type Sizable

type Sizable interface {
	Size() int
}

type Storable

type Storable interface {
	Loadable
	Store(Object, Object)
}

type String

type String string

func (String) Eval

func (s String) Eval(env Environment) Object

func (String) Load

func (s String) Load(key Object) Object

func (String) LoadInt

func (s String) LoadInt(index int) Object

func (String) Size

func (s String) Size() int

func (String) WriteTo

func (s String) WriteTo(w io.Writer) (int64, error)

type StringLoadable

type StringLoadable interface {
	LoadStr(string) (Object, bool)
}

Jump to

Keyboard shortcuts

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