|
| 1 | +package "tiye/cirru-edn/lib" |
| 2 | + |
| 3 | +import( |
| 4 | + "moonbitlang/core/hashset" |
| 5 | + "moonbitlang/core/strconv" |
| 6 | +) |
| 7 | + |
| 8 | +// Values |
| 9 | +fn format(Edn, Bool) -> String!EdnCommonError |
| 10 | + |
| 11 | +fn parse(String) -> Edn!@strconv.StrConvError |
| 12 | + |
| 13 | +// Types and methods |
| 14 | +pub(all) enum Edn { |
| 15 | + Nil |
| 16 | + Bool(Bool) |
| 17 | + Number(Double) |
| 18 | + Symbol(String) |
| 19 | + Tag(EdnTag) |
| 20 | + Str(String) |
| 21 | + Quote(@tiye/cirru-parser/lib.Cirru) |
| 22 | + Tuple(EdnTupleView) |
| 23 | + List(EdnListView) |
| 24 | + Set(EdnSetView) |
| 25 | + Map(EdnMapView) |
| 26 | + Record(EdnRecordView) |
| 27 | + Buffer(EdnBufferView) |
| 28 | + Atom(Edn) |
| 29 | +} |
| 30 | +impl Edn { |
| 31 | + is_literal(Self) -> Bool |
| 32 | + str(String) -> Self |
| 33 | + symbol(String) -> Self |
| 34 | + tag(String) -> Self |
| 35 | + tuple(Self, Array[Self]) -> Self |
| 36 | +} |
| 37 | +impl Compare for Edn |
| 38 | +impl Default for Edn |
| 39 | +impl Eq for Edn |
| 40 | +impl Hash for Edn |
| 41 | +impl Show for Edn |
| 42 | + |
| 43 | +type EdnBufferView |
| 44 | +impl Eq for EdnBufferView |
| 45 | + |
| 46 | +pub(all) type! EdnCommonError String |
| 47 | +impl Default for EdnCommonError |
| 48 | +impl Eq for EdnCommonError |
| 49 | +impl Hash for EdnCommonError |
| 50 | +impl Show for EdnCommonError |
| 51 | + |
| 52 | +type EdnListView |
| 53 | +impl Eq for EdnListView |
| 54 | + |
| 55 | +type EdnMapView |
| 56 | + |
| 57 | +pub(all) struct EdnRecordView { |
| 58 | + tag : EdnTag |
| 59 | + extra : Array[(EdnTag, Edn)] |
| 60 | +} |
| 61 | +impl Eq for EdnRecordView |
| 62 | +impl Show for EdnRecordView |
| 63 | + |
| 64 | +pub type EdnSetView @hashset.T[Edn] |
| 65 | +impl EdnSetView { |
| 66 | + add(Self, Edn) -> Unit |
| 67 | + contains(Self, Edn) -> Bool |
| 68 | + is_empty(Self) -> Bool |
| 69 | + length(Self) -> UInt |
| 70 | + to_string(Self) -> String |
| 71 | +} |
| 72 | +impl Compare for EdnSetView |
| 73 | +impl Eq for EdnSetView |
| 74 | +impl Hash for EdnSetView |
| 75 | + |
| 76 | +pub type EdnTag String |
| 77 | +impl EdnTag { |
| 78 | + new(String) -> Self |
| 79 | + str(Self) -> String |
| 80 | +} |
| 81 | +impl Compare for EdnTag |
| 82 | +impl Eq for EdnTag |
| 83 | +impl Hash for EdnTag |
| 84 | +impl Show for EdnTag |
| 85 | + |
| 86 | +pub(all) struct EdnTupleView { |
| 87 | + tag : Edn |
| 88 | + extra : Array[Edn] |
| 89 | +} |
| 90 | +impl EdnTupleView { |
| 91 | + new(Edn, Array[Edn]) -> Self |
| 92 | +} |
| 93 | +impl Compare for EdnTupleView |
| 94 | +impl Eq for EdnTupleView |
| 95 | +impl Hash for EdnTupleView |
| 96 | +impl Show for EdnTupleView |
| 97 | + |
| 98 | +// Type aliases |
| 99 | + |
| 100 | +// Traits |
| 101 | + |
0 commit comments