kaitai-struct-compiler 0.10.0-SNAPSHOT20220617.120542.c053fb7d → 0.10.0-SNAPSHOT20220621.211648.0a3dcbfb

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4430,9 +4430,9 @@ function $h_Lio_kaitai_struct_Version$() {
4430
4430
  $h_Lio_kaitai_struct_Version$.prototype = $c_Lio_kaitai_struct_Version$.prototype;
4431
4431
  $c_Lio_kaitai_struct_Version$.prototype.init___ = (function() {
4432
4432
  this.name$1 = "kaitai-struct-compiler-js";
4433
- this.version$1 = "0.10-SNAPSHOT20220617.120542.c053fb7d";
4434
- this.gitCommit$1 = "c053fb7d";
4435
- this.gitTime$1 = "2022-06-17T12:05:42+00:00";
4433
+ this.version$1 = "0.10-SNAPSHOT20220621.211648.0a3dcbfb";
4434
+ this.gitCommit$1 = "0a3dcbfb";
4435
+ this.gitTime$1 = "2022-06-21T21:16:48+00:00";
4436
4436
  return this
4437
4437
  });
4438
4438
  var $d_Lio_kaitai_struct_Version$ = new $TypeData().initClass({
@@ -28030,85 +28030,40 @@ $c_Lio_kaitai_struct_format_ClassSpec$.prototype.opaquePlaceholder__sci_List__Li
28030
28030
  placeholder.name$1 = typeName;
28031
28031
  return placeholder
28032
28032
  });
28033
- $c_Lio_kaitai_struct_format_ClassSpec$.prototype.checkDupSeqInstIds__sci_List__sci_Map__V = (function(seq, instances) {
28034
- var f = (function($this) {
28035
- return (function(attr$2) {
28036
- var attr = $as_Lio_kaitai_struct_format_AttrSpec(attr$2);
28037
- var x1 = attr.id$1;
28038
- if ((x1 instanceof $c_Lio_kaitai_struct_format_NamedIdentifier)) {
28039
- var x2 = $as_Lio_kaitai_struct_format_NamedIdentifier(x1);
28040
- var id = x2.name$2;
28041
- var xo = new $c_s_Some().init___O(new $c_T2().init___O__O(id, attr));
28042
- return xo.toList__sci_List()
28043
- } else {
28044
- var xo$1 = $m_s_None$();
28045
- return xo$1.toList__sci_List()
28046
- }
28047
- })
28048
- })(this);
28049
- var this$5 = $m_sci_List$();
28050
- var bf = this$5.ReusableCBFInstance$2;
28051
- if ((bf === $m_sci_List$().ReusableCBFInstance$2)) {
28052
- if ((seq === $m_sci_Nil$())) {
28053
- var jsx$1 = $m_sci_Nil$()
28033
+ $c_Lio_kaitai_struct_format_ClassSpec$.prototype.checkDupMemberIds__sci_List__V = (function(attrs) {
28034
+ var attrIds = $as_scm_Map($m_scm_Map$().apply__sc_Seq__sc_GenMap($m_sci_Nil$()));
28035
+ var these = attrs;
28036
+ while ((!these.isEmpty__Z())) {
28037
+ var arg1 = these.head__O();
28038
+ var attr = $as_Lio_kaitai_struct_format_MemberSpec(arg1);
28039
+ var x1 = attr.id__Lio_kaitai_struct_format_Identifier();
28040
+ if ((x1 instanceof $c_Lio_kaitai_struct_format_NamedIdentifier)) {
28041
+ var x2 = $as_Lio_kaitai_struct_format_NamedIdentifier(x1);
28042
+ var name = x2.name$2;
28043
+ var idOpt = new $c_s_Some().init___O(name)
28044
+ } else if ((x1 instanceof $c_Lio_kaitai_struct_format_InstanceIdentifier)) {
28045
+ var x3 = $as_Lio_kaitai_struct_format_InstanceIdentifier(x1);
28046
+ var name$2 = x3.name$2;
28047
+ var idOpt = new $c_s_Some().init___O(name$2)
28054
28048
  } else {
28055
- var rest = seq;
28056
- var found = new $c_sr_BooleanRef().init___Z(false);
28057
- var h = new $c_sr_ObjectRef().init___O(null);
28058
- var t = new $c_sr_ObjectRef().init___O(null);
28059
- while ((rest !== $m_sci_Nil$())) {
28060
- var arg1 = rest.head__O();
28061
- $as_sc_GenTraversableOnce(f(arg1)).seq__sc_TraversableOnce().foreach__F1__V(new $c_sjsr_AnonFunction1().init___sjs_js_Function1((function($this$1, found$1, h$1, t$1) {
28062
- return (function(b$2) {
28063
- if ((!found$1.elem$1)) {
28064
- h$1.elem$1 = new $c_sci_$colon$colon().init___O__sci_List(b$2, $m_sci_Nil$());
28065
- t$1.elem$1 = $as_sci_$colon$colon(h$1.elem$1);
28066
- found$1.elem$1 = true
28067
- } else {
28068
- var nx = new $c_sci_$colon$colon().init___O__sci_List(b$2, $m_sci_Nil$());
28069
- $as_sci_$colon$colon(t$1.elem$1).tl$5 = nx;
28070
- t$1.elem$1 = nx
28071
- }
28072
- })
28073
- })(seq, found, h, t)));
28074
- var this$9 = rest;
28075
- rest = this$9.tail__sci_List()
28076
- };
28077
- var jsx$1 = ((!found.elem$1) ? $m_sci_Nil$() : $as_sci_$colon$colon(h.elem$1))
28078
- }
28079
- } else {
28080
- $m_sci_List$();
28081
- var b = new $c_scm_ListBuffer().init___();
28082
- var these = seq;
28083
- while ((!these.isEmpty__Z())) {
28084
- var arg1$1 = these.head__O();
28085
- var xs = $as_sc_GenTraversableOnce(f(arg1$1)).seq__sc_TraversableOnce();
28086
- b.$$plus$plus$eq__sc_TraversableOnce__scm_ListBuffer(xs);
28087
- var this$11 = these;
28088
- these = this$11.tail__sci_List()
28049
+ var idOpt = $m_s_None$()
28089
28050
  };
28090
- var jsx$1 = b.toList__sci_List()
28091
- };
28092
- var attrIds = $as_sc_TraversableOnce(jsx$1).toMap__s_Predef$$less$colon$less__sci_Map($m_s_Predef$().singleton$und$less$colon$less$2);
28093
- instances.foreach__F1__V(new $c_sjsr_AnonFunction1().init___sjs_js_Function1((function(this$2$1, attrIds$1) {
28094
- return (function(x0$1$2) {
28095
- var x0$1 = $as_T2(x0$1$2);
28096
- if ((x0$1 !== null)) {
28097
- var id$1 = $as_Lio_kaitai_struct_format_InstanceIdentifier(x0$1.$$und1__O());
28098
- var instSpec = $as_Lio_kaitai_struct_format_InstanceSpec(x0$1.$$und2__O());
28099
- $m_Lio_kaitai_struct_format_ClassSpec$().checkDupId__p1__s_Option__T__Lio_kaitai_struct_format_YAMLPath__V(attrIds$1.get__O__s_Option(id$1.name$2), id$1.name$2, instSpec)
28100
- } else {
28101
- throw new $c_s_MatchError().init___O(x0$1)
28102
- }
28103
- })
28104
- })(this, attrIds)))
28051
+ if ((!idOpt.isEmpty__Z())) {
28052
+ var arg1$1 = idOpt.get__O();
28053
+ var id = $as_T(arg1$1);
28054
+ $m_Lio_kaitai_struct_format_ClassSpec$().checkDupId__p1__s_Option__T__Lio_kaitai_struct_format_YAMLPath__V(attrIds.get__O__s_Option(id), id, attr);
28055
+ attrIds.put__O__O__s_Option(id, attr)
28056
+ };
28057
+ var this$1 = these;
28058
+ these = this$1.tail__sci_List()
28059
+ }
28105
28060
  });
28106
28061
  $c_Lio_kaitai_struct_format_ClassSpec$.prototype.checkDupId__p1__s_Option__T__Lio_kaitai_struct_format_YAMLPath__V = (function(prevAttrOpt, id, nowAttr) {
28107
28062
  if ((prevAttrOpt instanceof $c_s_Some)) {
28108
28063
  var x2 = $as_s_Some(prevAttrOpt);
28109
- var prevAttr = $as_Lio_kaitai_struct_format_AttrSpec(x2.value$2);
28064
+ var prevAttr = $as_Lio_kaitai_struct_format_MemberSpec(x2.value$2);
28110
28065
  var jsx$1 = $m_Lio_kaitai_struct_problems_KSYParseError$();
28111
- var this$1 = prevAttr.path$1;
28066
+ var this$1 = prevAttr.path__sci_List();
28112
28067
  throw jsx$1.withText__T__sci_List__Lio_kaitai_struct_problems_CompilationProblemException(((("duplicate attribute ID '" + id) + "', previously defined at /") + $f_sc_TraversableOnce__mkString__T__T__T__T(this$1, "", "/", "")), nowAttr.path__sci_List())
28113
28068
  } else {
28114
28069
  var x = $m_s_None$();
@@ -28195,12 +28150,12 @@ $c_Lio_kaitai_struct_format_ClassSpec$.prototype.fromYaml__O__s_Option__sci_List
28195
28150
  };
28196
28151
  var seq = $m_sci_Nil$()
28197
28152
  };
28198
- var x1$3 = srcMap.get__O__s_Option("types");
28153
+ var x1$3 = srcMap.get__O__s_Option("instances");
28199
28154
  if ((x1$3 instanceof $c_s_Some)) {
28200
28155
  var x2$3 = $as_s_Some(x1$3);
28201
28156
  var value$3 = x2$3.value$2;
28202
28157
  $m_sci_List$();
28203
- var array$3 = ["types"];
28158
+ var array$3 = ["instances"];
28204
28159
  var i$3 = (((-1) + $uI(array$3.length)) | 0);
28205
28160
  var result$3 = $m_sci_Nil$();
28206
28161
  while ((i$3 >= 0)) {
@@ -28212,38 +28167,43 @@ $c_Lio_kaitai_struct_format_ClassSpec$.prototype.fromYaml__O__s_Option__sci_List
28212
28167
  };
28213
28168
  var jsx$4 = result$3;
28214
28169
  var this$23 = $m_sci_List$();
28215
- var types = this.typesFromYaml__O__s_Option__sci_List__Lio_kaitai_struct_format_MetaSpec__sci_Map(value$3, fileName, $as_sci_List(path.$$plus$plus__sc_GenTraversableOnce__scg_CanBuildFrom__O(jsx$4, this$23.ReusableCBFInstance$2)), meta)
28170
+ var instances = this.instancesFromYaml__O__sci_List__Lio_kaitai_struct_format_MetaSpec__sci_Map(value$3, $as_sci_List(path.$$plus$plus__sc_GenTraversableOnce__scg_CanBuildFrom__O(jsx$4, this$23.ReusableCBFInstance$2)), meta)
28216
28171
  } else {
28217
28172
  var x$5 = $m_s_None$();
28218
28173
  if ((!(x$5 === x1$3))) {
28219
28174
  throw new $c_s_MatchError().init___O(x1$3)
28220
28175
  };
28221
- var types = $as_sci_Map($m_s_Predef$().Map$2.apply__sc_Seq__sc_GenMap($m_sci_Nil$()))
28176
+ var instances = $as_sci_Map($m_s_Predef$().Map$2.apply__sc_Seq__sc_GenMap($m_sci_Nil$()))
28222
28177
  };
28223
- var x1$4 = srcMap.get__O__s_Option("instances");
28178
+ var this$24 = $m_sci_List$();
28179
+ var jsx$6 = $as_sci_List(params.$$plus$plus__sc_GenTraversableOnce__scg_CanBuildFrom__O(seq, this$24.ReusableCBFInstance$2));
28180
+ var jsx$5 = instances.values__sc_Iterable();
28181
+ var this$25 = $m_sci_List$();
28182
+ this.checkDupMemberIds__sci_List__V($as_sci_List(jsx$6.$$plus$plus__sc_GenTraversableOnce__scg_CanBuildFrom__O(jsx$5, this$25.ReusableCBFInstance$2)));
28183
+ var x1$4 = srcMap.get__O__s_Option("types");
28224
28184
  if ((x1$4 instanceof $c_s_Some)) {
28225
28185
  var x2$4 = $as_s_Some(x1$4);
28226
28186
  var value$4 = x2$4.value$2;
28227
28187
  $m_sci_List$();
28228
- var array$4 = ["instances"];
28188
+ var array$4 = ["types"];
28229
28189
  var i$4 = (((-1) + $uI(array$4.length)) | 0);
28230
28190
  var result$4 = $m_sci_Nil$();
28231
28191
  while ((i$4 >= 0)) {
28232
- var this$27 = result$4;
28192
+ var this$29 = result$4;
28233
28193
  var index$4 = i$4;
28234
28194
  var x$6 = array$4[index$4];
28235
- result$4 = new $c_sci_$colon$colon().init___O__sci_List(x$6, this$27);
28195
+ result$4 = new $c_sci_$colon$colon().init___O__sci_List(x$6, this$29);
28236
28196
  i$4 = (((-1) + i$4) | 0)
28237
28197
  };
28238
- var jsx$5 = result$4;
28239
- var this$28 = $m_sci_List$();
28240
- var instances = this.instancesFromYaml__O__sci_List__Lio_kaitai_struct_format_MetaSpec__sci_Map(value$4, $as_sci_List(path.$$plus$plus__sc_GenTraversableOnce__scg_CanBuildFrom__O(jsx$5, this$28.ReusableCBFInstance$2)), meta)
28198
+ var jsx$7 = result$4;
28199
+ var this$30 = $m_sci_List$();
28200
+ var types = this.typesFromYaml__O__s_Option__sci_List__Lio_kaitai_struct_format_MetaSpec__sci_Map(value$4, fileName, $as_sci_List(path.$$plus$plus__sc_GenTraversableOnce__scg_CanBuildFrom__O(jsx$7, this$30.ReusableCBFInstance$2)), meta)
28241
28201
  } else {
28242
28202
  var x$7 = $m_s_None$();
28243
28203
  if ((!(x$7 === x1$4))) {
28244
28204
  throw new $c_s_MatchError().init___O(x1$4)
28245
28205
  };
28246
- var instances = $as_sci_Map($m_s_Predef$().Map$2.apply__sc_Seq__sc_GenMap($m_sci_Nil$()))
28206
+ var types = $as_sci_Map($m_s_Predef$().Map$2.apply__sc_Seq__sc_GenMap($m_sci_Nil$()))
28247
28207
  };
28248
28208
  var x1$5 = srcMap.get__O__s_Option("enums");
28249
28209
  if ((x1$5 instanceof $c_s_Some)) {
@@ -28254,15 +28214,15 @@ $c_Lio_kaitai_struct_format_ClassSpec$.prototype.fromYaml__O__s_Option__sci_List
28254
28214
  var i$5 = (((-1) + $uI(array$5.length)) | 0);
28255
28215
  var result$5 = $m_sci_Nil$();
28256
28216
  while ((i$5 >= 0)) {
28257
- var this$32 = result$5;
28217
+ var this$34 = result$5;
28258
28218
  var index$5 = i$5;
28259
28219
  var x$8 = array$5[index$5];
28260
- result$5 = new $c_sci_$colon$colon().init___O__sci_List(x$8, this$32);
28220
+ result$5 = new $c_sci_$colon$colon().init___O__sci_List(x$8, this$34);
28261
28221
  i$5 = (((-1) + i$5) | 0)
28262
28222
  };
28263
- var jsx$6 = result$5;
28264
- var this$33 = $m_sci_List$();
28265
- var enums = this.enumsFromYaml__O__sci_List__sci_Map(value$5, $as_sci_List(path.$$plus$plus__sc_GenTraversableOnce__scg_CanBuildFrom__O(jsx$6, this$33.ReusableCBFInstance$2)))
28223
+ var jsx$8 = result$5;
28224
+ var this$35 = $m_sci_List$();
28225
+ var enums = this.enumsFromYaml__O__sci_List__sci_Map(value$5, $as_sci_List(path.$$plus$plus__sc_GenTraversableOnce__scg_CanBuildFrom__O(jsx$8, this$35.ReusableCBFInstance$2)))
28266
28226
  } else {
28267
28227
  var x$9 = $m_s_None$();
28268
28228
  if ((!(x$9 === x1$5))) {
@@ -28270,27 +28230,26 @@ $c_Lio_kaitai_struct_format_ClassSpec$.prototype.fromYaml__O__s_Option__sci_List
28270
28230
  };
28271
28231
  var enums = $as_sci_Map($m_s_Predef$().Map$2.apply__sc_Seq__sc_GenMap($m_sci_Nil$()))
28272
28232
  };
28273
- this.checkDupSeqInstIds__sci_List__sci_Map__V(seq, instances);
28274
28233
  var cs = new $c_Lio_kaitai_struct_format_ClassSpec().init___s_Option__sci_List__Z__Lio_kaitai_struct_format_MetaSpec__Lio_kaitai_struct_format_DocSpec__s_Option__sci_List__sci_List__sci_Map__sci_Map__sci_Map(fileName, path, path.isEmpty__Z(), meta, doc, toStringExpr, params, seq, types, instances, enums);
28275
28234
  if (path.isEmpty__Z()) {
28276
28235
  var x1$6 = explicitMeta.id$1;
28277
28236
  var x$11 = $m_s_None$();
28278
28237
  if ((x$11 === x1$6)) {
28279
- var jsx$8 = $m_Lio_kaitai_struct_problems_KSYParseError$();
28238
+ var jsx$10 = $m_Lio_kaitai_struct_problems_KSYParseError$();
28280
28239
  $m_sci_List$();
28281
28240
  var array$6 = ["meta", "id"];
28282
28241
  var i$6 = (((-1) + $uI(array$6.length)) | 0);
28283
28242
  var result$6 = $m_sci_Nil$();
28284
28243
  while ((i$6 >= 0)) {
28285
- var this$37 = result$6;
28244
+ var this$39 = result$6;
28286
28245
  var index$6 = i$6;
28287
28246
  var x$10 = array$6[index$6];
28288
- result$6 = new $c_sci_$colon$colon().init___O__sci_List(x$10, this$37);
28247
+ result$6 = new $c_sci_$colon$colon().init___O__sci_List(x$10, this$39);
28289
28248
  i$6 = (((-1) + i$6) | 0)
28290
28249
  };
28291
- var jsx$7 = result$6;
28292
- var this$38 = $m_sci_List$();
28293
- throw jsx$8.withText__T__sci_List__Lio_kaitai_struct_problems_CompilationProblemException("no `meta/id` encountered in top-level class spec", $as_sci_List(path.$$plus$plus__sc_GenTraversableOnce__scg_CanBuildFrom__O(jsx$7, this$38.ReusableCBFInstance$2)))
28250
+ var jsx$9 = result$6;
28251
+ var this$40 = $m_sci_List$();
28252
+ throw jsx$10.withText__T__sci_List__Lio_kaitai_struct_problems_CompilationProblemException("no `meta/id` encountered in top-level class spec", $as_sci_List(path.$$plus$plus__sc_GenTraversableOnce__scg_CanBuildFrom__O(jsx$9, this$40.ReusableCBFInstance$2)))
28294
28253
  } else if ((x1$6 instanceof $c_s_Some)) {
28295
28254
  var x2$6 = $as_s_Some(x1$6);
28296
28255
  var id = $as_T(x2$6.value$2);
@@ -28299,10 +28258,10 @@ $c_Lio_kaitai_struct_format_ClassSpec$.prototype.fromYaml__O__s_Option__sci_List
28299
28258
  var i$7 = (((-1) + $uI(array$7.length)) | 0);
28300
28259
  var result$7 = $m_sci_Nil$();
28301
28260
  while ((i$7 >= 0)) {
28302
- var this$42 = result$7;
28261
+ var this$44 = result$7;
28303
28262
  var index$7 = i$7;
28304
28263
  var x$12 = array$7[index$7];
28305
- result$7 = new $c_sci_$colon$colon().init___O__sci_List(x$12, this$42);
28264
+ result$7 = new $c_sci_$colon$colon().init___O__sci_List(x$12, this$44);
28306
28265
  i$7 = (((-1) + i$7) | 0)
28307
28266
  };
28308
28267
  cs.name$1 = result$7
@@ -28376,29 +28335,11 @@ $c_Lio_kaitai_struct_format_ClassSpec$.prototype.seqFromYaml__O__sci_List__Lio_k
28376
28335
  var jsx$3 = b.result__O()
28377
28336
  };
28378
28337
  var seq = $as_sci_List(jsx$3);
28379
- this.checkDupSeqIds__sci_List__V(seq);
28380
28338
  return seq
28381
28339
  } else {
28382
28340
  throw $m_Lio_kaitai_struct_problems_KSYParseError$().withText__T__sci_List__Lio_kaitai_struct_problems_CompilationProblemException(("expected array, found " + src), path)
28383
28341
  }
28384
28342
  });
28385
- $c_Lio_kaitai_struct_format_ClassSpec$.prototype.checkDupSeqIds__sci_List__V = (function(seq) {
28386
- var attrIds = $as_scm_Map($m_scm_Map$().apply__sc_Seq__sc_GenMap($m_sci_Nil$()));
28387
- var these = seq;
28388
- while ((!these.isEmpty__Z())) {
28389
- var arg1 = these.head__O();
28390
- var attr = $as_Lio_kaitai_struct_format_AttrSpec(arg1);
28391
- var x1 = attr.id$1;
28392
- if ((x1 instanceof $c_Lio_kaitai_struct_format_NamedIdentifier)) {
28393
- var x2 = $as_Lio_kaitai_struct_format_NamedIdentifier(x1);
28394
- var id = x2.name$2;
28395
- $m_Lio_kaitai_struct_format_ClassSpec$().checkDupId__p1__s_Option__T__Lio_kaitai_struct_format_YAMLPath__V(attrIds.get__O__s_Option(id), id, attr);
28396
- attrIds.put__O__O__s_Option(id, attr)
28397
- };
28398
- var this$1 = these;
28399
- these = this$1.tail__sci_List()
28400
- }
28401
- });
28402
28343
  $c_Lio_kaitai_struct_format_ClassSpec$.prototype.instancesFromYaml__O__sci_List__Lio_kaitai_struct_format_MetaSpec__sci_Map = (function(src, path, metaDef) {
28403
28344
  var srcMap = $m_Lio_kaitai_struct_format_ParseUtils$().asMap__O__sci_List__sci_Map(src, path);
28404
28345
  var f = new $c_sjsr_AnonFunction1().init___sjs_js_Function1((function($this, path$1, metaDef$1) {
@@ -63129,9 +63070,6 @@ function $h_Lio_kaitai_struct_translators_BaseTranslator() {
63129
63070
  /*<skip>*/
63130
63071
  }
63131
63072
  $h_Lio_kaitai_struct_translators_BaseTranslator.prototype = $c_Lio_kaitai_struct_translators_BaseTranslator.prototype;
63132
- $c_Lio_kaitai_struct_translators_BaseTranslator.prototype.doNumericCompareOp__Lio_kaitai_struct_exprlang_Ast$expr__Lio_kaitai_struct_exprlang_Ast$cmpop__Lio_kaitai_struct_exprlang_Ast$expr__T = (function(left, op, right) {
63133
- return $f_Lio_kaitai_struct_translators_CommonOps__doNumericCompareOp__Lio_kaitai_struct_exprlang_Ast$expr__Lio_kaitai_struct_exprlang_Ast$cmpop__Lio_kaitai_struct_exprlang_Ast$expr__T(this, left, op, right)
63134
- });
63135
63073
  $c_Lio_kaitai_struct_translators_BaseTranslator.prototype.boolToInt__Lio_kaitai_struct_exprlang_Ast$expr__O = (function(value) {
63136
63074
  return this.boolToInt__Lio_kaitai_struct_exprlang_Ast$expr__T(value)
63137
63075
  });
@@ -63385,7 +63323,7 @@ $c_Lio_kaitai_struct_translators_BaseTranslator.prototype.translate__Lio_kaitai_
63385
63323
  var _1 = this.detectType__Lio_kaitai_struct_exprlang_Ast$expr__Lio_kaitai_struct_datatype_DataType(left);
63386
63324
  var _2 = this.detectType__Lio_kaitai_struct_exprlang_Ast$expr__Lio_kaitai_struct_datatype_DataType(right);
63387
63325
  if (((_1 instanceof $c_Lio_kaitai_struct_datatype_DataType$NumericType) && (_2 instanceof $c_Lio_kaitai_struct_datatype_DataType$NumericType))) {
63388
- return this.doNumericCompareOp__Lio_kaitai_struct_exprlang_Ast$expr__Lio_kaitai_struct_exprlang_Ast$cmpop__Lio_kaitai_struct_exprlang_Ast$expr__T(left, op$2, right)
63326
+ return $f_Lio_kaitai_struct_translators_CommonOps__doNumericCompareOp__Lio_kaitai_struct_exprlang_Ast$expr__Lio_kaitai_struct_exprlang_Ast$cmpop__Lio_kaitai_struct_exprlang_Ast$expr__T(this, left, op$2, right)
63389
63327
  };
63390
63328
  if (((_1 instanceof $c_Lio_kaitai_struct_datatype_DataType$BooleanType) && (_2 instanceof $c_Lio_kaitai_struct_datatype_DataType$BooleanType))) {
63391
63329
  var x$3 = $m_Lio_kaitai_struct_exprlang_Ast$cmpop$Eq$();
@@ -63396,7 +63334,7 @@ $c_Lio_kaitai_struct_translators_BaseTranslator.prototype.translate__Lio_kaitai_
63396
63334
  var jsx$1 = (x$5 === op$2)
63397
63335
  };
63398
63336
  if (jsx$1) {
63399
- return this.doNumericCompareOp__Lio_kaitai_struct_exprlang_Ast$expr__Lio_kaitai_struct_exprlang_Ast$cmpop__Lio_kaitai_struct_exprlang_Ast$expr__T(left, op$2, right)
63337
+ return $f_Lio_kaitai_struct_translators_CommonOps__doNumericCompareOp__Lio_kaitai_struct_exprlang_Ast$expr__Lio_kaitai_struct_exprlang_Ast$cmpop__Lio_kaitai_struct_exprlang_Ast$expr__T(this, left, op$2, right)
63400
63338
  } else {
63401
63339
  throw new $c_Lio_kaitai_struct_precompile_TypeMismatchError().init___T((("can't compare booleans using " + op$2) + " operator"))
63402
63340
  }
@@ -67420,10 +67358,12 @@ function $h_Lio_kaitai_struct_translators_PerlTranslator() {
67420
67358
  $h_Lio_kaitai_struct_translators_PerlTranslator.prototype = $c_Lio_kaitai_struct_translators_PerlTranslator.prototype;
67421
67359
  $c_Lio_kaitai_struct_translators_PerlTranslator.prototype.strToInt__Lio_kaitai_struct_exprlang_Ast$expr__Lio_kaitai_struct_exprlang_Ast$expr__T = (function(s, base) {
67422
67360
  var baseStr = this.translate__Lio_kaitai_struct_exprlang_Ast$expr__T(base);
67423
- if ((baseStr === "8")) {
67361
+ if ((baseStr === "2")) {
67362
+ return (("oct('0b' . " + this.translate__Lio_kaitai_struct_exprlang_Ast$expr__T(s)) + ")")
67363
+ } else if ((baseStr === "8")) {
67424
67364
  return (("oct(" + this.translate__Lio_kaitai_struct_exprlang_Ast$expr__T(s)) + ")")
67425
67365
  } else if ((baseStr === "10")) {
67426
- return this.translate__Lio_kaitai_struct_exprlang_Ast$expr__T(s)
67366
+ return (this.translate__Lio_kaitai_struct_exprlang_Ast$expr__T(s) + " + 0")
67427
67367
  } else if ((baseStr === "16")) {
67428
67368
  return (("hex(" + this.translate__Lio_kaitai_struct_exprlang_Ast$expr__T(s)) + ")")
67429
67369
  } else {
@@ -67439,6 +67379,12 @@ $c_Lio_kaitai_struct_translators_PerlTranslator.prototype.arraySize__Lio_kaitai_
67439
67379
  $c_Lio_kaitai_struct_translators_PerlTranslator.prototype.strSubstring__Lio_kaitai_struct_exprlang_Ast$expr__Lio_kaitai_struct_exprlang_Ast$expr__Lio_kaitai_struct_exprlang_Ast$expr__O = (function(s, from, to) {
67440
67380
  return this.strSubstring__Lio_kaitai_struct_exprlang_Ast$expr__Lio_kaitai_struct_exprlang_Ast$expr__Lio_kaitai_struct_exprlang_Ast$expr__T(s, from, to)
67441
67381
  });
67382
+ $c_Lio_kaitai_struct_translators_PerlTranslator.prototype.bytesMax__Lio_kaitai_struct_exprlang_Ast$expr__O = (function(b) {
67383
+ return this.bytesMax__Lio_kaitai_struct_exprlang_Ast$expr__T(b)
67384
+ });
67385
+ $c_Lio_kaitai_struct_translators_PerlTranslator.prototype.bytesLast__Lio_kaitai_struct_exprlang_Ast$expr__O = (function(b) {
67386
+ return this.bytesLast__Lio_kaitai_struct_exprlang_Ast$expr__T(b)
67387
+ });
67442
67388
  $c_Lio_kaitai_struct_translators_PerlTranslator.prototype.strReverse__Lio_kaitai_struct_exprlang_Ast$expr__T = (function(value) {
67443
67389
  return (("scalar(reverse(" + this.translate__Lio_kaitai_struct_exprlang_Ast$expr__T(value)) + "))")
67444
67390
  });
@@ -67455,12 +67401,15 @@ $c_Lio_kaitai_struct_translators_PerlTranslator.prototype.strLength__Lio_kaitai_
67455
67401
  $c_Lio_kaitai_struct_translators_PerlTranslator.prototype.floatToInt__Lio_kaitai_struct_exprlang_Ast$expr__O = (function(value) {
67456
67402
  return this.floatToInt__Lio_kaitai_struct_exprlang_Ast$expr__T(value)
67457
67403
  });
67458
- $c_Lio_kaitai_struct_translators_PerlTranslator.prototype.arrayLast__Lio_kaitai_struct_exprlang_Ast$expr__T = (function(a) {
67459
- return (("@{" + this.translate__Lio_kaitai_struct_exprlang_Ast$expr__T(a)) + "}[-1]")
67404
+ $c_Lio_kaitai_struct_translators_PerlTranslator.prototype.bytesFirst__Lio_kaitai_struct_exprlang_Ast$expr__T = (function(b) {
67405
+ return (("unpack('C', substr(" + this.translate__Lio_kaitai_struct_exprlang_Ast$expr__T(b)) + ", 0, 1))")
67460
67406
  });
67461
67407
  $c_Lio_kaitai_struct_translators_PerlTranslator.prototype.bytesLength__Lio_kaitai_struct_exprlang_Ast$expr__O = (function(b) {
67462
67408
  return this.strLength__Lio_kaitai_struct_exprlang_Ast$expr__T(b)
67463
67409
  });
67410
+ $c_Lio_kaitai_struct_translators_PerlTranslator.prototype.arrayLast__Lio_kaitai_struct_exprlang_Ast$expr__T = (function(a) {
67411
+ return (("@{" + this.translate__Lio_kaitai_struct_exprlang_Ast$expr__T(a)) + "}[-1]")
67412
+ });
67464
67413
  $c_Lio_kaitai_struct_translators_PerlTranslator.prototype.arrayMax__Lio_kaitai_struct_exprlang_Ast$expr__O = (function(a) {
67465
67414
  return this.arrayMax__Lio_kaitai_struct_exprlang_Ast$expr__T(a)
67466
67415
  });
@@ -67531,6 +67480,9 @@ $c_Lio_kaitai_struct_translators_PerlTranslator.prototype.doIfExp__Lio_kaitai_st
67531
67480
  $c_Lio_kaitai_struct_translators_PerlTranslator.prototype.asciiCharQuoteMap__sci_Map = (function() {
67532
67481
  return this.asciiCharQuoteMap$3
67533
67482
  });
67483
+ $c_Lio_kaitai_struct_translators_PerlTranslator.prototype.bytesSubscript__Lio_kaitai_struct_exprlang_Ast$expr__Lio_kaitai_struct_exprlang_Ast$expr__O = (function(container, idx) {
67484
+ return this.bytesSubscript__Lio_kaitai_struct_exprlang_Ast$expr__Lio_kaitai_struct_exprlang_Ast$expr__T(container, idx)
67485
+ });
67534
67486
  $c_Lio_kaitai_struct_translators_PerlTranslator.prototype.doArrayLiteral__Lio_kaitai_struct_datatype_DataType__sc_Seq__T = (function(t, value) {
67535
67487
  var jsx$1 = new $c_sjsr_AnonFunction1().init___sjs_js_Function1((function($this) {
67536
67488
  return (function(v$2) {
@@ -67548,7 +67500,15 @@ $c_Lio_kaitai_struct_translators_PerlTranslator.prototype.arraySubscript__Lio_ka
67548
67500
  return (((("@{" + this.translate__Lio_kaitai_struct_exprlang_Ast$expr__T(container)) + "}[") + this.translate__Lio_kaitai_struct_exprlang_Ast$expr__T(idx)) + "]")
67549
67501
  });
67550
67502
  $c_Lio_kaitai_struct_translators_PerlTranslator.prototype.strSubstring__Lio_kaitai_struct_exprlang_Ast$expr__Lio_kaitai_struct_exprlang_Ast$expr__Lio_kaitai_struct_exprlang_Ast$expr__T = (function(s, from, to) {
67551
- return (((((this.translate__Lio_kaitai_struct_exprlang_Ast$expr__T(s) + "[") + this.translate__Lio_kaitai_struct_exprlang_Ast$expr__T(from)) + ":") + this.translate__Lio_kaitai_struct_exprlang_Ast$expr__T(to)) + "]")
67503
+ return (((((((("substr(" + this.translate__Lio_kaitai_struct_exprlang_Ast$expr__T(s)) + ", ") + this.translate__Lio_kaitai_struct_exprlang_Ast$expr__T(from)) + ", (") + this.translate__Lio_kaitai_struct_exprlang_Ast$expr__T(to)) + ") - (") + this.translate__Lio_kaitai_struct_exprlang_Ast$expr__T(from)) + "))")
67504
+ });
67505
+ $c_Lio_kaitai_struct_translators_PerlTranslator.prototype.bytesLast__Lio_kaitai_struct_exprlang_Ast$expr__T = (function(b) {
67506
+ return (("unpack('C', substr(" + this.translate__Lio_kaitai_struct_exprlang_Ast$expr__T(b)) + ", -1, 1))")
67507
+ });
67508
+ $c_Lio_kaitai_struct_translators_PerlTranslator.prototype.bytesMax__Lio_kaitai_struct_exprlang_Ast$expr__T = (function(b) {
67509
+ var this$1 = this.importList$3;
67510
+ $m_Lio_kaitai_struct_Utils$().addUniqueAttr__scm_ListBuffer__O__V(this$1.list$1, "List::Util");
67511
+ return (("List::Util::max(unpack('C*', " + this.translate__Lio_kaitai_struct_exprlang_Ast$expr__T(b)) + "))")
67552
67512
  });
67553
67513
  $c_Lio_kaitai_struct_translators_PerlTranslator.prototype.doByteArrayNonLiteral__sc_Seq__T = (function(elts) {
67554
67514
  var jsx$1 = new $c_sjsr_AnonFunction1().init___sjs_js_Function1((function($this) {
@@ -67582,9 +67542,14 @@ $c_Lio_kaitai_struct_translators_PerlTranslator.prototype.arrayMax__Lio_kaitai_s
67582
67542
  $c_Lio_kaitai_struct_translators_PerlTranslator.prototype.kaitaiStreamSize__Lio_kaitai_struct_exprlang_Ast$expr__T = (function(value) {
67583
67543
  return (this.translate__Lio_kaitai_struct_exprlang_Ast$expr__T(value) + "->size()")
67584
67544
  });
67545
+ $c_Lio_kaitai_struct_translators_PerlTranslator.prototype.bytesMin__Lio_kaitai_struct_exprlang_Ast$expr__O = (function(b) {
67546
+ return this.bytesMin__Lio_kaitai_struct_exprlang_Ast$expr__T(b)
67547
+ });
67585
67548
  $c_Lio_kaitai_struct_translators_PerlTranslator.prototype.intToStr__Lio_kaitai_struct_exprlang_Ast$expr__Lio_kaitai_struct_exprlang_Ast$expr__T = (function(i, base) {
67586
67549
  var baseStr = this.translate__Lio_kaitai_struct_exprlang_Ast$expr__T(base);
67587
- if ((baseStr === "8")) {
67550
+ if ((baseStr === "2")) {
67551
+ var format = "%b"
67552
+ } else if ((baseStr === "8")) {
67588
67553
  var format = "%o"
67589
67554
  } else if ((baseStr === "10")) {
67590
67555
  var format = "%d"
@@ -67596,6 +67561,9 @@ $c_Lio_kaitai_struct_translators_PerlTranslator.prototype.intToStr__Lio_kaitai_s
67596
67561
  };
67597
67562
  return (((("sprintf('" + format) + "', ") + this.translate__Lio_kaitai_struct_exprlang_Ast$expr__T(i)) + ")")
67598
67563
  });
67564
+ $c_Lio_kaitai_struct_translators_PerlTranslator.prototype.bytesSubscript__Lio_kaitai_struct_exprlang_Ast$expr__Lio_kaitai_struct_exprlang_Ast$expr__T = (function(container, idx) {
67565
+ return (((("unpack('C', substr(" + this.translate__Lio_kaitai_struct_exprlang_Ast$expr__T(container)) + ", ") + this.translate__Lio_kaitai_struct_exprlang_Ast$expr__T(idx)) + ", 1))")
67566
+ });
67599
67567
  $c_Lio_kaitai_struct_translators_PerlTranslator.prototype.doName__T__T = (function(s) {
67600
67568
  return (($m_Lio_kaitai_struct_format_Identifier$().ITERATOR$1 === s) ? "$_" : (($m_Lio_kaitai_struct_format_Identifier$().ITERATOR2$1 === s) ? "$_buf" : (($m_Lio_kaitai_struct_format_Identifier$().INDEX$1 === s) ? "$i" : (s + "()"))))
67601
67569
  });
@@ -67607,12 +67575,12 @@ $c_Lio_kaitai_struct_translators_PerlTranslator.prototype.bytesToStr__T__Lio_kai
67607
67575
  $m_Lio_kaitai_struct_Utils$().addUniqueAttr__scm_ListBuffer__O__V(this$1.list$1, "Encode");
67608
67576
  return (((("Encode::decode(" + this.translate__Lio_kaitai_struct_exprlang_Ast$expr__T(encoding)) + ", ") + bytesExpr) + ")")
67609
67577
  });
67610
- $c_Lio_kaitai_struct_translators_PerlTranslator.prototype.anyField__Lio_kaitai_struct_exprlang_Ast$expr__T__T = (function(value, attrName) {
67611
- return ((this.translate__Lio_kaitai_struct_exprlang_Ast$expr__T(value) + "->") + this.doName__T__T(attrName))
67612
- });
67613
67578
  $c_Lio_kaitai_struct_translators_PerlTranslator.prototype.enumToInt__Lio_kaitai_struct_exprlang_Ast$expr__Lio_kaitai_struct_datatype_DataType$EnumType__O = (function(value, et) {
67614
67579
  return this.translate__Lio_kaitai_struct_exprlang_Ast$expr__T(value)
67615
67580
  });
67581
+ $c_Lio_kaitai_struct_translators_PerlTranslator.prototype.anyField__Lio_kaitai_struct_exprlang_Ast$expr__T__T = (function(value, attrName) {
67582
+ return ((this.translate__Lio_kaitai_struct_exprlang_Ast$expr__T(value) + "->") + this.doName__T__T(attrName))
67583
+ });
67616
67584
  $c_Lio_kaitai_struct_translators_PerlTranslator.prototype.arraySize__Lio_kaitai_struct_exprlang_Ast$expr__O = (function(a) {
67617
67585
  return this.arraySize__Lio_kaitai_struct_exprlang_Ast$expr__T(a)
67618
67586
  });
@@ -67652,6 +67620,9 @@ $c_Lio_kaitai_struct_translators_PerlTranslator.prototype.doStrCompareOp__Lio_ka
67652
67620
  $c_Lio_kaitai_struct_translators_PerlTranslator.prototype.strReverse__Lio_kaitai_struct_exprlang_Ast$expr__O = (function(s) {
67653
67621
  return this.strReverse__Lio_kaitai_struct_exprlang_Ast$expr__T(s)
67654
67622
  });
67623
+ $c_Lio_kaitai_struct_translators_PerlTranslator.prototype.bytesFirst__Lio_kaitai_struct_exprlang_Ast$expr__O = (function(b) {
67624
+ return this.bytesFirst__Lio_kaitai_struct_exprlang_Ast$expr__T(b)
67625
+ });
67655
67626
  $c_Lio_kaitai_struct_translators_PerlTranslator.prototype.doBytesCompareOp__Lio_kaitai_struct_exprlang_Ast$expr__Lio_kaitai_struct_exprlang_Ast$cmpop__Lio_kaitai_struct_exprlang_Ast$expr__T = (function(left, op, right) {
67656
67627
  return this.doStrCompareOp__Lio_kaitai_struct_exprlang_Ast$expr__Lio_kaitai_struct_exprlang_Ast$cmpop__Lio_kaitai_struct_exprlang_Ast$expr__T(left, op, right)
67657
67628
  });
@@ -67690,6 +67661,11 @@ $c_Lio_kaitai_struct_translators_PerlTranslator.prototype.doArrayLiteral__Lio_ka
67690
67661
  $c_Lio_kaitai_struct_translators_PerlTranslator.prototype.arrayLast__Lio_kaitai_struct_exprlang_Ast$expr__O = (function(a) {
67691
67662
  return this.arrayLast__Lio_kaitai_struct_exprlang_Ast$expr__T(a)
67692
67663
  });
67664
+ $c_Lio_kaitai_struct_translators_PerlTranslator.prototype.bytesMin__Lio_kaitai_struct_exprlang_Ast$expr__T = (function(b) {
67665
+ var this$1 = this.importList$3;
67666
+ $m_Lio_kaitai_struct_Utils$().addUniqueAttr__scm_ListBuffer__O__V(this$1.list$1, "List::Util");
67667
+ return (("List::Util::min(unpack('C*', " + this.translate__Lio_kaitai_struct_exprlang_Ast$expr__T(b)) + "))")
67668
+ });
67693
67669
  $c_Lio_kaitai_struct_translators_PerlTranslator.prototype.arrayMin__Lio_kaitai_struct_exprlang_Ast$expr__O = (function(a) {
67694
67670
  return this.arrayMin__Lio_kaitai_struct_exprlang_Ast$expr__T(a)
67695
67671
  });
@@ -70937,34 +70913,6 @@ $c_Lio_kaitai_struct_translators_LuaTranslator.prototype.strToInt__Lio_kaitai_st
70937
70913
  var add = ((baseStr === "10") ? "" : (", " + baseStr));
70938
70914
  return ((("tonumber(" + this.translate__Lio_kaitai_struct_exprlang_Ast$expr__T(s)) + add) + ")")
70939
70915
  });
70940
- $c_Lio_kaitai_struct_translators_LuaTranslator.prototype.doNumericCompareOp__Lio_kaitai_struct_exprlang_Ast$expr__Lio_kaitai_struct_exprlang_Ast$cmpop__Lio_kaitai_struct_exprlang_Ast$expr__T = (function(left, op, right) {
70941
- var f = (function($this) {
70942
- return (function(n$2) {
70943
- var n = $uZ(n$2);
70944
- return (n ? "1" : "0")
70945
- })
70946
- })(this);
70947
- if ((left instanceof $c_Lio_kaitai_struct_exprlang_Ast$expr$Bool)) {
70948
- var x4 = $as_Lio_kaitai_struct_exprlang_Ast$expr$Bool(left);
70949
- var l = x4.n$1;
70950
- if ((right instanceof $c_Lio_kaitai_struct_exprlang_Ast$expr$Bool)) {
70951
- var x5 = $as_Lio_kaitai_struct_exprlang_Ast$expr$Bool(right);
70952
- var r = x5.n$1;
70953
- return ((((f(l) + " ") + this.cmpOp__Lio_kaitai_struct_exprlang_Ast$cmpop__T(op)) + " ") + f(r))
70954
- }
70955
- };
70956
- if ((left instanceof $c_Lio_kaitai_struct_exprlang_Ast$expr$Bool)) {
70957
- var x7 = $as_Lio_kaitai_struct_exprlang_Ast$expr$Bool(left);
70958
- var l$2 = x7.n$1;
70959
- return ((((f(l$2) + " ") + this.cmpOp__Lio_kaitai_struct_exprlang_Ast$cmpop__T(op)) + " ") + this.translate__Lio_kaitai_struct_exprlang_Ast$expr__T(right))
70960
- };
70961
- if ((right instanceof $c_Lio_kaitai_struct_exprlang_Ast$expr$Bool)) {
70962
- var x9 = $as_Lio_kaitai_struct_exprlang_Ast$expr$Bool(right);
70963
- var r$3 = x9.n$1;
70964
- return ((((this.translate__Lio_kaitai_struct_exprlang_Ast$expr__T(left) + " ") + this.cmpOp__Lio_kaitai_struct_exprlang_Ast$cmpop__T(op)) + " ") + f(r$3))
70965
- };
70966
- return $f_Lio_kaitai_struct_translators_CommonOps__doNumericCompareOp__Lio_kaitai_struct_exprlang_Ast$expr__Lio_kaitai_struct_exprlang_Ast$cmpop__Lio_kaitai_struct_exprlang_Ast$expr__T(this, left, op, right)
70967
- });
70968
70916
  $c_Lio_kaitai_struct_translators_LuaTranslator.prototype.boolToInt__Lio_kaitai_struct_exprlang_Ast$expr__O = (function(value) {
70969
70917
  return this.boolToInt__Lio_kaitai_struct_exprlang_Ast$expr__T(value)
70970
70918
  });
@@ -79992,8 +79940,7 @@ $c_Lio_kaitai_struct_languages_LuaCompiler.prototype.condRepeatUntilFooter__Lio_
79992
79940
  this.out$2.puts__T__V("end");
79993
79941
  this.out$2.puts__T__V("i = i + 1");
79994
79942
  this.out$2.dec__V();
79995
- this.out$2.puts__T__V("end");
79996
- this.out$2.dec__V()
79943
+ this.out$2.puts__T__V("end")
79997
79944
  });
79998
79945
  $c_Lio_kaitai_struct_languages_LuaCompiler.prototype.switchEnd__V = (function() {
79999
79946
  /*<skip>*/
@@ -80210,7 +80157,7 @@ $c_Lio_kaitai_struct_languages_LuaCompiler.prototype.parseExpr__Lio_kaitai_struc
80210
80157
  } else if ((dataType instanceof $c_Lio_kaitai_struct_datatype_DataType$BitsType1)) {
80211
80158
  var x4 = $as_Lio_kaitai_struct_datatype_DataType$BitsType1(dataType);
80212
80159
  var bitEndian = x4.bitEndian$2;
80213
- return (((io + ":read_bits_int_") + bitEndian.toSuffix__T()) + "(1)")
80160
+ return (((io + ":read_bits_int_") + bitEndian.toSuffix__T()) + "(1) ~= 0")
80214
80161
  } else if ((dataType instanceof $c_Lio_kaitai_struct_datatype_DataType$BitsType)) {
80215
80162
  var x5 = $as_Lio_kaitai_struct_datatype_DataType$BitsType(dataType);
80216
80163
  var width = x5.width$3;
package/package.json CHANGED
@@ -35,5 +35,5 @@
35
35
  "scripts": {
36
36
  "test": "echo \"Error: no test specified\" && exit 1"
37
37
  },
38
- "version": "0.10.0-SNAPSHOT20220617.120542.c053fb7d"
38
+ "version": "0.10.0-SNAPSHOT20220621.211648.0a3dcbfb"
39
39
  }