Fork of daniellemaywood.uk/gleam — Wasm codegen work
2

Configure Feed

Select the types of activity you want to include in your feed.

gleam / compiler-core / schema.capnp
4.6 kB 252 lines
1@0xb533a99cfdbcedbe; 2 3# This Cap'n Proto schema is compiled into Rust code for use in the compiler. 4# 5# We don't want the compiler build to depend on the Cap'n Proto compiler so 6# the Cap'n Proto to Rust build step is commented out in `build.rs`. 7# 8# This schema is not considered a stable API and may change at any time. 9 10struct Property(Value) { 11 key @0 :Text; 12 value @1 :Value; 13} 14 15struct Option(Value) { 16 union { 17 none @0 :Void; 18 some @1 :Value; 19 } 20} 21 22struct Module { 23 name @0 :Text; 24 types @1 :List(Property(TypeConstructor)); 25 values @2 :List(Property(ValueConstructor)); 26 accessors @3 :List(Property(AccessorsMap)); 27 package @4 :Text; 28 typesConstructors @5 :List(Property(TypesVariantConstructors)); 29 unusedImports @6 :List(SrcSpan); 30 containsTodo @7 :Bool; 31 lineNumbers @8 :LineNumbers; 32 srcPath @9 :Text; 33 isInternal @10 :Bool; 34} 35 36struct TypesVariantConstructors { 37 variants @0 :List(TypeValueConstructor); 38 typeParametersIds @1 :List(UInt16); 39} 40 41struct TypeValueConstructor { 42 name @0 :Text; 43 parameters @1 :List(TypeValueConstructorParameter); 44} 45 46struct TypeValueConstructorParameter { 47 type @0 :Type; 48} 49 50struct TypeConstructor { 51 type @0 :Type; 52 # TODO: convert this to an int as we only need to reconstruct type vars, 53 # not other types 54 # TODO: test 55 parameters @1 :List(Type); 56 module @2 :Text; 57 publicity @3 :Publicity; 58 deprecated @4 :Text; 59} 60 61struct AccessorsMap { 62 type @0 :Type; 63 accessors @1 :List(Property(RecordAccessor)); 64} 65 66struct RecordAccessor { 67 type @0 :Type; 68 index @1 :UInt16; 69 label @2 :Text; 70} 71 72struct Type { 73 union { 74 app :group { 75 name @0 :Text; 76 module @1 :Text; 77 parameters @2 :List(Type); 78 package @7 :Text; 79 } 80 81 fn :group { 82 arguments @3 :List(Type); 83 return @4 :Type; 84 } 85 86 var :group { 87 id @5 :UInt64; 88 } 89 90 tuple :group { 91 elements @6 :List(Type); 92 } 93 } 94} 95 96struct ValueConstructor { 97 type @0 :Type; 98 variant @1 :ValueConstructorVariant; 99 publicity @2 :Publicity; 100 deprecated @3 :Text; 101} 102 103enum Publicity { 104 public @0; 105 private @1; 106 internal @2; 107} 108 109struct Implementations { 110 gleam @0 :Bool; 111 usesErlangExternals @1 :Bool; 112 usesJavascriptExternals @2 :Bool; 113 canRunOnErlang @3 :Bool; 114 canRunOnJavascript @4 :Bool; 115} 116 117struct ValueConstructorVariant { 118 union { 119 moduleConstant :group { 120 literal @0 :Constant; 121 location @1 :SrcSpan; 122 module @2 :Text; 123 documentation @14 :Text; 124 implementations @19 :Implementations; 125 } 126 127 moduleFn :group { 128 name @3 :Text; 129 fieldMap @4 :Option(FieldMap); 130 module @5 :Text; 131 arity @6 :UInt16; 132 location @7 :SrcSpan; 133 documentation @15 :Text; 134 implementations @18 :Implementations; 135 } 136 137 record :group { 138 name @8 :Text; 139 arity @9 :UInt16; 140 fieldMap @10 :Option(FieldMap); 141 location @11 :SrcSpan; 142 module @12 :Text; 143 constructorsCount @13 :UInt16; 144 documentation @16 :Text; 145 constructorIndex @17 :UInt16; 146 } 147 } 148} 149 150struct SrcSpan { 151 start @0 :UInt32; 152 end @1 :UInt32; 153} 154 155# Cap'n Proto only permits pointer types to be used as type parameters 156struct BoxedUInt16 { 157 value @0 :UInt16; 158} 159 160# Cap'n Proto only permits pointer types to be used as type parameters 161struct BoxedUInt32 { 162 value @0 :UInt32; 163} 164 165struct FieldMap { 166 arity @0 :UInt32; 167 fields @1 :List(Property(BoxedUInt32)); 168} 169 170struct Constant { 171 union { 172 int @0 :Text; 173 float @1 :Text; 174 string @2 :Text; 175 tuple @3 :List(Constant); 176 177 list :group { 178 elements @4 :List(Constant); 179 type @5 :Type; 180 } 181 182 record :group { 183 args @6 :List(Constant); 184 tag @7 :Text; 185 typ @8 :Type; 186 } 187 188 bitArray @9 :List(BitArraySegment); 189 190 var :group { 191 module @10 :Text; 192 name @11 :Text; 193 typ @12 :Type; 194 constructor @13 :ValueConstructor; 195 } 196 } 197} 198 199struct BitArraySegment { 200 value @0 :Constant; 201 options @1 :List(BitArraySegmentOption); 202 type @2 :Type; 203} 204 205struct BitArraySegmentOption { 206 union { 207 bytes @0 :Void; 208 209 integer @1 :Void; 210 211 float @2 :Void; 212 213 bits @3 :Void; 214 215 utf8 @4 :Void; 216 217 utf16 @5 :Void; 218 219 utf32 @6 :Void; 220 221 utf8Codepoint @7 :Void; 222 223 utf16Codepoint @8 :Void; 224 225 utf32Codepoint @9 :Void; 226 227 signed @10 :Void; 228 229 unsigned @11 :Void; 230 231 big @12 :Void; 232 233 little @13 :Void; 234 235 native @14 :Void; 236 237 size :group { 238 value @15 :Constant; 239 shortForm @16 :Bool; 240 } 241 242 unit :group { 243 value @17 :UInt8; 244 shortForm @18 :Bool; 245 } 246 } 247} 248 249struct LineNumbers { 250 lineStarts @0 :List(UInt32); 251 length @1 :UInt32; 252}