55 lines
1.6 KiB
Nim
55 lines
1.6 KiB
Nim
# Copyright 2022 Mattia Giambirtone & All Contributors
|
|
#
|
|
# 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.
|
|
|
|
|
|
type
|
|
ObjectKind* = enum
|
|
## Enumeration of Peon
|
|
## types
|
|
Int8, UInt8, Int16, UInt16, Int32,
|
|
UInt32, Int64, UInt64, Float32, Float64,
|
|
Char, Byte, String, Function, CustomType,
|
|
Nil, Nan, Bool, Inf
|
|
PeonObject* = object
|
|
## A generic Peon object
|
|
case kind*: ObjectKind:
|
|
of Bool:
|
|
boolean*: bool
|
|
of Inf:
|
|
positive*: bool
|
|
of Byte:
|
|
`byte`*: byte
|
|
of Int8:
|
|
tiny*: uint8
|
|
of UInt8:
|
|
uTiny*: uint8
|
|
of Int16:
|
|
short*: int16
|
|
of UInt16:
|
|
uShort*: uint16
|
|
of Int32:
|
|
`int`*: int32
|
|
of UInt32:
|
|
uInt*: uint32
|
|
of Int64:
|
|
long*: int64
|
|
of UInt64:
|
|
uLong*: uint64
|
|
of Nil, Nan:
|
|
discard
|
|
of CustomType:
|
|
fields*: seq[PeonObject]
|
|
else:
|
|
discard # TODO
|