Documentation
¶
Overview ¶
Copyright 2021 Lee Boynton
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 2021 Lee Boynton ¶
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 2021 Lee Boynton ¶
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 2021 Lee Boynton ¶
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 2021 Lee Boynton ¶
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 2021 Lee Boynton ¶
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 2021 Lee Boynton ¶
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 2021 Lee Boynton ¶
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 2021 Lee Boynton ¶
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 2021 Lee Boynton ¶
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 2021 Lee Boynton ¶
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 2021 Lee Boynton ¶
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 ¶
- Variables
- func EncodeString(s string) string
- func Equal(o1 Value, o2 Value) bool
- func IsDelimiter(b byte) bool
- func IsPrimitiveType(tag Value) bool
- func IsType(o Value) bool
- func IsValidKeywordName(s string) bool
- func IsValidStructKey(d Value) bool
- func IsValidSymbolName(name string) bool
- func IsValidTypeName(s string) bool
- func IsWhitespace(b byte) bool
- func NumberEqual(f1 float64, f2 float64) bool
- func TypeNameOf(val Value) string
- type Boolean
- type Character
- type Error
- type Instance
- type Keyword
- type List
- type NullValue
- type Number
- type Reader
- func (dr *Reader) DecodeAtom(firstChar byte) (Value, error)
- func (dr *Reader) DecodeAtomString(firstChar byte) (string, error)
- func (dr *Reader) DecodeComment() error
- func (dr *Reader) DecodeList() (Value, error)
- func (dr *Reader) DecodeReaderMacro() (Value, error)
- func (dr *Reader) DecodeSequence(endChar byte) ([]Value, error)
- func (dr *Reader) DecodeString() (Value, error)
- func (dr *Reader) DecodeStruct() (Value, error)
- func (dr *Reader) DecodeType(firstChar byte) (string, error)
- func (dr *Reader) DecodeVector() (Value, error)
- func (dr *Reader) GetChar() (byte, error)
- func (reader *Reader) Read() (Value, error)
- func (reader *Reader) ReadAll() (*List, error)
- func (dr *Reader) ReadValue() (Value, error)
- func (dr *Reader) SkipToData(skipColon bool) (byte, error)
- func (dr *Reader) UngetChar() error
- type ReaderExtension
- type String
- type Struct
- func (s1 *Struct) Equals(another Value) bool
- func (strct *Struct) Get(key Value) Value
- func (strct *Struct) Has(key Value) bool
- func (data *Struct) Length() int
- func (strct *Struct) Put(key Value, val Value) *Struct
- func (d *Struct) String() string
- func (d *Struct) Type() Value
- func (strct *Struct) Unput(key Value) *Struct
- func (d *Struct) Value() Value
- type StructKey
- type Symbol
- type Type
- type Value
- type Vector
- type Writer
- func (writer *Writer) Write(val Value) (string, error)
- func (writer *Writer) WriteAll(lst *List) (string, error)
- func (writer *Writer) WriteData(o Value, json bool, indent string, indentSize string) (string, error)
- func (writer *Writer) WriteList(lst *List, indent string, indentSize string) string
- func (writer *Writer) WriteStruct(strct *Struct, json bool, indent string, indentSize string) (string, error)
- func (writer *Writer) WriteVector(vec *Vector, json bool, indent string, indentSize string) (string, error)
- type WriterExtension
Constants ¶
This section is empty.
Variables ¶
var ArgumentErrorKey = Intern("argument-error:")
var ErrorKey = Intern("error:")
ErrorKey - used for generic errors. By convention, error data (which is a vector of values), should have a keyword as the first element, and then a message as the second, and then optional other data after that.
var IOErrorKey = Intern("io-error:")
var KeywordType = primitiveType("<keyword>")
var NullType = primitiveType("<null>")
var SymbolType = primitiveType("<symbol>")
var SyntaxErrorKey = Intern("syntax-error:")
Functions ¶
func EncodeString ¶
EncodeString - return the encoded form of a string value
func IsDelimiter ¶
func IsPrimitiveType ¶
func IsValidKeywordName ¶
func IsValidStructKey ¶
func IsValidSymbolName ¶
func IsValidTypeName ¶
func IsWhitespace ¶
func NumberEqual ¶
func TypeNameOf ¶
Types ¶
type Instance ¶
Instance - a type/data value pair, i.e. `#<point>{x: 23 y: 57}` which is a struct tagged with the <point> type The 'type' of an instance is determined by a tag, i.e. it is not a primitive type
type Keyword ¶
type Keyword struct {
Text string //the textual representation of the Keyword
}
Keywords are symbolic identifiers with a trailing ':', i.e. `foo:`
type List ¶
func ListFromValues ¶
type Reader ¶
type Reader struct {
Input *bufio.Reader
Position int
Extension ReaderExtension
}
func (*Reader) DecodeAtomString ¶
func (*Reader) DecodeComment ¶
func (*Reader) DecodeList ¶
func (*Reader) DecodeReaderMacro ¶
func (*Reader) DecodeString ¶
func (*Reader) DecodeStruct ¶
func (*Reader) DecodeVector ¶
type ReaderExtension ¶
type Struct ¶
func MakeStruct ¶
MakeStruct - create a new <struct> object from the arguments, which can be other structs, or key/value pairs
type Symbol ¶
type Symbol struct {
Text string //the textual representation of the Symbol
Value Value //A hook for a value to bound to the symbol. Used by Ell, not actually part of EllDn Spec.
}
Symbols are symbolic identifiers, i.e. Intern("foo") == Intern("foo"), the same objects.
type Type ¶
type Type struct {
Text string //only the Name is needed for builtin types
}
Type is a type tag, of the form <foo> for type Foo. Types are part of the data notation.
type Value ¶
not a concrete type, used as a type assertion that any type is ok. Note that the Read function lets the caller choose whether or not the keys should be coerced to a specific type (<keyword>, <symbol>, <string>) or not <any>
var BooleanType Value = primitiveType("<boolean>")
var ErrorType Value = primitiveType("<error>")
Q: do I really need this? It is not part of EllDN. It has Instance syntax anyway. So...like UUID/Timestamp, right?
var NumberType Value = primitiveType("<number>")
var StringType Value = primitiveType("<string>")
var StructType Value = primitiveType("<struct>")
var TypeType Value = primitiveType("<type>")
type Vector ¶
type Vector struct {
Elements []Value
}
var EmptyVector *Vector = VectorFromElementsNoCopy(nil) //NewVector()
func ListToVector ¶
func MakeVector ¶
func VectorFromElements ¶
VectorFromElements - return a new <vector> object from the given slice of elements. The slice is copied.