loreline 0.7.1 → 0.8.1

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.
package/js/loreline.js CHANGED
@@ -725,6 +725,36 @@ class haxe_NativeStackTrace {
725
725
  }
726
726
  $hxClasses["haxe.NativeStackTrace"] = haxe_NativeStackTrace;
727
727
  haxe_NativeStackTrace.__name__ = "haxe.NativeStackTrace";
728
+ class haxe_Timer {
729
+ constructor(time_ms) {
730
+ let me = this;
731
+ this.id = setInterval(function() {
732
+ me.run();
733
+ },time_ms);
734
+ }
735
+ stop() {
736
+ if(this.id == null) {
737
+ return;
738
+ }
739
+ clearInterval(this.id);
740
+ this.id = null;
741
+ }
742
+ run() {
743
+ }
744
+ static delay(f,time_ms) {
745
+ let t = new haxe_Timer(time_ms);
746
+ t.run = function() {
747
+ t.stop();
748
+ f();
749
+ };
750
+ return t;
751
+ }
752
+ }
753
+ $hxClasses["haxe.Timer"] = haxe_Timer;
754
+ haxe_Timer.__name__ = "haxe.Timer";
755
+ Object.assign(haxe_Timer.prototype, {
756
+ __class__: haxe_Timer
757
+ });
728
758
  class haxe_ValueException extends haxe_Exception {
729
759
  constructor(value,previous,native) {
730
760
  super(String(value),previous,native);
@@ -10854,11 +10884,11 @@ class loreline_AstUtils {
10854
10884
  let bin = child;
10855
10885
  let _g = bin.op;
10856
10886
  switch(_g._hx_index) {
10857
- case 36:
10887
+ case 37:
10858
10888
  let _g1 = _g.word;
10859
10889
  bin.op = loreline_TokenType.OpAnd(true);
10860
10890
  break;
10861
- case 37:
10891
+ case 38:
10862
10892
  let _g2 = _g.word;
10863
10893
  bin.op = loreline_TokenType.OpOr(true);
10864
10894
  break;
@@ -10873,11 +10903,11 @@ class loreline_AstUtils {
10873
10903
  let bin = child;
10874
10904
  let _g = bin.op;
10875
10905
  switch(_g._hx_index) {
10876
- case 36:
10906
+ case 37:
10877
10907
  let _g1 = _g.word;
10878
10908
  bin.op = loreline_TokenType.OpAnd(false);
10879
10909
  break;
10880
- case 37:
10910
+ case 38:
10881
10911
  let _g2 = _g.word;
10882
10912
  bin.op = loreline_TokenType.OpOr(false);
10883
10913
  break;
@@ -12666,6 +12696,10 @@ class loreline_Functions {
12666
12696
  target.h["map_copy"] = $bind(this,this.map_copy);
12667
12697
  target.h["current_beat"] = $bind(this,this.current_beat);
12668
12698
  target.h["has_beat"] = $bind(this,this.has_beat);
12699
+ target.h["beat_visits"] = $bind(this,this.beat_visits);
12700
+ target.h["choices"] = $bind(this,this.choices);
12701
+ target.h["choices_disabled"] = $bind(this,this.choices_disabled);
12702
+ target.h["choices_all"] = $bind(this,this.choices_all);
12669
12703
  }
12670
12704
  rng() {
12671
12705
  if(this._random == null) {
@@ -12713,7 +12747,7 @@ class loreline_Functions {
12713
12747
  }
12714
12748
  wait(seconds) {
12715
12749
  return new loreline_Async(function(done) {
12716
- done();
12750
+ haxe_Timer.delay(done,seconds * 1000 | 0);
12717
12751
  });
12718
12752
  }
12719
12753
  float_(value) {
@@ -13014,13 +13048,17 @@ class loreline_Functions {
13014
13048
  while(i >= 0) {
13015
13049
  let scope = this.interpreter.stack[i];
13016
13050
  if(scope.beat != null) {
13017
- return scope.beat.name;
13051
+ return scope.beat;
13018
13052
  }
13019
13053
  --i;
13020
13054
  }
13021
13055
  return null;
13022
13056
  }
13023
13057
  has_beat(name) {
13058
+ if(((name) instanceof loreline_NBeatDecl)) {
13059
+ return true;
13060
+ }
13061
+ let nameStr = name;
13024
13062
  let i = this.interpreter.stack.length - 1;
13025
13063
  while(i >= 0) {
13026
13064
  let scope = this.interpreter.stack[i];
@@ -13032,7 +13070,7 @@ class loreline_Functions {
13032
13070
  ++_g;
13033
13071
  if(((node) instanceof loreline_NBeatDecl)) {
13034
13072
  let beatDecl = node;
13035
- if(beatDecl.name == name) {
13073
+ if(beatDecl.name == nameStr) {
13036
13074
  return true;
13037
13075
  }
13038
13076
  }
@@ -13040,7 +13078,67 @@ class loreline_Functions {
13040
13078
  }
13041
13079
  --i;
13042
13080
  }
13043
- return Object.prototype.hasOwnProperty.call(this.interpreter.topLevelBeats.h,name);
13081
+ return Object.prototype.hasOwnProperty.call(this.interpreter.topLevelBeats.h,nameStr);
13082
+ }
13083
+ beat_visits(name) {
13084
+ if(name == null) {
13085
+ let i = this.interpreter.stack.length - 1;
13086
+ while(i >= 0) {
13087
+ let scope = this.interpreter.stack[i];
13088
+ if(scope.beat != null) {
13089
+ return this.interpreter.getBeatVisitCount(scope.beat);
13090
+ }
13091
+ --i;
13092
+ }
13093
+ return 0;
13094
+ } else if(((name) instanceof loreline_NBeatDecl)) {
13095
+ return this.interpreter.getBeatVisitCount(name);
13096
+ } else {
13097
+ let beat = this.interpreter.resolveBeatByName(name);
13098
+ if(beat == null) {
13099
+ return 0;
13100
+ }
13101
+ return this.interpreter.getBeatVisitCount(beat);
13102
+ }
13103
+ }
13104
+ choices() {
13105
+ let texts = this.interpreter._choiceEvalTexts;
13106
+ let enabled = this.interpreter._choiceEvalEnabled;
13107
+ let result = [];
13108
+ let _g = 0;
13109
+ let _g1 = texts.length;
13110
+ while(_g < _g1) {
13111
+ let i = _g++;
13112
+ if(enabled[i]) {
13113
+ result.push(texts[i]);
13114
+ }
13115
+ }
13116
+ return result;
13117
+ }
13118
+ choices_disabled() {
13119
+ let texts = this.interpreter._choiceEvalTexts;
13120
+ let enabled = this.interpreter._choiceEvalEnabled;
13121
+ let result = [];
13122
+ let _g = 0;
13123
+ let _g1 = texts.length;
13124
+ while(_g < _g1) {
13125
+ let i = _g++;
13126
+ if(!enabled[i]) {
13127
+ result.push(texts[i]);
13128
+ }
13129
+ }
13130
+ return result;
13131
+ }
13132
+ choices_all() {
13133
+ let texts = this.interpreter._choiceEvalTexts;
13134
+ let result = [];
13135
+ let _g = 0;
13136
+ let _g1 = texts.length;
13137
+ while(_g < _g1) {
13138
+ let i = _g++;
13139
+ result.push(texts[i]);
13140
+ }
13141
+ return result;
13044
13142
  }
13045
13143
  }
13046
13144
  $hxClasses["loreline.Functions"] = loreline_Functions;
@@ -13455,6 +13553,10 @@ class loreline_HscriptInterp {
13455
13553
  if(Object.prototype.hasOwnProperty.call(this.interpreter.topLevelFunctions.h,id)) {
13456
13554
  return this.interpreter.topLevelFunctions.h[id];
13457
13555
  }
13556
+ let beat = this.interpreter.resolveBeatByName(id);
13557
+ if(beat != null) {
13558
+ return beat;
13559
+ }
13458
13560
  let e = new hscript_Error(hscript_ErrorDef.EUnknownVariable(id),this.curExpr.pmin,this.curExpr.pmax,this.curExpr.origin,this.curExpr.line);
13459
13561
  throw haxe_Exception.thrown(e);
13460
13562
  }
@@ -14105,6 +14207,8 @@ class loreline_HscriptInterp {
14105
14207
  helper = loreline_Objects.getStringHelper(this.interpreter,f);
14106
14208
  } else if(loreline_Arrays.isArray(o)) {
14107
14209
  helper = loreline_Objects.getArrayHelper(this.interpreter,f);
14210
+ } else if(((o) instanceof loreline_NBeatDecl)) {
14211
+ helper = loreline_Objects.getBeatHelper(this.interpreter,f);
14108
14212
  } else if(loreline_Objects.isFields(o)) {
14109
14213
  helper = loreline_Objects.getMapHelper(this.interpreter,f);
14110
14214
  }
@@ -14581,8 +14685,9 @@ var loreline_RuntimeAccess = $hxEnums["loreline.RuntimeAccess"] = { __ename__:"l
14581
14685
  ,ArrayAccess: ($_=function(pos,array,index) { return {_hx_index:1,pos:pos,array:array,index:index,__enum__:"loreline.RuntimeAccess",toString:$estr}; },$_._hx_name="ArrayAccess",$_.__params__ = ["pos","array","index"],$_)
14582
14686
  ,CharacterAccess: ($_=function(pos,name) { return {_hx_index:2,pos:pos,name:name,__enum__:"loreline.RuntimeAccess",toString:$estr}; },$_._hx_name="CharacterAccess",$_.__params__ = ["pos","name"],$_)
14583
14687
  ,FunctionAccess: ($_=function(pos,name) { return {_hx_index:3,pos:pos,name:name,__enum__:"loreline.RuntimeAccess",toString:$estr}; },$_._hx_name="FunctionAccess",$_.__params__ = ["pos","name"],$_)
14688
+ ,BeatAccess: ($_=function(pos,beat) { return {_hx_index:4,pos:pos,beat:beat,__enum__:"loreline.RuntimeAccess",toString:$estr}; },$_._hx_name="BeatAccess",$_.__params__ = ["pos","beat"],$_)
14584
14689
  };
14585
- loreline_RuntimeAccess.__constructs__ = [loreline_RuntimeAccess.FieldAccess,loreline_RuntimeAccess.ArrayAccess,loreline_RuntimeAccess.CharacterAccess,loreline_RuntimeAccess.FunctionAccess];
14690
+ loreline_RuntimeAccess.__constructs__ = [loreline_RuntimeAccess.FieldAccess,loreline_RuntimeAccess.ArrayAccess,loreline_RuntimeAccess.CharacterAccess,loreline_RuntimeAccess.FunctionAccess,loreline_RuntimeAccess.BeatAccess];
14586
14691
  class loreline_RuntimeScope {
14587
14692
  constructor(id,beat,node,beats,state,head,insertion) {
14588
14693
  this.insertion = null;
@@ -14694,6 +14799,8 @@ Object.assign(loreline_EvalNext.prototype, {
14694
14799
  });
14695
14800
  class loreline_Interpreter {
14696
14801
  constructor(script,handleDialogue,handleChoice,handleFinish,options) {
14802
+ this._choiceEvalEnabled = [];
14803
+ this._choiceEvalTexts = [];
14697
14804
  this.pendingChoiceOptions = null;
14698
14805
  this.beatToResume = null;
14699
14806
  this.finishTrigger = null;
@@ -14703,6 +14810,7 @@ class loreline_Interpreter {
14703
14810
  this.nextScopeId = 1;
14704
14811
  this.stack = [];
14705
14812
  this.stringLiteralProcessors = [];
14813
+ this.beatHelpers = new haxe_ds_StringMap();
14706
14814
  this.mapHelpers = new haxe_ds_StringMap();
14707
14815
  this.arrayHelpers = new haxe_ds_StringMap();
14708
14816
  this.stringHelpers = new haxe_ds_StringMap();
@@ -14778,15 +14886,20 @@ class loreline_Interpreter {
14778
14886
  throw haxe_Exception.thrown(new loreline_RuntimeError("Beat " + beatName + " not found",this.script.pos));
14779
14887
  }
14780
14888
  } else {
14781
- let decl = this.script.iterator();
14782
- while(decl.hasNext()) {
14783
- let decl1 = decl.next();
14784
- if(((decl1) instanceof loreline_NBeatDecl)) {
14785
- let beat = decl1;
14889
+ let _g = 0;
14890
+ let _g1 = this.script.body;
14891
+ while(_g < _g1.length) {
14892
+ let node = _g1[_g];
14893
+ ++_g;
14894
+ if(((node) instanceof loreline_NBeatDecl)) {
14895
+ let beat = node;
14786
14896
  if(beat.name == "_") {
14787
14897
  resolvedBeat = beat;
14898
+ break;
14899
+ }
14900
+ if(resolvedBeat == null) {
14901
+ resolvedBeat = beat;
14788
14902
  }
14789
- break;
14790
14903
  }
14791
14904
  }
14792
14905
  if(resolvedBeat == null) {
@@ -14794,8 +14907,14 @@ class loreline_Interpreter {
14794
14907
  while(decl.hasNext()) {
14795
14908
  let decl1 = decl.next();
14796
14909
  if(((decl1) instanceof loreline_NBeatDecl)) {
14797
- resolvedBeat = decl1;
14798
- break;
14910
+ let beat = decl1;
14911
+ if(beat.name == "_") {
14912
+ resolvedBeat = beat;
14913
+ break;
14914
+ }
14915
+ if(resolvedBeat == null) {
14916
+ resolvedBeat = beat;
14917
+ }
14799
14918
  }
14800
14919
  }
14801
14920
  }
@@ -14828,6 +14947,20 @@ class loreline_Interpreter {
14828
14947
  }
14829
14948
  result.pendingChoiceOptions = _g;
14830
14949
  }
14950
+ if(this._choiceEvalTexts.length > 0) {
14951
+ let _g = [];
14952
+ let _g1 = 0;
14953
+ let _g2 = this._choiceEvalTexts.length;
14954
+ while(_g1 < _g2) {
14955
+ let i = _g1++;
14956
+ let entry = { text : this._choiceEvalTexts[i]};
14957
+ if(!this._choiceEvalEnabled[i]) {
14958
+ entry.disabled = true;
14959
+ }
14960
+ _g.push(entry);
14961
+ }
14962
+ result.choiceEvalContext = _g;
14963
+ }
14831
14964
  if(Reflect.fields(insertions).length > 0) {
14832
14965
  result.insertions = insertions;
14833
14966
  }
@@ -14842,6 +14975,8 @@ class loreline_Interpreter {
14842
14975
  this.nextScopeId = 1;
14843
14976
  this.nextInsertionId = 1;
14844
14977
  this.pendingChoiceOptions = null;
14978
+ this._choiceEvalTexts.length = 0;
14979
+ this._choiceEvalEnabled.length = 0;
14845
14980
  this.restoreState(this.topLevelState,saveData.state);
14846
14981
  this.restoreCharacters(saveData.characters);
14847
14982
  this.restoreNodeStates(saveData.nodeStates);
@@ -14862,6 +14997,18 @@ class loreline_Interpreter {
14862
14997
  }
14863
14998
  }
14864
14999
  }
15000
+ if(saveData.choiceEvalContext != null) {
15001
+ this._choiceEvalTexts.length = 0;
15002
+ this._choiceEvalEnabled.length = 0;
15003
+ let _g = 0;
15004
+ let _g1 = saveData.choiceEvalContext;
15005
+ while(_g < _g1.length) {
15006
+ let entry = _g1[_g];
15007
+ ++_g;
15008
+ this._choiceEvalTexts.push(entry.text);
15009
+ this._choiceEvalEnabled.push(entry.disabled != true);
15010
+ }
15011
+ }
14865
15012
  }
14866
15013
  resume() {
14867
15014
  if(this.stack.length == 0) {
@@ -14899,6 +15046,72 @@ class loreline_Interpreter {
14899
15046
  let fields = this.topLevelCharacters.h[character].fields;
14900
15047
  loreline_Objects.setField(this,fields,name,value);
14901
15048
  }
15049
+ getStateField(name) {
15050
+ let i = this.stack.length - 1;
15051
+ while(i >= 0) {
15052
+ let scope = this.stack[i];
15053
+ if(scope.state != null) {
15054
+ if(loreline_Objects.fieldExists(this,scope.state.fields,name)) {
15055
+ return loreline_Objects.getField(this,scope.state.fields,name);
15056
+ }
15057
+ }
15058
+ if(scope.node != null) {
15059
+ let key = scope.node.id.thisVal;
15060
+ let stateInNode = this.nodeStates.map._get(key.high,key.low);
15061
+ if(stateInNode != null) {
15062
+ if(loreline_Objects.fieldExists(this,stateInNode.fields,name)) {
15063
+ return loreline_Objects.getField(this,stateInNode.fields,name);
15064
+ }
15065
+ }
15066
+ }
15067
+ --i;
15068
+ }
15069
+ if(loreline_Objects.fieldExists(this,this.topLevelState.fields,name)) {
15070
+ return loreline_Objects.getField(this,this.topLevelState.fields,name);
15071
+ }
15072
+ return null;
15073
+ }
15074
+ setStateField(name,value) {
15075
+ let i = this.stack.length - 1;
15076
+ while(i >= 0) {
15077
+ let scope = this.stack[i];
15078
+ if(scope.state != null) {
15079
+ if(loreline_Objects.fieldExists(this,scope.state.fields,name)) {
15080
+ loreline_Objects.setField(this,scope.state.fields,name,value);
15081
+ return;
15082
+ }
15083
+ }
15084
+ if(scope.node != null) {
15085
+ let key = scope.node.id.thisVal;
15086
+ let stateInNode = this.nodeStates.map._get(key.high,key.low);
15087
+ if(stateInNode != null) {
15088
+ if(loreline_Objects.fieldExists(this,stateInNode.fields,name)) {
15089
+ loreline_Objects.setField(this,stateInNode.fields,name,value);
15090
+ return;
15091
+ }
15092
+ }
15093
+ }
15094
+ --i;
15095
+ }
15096
+ loreline_Objects.setField(this,this.topLevelState.fields,name,value);
15097
+ }
15098
+ getTopLevelStateField(name) {
15099
+ return loreline_Objects.getField(this,this.topLevelState.fields,name);
15100
+ }
15101
+ setTopLevelStateField(name,value) {
15102
+ loreline_Objects.setField(this,this.topLevelState.fields,name,value);
15103
+ }
15104
+ currentNode() {
15105
+ let scope = this.get_currentScope();
15106
+ if(scope == null) {
15107
+ return null;
15108
+ }
15109
+ if(scope.head != null) {
15110
+ return scope.head;
15111
+ } else {
15112
+ return scope.node;
15113
+ }
15114
+ }
14902
15115
  serializeScope(scope,insertions) {
14903
15116
  let result = { id : scope.id};
14904
15117
  if(scope.beat != null) {
@@ -15670,6 +15883,8 @@ class loreline_Interpreter {
15670
15883
  this.arrayHelpers.h[HxOverrides.substr(key1,6,null)] = func;
15671
15884
  } else if(key1.startsWith("map_")) {
15672
15885
  this.mapHelpers.h[HxOverrides.substr(key1,4,null)] = func;
15886
+ } else if(key1.startsWith("beat_")) {
15887
+ this.beatHelpers.h[HxOverrides.substr(key1,5,null)] = func;
15673
15888
  }
15674
15889
  }
15675
15890
  }
@@ -15852,6 +16067,8 @@ class loreline_Interpreter {
15852
16067
  this.nextScopeId = 1;
15853
16068
  this.nextInsertionId = 1;
15854
16069
  this.pendingChoiceOptions = null;
16070
+ this._choiceEvalTexts.length = 0;
16071
+ this._choiceEvalEnabled.length = 0;
15855
16072
  let done = this.wrapNext($bind(this,this.finish));
15856
16073
  this.finishTrigger = done;
15857
16074
  this.evalBeatRun(beat,done.cb);
@@ -15931,6 +16148,7 @@ class loreline_Interpreter {
15931
16148
  moveNext();
15932
16149
  }
15933
16150
  evalBeatRun(beat,next) {
16151
+ this.incrementBeatVisitCount(beat);
15934
16152
  this.evalNodeBody(beat,beat,beat.body,null,next);
15935
16153
  }
15936
16154
  evalStateDecl(state,next) {
@@ -15959,6 +16177,15 @@ class loreline_Interpreter {
15959
16177
  let restoredOptions = this.pendingChoiceOptions;
15960
16178
  if(restoredOptions != null) {
15961
16179
  this.pendingChoiceOptions = null;
16180
+ this._choiceEvalTexts.length = 0;
16181
+ this._choiceEvalEnabled.length = 0;
16182
+ let _g = 0;
16183
+ while(_g < restoredOptions.length) {
16184
+ let opt = restoredOptions[_g];
16185
+ ++_g;
16186
+ this._choiceEvalTexts.push(opt.text);
16187
+ this._choiceEvalEnabled.push(opt.enabled);
16188
+ }
15962
16189
  this.presentChoice(choice,restoredOptions,next);
15963
16190
  return;
15964
16191
  }
@@ -15990,10 +16217,21 @@ class loreline_Interpreter {
15990
16217
  }
15991
16218
  let index = -1;
15992
16219
  let _gthis = this;
16220
+ let clearChoiceEval = function() {
16221
+ _gthis._choiceEvalTexts.length = 0;
16222
+ _gthis._choiceEvalEnabled.length = 0;
16223
+ };
15993
16224
  let choiceCallback = this.wrapNext(function() {
15994
16225
  _gthis.pendingChoiceOptions = null;
15995
16226
  if(index >= 0 && index < options.length) {
15996
16227
  let option = options[index];
16228
+ if(option.node.once) {
16229
+ _gthis.setChoiceOptionChosen(option.node);
16230
+ }
16231
+ let wrappedNext = function() {
16232
+ clearChoiceEval();
16233
+ next();
16234
+ };
15997
16235
  if(option.insertion != null) {
15998
16236
  let scopeLevel = _gthis.stack.length;
15999
16237
  while(_gthis.stack.length > 0) _gthis.stack.pop();
@@ -16009,11 +16247,12 @@ class loreline_Interpreter {
16009
16247
  }
16010
16248
  let lastScope = _gthis.stack[_gthis.stack.length - 1];
16011
16249
  _gthis.push(new loreline_RuntimeScope(null,lastScope.beat,_gthis.lens.getParentNode(option.node),null,null,option.node,null));
16012
- _gthis.resumeFromLevel(scopeLevel,next);
16250
+ _gthis.resumeFromLevel(scopeLevel,wrappedNext);
16013
16251
  } else {
16014
- _gthis.evalChoiceOption(option.node,next);
16252
+ _gthis.evalChoiceOption(option.node,wrappedNext);
16015
16253
  }
16016
16254
  } else {
16255
+ clearChoiceEval();
16017
16256
  next();
16018
16257
  }
16019
16258
  });
@@ -16025,6 +16264,8 @@ class loreline_Interpreter {
16025
16264
  }
16026
16265
  evalChoiceOptionsAndInsertions(beat,choice,result,next,startIndex) {
16027
16266
  let options = choice.options;
16267
+ this._choiceEvalTexts.length = 0;
16268
+ this._choiceEvalEnabled.length = 0;
16028
16269
  let index = startIndex != null ? startIndex : 0;
16029
16270
  let moveNext = null;
16030
16271
  let insertion = null;
@@ -16037,26 +16278,35 @@ class loreline_Interpreter {
16037
16278
  let i = _g++;
16038
16279
  let opt = insertion.options[i];
16039
16280
  result.push(opt);
16281
+ _gthis._choiceEvalTexts.push(opt.text);
16282
+ _gthis._choiceEvalEnabled.push(opt.enabled);
16040
16283
  }
16041
16284
  insertion = null;
16042
16285
  }
16043
16286
  if(index < options.length) {
16044
16287
  let option = options[index];
16045
16288
  index += 1;
16046
- let enabled = option.condition == null || _gthis.evaluateCondition(option.condition);
16289
+ let onceDisabled = option.once && _gthis.isChoiceOptionChosen(option);
16290
+ let enabled = !onceDisabled && (option.condition == null || _gthis.evaluateCondition(option.condition));
16047
16291
  if(option.text != null) {
16048
16292
  let done = _gthis.wrapNext(moveNext);
16049
16293
  let str = _gthis.getTranslatedString(option,option.text);
16050
16294
  let content = _gthis.evaluateString(str);
16051
16295
  result.push(new loreline_ChoiceOption(content.text,content.tags,enabled,option,_gthis.get_currentInsertion()));
16296
+ _gthis._choiceEvalTexts.push(content.text);
16297
+ _gthis._choiceEvalEnabled.push(enabled);
16052
16298
  done.cb();
16053
16299
  done.sync = false;
16054
16300
  } else if(option.insertion != null) {
16055
16301
  let done = _gthis.wrapNext(moveNext);
16056
- insertion = new loreline_RuntimeInsertion(_gthis.nextInsertionId++,option.insertion);
16057
- insertion.parentPartialOptions = [].concat(result);
16058
- insertion.parentNextOptionIndex = index;
16059
- _gthis.evalInsertion(insertion,done.cb);
16302
+ if(!enabled) {
16303
+ done.cb();
16304
+ } else {
16305
+ insertion = new loreline_RuntimeInsertion(_gthis.nextInsertionId++,option.insertion);
16306
+ insertion.parentPartialOptions = [].concat(result);
16307
+ insertion.parentNextOptionIndex = index;
16308
+ _gthis.evalInsertion(insertion,done.cb);
16309
+ }
16060
16310
  done.sync = false;
16061
16311
  } else {
16062
16312
  throw haxe_Exception.thrown(new loreline_RuntimeError("Invalid choice option",option.pos));
@@ -16169,6 +16419,30 @@ class loreline_Interpreter {
16169
16419
  _gthis.evalShuffledItems(alt,indices,idx + 1,next);
16170
16420
  });
16171
16421
  }
16422
+ getBeatVisitCount(beat) {
16423
+ let key = beat.id.thisVal;
16424
+ let state = this.nodeStates.map._get(key.high,key.low);
16425
+ if(state == null) {
16426
+ return 0;
16427
+ }
16428
+ let count = loreline_Objects.getField(this,state.fields,"_visitCount");
16429
+ if(count == null) {
16430
+ return 0;
16431
+ }
16432
+ return count;
16433
+ }
16434
+ incrementBeatVisitCount(beat) {
16435
+ let key = beat.id.thisVal;
16436
+ let state = this.nodeStates.map._get(key.high,key.low);
16437
+ if(state == null) {
16438
+ state = new loreline_RuntimeState(this,beat,null,null);
16439
+ let key = beat.id.thisVal;
16440
+ this.nodeStates.map._set(key.high,key.low,state);
16441
+ }
16442
+ let tmp = loreline_Objects.getField(this,state.fields,"_visitCount");
16443
+ let count = tmp != null ? tmp : 0;
16444
+ loreline_Objects.setField(this,state.fields,"_visitCount",count + 1);
16445
+ }
16172
16446
  getAlternativeVisitCount(alt) {
16173
16447
  let key = alt.id.thisVal;
16174
16448
  let state = this.nodeStates.map._get(key.high,key.low);
@@ -16191,14 +16465,33 @@ class loreline_Interpreter {
16191
16465
  }
16192
16466
  loreline_Objects.setField(this,state.fields,"_visitCount",count);
16193
16467
  }
16468
+ isChoiceOptionChosen(option) {
16469
+ let key = option.id.thisVal;
16470
+ let state = this.nodeStates.map._get(key.high,key.low);
16471
+ if(state == null) {
16472
+ return false;
16473
+ }
16474
+ let chosen = loreline_Objects.getField(this,state.fields,"_chosen");
16475
+ if(chosen == null) {
16476
+ return false;
16477
+ }
16478
+ return chosen;
16479
+ }
16480
+ setChoiceOptionChosen(option) {
16481
+ let key = option.id.thisVal;
16482
+ let state = this.nodeStates.map._get(key.high,key.low);
16483
+ if(state == null) {
16484
+ state = new loreline_RuntimeState(this,option,null,null);
16485
+ let key = option.id.thisVal;
16486
+ this.nodeStates.map._set(key.high,key.low,state);
16487
+ }
16488
+ loreline_Objects.setField(this,state.fields,"_chosen",true);
16489
+ }
16194
16490
  evalAssignment(assign,next) {
16195
16491
  let target = this.resolveAssignmentTarget(assign.target);
16196
16492
  let value = this.evaluateExpression(assign.value);
16197
16493
  let currentValue;
16198
16494
  switch(assign.op._hx_index) {
16199
- case 20:
16200
- currentValue = value;
16201
- break;
16202
16495
  case 21:
16203
16496
  currentValue = this.performOperation(loreline_TokenType.OpPlus,this.readAccess(target),value,assign.pos);
16204
16497
  break;
@@ -16211,6 +16504,9 @@ class loreline_Interpreter {
16211
16504
  case 24:
16212
16505
  currentValue = this.performOperation(loreline_TokenType.OpDivide,this.readAccess(target),value,assign.pos);
16213
16506
  break;
16507
+ case 20:case 25:
16508
+ currentValue = value;
16509
+ break;
16214
16510
  default:
16215
16511
  throw haxe_Exception.thrown(new loreline_RuntimeError("Invalid assignment operator",assign.pos));
16216
16512
  }
@@ -16300,6 +16596,20 @@ class loreline_Interpreter {
16300
16596
  }
16301
16597
  return false;
16302
16598
  }
16599
+ resolveBeatByName(name,scopeLevel) {
16600
+ if(scopeLevel == null) {
16601
+ scopeLevel = -1;
16602
+ }
16603
+ let i = scopeLevel == -1 ? this.stack.length - 1 : scopeLevel;
16604
+ while(i >= 0) {
16605
+ let b = this.stack[i].beatByName(name);
16606
+ if(b != null) {
16607
+ return b;
16608
+ }
16609
+ --i;
16610
+ }
16611
+ return this.topLevelBeats.h[name];
16612
+ }
16303
16613
  resolveBeatFromCall(call,scopeLevel) {
16304
16614
  if(scopeLevel == null) {
16305
16615
  scopeLevel = -1;
@@ -16307,21 +16617,7 @@ class loreline_Interpreter {
16307
16617
  if(((call.target) instanceof loreline_NAccess)) {
16308
16618
  let access = call.target;
16309
16619
  if(access.target == null) {
16310
- let beatName = access.name;
16311
- let resolvedBeat = null;
16312
- let i = scopeLevel == -1 ? this.stack.length - 1 : scopeLevel;
16313
- while(i >= 0) {
16314
- let scope = this.stack[i];
16315
- let beatInScope = scope.beatByName(beatName);
16316
- if(beatInScope != null) {
16317
- resolvedBeat = beatInScope;
16318
- break;
16319
- }
16320
- --i;
16321
- }
16322
- if(resolvedBeat == null && Object.prototype.hasOwnProperty.call(this.topLevelBeats.h,beatName)) {
16323
- resolvedBeat = this.topLevelBeats.h[beatName];
16324
- }
16620
+ let resolvedBeat = this.resolveBeatByName(access.name,scopeLevel);
16325
16621
  if(resolvedBeat != null) {
16326
16622
  return resolvedBeat;
16327
16623
  }
@@ -16909,6 +17205,8 @@ class loreline_Interpreter {
16909
17205
  helper = loreline_Objects.getStringHelper(this,access.name);
16910
17206
  } else if(loreline_Arrays.isArray(obj)) {
16911
17207
  helper = loreline_Objects.getArrayHelper(this,access.name);
17208
+ } else if(((obj) instanceof loreline_NBeatDecl)) {
17209
+ helper = loreline_Objects.getBeatHelper(this,access.name);
16912
17210
  } else if(loreline_Objects.isFields(obj)) {
16913
17211
  helper = loreline_Objects.getMapHelper(this,access.name);
16914
17212
  }
@@ -17055,11 +17353,20 @@ class loreline_Interpreter {
17055
17353
  return this.evaluateString(str).text;
17056
17354
  }
17057
17355
  break;
17356
+ case loreline_NTernary:
17357
+ let ternary = expr;
17358
+ let condValue = this.evaluateCondition(ternary.condition);
17359
+ if(condValue) {
17360
+ return this.evaluateExpression(ternary.trueExpr);
17361
+ } else {
17362
+ return this.evaluateExpression(ternary.falseExpr);
17363
+ }
17364
+ break;
17058
17365
  case loreline_NUnary:
17059
17366
  let un = expr;
17060
17367
  let operand = this.evaluateExpression(un.operand);
17061
17368
  switch(un.op._hx_index) {
17062
- case 26:
17369
+ case 27:
17063
17370
  if(typeof(operand) == "number" && ((operand | 0) === operand)) {
17064
17371
  let v = operand;
17065
17372
  return -v;
@@ -17070,7 +17377,7 @@ class loreline_Interpreter {
17070
17377
  throw haxe_Exception.thrown(new loreline_RuntimeError("Invalid unary operation",un.pos));
17071
17378
  }
17072
17379
  break;
17073
- case 38:
17380
+ case 39:
17074
17381
  if(typeof(operand) == "boolean") {
17075
17382
  let v = operand;
17076
17383
  return !v;
@@ -17140,6 +17447,10 @@ class loreline_Interpreter {
17140
17447
  throw haxe_Exception.thrown(new loreline_RuntimeError("Function not found: " + name2,pos3));
17141
17448
  }
17142
17449
  break;
17450
+ case 4:
17451
+ let pos4 = access.pos;
17452
+ let beat = access.beat;
17453
+ return beat;
17143
17454
  }
17144
17455
  }
17145
17456
  writeAccess(access,value) {
@@ -17167,6 +17478,10 @@ class loreline_Interpreter {
17167
17478
  let pos3 = access.pos;
17168
17479
  let name2 = access.name;
17169
17480
  throw haxe_Exception.thrown(new loreline_RuntimeError("Cannot overwrite function: " + name2,pos3));
17481
+ case 4:
17482
+ let pos4 = access.pos;
17483
+ let beat = access.beat;
17484
+ throw haxe_Exception.thrown(new loreline_RuntimeError("Cannot overwrite beat: " + beat.name,pos4));
17170
17485
  }
17171
17486
  }
17172
17487
  resolveAssignmentTarget(target) {
@@ -17181,6 +17496,11 @@ class loreline_Interpreter {
17181
17496
  if(loreline_Arrays.isArray(target1) && (typeof(index) == "number" && ((index | 0) === index) || typeof(index) == "number")) {
17182
17497
  let i = index | 0;
17183
17498
  return loreline_RuntimeAccess.ArrayAccess(arrAccess.pos,target1,i);
17499
+ } else if(typeof(index) == "string") {
17500
+ if(target1 == null) {
17501
+ throw haxe_Exception.thrown(new loreline_RuntimeError("Cannot access field '" + (index == null ? "null" : Std.string(index)) + "' of null",arrAccess.pos));
17502
+ }
17503
+ return loreline_RuntimeAccess.FieldAccess(arrAccess.pos,target1,index);
17184
17504
  } else {
17185
17505
  throw haxe_Exception.thrown(new loreline_RuntimeError("Invalid array access target",arrAccess.pos));
17186
17506
  }
@@ -17271,6 +17591,19 @@ class loreline_Interpreter {
17271
17591
  }
17272
17592
  return loreline_RuntimeAccess.FunctionAccess(tmp1 != null ? tmp1 : this.script.pos,name);
17273
17593
  }
17594
+ let beat = this.resolveBeatByName(name);
17595
+ if(beat != null) {
17596
+ let tmp = access != null ? access.pos : null;
17597
+ let tmp1;
17598
+ if(tmp != null) {
17599
+ tmp1 = tmp;
17600
+ } else {
17601
+ let tmp = this.get_currentScope();
17602
+ let tmp2 = tmp != null ? tmp.node : null;
17603
+ tmp1 = tmp2 != null ? tmp2.pos : null;
17604
+ }
17605
+ return loreline_RuntimeAccess.BeatAccess(tmp1 != null ? tmp1 : this.script.pos,beat);
17606
+ }
17274
17607
  if(!this.strictAccess) {
17275
17608
  let tmp = access != null ? access.pos : null;
17276
17609
  let tmp1;
@@ -17322,7 +17655,7 @@ class loreline_Interpreter {
17322
17655
  let leftType = Type.typeof(left);
17323
17656
  let rightType = Type.typeof(right);
17324
17657
  switch(op._hx_index) {
17325
- case 25:
17658
+ case 26:
17326
17659
  switch(leftType._hx_index) {
17327
17660
  case 1:
17328
17661
  switch(rightType._hx_index) {
@@ -17459,7 +17792,7 @@ class loreline_Interpreter {
17459
17792
  }
17460
17793
  }
17461
17794
  break;
17462
- case 26:case 27:case 28:case 29:
17795
+ case 27:case 28:case 29:case 30:
17463
17796
  switch(leftType._hx_index) {
17464
17797
  case 1:case 2:
17465
17798
  switch(rightType._hx_index) {
@@ -17467,11 +17800,11 @@ class loreline_Interpreter {
17467
17800
  let leftNum = parseFloat(Std.string(left));
17468
17801
  let rightNum = parseFloat(Std.string(right));
17469
17802
  switch(op._hx_index) {
17470
- case 26:
17471
- return leftNum - rightNum;
17472
17803
  case 27:
17473
- return leftNum * rightNum;
17804
+ return leftNum - rightNum;
17474
17805
  case 28:
17806
+ return leftNum * rightNum;
17807
+ case 29:
17475
17808
  if(rightNum == 0) {
17476
17809
  let tmp = pos;
17477
17810
  let tmp1;
@@ -17485,7 +17818,7 @@ class loreline_Interpreter {
17485
17818
  throw haxe_Exception.thrown(new loreline_RuntimeError("Division by zero",tmp1 != null ? tmp1 : this.script.pos));
17486
17819
  }
17487
17820
  return leftNum / rightNum;
17488
- case 29:
17821
+ case 30:
17489
17822
  if(rightNum == 0) {
17490
17823
  let tmp = pos;
17491
17824
  let tmp1;
@@ -17506,16 +17839,16 @@ class loreline_Interpreter {
17506
17839
  default:
17507
17840
  let opName;
17508
17841
  switch(op._hx_index) {
17509
- case 26:
17842
+ case 27:
17510
17843
  opName = "subtract";
17511
17844
  break;
17512
- case 27:
17845
+ case 28:
17513
17846
  opName = "multiply";
17514
17847
  break;
17515
- case 28:
17848
+ case 29:
17516
17849
  opName = "divide";
17517
17850
  break;
17518
- case 29:
17851
+ case 30:
17519
17852
  opName = "modulo";
17520
17853
  break;
17521
17854
  default:
@@ -17537,16 +17870,16 @@ class loreline_Interpreter {
17537
17870
  default:
17538
17871
  let opName1;
17539
17872
  switch(op._hx_index) {
17540
- case 26:
17873
+ case 27:
17541
17874
  opName1 = "subtract";
17542
17875
  break;
17543
- case 27:
17876
+ case 28:
17544
17877
  opName1 = "multiply";
17545
17878
  break;
17546
- case 28:
17879
+ case 29:
17547
17880
  opName1 = "divide";
17548
17881
  break;
17549
- case 29:
17882
+ case 30:
17550
17883
  opName1 = "modulo";
17551
17884
  break;
17552
17885
  default:
@@ -17565,17 +17898,18 @@ class loreline_Interpreter {
17565
17898
  throw haxe_Exception.thrown(new loreline_RuntimeError(tmp9,tmp11 != null ? tmp11 : this.script.pos));
17566
17899
  }
17567
17900
  break;
17568
- case 30:case 31:
17901
+ case 31:case 32:
17902
+ let result = ((left) instanceof loreline_NBeatDecl) && typeof(right) == "string" ? left.name == right : typeof(left) == "string" && ((right) instanceof loreline_NBeatDecl) ? left == right.name : ((left) instanceof loreline_NBeatDecl) && ((right) instanceof loreline_NBeatDecl) ? left.name == right.name : left == right;
17569
17903
  switch(op._hx_index) {
17570
- case 30:
17571
- return left == right;
17572
17904
  case 31:
17573
- return left != right;
17905
+ return result;
17906
+ case 32:
17907
+ return !result;
17574
17908
  default:
17575
17909
  throw haxe_Exception.thrown("Unreachable");
17576
17910
  }
17577
17911
  break;
17578
- case 32:case 33:case 34:case 35:
17912
+ case 33:case 34:case 35:case 36:
17579
17913
  switch(leftType._hx_index) {
17580
17914
  case 1:case 2:
17581
17915
  switch(rightType._hx_index) {
@@ -17583,13 +17917,13 @@ class loreline_Interpreter {
17583
17917
  let leftNum1 = parseFloat(Std.string(left));
17584
17918
  let rightNum1 = parseFloat(Std.string(right));
17585
17919
  switch(op._hx_index) {
17586
- case 32:
17587
- return leftNum1 > rightNum1;
17588
17920
  case 33:
17589
- return leftNum1 < rightNum1;
17921
+ return leftNum1 > rightNum1;
17590
17922
  case 34:
17591
- return leftNum1 >= rightNum1;
17923
+ return leftNum1 < rightNum1;
17592
17924
  case 35:
17925
+ return leftNum1 >= rightNum1;
17926
+ case 36:
17593
17927
  return leftNum1 <= rightNum1;
17594
17928
  default:
17595
17929
  throw haxe_Exception.thrown("Unreachable");
@@ -17623,12 +17957,12 @@ class loreline_Interpreter {
17623
17957
  throw haxe_Exception.thrown(new loreline_RuntimeError(tmp15,tmp17 != null ? tmp17 : this.script.pos));
17624
17958
  }
17625
17959
  break;
17626
- case 36:
17960
+ case 37:
17627
17961
  let _g = op.word;
17628
17962
  if(leftType._hx_index == 3) {
17629
17963
  if(rightType._hx_index == 3) {
17630
17964
  switch(op._hx_index) {
17631
- case 36:
17965
+ case 37:
17632
17966
  let _g = op.word;
17633
17967
  if(left) {
17634
17968
  return right;
@@ -17636,7 +17970,7 @@ class loreline_Interpreter {
17636
17970
  return false;
17637
17971
  }
17638
17972
  break;
17639
- case 37:
17973
+ case 38:
17640
17974
  let _g1 = op.word;
17641
17975
  if(!left) {
17642
17976
  return right;
@@ -17674,12 +18008,12 @@ class loreline_Interpreter {
17674
18008
  throw haxe_Exception.thrown(new loreline_RuntimeError(tmp,tmp2 != null ? tmp2 : this.script.pos));
17675
18009
  }
17676
18010
  break;
17677
- case 37:
18011
+ case 38:
17678
18012
  let _g1 = op.word;
17679
18013
  if(leftType._hx_index == 3) {
17680
18014
  if(rightType._hx_index == 3) {
17681
18015
  switch(op._hx_index) {
17682
- case 36:
18016
+ case 37:
17683
18017
  let _g = op.word;
17684
18018
  if(left) {
17685
18019
  return right;
@@ -17687,7 +18021,7 @@ class loreline_Interpreter {
17687
18021
  return false;
17688
18022
  }
17689
18023
  break;
17690
- case 37:
18024
+ case 38:
17691
18025
  let _g1 = op.word;
17692
18026
  if(!left) {
17693
18027
  return right;
@@ -17740,10 +18074,88 @@ class loreline_Interpreter {
17740
18074
  }
17741
18075
  }
17742
18076
  valueToString(value) {
18077
+ return this.valueToStringImpl(value,null);
18078
+ }
18079
+ valueToStringImpl(value,seen) {
17743
18080
  if(value == null) {
17744
18081
  return "null";
17745
- } else {
17746
- return Std.string(value);
18082
+ }
18083
+ if(typeof(value) == "string") {
18084
+ return value;
18085
+ }
18086
+ if(typeof(value) == "boolean" || typeof(value) == "number" && ((value | 0) === value) || typeof(value) == "number") {
18087
+ if(value == null) {
18088
+ return "null";
18089
+ } else {
18090
+ return Std.string(value);
18091
+ }
18092
+ }
18093
+ if(seen == null) {
18094
+ seen = [];
18095
+ }
18096
+ let _g = 0;
18097
+ while(_g < seen.length) {
18098
+ let s = seen[_g];
18099
+ ++_g;
18100
+ if(s == value) {
18101
+ return "...";
18102
+ }
18103
+ }
18104
+ seen.push(value);
18105
+ if(loreline_Arrays.isArray(value)) {
18106
+ let len = loreline_Arrays.arrayLength(value);
18107
+ let buf_b = "";
18108
+ buf_b += "[";
18109
+ let _g = 0;
18110
+ let _g1 = len;
18111
+ while(_g < _g1) {
18112
+ let i = _g++;
18113
+ if(i > 0) {
18114
+ buf_b += ", ";
18115
+ }
18116
+ buf_b += Std.string(this.valueToStringImpl(loreline_Arrays.arrayGet(value,i),seen));
18117
+ }
18118
+ buf_b += "]";
18119
+ seen.pop();
18120
+ return buf_b;
18121
+ }
18122
+ if(((value) instanceof loreline_NBeatDecl)) {
18123
+ seen.pop();
18124
+ return value.name;
18125
+ }
18126
+ if(loreline_Objects.isFields(value)) {
18127
+ let keys = loreline_Objects.getFields(this,value);
18128
+ keys.sort(function(a,b) {
18129
+ if(a < b) {
18130
+ return -1;
18131
+ } else if(a > b) {
18132
+ return 1;
18133
+ } else {
18134
+ return 0;
18135
+ }
18136
+ });
18137
+ let buf_b = "";
18138
+ buf_b += "{";
18139
+ let _g = 0;
18140
+ let _g1 = keys.length;
18141
+ while(_g < _g1) {
18142
+ let i = _g++;
18143
+ if(i > 0) {
18144
+ buf_b += ", ";
18145
+ }
18146
+ buf_b += Std.string(keys[i]);
18147
+ buf_b += ": ";
18148
+ buf_b += Std.string(this.valueToStringImpl(loreline_Objects.getField(this,value,keys[i]),seen));
18149
+ }
18150
+ buf_b += "}";
18151
+ seen.pop();
18152
+ return buf_b;
18153
+ }
18154
+ seen.pop();
18155
+ if(value == null) {
18156
+ return "null";
18157
+ } else {
18158
+ return Std.string(value);
17747
18159
  }
17748
18160
  }
17749
18161
  printLoreline(node) {
@@ -17775,6 +18187,686 @@ class loreline_Json {
17775
18187
  }
17776
18188
  $hxClasses["loreline.Json"] = loreline_Json;
17777
18189
  loreline_Json.__name__ = "loreline.Json";
18190
+ class loreline_JsonToAst {
18191
+ static scriptFromJson(json) {
18192
+ if(json == null) {
18193
+ throw haxe_Exception.thrown("Cannot create Script from null JSON");
18194
+ }
18195
+ let nodeType = json.type;
18196
+ if(nodeType != "Script") {
18197
+ throw haxe_Exception.thrown("Expected Script node, got: " + nodeType);
18198
+ }
18199
+ let id = loreline_JsonToAst.idFromJson(json);
18200
+ let pos = loreline_JsonToAst.positionFromJson(json.pos);
18201
+ let bodyArr = json.body;
18202
+ let _g = [];
18203
+ let _g1 = 0;
18204
+ while(_g1 < bodyArr.length) {
18205
+ let item = bodyArr[_g1];
18206
+ ++_g1;
18207
+ _g.push(loreline_JsonToAst.nodeFromJson(item));
18208
+ }
18209
+ let body = _g;
18210
+ let script = new loreline_Script(id,pos,body);
18211
+ script.indentSize = json.indentSize != null ? json.indentSize : 2;
18212
+ loreline_JsonToAst.applyComments(script,json);
18213
+ return script;
18214
+ }
18215
+ static nodeFromJson(json) {
18216
+ if(json == null) {
18217
+ return null;
18218
+ }
18219
+ let nodeType = json.type;
18220
+ switch(nodeType) {
18221
+ case "Access":
18222
+ return loreline_JsonToAst.accessFromJson(json);
18223
+ case "Alternative":
18224
+ return loreline_JsonToAst.alternativeFromJson(json);
18225
+ case "ArrayAccess":
18226
+ return loreline_JsonToAst.arrayAccessFromJson(json);
18227
+ case "Assign":
18228
+ return loreline_JsonToAst.assignFromJson(json);
18229
+ case "Beat":
18230
+ return loreline_JsonToAst.beatFromJson(json);
18231
+ case "Binary":
18232
+ return loreline_JsonToAst.binaryFromJson(json);
18233
+ case "Block":
18234
+ return loreline_JsonToAst.blockFromJson(json);
18235
+ case "Call":
18236
+ return loreline_JsonToAst.callFromJson(json);
18237
+ case "Character":
18238
+ return loreline_JsonToAst.characterFromJson(json);
18239
+ case "Choice":
18240
+ return loreline_JsonToAst.choiceStatementFromJson(json);
18241
+ case "Comment":
18242
+ return loreline_JsonToAst.commentFromJson(json);
18243
+ case "Dialogue":
18244
+ return loreline_JsonToAst.dialogueStatementFromJson(json);
18245
+ case "Field":
18246
+ return loreline_JsonToAst.objectFieldFromJson(json);
18247
+ case "Function":
18248
+ return loreline_JsonToAst.functionDeclFromJson(json);
18249
+ case "If":
18250
+ return loreline_JsonToAst.ifStatementFromJson(json);
18251
+ case "Import":
18252
+ return loreline_JsonToAst.importStatementFromJson(json);
18253
+ case "Insertion":
18254
+ return loreline_JsonToAst.insertionFromJson(json);
18255
+ case "Literal":
18256
+ return loreline_JsonToAst.literalFromJson(json);
18257
+ case "Option":
18258
+ return loreline_JsonToAst.choiceOptionFromJson(json);
18259
+ case "Part":
18260
+ return loreline_JsonToAst.stringPartFromJson(json);
18261
+ case "Script":
18262
+ return loreline_JsonToAst.scriptFromJson(json);
18263
+ case "State":
18264
+ return loreline_JsonToAst.stateFromJson(json);
18265
+ case "String":
18266
+ return loreline_JsonToAst.stringLiteralFromJson(json);
18267
+ case "Ternary":
18268
+ return loreline_JsonToAst.ternaryFromJson(json);
18269
+ case "Text":
18270
+ return loreline_JsonToAst.textStatementFromJson(json);
18271
+ case "Transition":
18272
+ return loreline_JsonToAst.transitionFromJson(json);
18273
+ case "Unary":
18274
+ return loreline_JsonToAst.unaryFromJson(json);
18275
+ default:
18276
+ throw haxe_Exception.thrown("Unknown node type: " + nodeType);
18277
+ }
18278
+ }
18279
+ static commentFromJson(json) {
18280
+ let id = loreline_JsonToAst.idFromJson(json);
18281
+ let pos = loreline_JsonToAst.positionFromJson(json.pos);
18282
+ let isHash = json.isHash != null && json.isHash;
18283
+ return new loreline_Comment(id,pos,json.content,json.multiline,isHash);
18284
+ }
18285
+ static stateFromJson(json) {
18286
+ let id = loreline_JsonToAst.idFromJson(json);
18287
+ let pos = loreline_JsonToAst.positionFromJson(json.pos);
18288
+ let fieldsArr = json.fields;
18289
+ let _g = [];
18290
+ let _g1 = 0;
18291
+ while(_g1 < fieldsArr.length) {
18292
+ let f = fieldsArr[_g1];
18293
+ ++_g1;
18294
+ _g.push(loreline_JsonToAst.nodeFromJson(f));
18295
+ }
18296
+ let fields = _g;
18297
+ let comments = loreline_JsonToAst.extractComments(json);
18298
+ let node = new loreline_NStateDecl(id,pos,json.temporary,fields,comments.leading,comments.trailing);
18299
+ node.style = loreline_JsonToAst.blockStyleFromString(json.style);
18300
+ return node;
18301
+ }
18302
+ static objectFieldFromJson(json) {
18303
+ let id = loreline_JsonToAst.idFromJson(json);
18304
+ let pos = loreline_JsonToAst.positionFromJson(json.pos);
18305
+ let comments = loreline_JsonToAst.extractComments(json);
18306
+ return new loreline_NObjectField(id,pos,json.name,loreline_JsonToAst.nodeFromJson(json.value),comments.leading,comments.trailing);
18307
+ }
18308
+ static characterFromJson(json) {
18309
+ let id = loreline_JsonToAst.idFromJson(json);
18310
+ let pos = loreline_JsonToAst.positionFromJson(json.pos);
18311
+ let namePos = loreline_JsonToAst.positionFromJson(json.namePos);
18312
+ let fieldsArr = json.fields;
18313
+ let _g = [];
18314
+ let _g1 = 0;
18315
+ while(_g1 < fieldsArr.length) {
18316
+ let f = fieldsArr[_g1];
18317
+ ++_g1;
18318
+ _g.push(loreline_JsonToAst.nodeFromJson(f));
18319
+ }
18320
+ let fields = _g;
18321
+ let comments = loreline_JsonToAst.extractComments(json);
18322
+ let node = new loreline_NCharacterDecl(id,pos,json.name,namePos,fields,comments.leading,comments.trailing);
18323
+ node.style = loreline_JsonToAst.blockStyleFromString(json.style);
18324
+ return node;
18325
+ }
18326
+ static beatFromJson(json) {
18327
+ let id = loreline_JsonToAst.idFromJson(json);
18328
+ let pos = loreline_JsonToAst.positionFromJson(json.pos);
18329
+ let bodyArr = json.body;
18330
+ let _g = [];
18331
+ let _g1 = 0;
18332
+ while(_g1 < bodyArr.length) {
18333
+ let item = bodyArr[_g1];
18334
+ ++_g1;
18335
+ _g.push(loreline_JsonToAst.nodeFromJson(item));
18336
+ }
18337
+ let body = _g;
18338
+ let comments = loreline_JsonToAst.extractComments(json);
18339
+ let node = new loreline_NBeatDecl(id,pos,json.name,body,comments.leading,comments.trailing);
18340
+ node.style = loreline_JsonToAst.blockStyleFromString(json.style);
18341
+ return node;
18342
+ }
18343
+ static stringPartFromJson(json) {
18344
+ let id = loreline_JsonToAst.idFromJson(json);
18345
+ let pos = loreline_JsonToAst.positionFromJson(json.pos);
18346
+ let partStr = json.part;
18347
+ let partType;
18348
+ switch(partStr) {
18349
+ case "Expr":
18350
+ partType = loreline_StringPartType.Expr(loreline_JsonToAst.nodeFromJson(json.expression));
18351
+ break;
18352
+ case "Raw":
18353
+ partType = loreline_StringPartType.Raw(json.text);
18354
+ break;
18355
+ case "Tag":
18356
+ partType = loreline_StringPartType.Tag(json.closing,loreline_JsonToAst.nodeFromJson(json.content));
18357
+ break;
18358
+ default:
18359
+ throw haxe_Exception.thrown("Unknown string part type: " + partStr);
18360
+ }
18361
+ let comments = loreline_JsonToAst.extractComments(json);
18362
+ return new loreline_NStringPart(id,pos,partType,comments.leading,comments.trailing);
18363
+ }
18364
+ static stringLiteralFromJson(json) {
18365
+ let id = loreline_JsonToAst.idFromJson(json);
18366
+ let pos = loreline_JsonToAst.positionFromJson(json.pos);
18367
+ let quotes = loreline_JsonToAst.quotesFromString(json.quotes);
18368
+ let partsArr = json.parts;
18369
+ let _g = [];
18370
+ let _g1 = 0;
18371
+ while(_g1 < partsArr.length) {
18372
+ let p = partsArr[_g1];
18373
+ ++_g1;
18374
+ _g.push(loreline_JsonToAst.nodeFromJson(p));
18375
+ }
18376
+ let parts = _g;
18377
+ let comments = loreline_JsonToAst.extractComments(json);
18378
+ return new loreline_NStringLiteral(id,pos,quotes,parts,comments.leading,comments.trailing);
18379
+ }
18380
+ static textStatementFromJson(json) {
18381
+ let id = loreline_JsonToAst.idFromJson(json);
18382
+ let pos = loreline_JsonToAst.positionFromJson(json.pos);
18383
+ let content = loreline_JsonToAst.nodeFromJson(json.content);
18384
+ let comments = loreline_JsonToAst.extractComments(json);
18385
+ let node = new loreline_NTextStatement(id,pos,content,comments.leading,comments.trailing);
18386
+ if(json.condition != null) {
18387
+ node.condition = loreline_JsonToAst.nodeFromJson(json.condition);
18388
+ node.conditionStyle = loreline_JsonToAst.conditionStyleFromString(json.conditionStyle);
18389
+ node.conditionPos = loreline_JsonToAst.positionFromJson(json.conditionPos);
18390
+ }
18391
+ return node;
18392
+ }
18393
+ static dialogueStatementFromJson(json) {
18394
+ let id = loreline_JsonToAst.idFromJson(json);
18395
+ let pos = loreline_JsonToAst.positionFromJson(json.pos);
18396
+ let characterPos = loreline_JsonToAst.positionFromJson(json.characterPos);
18397
+ let content = loreline_JsonToAst.nodeFromJson(json.content);
18398
+ let comments = loreline_JsonToAst.extractComments(json);
18399
+ let node = new loreline_NDialogueStatement(id,pos,json.character,characterPos,content,comments.leading,comments.trailing);
18400
+ if(json.condition != null) {
18401
+ node.condition = loreline_JsonToAst.nodeFromJson(json.condition);
18402
+ node.conditionStyle = loreline_JsonToAst.conditionStyleFromString(json.conditionStyle);
18403
+ node.conditionPos = loreline_JsonToAst.positionFromJson(json.conditionPos);
18404
+ }
18405
+ return node;
18406
+ }
18407
+ static choiceStatementFromJson(json) {
18408
+ let id = loreline_JsonToAst.idFromJson(json);
18409
+ let pos = loreline_JsonToAst.positionFromJson(json.pos);
18410
+ let optionsArr = json.options;
18411
+ let _g = [];
18412
+ let _g1 = 0;
18413
+ while(_g1 < optionsArr.length) {
18414
+ let o = optionsArr[_g1];
18415
+ ++_g1;
18416
+ _g.push(loreline_JsonToAst.nodeFromJson(o));
18417
+ }
18418
+ let options = _g;
18419
+ let comments = loreline_JsonToAst.extractComments(json);
18420
+ let node = new loreline_NChoiceStatement(id,pos,options,comments.leading,comments.trailing);
18421
+ node.style = loreline_JsonToAst.blockStyleFromString(json.style);
18422
+ return node;
18423
+ }
18424
+ static choiceOptionFromJson(json) {
18425
+ let id = loreline_JsonToAst.idFromJson(json);
18426
+ let pos = loreline_JsonToAst.positionFromJson(json.pos);
18427
+ let text = json.text != null ? loreline_JsonToAst.nodeFromJson(json.text) : null;
18428
+ let insertion = json.insertion != null ? loreline_JsonToAst.nodeFromJson(json.insertion) : null;
18429
+ let condition = json.condition != null ? loreline_JsonToAst.nodeFromJson(json.condition) : null;
18430
+ let condStyle = json.conditionStyle != null ? loreline_JsonToAst.conditionStyleFromString(json.conditionStyle) : 0;
18431
+ let bodyArr = json.body;
18432
+ let _g = [];
18433
+ let _g1 = 0;
18434
+ while(_g1 < bodyArr.length) {
18435
+ let item = bodyArr[_g1];
18436
+ ++_g1;
18437
+ _g.push(loreline_JsonToAst.nodeFromJson(item));
18438
+ }
18439
+ let body = _g;
18440
+ let comments = loreline_JsonToAst.extractComments(json);
18441
+ let node = new loreline_NChoiceOption(id,pos,text,insertion,condition,condStyle,body,comments.leading,comments.trailing);
18442
+ node.style = loreline_JsonToAst.blockStyleFromString(json.style);
18443
+ if(json.once != null && json.once) {
18444
+ node.once = true;
18445
+ }
18446
+ if(json.conditionPos != null) {
18447
+ node.conditionPos = loreline_JsonToAst.positionFromJson(json.conditionPos);
18448
+ }
18449
+ return node;
18450
+ }
18451
+ static blockFromJson(json) {
18452
+ let id = loreline_JsonToAst.idFromJson(json);
18453
+ let pos = loreline_JsonToAst.positionFromJson(json.pos);
18454
+ let bodyArr = json.body;
18455
+ let _g = [];
18456
+ let _g1 = 0;
18457
+ while(_g1 < bodyArr.length) {
18458
+ let item = bodyArr[_g1];
18459
+ ++_g1;
18460
+ _g.push(loreline_JsonToAst.nodeFromJson(item));
18461
+ }
18462
+ let body = _g;
18463
+ let comments = loreline_JsonToAst.extractComments(json);
18464
+ let node = new loreline_NBlock(id,pos,body,comments.leading,comments.trailing);
18465
+ node.style = loreline_JsonToAst.blockStyleFromString(json.style);
18466
+ return node;
18467
+ }
18468
+ static ifStatementFromJson(json) {
18469
+ let id = loreline_JsonToAst.idFromJson(json);
18470
+ let pos = loreline_JsonToAst.positionFromJson(json.pos);
18471
+ let condition = loreline_JsonToAst.nodeFromJson(json.condition);
18472
+ let condStyle = loreline_JsonToAst.conditionStyleFromString(json.conditionStyle);
18473
+ let thenArr = json.thenBranch;
18474
+ let _g = [];
18475
+ let _g1 = 0;
18476
+ while(_g1 < thenArr.length) {
18477
+ let item = thenArr[_g1];
18478
+ ++_g1;
18479
+ _g.push(loreline_JsonToAst.nodeFromJson(item));
18480
+ }
18481
+ let thenBody = _g;
18482
+ let thenBlock = new loreline_NBlock(loreline_NodeId.UNDEFINED,pos,thenBody);
18483
+ thenBlock.style = loreline_JsonToAst.blockStyleFromString(json.thenStyle);
18484
+ let elseBlock = null;
18485
+ if(json.elseBranch != null) {
18486
+ let elseArr = json.elseBranch;
18487
+ let _g = [];
18488
+ let _g1 = 0;
18489
+ while(_g1 < elseArr.length) {
18490
+ let item = elseArr[_g1];
18491
+ ++_g1;
18492
+ _g.push(loreline_JsonToAst.nodeFromJson(item));
18493
+ }
18494
+ let elseBody = _g;
18495
+ elseBlock = new loreline_NBlock(loreline_NodeId.UNDEFINED,pos,elseBody);
18496
+ elseBlock.style = loreline_JsonToAst.blockStyleFromString(json.elseStyle);
18497
+ }
18498
+ let comments = loreline_JsonToAst.extractComments(json);
18499
+ let elseLeading = null;
18500
+ let elseTrailing = null;
18501
+ if(json.comments != null) {
18502
+ if(json.comments.elseLeading != null) {
18503
+ let arr = json.comments.elseLeading;
18504
+ let _g = [];
18505
+ let _g1 = 0;
18506
+ while(_g1 < arr.length) {
18507
+ let c = arr[_g1];
18508
+ ++_g1;
18509
+ _g.push(loreline_JsonToAst.commentFromJson(c));
18510
+ }
18511
+ elseLeading = _g;
18512
+ }
18513
+ if(json.comments.elseTrailing != null) {
18514
+ let arr = json.comments.elseTrailing;
18515
+ let _g = [];
18516
+ let _g1 = 0;
18517
+ while(_g1 < arr.length) {
18518
+ let c = arr[_g1];
18519
+ ++_g1;
18520
+ _g.push(loreline_JsonToAst.commentFromJson(c));
18521
+ }
18522
+ elseTrailing = _g;
18523
+ }
18524
+ }
18525
+ return new loreline_NIfStatement(id,pos,condition,condStyle,thenBlock,elseBlock,comments.leading,comments.trailing,elseLeading,elseTrailing);
18526
+ }
18527
+ static alternativeFromJson(json) {
18528
+ let id = loreline_JsonToAst.idFromJson(json);
18529
+ let pos = loreline_JsonToAst.positionFromJson(json.pos);
18530
+ let mode = loreline_JsonToAst.alternativeModeFromString(json.mode);
18531
+ let itemsArr = json.items;
18532
+ let _g = [];
18533
+ let _g1 = 0;
18534
+ while(_g1 < itemsArr.length) {
18535
+ let item = itemsArr[_g1];
18536
+ ++_g1;
18537
+ _g.push(loreline_JsonToAst.nodeFromJson(item));
18538
+ }
18539
+ let items = _g;
18540
+ let comments = loreline_JsonToAst.extractComments(json);
18541
+ let node = new loreline_NAlternative(id,pos,mode,items,comments.leading,comments.trailing);
18542
+ node.style = loreline_JsonToAst.blockStyleFromString(json.style);
18543
+ if(json.separatorComments != null) {
18544
+ let sepArr = json.separatorComments;
18545
+ let _g = [];
18546
+ let _g1 = 0;
18547
+ while(_g1 < sepArr.length) {
18548
+ let commentsGroup = sepArr[_g1];
18549
+ ++_g1;
18550
+ if(commentsGroup != null) {
18551
+ let group = commentsGroup;
18552
+ let _g1 = [];
18553
+ let _g2 = 0;
18554
+ while(_g2 < group.length) {
18555
+ let c = group[_g2];
18556
+ ++_g2;
18557
+ _g1.push(loreline_JsonToAst.commentFromJson(c));
18558
+ }
18559
+ _g.push(_g1);
18560
+ } else {
18561
+ _g.push(null);
18562
+ }
18563
+ }
18564
+ node.separatorComments = _g;
18565
+ }
18566
+ return node;
18567
+ }
18568
+ static callFromJson(json) {
18569
+ let id = loreline_JsonToAst.idFromJson(json);
18570
+ let pos = loreline_JsonToAst.positionFromJson(json.pos);
18571
+ let target = loreline_JsonToAst.nodeFromJson(json.target);
18572
+ let argsArr = json.args;
18573
+ let _g = [];
18574
+ let _g1 = 0;
18575
+ while(_g1 < argsArr.length) {
18576
+ let a = argsArr[_g1];
18577
+ ++_g1;
18578
+ _g.push(loreline_JsonToAst.nodeFromJson(a));
18579
+ }
18580
+ let args = _g;
18581
+ let comments = loreline_JsonToAst.extractComments(json);
18582
+ return new loreline_NCall(id,pos,target,args,comments.leading,comments.trailing);
18583
+ }
18584
+ static transitionFromJson(json) {
18585
+ let id = loreline_JsonToAst.idFromJson(json);
18586
+ let pos = loreline_JsonToAst.positionFromJson(json.pos);
18587
+ let targetPos = loreline_JsonToAst.positionFromJson(json.targetPos);
18588
+ let comments = loreline_JsonToAst.extractComments(json);
18589
+ return new loreline_NTransition(id,pos,json.target,targetPos,comments.leading,comments.trailing);
18590
+ }
18591
+ static insertionFromJson(json) {
18592
+ let id = loreline_JsonToAst.idFromJson(json);
18593
+ let pos = loreline_JsonToAst.positionFromJson(json.pos);
18594
+ let targetPos = loreline_JsonToAst.positionFromJson(json.targetPos);
18595
+ let comments = loreline_JsonToAst.extractComments(json);
18596
+ return new loreline_NInsertion(id,pos,json.target,targetPos,comments.leading,comments.trailing);
18597
+ }
18598
+ static functionDeclFromJson(json) {
18599
+ let id = loreline_JsonToAst.idFromJson(json);
18600
+ let pos = loreline_JsonToAst.positionFromJson(json.pos);
18601
+ let name = json.name;
18602
+ let argsArr = json.args;
18603
+ let _g = [];
18604
+ let _g1 = 0;
18605
+ while(_g1 < argsArr.length) {
18606
+ let a = argsArr[_g1];
18607
+ ++_g1;
18608
+ _g.push(a);
18609
+ }
18610
+ let args = _g;
18611
+ let comments = loreline_JsonToAst.extractComments(json);
18612
+ return new loreline_NFunctionDecl(id,pos,name,args,json.code,json.external,comments.leading,comments.trailing);
18613
+ }
18614
+ static literalFromJson(json) {
18615
+ let id = loreline_JsonToAst.idFromJson(json);
18616
+ let pos = loreline_JsonToAst.positionFromJson(json.pos);
18617
+ let litStr = json.literal;
18618
+ let comments = loreline_JsonToAst.extractComments(json);
18619
+ let literalType;
18620
+ let value;
18621
+ switch(litStr) {
18622
+ case "Array":
18623
+ literalType = loreline_LiteralType.Array;
18624
+ if(json.value != null) {
18625
+ let arr = json.value;
18626
+ let _g = [];
18627
+ let _g1 = 0;
18628
+ while(_g1 < arr.length) {
18629
+ let elem = arr[_g1];
18630
+ ++_g1;
18631
+ if(Object.prototype.hasOwnProperty.call(elem,"type")) {
18632
+ _g.push(loreline_JsonToAst.nodeFromJson(elem));
18633
+ } else {
18634
+ _g.push(elem);
18635
+ }
18636
+ }
18637
+ value = _g;
18638
+ } else {
18639
+ value = null;
18640
+ }
18641
+ break;
18642
+ case "Boolean":
18643
+ literalType = loreline_LiteralType.Boolean;
18644
+ value = json.value;
18645
+ break;
18646
+ case "Null":
18647
+ literalType = loreline_LiteralType.Null;
18648
+ value = null;
18649
+ break;
18650
+ case "Number":
18651
+ literalType = loreline_LiteralType.Number;
18652
+ value = json.value;
18653
+ break;
18654
+ case "Object":
18655
+ let style = loreline_JsonToAst.blockStyleFromString(json.style);
18656
+ literalType = loreline_LiteralType.Object(style);
18657
+ if(json.value != null) {
18658
+ let arr = json.value;
18659
+ let _g = [];
18660
+ let _g1 = 0;
18661
+ while(_g1 < arr.length) {
18662
+ let f = arr[_g1];
18663
+ ++_g1;
18664
+ _g.push(loreline_JsonToAst.nodeFromJson(f));
18665
+ }
18666
+ value = _g;
18667
+ } else {
18668
+ value = [];
18669
+ }
18670
+ break;
18671
+ default:
18672
+ throw haxe_Exception.thrown("Unknown literal type: " + litStr);
18673
+ }
18674
+ return new loreline_NLiteral(id,pos,value,literalType,comments.leading,comments.trailing);
18675
+ }
18676
+ static accessFromJson(json) {
18677
+ let id = loreline_JsonToAst.idFromJson(json);
18678
+ let pos = loreline_JsonToAst.positionFromJson(json.pos);
18679
+ let target = json.target != null ? loreline_JsonToAst.nodeFromJson(json.target) : null;
18680
+ let comments = loreline_JsonToAst.extractComments(json);
18681
+ return new loreline_NAccess(id,pos,target,json.name,comments.leading,comments.trailing);
18682
+ }
18683
+ static assignFromJson(json) {
18684
+ let id = loreline_JsonToAst.idFromJson(json);
18685
+ let pos = loreline_JsonToAst.positionFromJson(json.pos);
18686
+ let target = loreline_JsonToAst.nodeFromJson(json.target);
18687
+ let op = loreline_JsonToAst.tokenTypeFromString(json.op);
18688
+ let value = loreline_JsonToAst.nodeFromJson(json.value);
18689
+ let comments = loreline_JsonToAst.extractComments(json);
18690
+ return new loreline_NAssign(id,pos,target,op,value,comments.leading,comments.trailing);
18691
+ }
18692
+ static arrayAccessFromJson(json) {
18693
+ let id = loreline_JsonToAst.idFromJson(json);
18694
+ let pos = loreline_JsonToAst.positionFromJson(json.pos);
18695
+ let target = loreline_JsonToAst.nodeFromJson(json.target);
18696
+ let index = loreline_JsonToAst.nodeFromJson(json.index);
18697
+ let comments = loreline_JsonToAst.extractComments(json);
18698
+ return new loreline_NArrayAccess(id,pos,target,index,comments.leading,comments.trailing);
18699
+ }
18700
+ static binaryFromJson(json) {
18701
+ let id = loreline_JsonToAst.idFromJson(json);
18702
+ let pos = loreline_JsonToAst.positionFromJson(json.pos);
18703
+ let left = loreline_JsonToAst.nodeFromJson(json.left);
18704
+ let op = loreline_JsonToAst.tokenTypeFromString(json.op);
18705
+ let right = loreline_JsonToAst.nodeFromJson(json.right);
18706
+ let comments = loreline_JsonToAst.extractComments(json);
18707
+ return new loreline_NBinary(id,pos,left,op,right,comments.leading,comments.trailing);
18708
+ }
18709
+ static unaryFromJson(json) {
18710
+ let id = loreline_JsonToAst.idFromJson(json);
18711
+ let pos = loreline_JsonToAst.positionFromJson(json.pos);
18712
+ let op = loreline_JsonToAst.tokenTypeFromString(json.op);
18713
+ let operand = loreline_JsonToAst.nodeFromJson(json.operand);
18714
+ let comments = loreline_JsonToAst.extractComments(json);
18715
+ return new loreline_NUnary(id,pos,op,operand,comments.leading,comments.trailing);
18716
+ }
18717
+ static ternaryFromJson(json) {
18718
+ let id = loreline_JsonToAst.idFromJson(json);
18719
+ let pos = loreline_JsonToAst.positionFromJson(json.pos);
18720
+ let condition = loreline_JsonToAst.nodeFromJson(json.condition);
18721
+ let trueExpr = loreline_JsonToAst.nodeFromJson(json.trueExpr);
18722
+ let falseExpr = loreline_JsonToAst.nodeFromJson(json.falseExpr);
18723
+ let comments = loreline_JsonToAst.extractComments(json);
18724
+ return new loreline_NTernary(id,pos,condition,trueExpr,falseExpr,comments.leading,comments.trailing);
18725
+ }
18726
+ static importStatementFromJson(json) {
18727
+ let id = loreline_JsonToAst.idFromJson(json);
18728
+ let pos = loreline_JsonToAst.positionFromJson(json.pos);
18729
+ let path = loreline_JsonToAst.nodeFromJson(json.path);
18730
+ let script = json.script != null ? loreline_JsonToAst.scriptFromJson(json.script) : null;
18731
+ let comments = loreline_JsonToAst.extractComments(json);
18732
+ return new loreline_NImportStatement(id,pos,path,script,comments.leading,comments.trailing);
18733
+ }
18734
+ static idFromJson(json) {
18735
+ let idStr = json.id;
18736
+ if(idStr != null) {
18737
+ return loreline_NodeId.fromString(idStr);
18738
+ } else {
18739
+ return loreline_NodeId.UNDEFINED;
18740
+ }
18741
+ }
18742
+ static positionFromJson(json) {
18743
+ if(json == null) {
18744
+ return new loreline_Position(0,0,0,0);
18745
+ }
18746
+ let length = json.length != null ? json.length : 0;
18747
+ return new loreline_Position(json.line,json.column,json.offset,length);
18748
+ }
18749
+ static extractComments(json) {
18750
+ if(json.comments == null) {
18751
+ return { leading : null, trailing : null};
18752
+ }
18753
+ let leading = null;
18754
+ let trailing = null;
18755
+ if(json.comments.leading != null) {
18756
+ let arr = json.comments.leading;
18757
+ let _g = [];
18758
+ let _g1 = 0;
18759
+ while(_g1 < arr.length) {
18760
+ let c = arr[_g1];
18761
+ ++_g1;
18762
+ _g.push(loreline_JsonToAst.commentFromJson(c));
18763
+ }
18764
+ leading = _g;
18765
+ }
18766
+ if(json.comments.trailing != null) {
18767
+ let arr = json.comments.trailing;
18768
+ let _g = [];
18769
+ let _g1 = 0;
18770
+ while(_g1 < arr.length) {
18771
+ let c = arr[_g1];
18772
+ ++_g1;
18773
+ _g.push(loreline_JsonToAst.commentFromJson(c));
18774
+ }
18775
+ trailing = _g;
18776
+ }
18777
+ return { leading : leading, trailing : trailing};
18778
+ }
18779
+ static applyComments(node,json) {
18780
+ let comments = loreline_JsonToAst.extractComments(json);
18781
+ node.leadingComments = comments.leading;
18782
+ node.trailingComments = comments.trailing;
18783
+ }
18784
+ static blockStyleFromString(s) {
18785
+ if(s == "Braces") {
18786
+ return 1;
18787
+ } else {
18788
+ return 0;
18789
+ }
18790
+ }
18791
+ static conditionStyleFromString(s) {
18792
+ if(s == "Parens") {
18793
+ return 2;
18794
+ } else {
18795
+ return 0;
18796
+ }
18797
+ }
18798
+ static alternativeModeFromString(s) {
18799
+ switch(s) {
18800
+ case "Cycle":
18801
+ return 1;
18802
+ case "Once":
18803
+ return 2;
18804
+ case "Pick":
18805
+ return 3;
18806
+ case "Shuffle":
18807
+ return 4;
18808
+ default:
18809
+ return 0;
18810
+ }
18811
+ }
18812
+ static quotesFromString(s) {
18813
+ if(s == "DoubleQuotes") {
18814
+ return 1;
18815
+ } else {
18816
+ return 0;
18817
+ }
18818
+ }
18819
+ static tokenTypeFromString(s) {
18820
+ switch(s) {
18821
+ case "OpAssign":
18822
+ return loreline_TokenType.OpAssign;
18823
+ case "OpDivide":
18824
+ return loreline_TokenType.OpDivide;
18825
+ case "OpDivideAssign":
18826
+ return loreline_TokenType.OpDivideAssign;
18827
+ case "OpEquals":
18828
+ return loreline_TokenType.OpEquals;
18829
+ case "OpGreater":
18830
+ return loreline_TokenType.OpGreater;
18831
+ case "OpGreaterEq":
18832
+ return loreline_TokenType.OpGreaterEq;
18833
+ case "OpLess":
18834
+ return loreline_TokenType.OpLess;
18835
+ case "OpLessEq":
18836
+ return loreline_TokenType.OpLessEq;
18837
+ case "OpMinus":
18838
+ return loreline_TokenType.OpMinus;
18839
+ case "OpMinusAssign":
18840
+ return loreline_TokenType.OpMinusAssign;
18841
+ case "OpModulo":
18842
+ return loreline_TokenType.OpModulo;
18843
+ case "OpMultiply":
18844
+ return loreline_TokenType.OpMultiply;
18845
+ case "OpMultiplyAssign":
18846
+ return loreline_TokenType.OpMultiplyAssign;
18847
+ case "OpNot":
18848
+ return loreline_TokenType.OpNot;
18849
+ case "OpNotEquals":
18850
+ return loreline_TokenType.OpNotEquals;
18851
+ case "OpPlus":
18852
+ return loreline_TokenType.OpPlus;
18853
+ case "OpPlusAssign":
18854
+ return loreline_TokenType.OpPlusAssign;
18855
+ case "OpUnquotedAssign":
18856
+ return loreline_TokenType.OpUnquotedAssign;
18857
+ default:
18858
+ if(s.startsWith("OpAnd")) {
18859
+ return loreline_TokenType.OpAnd(s.indexOf("true") != -1);
18860
+ } else if(s.startsWith("OpOr")) {
18861
+ return loreline_TokenType.OpOr(s.indexOf("true") != -1);
18862
+ } else {
18863
+ throw haxe_Exception.thrown("Unknown operator: " + s);
18864
+ }
18865
+ }
18866
+ }
18867
+ }
18868
+ $hxClasses["loreline.JsonToAst"] = loreline_JsonToAst;
18869
+ loreline_JsonToAst.__name__ = "loreline.JsonToAst";
17778
18870
  class loreline_Reference {
17779
18871
  constructor(target,origin) {
17780
18872
  this.target = target;
@@ -19057,39 +20149,41 @@ var loreline_TokenType = $hxEnums["loreline.TokenType"] = { __ename__:"loreline.
19057
20149
  ,OpMinusAssign: {_hx_name:"OpMinusAssign",_hx_index:22,__enum__:"loreline.TokenType",toString:$estr}
19058
20150
  ,OpMultiplyAssign: {_hx_name:"OpMultiplyAssign",_hx_index:23,__enum__:"loreline.TokenType",toString:$estr}
19059
20151
  ,OpDivideAssign: {_hx_name:"OpDivideAssign",_hx_index:24,__enum__:"loreline.TokenType",toString:$estr}
19060
- ,OpPlus: {_hx_name:"OpPlus",_hx_index:25,__enum__:"loreline.TokenType",toString:$estr}
19061
- ,OpMinus: {_hx_name:"OpMinus",_hx_index:26,__enum__:"loreline.TokenType",toString:$estr}
19062
- ,OpMultiply: {_hx_name:"OpMultiply",_hx_index:27,__enum__:"loreline.TokenType",toString:$estr}
19063
- ,OpDivide: {_hx_name:"OpDivide",_hx_index:28,__enum__:"loreline.TokenType",toString:$estr}
19064
- ,OpModulo: {_hx_name:"OpModulo",_hx_index:29,__enum__:"loreline.TokenType",toString:$estr}
19065
- ,OpEquals: {_hx_name:"OpEquals",_hx_index:30,__enum__:"loreline.TokenType",toString:$estr}
19066
- ,OpNotEquals: {_hx_name:"OpNotEquals",_hx_index:31,__enum__:"loreline.TokenType",toString:$estr}
19067
- ,OpGreater: {_hx_name:"OpGreater",_hx_index:32,__enum__:"loreline.TokenType",toString:$estr}
19068
- ,OpLess: {_hx_name:"OpLess",_hx_index:33,__enum__:"loreline.TokenType",toString:$estr}
19069
- ,OpGreaterEq: {_hx_name:"OpGreaterEq",_hx_index:34,__enum__:"loreline.TokenType",toString:$estr}
19070
- ,OpLessEq: {_hx_name:"OpLessEq",_hx_index:35,__enum__:"loreline.TokenType",toString:$estr}
19071
- ,OpAnd: ($_=function(word) { return {_hx_index:36,word:word,__enum__:"loreline.TokenType",toString:$estr}; },$_._hx_name="OpAnd",$_.__params__ = ["word"],$_)
19072
- ,OpOr: ($_=function(word) { return {_hx_index:37,word:word,__enum__:"loreline.TokenType",toString:$estr}; },$_._hx_name="OpOr",$_.__params__ = ["word"],$_)
19073
- ,OpNot: {_hx_name:"OpNot",_hx_index:38,__enum__:"loreline.TokenType",toString:$estr}
19074
- ,Arrow: {_hx_name:"Arrow",_hx_index:39,__enum__:"loreline.TokenType",toString:$estr}
19075
- ,Colon: {_hx_name:"Colon",_hx_index:40,__enum__:"loreline.TokenType",toString:$estr}
19076
- ,Comma: {_hx_name:"Comma",_hx_index:41,__enum__:"loreline.TokenType",toString:$estr}
19077
- ,Dot: {_hx_name:"Dot",_hx_index:42,__enum__:"loreline.TokenType",toString:$estr}
19078
- ,LBrace: {_hx_name:"LBrace",_hx_index:43,__enum__:"loreline.TokenType",toString:$estr}
19079
- ,RBrace: {_hx_name:"RBrace",_hx_index:44,__enum__:"loreline.TokenType",toString:$estr}
19080
- ,LParen: {_hx_name:"LParen",_hx_index:45,__enum__:"loreline.TokenType",toString:$estr}
19081
- ,RParen: {_hx_name:"RParen",_hx_index:46,__enum__:"loreline.TokenType",toString:$estr}
19082
- ,LBracket: {_hx_name:"LBracket",_hx_index:47,__enum__:"loreline.TokenType",toString:$estr}
19083
- ,RBracket: {_hx_name:"RBracket",_hx_index:48,__enum__:"loreline.TokenType",toString:$estr}
19084
- ,CommentLine: ($_=function(content) { return {_hx_index:49,content:content,__enum__:"loreline.TokenType",toString:$estr}; },$_._hx_name="CommentLine",$_.__params__ = ["content"],$_)
19085
- ,CommentMultiLine: ($_=function(content) { return {_hx_index:50,content:content,__enum__:"loreline.TokenType",toString:$estr}; },$_._hx_name="CommentMultiLine",$_.__params__ = ["content"],$_)
19086
- ,CommentHash: ($_=function(content) { return {_hx_index:51,content:content,__enum__:"loreline.TokenType",toString:$estr}; },$_._hx_name="CommentHash",$_.__params__ = ["content"],$_)
19087
- ,Indent: {_hx_name:"Indent",_hx_index:52,__enum__:"loreline.TokenType",toString:$estr}
19088
- ,Unindent: {_hx_name:"Unindent",_hx_index:53,__enum__:"loreline.TokenType",toString:$estr}
19089
- ,LineBreak: {_hx_name:"LineBreak",_hx_index:54,__enum__:"loreline.TokenType",toString:$estr}
19090
- ,Eof: {_hx_name:"Eof",_hx_index:55,__enum__:"loreline.TokenType",toString:$estr}
20152
+ ,OpUnquotedAssign: {_hx_name:"OpUnquotedAssign",_hx_index:25,__enum__:"loreline.TokenType",toString:$estr}
20153
+ ,OpPlus: {_hx_name:"OpPlus",_hx_index:26,__enum__:"loreline.TokenType",toString:$estr}
20154
+ ,OpMinus: {_hx_name:"OpMinus",_hx_index:27,__enum__:"loreline.TokenType",toString:$estr}
20155
+ ,OpMultiply: {_hx_name:"OpMultiply",_hx_index:28,__enum__:"loreline.TokenType",toString:$estr}
20156
+ ,OpDivide: {_hx_name:"OpDivide",_hx_index:29,__enum__:"loreline.TokenType",toString:$estr}
20157
+ ,OpModulo: {_hx_name:"OpModulo",_hx_index:30,__enum__:"loreline.TokenType",toString:$estr}
20158
+ ,OpEquals: {_hx_name:"OpEquals",_hx_index:31,__enum__:"loreline.TokenType",toString:$estr}
20159
+ ,OpNotEquals: {_hx_name:"OpNotEquals",_hx_index:32,__enum__:"loreline.TokenType",toString:$estr}
20160
+ ,OpGreater: {_hx_name:"OpGreater",_hx_index:33,__enum__:"loreline.TokenType",toString:$estr}
20161
+ ,OpLess: {_hx_name:"OpLess",_hx_index:34,__enum__:"loreline.TokenType",toString:$estr}
20162
+ ,OpGreaterEq: {_hx_name:"OpGreaterEq",_hx_index:35,__enum__:"loreline.TokenType",toString:$estr}
20163
+ ,OpLessEq: {_hx_name:"OpLessEq",_hx_index:36,__enum__:"loreline.TokenType",toString:$estr}
20164
+ ,OpAnd: ($_=function(word) { return {_hx_index:37,word:word,__enum__:"loreline.TokenType",toString:$estr}; },$_._hx_name="OpAnd",$_.__params__ = ["word"],$_)
20165
+ ,OpOr: ($_=function(word) { return {_hx_index:38,word:word,__enum__:"loreline.TokenType",toString:$estr}; },$_._hx_name="OpOr",$_.__params__ = ["word"],$_)
20166
+ ,OpNot: {_hx_name:"OpNot",_hx_index:39,__enum__:"loreline.TokenType",toString:$estr}
20167
+ ,Arrow: {_hx_name:"Arrow",_hx_index:40,__enum__:"loreline.TokenType",toString:$estr}
20168
+ ,Colon: {_hx_name:"Colon",_hx_index:41,__enum__:"loreline.TokenType",toString:$estr}
20169
+ ,Question: {_hx_name:"Question",_hx_index:42,__enum__:"loreline.TokenType",toString:$estr}
20170
+ ,Comma: {_hx_name:"Comma",_hx_index:43,__enum__:"loreline.TokenType",toString:$estr}
20171
+ ,Dot: {_hx_name:"Dot",_hx_index:44,__enum__:"loreline.TokenType",toString:$estr}
20172
+ ,LBrace: {_hx_name:"LBrace",_hx_index:45,__enum__:"loreline.TokenType",toString:$estr}
20173
+ ,RBrace: {_hx_name:"RBrace",_hx_index:46,__enum__:"loreline.TokenType",toString:$estr}
20174
+ ,LParen: {_hx_name:"LParen",_hx_index:47,__enum__:"loreline.TokenType",toString:$estr}
20175
+ ,RParen: {_hx_name:"RParen",_hx_index:48,__enum__:"loreline.TokenType",toString:$estr}
20176
+ ,LBracket: {_hx_name:"LBracket",_hx_index:49,__enum__:"loreline.TokenType",toString:$estr}
20177
+ ,RBracket: {_hx_name:"RBracket",_hx_index:50,__enum__:"loreline.TokenType",toString:$estr}
20178
+ ,CommentLine: ($_=function(content) { return {_hx_index:51,content:content,__enum__:"loreline.TokenType",toString:$estr}; },$_._hx_name="CommentLine",$_.__params__ = ["content"],$_)
20179
+ ,CommentMultiLine: ($_=function(content) { return {_hx_index:52,content:content,__enum__:"loreline.TokenType",toString:$estr}; },$_._hx_name="CommentMultiLine",$_.__params__ = ["content"],$_)
20180
+ ,CommentHash: ($_=function(content) { return {_hx_index:53,content:content,__enum__:"loreline.TokenType",toString:$estr}; },$_._hx_name="CommentHash",$_.__params__ = ["content"],$_)
20181
+ ,Indent: {_hx_name:"Indent",_hx_index:54,__enum__:"loreline.TokenType",toString:$estr}
20182
+ ,Unindent: {_hx_name:"Unindent",_hx_index:55,__enum__:"loreline.TokenType",toString:$estr}
20183
+ ,LineBreak: {_hx_name:"LineBreak",_hx_index:56,__enum__:"loreline.TokenType",toString:$estr}
20184
+ ,Eof: {_hx_name:"Eof",_hx_index:57,__enum__:"loreline.TokenType",toString:$estr}
19091
20185
  };
19092
- loreline_TokenType.__constructs__ = [loreline_TokenType.KwImport,loreline_TokenType.KwState,loreline_TokenType.KwBeat,loreline_TokenType.KwCharacter,loreline_TokenType.KwChoice,loreline_TokenType.KwIf,loreline_TokenType.KwElse,loreline_TokenType.KwNew,loreline_TokenType.KwSequence,loreline_TokenType.KwCycle,loreline_TokenType.KwOnce,loreline_TokenType.KwPick,loreline_TokenType.KwShuffle,loreline_TokenType.Separator,loreline_TokenType.Function,loreline_TokenType.LString,loreline_TokenType.LNumber,loreline_TokenType.LBoolean,loreline_TokenType.LNull,loreline_TokenType.Identifier,loreline_TokenType.OpAssign,loreline_TokenType.OpPlusAssign,loreline_TokenType.OpMinusAssign,loreline_TokenType.OpMultiplyAssign,loreline_TokenType.OpDivideAssign,loreline_TokenType.OpPlus,loreline_TokenType.OpMinus,loreline_TokenType.OpMultiply,loreline_TokenType.OpDivide,loreline_TokenType.OpModulo,loreline_TokenType.OpEquals,loreline_TokenType.OpNotEquals,loreline_TokenType.OpGreater,loreline_TokenType.OpLess,loreline_TokenType.OpGreaterEq,loreline_TokenType.OpLessEq,loreline_TokenType.OpAnd,loreline_TokenType.OpOr,loreline_TokenType.OpNot,loreline_TokenType.Arrow,loreline_TokenType.Colon,loreline_TokenType.Comma,loreline_TokenType.Dot,loreline_TokenType.LBrace,loreline_TokenType.RBrace,loreline_TokenType.LParen,loreline_TokenType.RParen,loreline_TokenType.LBracket,loreline_TokenType.RBracket,loreline_TokenType.CommentLine,loreline_TokenType.CommentMultiLine,loreline_TokenType.CommentHash,loreline_TokenType.Indent,loreline_TokenType.Unindent,loreline_TokenType.LineBreak,loreline_TokenType.Eof];
20186
+ loreline_TokenType.__constructs__ = [loreline_TokenType.KwImport,loreline_TokenType.KwState,loreline_TokenType.KwBeat,loreline_TokenType.KwCharacter,loreline_TokenType.KwChoice,loreline_TokenType.KwIf,loreline_TokenType.KwElse,loreline_TokenType.KwNew,loreline_TokenType.KwSequence,loreline_TokenType.KwCycle,loreline_TokenType.KwOnce,loreline_TokenType.KwPick,loreline_TokenType.KwShuffle,loreline_TokenType.Separator,loreline_TokenType.Function,loreline_TokenType.LString,loreline_TokenType.LNumber,loreline_TokenType.LBoolean,loreline_TokenType.LNull,loreline_TokenType.Identifier,loreline_TokenType.OpAssign,loreline_TokenType.OpPlusAssign,loreline_TokenType.OpMinusAssign,loreline_TokenType.OpMultiplyAssign,loreline_TokenType.OpDivideAssign,loreline_TokenType.OpUnquotedAssign,loreline_TokenType.OpPlus,loreline_TokenType.OpMinus,loreline_TokenType.OpMultiply,loreline_TokenType.OpDivide,loreline_TokenType.OpModulo,loreline_TokenType.OpEquals,loreline_TokenType.OpNotEquals,loreline_TokenType.OpGreater,loreline_TokenType.OpLess,loreline_TokenType.OpGreaterEq,loreline_TokenType.OpLessEq,loreline_TokenType.OpAnd,loreline_TokenType.OpOr,loreline_TokenType.OpNot,loreline_TokenType.Arrow,loreline_TokenType.Colon,loreline_TokenType.Question,loreline_TokenType.Comma,loreline_TokenType.Dot,loreline_TokenType.LBrace,loreline_TokenType.RBrace,loreline_TokenType.LParen,loreline_TokenType.RParen,loreline_TokenType.LBracket,loreline_TokenType.RBracket,loreline_TokenType.CommentLine,loreline_TokenType.CommentMultiLine,loreline_TokenType.CommentHash,loreline_TokenType.Indent,loreline_TokenType.Unindent,loreline_TokenType.LineBreak,loreline_TokenType.Eof];
19093
20187
  class loreline_TokenTypeHelpers {
19094
20188
  static equals(a,b) {
19095
20189
  switch(a._hx_index) {
@@ -19344,16 +20438,14 @@ class loreline_TokenTypeHelpers {
19344
20438
  }
19345
20439
  break;
19346
20440
  case 36:
19347
- let _g2 = a.word;
19348
20441
  if(b._hx_index == 36) {
19349
- let _g = b.word;
19350
20442
  return true;
19351
20443
  } else {
19352
20444
  return Type.enumEq(a,b);
19353
20445
  }
19354
20446
  break;
19355
20447
  case 37:
19356
- let _g3 = a.word;
20448
+ let _g2 = a.word;
19357
20449
  if(b._hx_index == 37) {
19358
20450
  let _g = b.word;
19359
20451
  return true;
@@ -19362,7 +20454,9 @@ class loreline_TokenTypeHelpers {
19362
20454
  }
19363
20455
  break;
19364
20456
  case 38:
20457
+ let _g3 = a.word;
19365
20458
  if(b._hx_index == 38) {
20459
+ let _g = b.word;
19366
20460
  return true;
19367
20461
  } else {
19368
20462
  return Type.enumEq(a,b);
@@ -19382,15 +20476,15 @@ class loreline_TokenTypeHelpers {
19382
20476
  return Type.enumEq(a,b);
19383
20477
  }
19384
20478
  break;
19385
- case 42:
19386
- if(b._hx_index == 42) {
20479
+ case 41:
20480
+ if(b._hx_index == 41) {
19387
20481
  return true;
19388
20482
  } else {
19389
20483
  return Type.enumEq(a,b);
19390
20484
  }
19391
20485
  break;
19392
- case 43:
19393
- if(b._hx_index == 43) {
20486
+ case 42:
20487
+ if(b._hx_index == 42) {
19394
20488
  return true;
19395
20489
  } else {
19396
20490
  return Type.enumEq(a,b);
@@ -19433,18 +20527,14 @@ class loreline_TokenTypeHelpers {
19433
20527
  break;
19434
20528
  case 49:
19435
20529
  if(b._hx_index == 49) {
19436
- let c2 = b.content;
19437
- let c1 = a.content;
19438
- return c1 == c2;
20530
+ return true;
19439
20531
  } else {
19440
20532
  return Type.enumEq(a,b);
19441
20533
  }
19442
20534
  break;
19443
20535
  case 50:
19444
20536
  if(b._hx_index == 50) {
19445
- let c2 = b.content;
19446
- let c1 = a.content;
19447
- return c1 == c2;
20537
+ return true;
19448
20538
  } else {
19449
20539
  return Type.enumEq(a,b);
19450
20540
  }
@@ -19460,14 +20550,18 @@ class loreline_TokenTypeHelpers {
19460
20550
  break;
19461
20551
  case 52:
19462
20552
  if(b._hx_index == 52) {
19463
- return true;
20553
+ let c2 = b.content;
20554
+ let c1 = a.content;
20555
+ return c1 == c2;
19464
20556
  } else {
19465
20557
  return Type.enumEq(a,b);
19466
20558
  }
19467
20559
  break;
19468
20560
  case 53:
19469
20561
  if(b._hx_index == 53) {
19470
- return true;
20562
+ let c2 = b.content;
20563
+ let c1 = a.content;
20564
+ return c1 == c2;
19471
20565
  } else {
19472
20566
  return Type.enumEq(a,b);
19473
20567
  }
@@ -19486,19 +20580,33 @@ class loreline_TokenTypeHelpers {
19486
20580
  return Type.enumEq(a,b);
19487
20581
  }
19488
20582
  break;
20583
+ case 56:
20584
+ if(b._hx_index == 56) {
20585
+ return true;
20586
+ } else {
20587
+ return Type.enumEq(a,b);
20588
+ }
20589
+ break;
20590
+ case 57:
20591
+ if(b._hx_index == 57) {
20592
+ return true;
20593
+ } else {
20594
+ return Type.enumEq(a,b);
20595
+ }
20596
+ break;
19489
20597
  default:
19490
20598
  return Type.enumEq(a,b);
19491
20599
  }
19492
20600
  }
19493
20601
  static isComment(a) {
19494
20602
  switch(a._hx_index) {
19495
- case 49:
20603
+ case 51:
19496
20604
  let _g = a.content;
19497
20605
  return true;
19498
- case 50:
20606
+ case 52:
19499
20607
  let _g1 = a.content;
19500
20608
  return true;
19501
- case 51:
20609
+ case 53:
19502
20610
  let _g2 = a.content;
19503
20611
  return true;
19504
20612
  default:
@@ -19507,7 +20615,7 @@ class loreline_TokenTypeHelpers {
19507
20615
  }
19508
20616
  static isAssignOp(a) {
19509
20617
  switch(a._hx_index) {
19510
- case 20:case 21:case 22:case 23:case 24:
20618
+ case 20:case 21:case 22:case 23:case 24:case 25:
19511
20619
  return true;
19512
20620
  default:
19513
20621
  return false;
@@ -19594,28 +20702,30 @@ class loreline_TokenTypeHelpers {
19594
20702
  case 24:
19595
20703
  return "/=";
19596
20704
  case 25:
19597
- return "+";
20705
+ return ":=";
19598
20706
  case 26:
19599
- return "-";
20707
+ return "+";
19600
20708
  case 27:
19601
- return "*";
20709
+ return "-";
19602
20710
  case 28:
19603
- return "/";
20711
+ return "*";
19604
20712
  case 29:
19605
- return "%";
20713
+ return "/";
19606
20714
  case 30:
19607
- return "==";
20715
+ return "%";
19608
20716
  case 31:
19609
- return "!=";
20717
+ return "==";
19610
20718
  case 32:
19611
- return ">";
20719
+ return "!=";
19612
20720
  case 33:
19613
- return "<";
20721
+ return ">";
19614
20722
  case 34:
19615
- return ">=";
20723
+ return "<";
19616
20724
  case 35:
19617
- return "<=";
20725
+ return ">=";
19618
20726
  case 36:
20727
+ return "<=";
20728
+ case 37:
19619
20729
  let word = a.word;
19620
20730
  if(word) {
19621
20731
  return "and";
@@ -19623,7 +20733,7 @@ class loreline_TokenTypeHelpers {
19623
20733
  return "&&";
19624
20734
  }
19625
20735
  break;
19626
- case 37:
20736
+ case 38:
19627
20737
  let word1 = a.word;
19628
20738
  if(word1) {
19629
20739
  return "or";
@@ -19631,44 +20741,46 @@ class loreline_TokenTypeHelpers {
19631
20741
  return "||";
19632
20742
  }
19633
20743
  break;
19634
- case 38:
19635
- return "!";
19636
20744
  case 39:
19637
- return "->";
20745
+ return "!";
19638
20746
  case 40:
19639
- return ":";
20747
+ return "->";
19640
20748
  case 41:
19641
- return ",";
20749
+ return ":";
19642
20750
  case 42:
19643
- return ".";
20751
+ return "?";
19644
20752
  case 43:
19645
- return "{";
20753
+ return ",";
19646
20754
  case 44:
19647
- return "}";
20755
+ return ".";
19648
20756
  case 45:
19649
- return "(";
20757
+ return "{";
19650
20758
  case 46:
19651
- return ")";
20759
+ return "}";
19652
20760
  case 47:
19653
- return "[";
20761
+ return "(";
19654
20762
  case 48:
19655
- return "]";
20763
+ return ")";
19656
20764
  case 49:
20765
+ return "[";
20766
+ case 50:
20767
+ return "]";
20768
+ case 51:
19657
20769
  let content = a.content;
19658
20770
  return "comment";
19659
- case 50:
20771
+ case 52:
19660
20772
  let content1 = a.content;
19661
20773
  return "multiline comment";
19662
- case 51:
20774
+ case 53:
19663
20775
  let content2 = a.content;
19664
20776
  return "hash comment";
19665
- case 52:
20777
+ case 54:
19666
20778
  return "indent";
19667
- case 53:
20779
+ case 55:
19668
20780
  return "unindent";
19669
- case 54:
20781
+ case 56:
19670
20782
  return "line break";
19671
- case 55:
20783
+ case 57:
19672
20784
  return "end of file";
19673
20785
  }
19674
20786
  }
@@ -19691,6 +20803,7 @@ Object.assign(loreline_Token.prototype, {
19691
20803
  });
19692
20804
  class loreline_Lexer {
19693
20805
  constructor(input) {
20806
+ this.keepOrphanExpressions = false;
19694
20807
  this.errors = null;
19695
20808
  this.allowTabs = true;
19696
20809
  this.detectedIndentSize = 2;
@@ -19758,7 +20871,7 @@ class loreline_Lexer {
19758
20871
  case 8:case 9:case 10:case 11:case 12:case 13:
19759
20872
  this.nextBlock = 9;
19760
20873
  break;
19761
- case 43:
20874
+ case 45:
19762
20875
  let tmp;
19763
20876
  switch(this.nextBlock) {
19764
20877
  case 0:case 1:
@@ -19783,15 +20896,15 @@ class loreline_Lexer {
19783
20896
  this.stack.push(tmp);
19784
20897
  this.nextBlock = 10;
19785
20898
  break;
19786
- case 47:
20899
+ case 49:
19787
20900
  this.stack.push(12);
19788
20901
  this.nextBlock = 10;
19789
20902
  break;
19790
- case 44:case 48:case 53:
20903
+ case 46:case 50:case 55:
19791
20904
  this.stack.pop();
19792
20905
  this.nextBlock = 10;
19793
20906
  break;
19794
- case 52:
20907
+ case 54:
19795
20908
  let tmp1;
19796
20909
  switch(this.nextBlock) {
19797
20910
  case 0:case 1:
@@ -19879,7 +20992,13 @@ class loreline_Lexer {
19879
20992
  }
19880
20993
  switch(c1) {
19881
20994
  case 34:
19882
- return this.readString(startPos);
20995
+ let tmp = this.tryReadUnquotedString();
20996
+ if(tmp != null) {
20997
+ return tmp;
20998
+ } else {
20999
+ return this.readString(startPos);
21000
+ }
21001
+ break;
19883
21002
  case 91:
19884
21003
  let _g = 0;
19885
21004
  let _g1 = 1;
@@ -19957,9 +21076,9 @@ class loreline_Lexer {
19957
21076
  this.previous = token2;
19958
21077
  return token2;
19959
21078
  default:
19960
- let tmp = this.tryReadUnquotedString();
19961
- if(tmp != null) {
19962
- return tmp;
21079
+ let tmp1 = this.tryReadUnquotedString();
21080
+ if(tmp1 != null) {
21081
+ return tmp1;
19963
21082
  } else {
19964
21083
  switch(c1) {
19965
21084
  case 33:
@@ -20669,30 +21788,69 @@ class loreline_Lexer {
20669
21788
  }
20670
21789
  break;
20671
21790
  case 58:
20672
- let _g14 = 0;
20673
- let _g15 = 1;
20674
- while(_g14 < _g15) {
20675
- let _ = _g14++;
20676
- if(this.pos >= this.length) {
20677
- break;
21791
+ let tmp2;
21792
+ if(this.pos + 1 < this.length) {
21793
+ let c = HxOverrides.cca(this.input,this.pos + 1);
21794
+ tmp2 = c == null ? -1 : c;
21795
+ } else {
21796
+ tmp2 = 0;
21797
+ }
21798
+ if(tmp2 == 61) {
21799
+ let count = 2;
21800
+ if(count == null) {
21801
+ count = 1;
20678
21802
  }
20679
- let c = HxOverrides.cca(this.input,this.pos);
20680
- if((c == null ? -1 : c) == 10) {
20681
- this.line++;
20682
- this.column = 1;
20683
- } else {
20684
- this.column++;
21803
+ let _g = 0;
21804
+ let _g1 = count;
21805
+ while(_g < _g1) {
21806
+ let _ = _g++;
21807
+ if(this.pos >= this.length) {
21808
+ break;
21809
+ }
21810
+ let c = HxOverrides.cca(this.input,this.pos);
21811
+ if((c == null ? -1 : c) == 10) {
21812
+ this.line++;
21813
+ this.column = 1;
21814
+ } else {
21815
+ this.column++;
21816
+ }
21817
+ this.pos++;
20685
21818
  }
20686
- this.pos++;
20687
- }
20688
- let position7 = startPos;
20689
- if(position7 == null) {
20690
- position7 = new loreline_Position(this.startLine,this.startColumn,this.pos);
21819
+ let position = startPos;
21820
+ if(position == null) {
21821
+ position = new loreline_Position(this.startLine,this.startColumn,this.pos);
21822
+ }
21823
+ position.length = this.pos - position.offset;
21824
+ let token = new loreline_Token(loreline_TokenType.OpUnquotedAssign,position);
21825
+ this.previous = token;
21826
+ return token;
21827
+ } else {
21828
+ let _g = 0;
21829
+ let _g1 = 1;
21830
+ while(_g < _g1) {
21831
+ let _ = _g++;
21832
+ if(this.pos >= this.length) {
21833
+ break;
21834
+ }
21835
+ let c = HxOverrides.cca(this.input,this.pos);
21836
+ if((c == null ? -1 : c) == 10) {
21837
+ this.line++;
21838
+ this.column = 1;
21839
+ } else {
21840
+ this.column++;
21841
+ }
21842
+ this.pos++;
21843
+ }
21844
+ let position = startPos;
21845
+ if(position == null) {
21846
+ position = new loreline_Position(this.startLine,this.startColumn,this.pos);
21847
+ }
21848
+ position.length = this.pos - position.offset;
21849
+ let token = new loreline_Token(loreline_TokenType.Colon,position);
21850
+ this.previous = token;
21851
+ return token;
20691
21852
  }
20692
- position7.length = this.pos - position7.offset;
20693
- let token7 = new loreline_Token(loreline_TokenType.Colon,position7);
20694
- this.previous = token7;
20695
- return token7;
21853
+ break;
20696
21854
  case 60:
20697
21855
  let c10 = c1;
20698
21856
  if(c10 >= 48 && c10 <= 57) {
@@ -20915,11 +22073,32 @@ class loreline_Lexer {
20915
22073
  }
20916
22074
  }
20917
22075
  break;
22076
+ case 63:
22077
+ let c13 = c1;
22078
+ if(c13 >= 48 && c13 <= 57) {
22079
+ return this.readNumber();
22080
+ } else {
22081
+ let c = c1;
22082
+ if(c >= 97 && c <= 122 || c >= 65 && c <= 90 || c == 95) {
22083
+ return this.readIdentifier();
22084
+ } else {
22085
+ this.pos++;
22086
+ let position = null;
22087
+ if(position == null) {
22088
+ position = new loreline_Position(this.startLine,this.startColumn,this.pos);
22089
+ }
22090
+ position.length = this.pos - position.offset;
22091
+ let token = new loreline_Token(loreline_TokenType.Question,position);
22092
+ this.previous = token;
22093
+ return token;
22094
+ }
22095
+ }
22096
+ break;
20918
22097
  case 93:
20919
- let _g16 = 0;
20920
- let _g17 = 1;
20921
- while(_g16 < _g17) {
20922
- let _ = _g16++;
22098
+ let _g14 = 0;
22099
+ let _g15 = 1;
22100
+ while(_g14 < _g15) {
22101
+ let _ = _g14++;
20923
22102
  if(this.pos >= this.length) {
20924
22103
  break;
20925
22104
  }
@@ -20933,17 +22112,17 @@ class loreline_Lexer {
20933
22112
  this.pos++;
20934
22113
  }
20935
22114
  this.strictExprs.pop();
20936
- let position8 = startPos;
20937
- if(position8 == null) {
20938
- position8 = new loreline_Position(this.startLine,this.startColumn,this.pos);
20939
- }
20940
- position8.length = this.pos - position8.offset;
20941
- let token8 = new loreline_Token(loreline_TokenType.RBracket,position8);
20942
- this.previous = token8;
20943
- return token8;
22115
+ let position7 = startPos;
22116
+ if(position7 == null) {
22117
+ position7 = new loreline_Position(this.startLine,this.startColumn,this.pos);
22118
+ }
22119
+ position7.length = this.pos - position7.offset;
22120
+ let token7 = new loreline_Token(loreline_TokenType.RBracket,position7);
22121
+ this.previous = token7;
22122
+ return token7;
20944
22123
  case 124:
20945
- let c13 = c1;
20946
- if(c13 >= 48 && c13 <= 57) {
22124
+ let c14 = c1;
22125
+ if(c14 >= 48 && c14 <= 57) {
20947
22126
  return this.readNumber();
20948
22127
  } else {
20949
22128
  let c = c1;
@@ -21017,8 +22196,8 @@ class loreline_Lexer {
21017
22196
  }
21018
22197
  break;
21019
22198
  default:
21020
- let c14 = c1;
21021
- if(c14 >= 48 && c14 <= 57) {
22199
+ let c15 = c1;
22200
+ if(c15 >= 48 && c15 <= 57) {
21022
22201
  return this.readNumber();
21023
22202
  } else {
21024
22203
  let c = c1;
@@ -21894,6 +23073,13 @@ class loreline_Lexer {
21894
23073
  while(pos < this.length && bracketLevel > 0) {
21895
23074
  let c = HxOverrides.cca(this.input,pos);
21896
23075
  c1 = c == null ? -1 : c;
23076
+ if(c1 == 34) {
23077
+ pos = this.scanStringEnd(pos,false);
23078
+ if(pos == -1) {
23079
+ return false;
23080
+ }
23081
+ continue;
23082
+ }
21897
23083
  if(c1 == 91) {
21898
23084
  ++bracketLevel;
21899
23085
  }
@@ -22007,12 +23193,50 @@ class loreline_Lexer {
22007
23193
  if(pos < this.length) {
22008
23194
  let c = HxOverrides.cca(this.input,pos);
22009
23195
  let c1 = c == null ? -1 : c;
23196
+ let tmp;
23197
+ if(c1 == 105 && pos + 1 < this.length) {
23198
+ let c = HxOverrides.cca(this.input,pos + 1);
23199
+ tmp = (c == null ? -1 : c) == 102;
23200
+ } else {
23201
+ tmp = false;
23202
+ }
23203
+ if(tmp) {
23204
+ let tmp;
23205
+ if(pos + 2 < this.length) {
23206
+ let c = HxOverrides.cca(this.input,pos + 2);
23207
+ let c1 = c == null ? -1 : c;
23208
+ tmp = !(c1 >= 97 && c1 <= 122 || c1 >= 65 && c1 <= 90 || c1 == 95 || c1 >= 48 && c1 <= 57);
23209
+ } else {
23210
+ tmp = true;
23211
+ }
23212
+ if(tmp) {
23213
+ return true;
23214
+ }
23215
+ }
22010
23216
  if(c1 != 10 && c1 != 13 && c1 != 32 && c1 != 9 && c1 != 47) {
22011
23217
  return false;
22012
23218
  }
22013
23219
  }
22014
23220
  return true;
22015
23221
  }
23222
+ isChoiceOnceStart(pos) {
23223
+ if(!this.inChoiceRoot()) {
23224
+ return false;
23225
+ }
23226
+ let c = HxOverrides.cca(this.input,pos);
23227
+ if((c == null ? -1 : c) != 45) {
23228
+ return false;
23229
+ }
23230
+ ++pos;
23231
+ if(pos >= this.length) {
23232
+ return false;
23233
+ }
23234
+ let c1 = HxOverrides.cca(this.input,pos);
23235
+ if((c1 == null ? -1 : c1) != 32) {
23236
+ return false;
23237
+ }
23238
+ return true;
23239
+ }
22016
23240
  isLabelStart(pos) {
22017
23241
  pos = this._skipWhitespaceAndComments(pos,false);
22018
23242
  let c = HxOverrides.cca(this.input,pos);
@@ -22140,7 +23364,16 @@ class loreline_Lexer {
22140
23364
  ++pos;
22141
23365
  while(pos < this.length) {
22142
23366
  let c = HxOverrides.cca(this.input,pos);
22143
- if((c == null ? -1 : c) == 93) {
23367
+ let bc = c == null ? -1 : c;
23368
+ if(bc == 34) {
23369
+ pos = this.scanStringEnd(pos,false);
23370
+ if(pos == -1) {
23371
+ pos = startPos;
23372
+ return false;
23373
+ }
23374
+ continue;
23375
+ }
23376
+ if(bc == 93) {
22144
23377
  ++pos;
22145
23378
  break;
22146
23379
  }
@@ -22210,9 +23443,20 @@ class loreline_Lexer {
22210
23443
  let c1 = c == null ? -1 : c;
22211
23444
  let tmp;
22212
23445
  if(!isEscape) {
22213
- if(c1 != 61) {
23446
+ let tmp1;
23447
+ if(c1 == 61) {
23448
+ if(pos + 1 < this.length) {
23449
+ let c = HxOverrides.cca(this.input,pos + 1);
23450
+ tmp1 = (c == null ? -1 : c) != 61;
23451
+ } else {
23452
+ tmp1 = true;
23453
+ }
23454
+ } else {
23455
+ tmp1 = false;
23456
+ }
23457
+ if(!tmp1) {
22214
23458
  let c = HxOverrides.cca(this.input,pos + 1);
22215
- tmp = (c == null ? -1 : c) == 61 && (c1 == 43 || c1 == 45 || c1 == 42 || c1 == 47);
23459
+ tmp = (c == null ? -1 : c) == 61 && (c1 == 43 || c1 == 45 || c1 == 42 || c1 == 47 || c1 == 58);
22216
23460
  } else {
22217
23461
  tmp = true;
22218
23462
  }
@@ -22270,7 +23514,15 @@ class loreline_Lexer {
22270
23514
  ++pos;
22271
23515
  while(pos < this.length) {
22272
23516
  let c = HxOverrides.cca(this.input,pos);
22273
- if((c == null ? -1 : c) == 93) {
23517
+ let bc = c == null ? -1 : c;
23518
+ if(bc == 34) {
23519
+ pos = this.scanStringEnd(pos,false);
23520
+ if(pos == -1) {
23521
+ return false;
23522
+ }
23523
+ continue;
23524
+ }
23525
+ if(bc == 93) {
22274
23526
  ++pos;
22275
23527
  break;
22276
23528
  }
@@ -22284,6 +23536,11 @@ class loreline_Lexer {
22284
23536
  ++pos;
22285
23537
  } else if(c1 == 13 || c1 == 10) {
22286
23538
  return false;
23539
+ } else if(c1 == 34) {
23540
+ pos = this.scanStringEnd(pos,false);
23541
+ if(pos == -1) {
23542
+ return false;
23543
+ }
22287
23544
  } else if(c1 >= 97 && c1 <= 122 || c1 >= 65 && c1 <= 90 || c1 == 95) {
22288
23545
  let result = true;
22289
23546
  let startPos = pos;
@@ -22324,7 +23581,18 @@ class loreline_Lexer {
22324
23581
  return false;
22325
23582
  }
22326
23583
  } else {
22327
- ++pos;
23584
+ let tmp;
23585
+ if((c1 == 61 || c1 == 33 || c1 == 60 || c1 == 62) && pos + 1 < this.length) {
23586
+ let c = HxOverrides.cca(this.input,pos + 1);
23587
+ tmp = (c == null ? -1 : c) == 61;
23588
+ } else {
23589
+ tmp = false;
23590
+ }
23591
+ if(tmp) {
23592
+ pos += 2;
23593
+ } else {
23594
+ ++pos;
23595
+ }
22328
23596
  }
22329
23597
  }
22330
23598
  return false;
@@ -22436,11 +23704,30 @@ class loreline_Lexer {
22436
23704
  ++pos;
22437
23705
  }
22438
23706
  if(!onlyTagsOnFirstLine) {
22439
- return -1;
22440
- }
22441
- let prevPos = pos;
22442
- let stopNextLine = true;
22443
- if(stopNextLine == null) {
23707
+ while(true) {
23708
+ let tmp;
23709
+ let tmp1;
23710
+ if(pos < this.length) {
23711
+ let c = HxOverrides.cca(this.input,pos);
23712
+ tmp1 = (c == null ? -1 : c) != 10;
23713
+ } else {
23714
+ tmp1 = false;
23715
+ }
23716
+ if(tmp1) {
23717
+ let c = HxOverrides.cca(this.input,pos);
23718
+ tmp = (c == null ? -1 : c) != 13;
23719
+ } else {
23720
+ tmp = false;
23721
+ }
23722
+ if(!tmp) {
23723
+ break;
23724
+ }
23725
+ ++pos;
23726
+ }
23727
+ }
23728
+ let prevPos = pos;
23729
+ let stopNextLine = true;
23730
+ if(stopNextLine == null) {
22444
23731
  stopNextLine = false;
22445
23732
  }
22446
23733
  pos = this._skipWhitespaceAndComments(pos,stopNextLine);
@@ -22638,6 +23925,20 @@ class loreline_Lexer {
22638
23925
  }
22639
23926
  return false;
22640
23927
  }
23928
+ followsUnquotedAssign() {
23929
+ let i = this.tokenized.length - 1;
23930
+ while(i >= 0) {
23931
+ let token = this.tokenized[i];
23932
+ if(loreline_TokenTypeHelpers.isComment(token.type) || token.type == loreline_TokenType.Indent || token.type == loreline_TokenType.Unindent) {
23933
+ --i;
23934
+ } else if(token.type == loreline_TokenType.OpUnquotedAssign) {
23935
+ return true;
23936
+ } else {
23937
+ return false;
23938
+ }
23939
+ }
23940
+ return false;
23941
+ }
22641
23942
  followsOnlyLabelOrCommentsInLine() {
22642
23943
  let foundLabel = false;
22643
23944
  let i = this.tokenized.length - 1;
@@ -22677,6 +23978,23 @@ class loreline_Lexer {
22677
23978
  }
22678
23979
  return true;
22679
23980
  }
23981
+ followsChoiceOncePrefix() {
23982
+ if(!this.inChoiceRoot()) {
23983
+ return false;
23984
+ }
23985
+ let i = this.tokenized.length - 1;
23986
+ while(i >= 0) {
23987
+ let token = this.tokenized[i];
23988
+ if(loreline_TokenTypeHelpers.isComment(token.type) || token.type == loreline_TokenType.Indent || token.type == loreline_TokenType.Unindent) {
23989
+ --i;
23990
+ } else if(token.type == loreline_TokenType.OpMinus) {
23991
+ return true;
23992
+ } else {
23993
+ return false;
23994
+ }
23995
+ }
23996
+ return false;
23997
+ }
22680
23998
  hasNonSpecialChar(str) {
22681
23999
  let _g = 0;
22682
24000
  let _g1 = str.length;
@@ -22780,19 +24098,19 @@ class loreline_Lexer {
22780
24098
  let _g1 = _g.name;
22781
24099
  this.strictExprs.push(1);
22782
24100
  return;
22783
- case 46:case 48:
24101
+ case 48:case 50:
22784
24102
  this.strictExprs.push(1);
22785
24103
  return;
22786
- case 49:
24104
+ case 51:
22787
24105
  let _g2 = _g.content;
22788
24106
  break;
22789
- case 50:
24107
+ case 52:
22790
24108
  let _g3 = _g.content;
22791
24109
  break;
22792
- case 51:
24110
+ case 53:
22793
24111
  let _g4 = _g.content;
22794
24112
  break;
22795
- case 52:case 53:case 54:
24113
+ case 54:case 55:case 56:
22796
24114
  break;
22797
24115
  default:
22798
24116
  this.strictExprs.push(0);
@@ -22818,18 +24136,18 @@ class loreline_Lexer {
22818
24136
  case 19:
22819
24137
  let _g1 = _g.name;
22820
24138
  return true;
22821
- case 46:case 48:
24139
+ case 48:case 50:
22822
24140
  return true;
22823
- case 49:
24141
+ case 51:
22824
24142
  let _g2 = _g.content;
22825
24143
  break;
22826
- case 50:
24144
+ case 52:
22827
24145
  let _g3 = _g.content;
22828
24146
  break;
22829
- case 51:
24147
+ case 53:
22830
24148
  let _g4 = _g.content;
22831
24149
  break;
22832
- case 52:case 53:case 54:
24150
+ case 54:case 55:case 56:
22833
24151
  break;
22834
24152
  default:
22835
24153
  return false;
@@ -22858,6 +24176,20 @@ class loreline_Lexer {
22858
24176
  if(cc == 10) {
22859
24177
  break;
22860
24178
  }
24179
+ if(cc == 47 && this.pos + 1 < this.length) {
24180
+ let c = HxOverrides.cca(this.input,this.pos + 1);
24181
+ let next = c == null ? -1 : c;
24182
+ if(next == 47 || next == 42) {
24183
+ break;
24184
+ }
24185
+ }
24186
+ if(cc == 35 && this.pos + 1 < this.length) {
24187
+ let c = HxOverrides.cca(this.input,this.pos + 1);
24188
+ let next = c == null ? -1 : c;
24189
+ if(next >= 97 && next <= 122 || next >= 65 && next <= 90 || next == 95 || next >= 48 && next <= 57 || next == 45) {
24190
+ break;
24191
+ }
24192
+ }
22861
24193
  buf_b += String.fromCodePoint(cc);
22862
24194
  this.pos++;
22863
24195
  }
@@ -22872,6 +24204,272 @@ class loreline_Lexer {
22872
24204
  return token;
22873
24205
  }
22874
24206
  }
24207
+ scanStringEnd(startPos,allowTags) {
24208
+ let p = startPos + 1;
24209
+ let inTag = false;
24210
+ while(p < this.length) {
24211
+ let c = HxOverrides.cca(this.input,p);
24212
+ let c1 = c == null ? -1 : c;
24213
+ if(c1 == 92) {
24214
+ p += 2;
24215
+ continue;
24216
+ }
24217
+ if(c1 == 10) {
24218
+ return -1;
24219
+ }
24220
+ if(c1 == 34 && !inTag) {
24221
+ return p + 1;
24222
+ }
24223
+ if(allowTags && c1 == 60 && !inTag) {
24224
+ let nc;
24225
+ if(p + 1 < this.length) {
24226
+ let c = HxOverrides.cca(this.input,p + 1);
24227
+ nc = c == null ? -1 : c;
24228
+ } else {
24229
+ nc = 0;
24230
+ }
24231
+ let isClosing = nc == 47;
24232
+ let checkPos = p + (isClosing ? 2 : 1);
24233
+ if(checkPos < this.length) {
24234
+ let c = HxOverrides.cca(this.input,checkPos);
24235
+ let ns = c == null ? -1 : c;
24236
+ if(ns >= 97 && ns <= 122 || ns >= 65 && ns <= 90 || ns == 95 || ns == 95 || ns == 36 || isClosing && ns == 62) {
24237
+ inTag = true;
24238
+ }
24239
+ }
24240
+ }
24241
+ if(c1 == 62 && inTag) {
24242
+ inTag = false;
24243
+ }
24244
+ if(c1 == 36 && p + 1 < this.length) {
24245
+ let c = HxOverrides.cca(this.input,p + 1);
24246
+ let next = c == null ? -1 : c;
24247
+ if(next == 123) {
24248
+ p += 2;
24249
+ let depth = 1;
24250
+ while(p < this.length && depth > 0) {
24251
+ let c = HxOverrides.cca(this.input,p);
24252
+ let ic = c == null ? -1 : c;
24253
+ if(ic == 92) {
24254
+ p += 2;
24255
+ continue;
24256
+ }
24257
+ if(ic == 10) {
24258
+ return -1;
24259
+ }
24260
+ let tmp;
24261
+ if(ic == 47 && p + 1 < this.length) {
24262
+ let c = HxOverrides.cca(this.input,p + 1);
24263
+ tmp = (c == null ? -1 : c) == 47;
24264
+ } else {
24265
+ tmp = false;
24266
+ }
24267
+ if(tmp) {
24268
+ return -1;
24269
+ }
24270
+ let tmp1;
24271
+ if(ic == 47 && p + 1 < this.length) {
24272
+ let c = HxOverrides.cca(this.input,p + 1);
24273
+ tmp1 = (c == null ? -1 : c) == 42;
24274
+ } else {
24275
+ tmp1 = false;
24276
+ }
24277
+ if(tmp1) {
24278
+ p += 2;
24279
+ while(true) {
24280
+ if(p >= this.length) {
24281
+ return -1;
24282
+ }
24283
+ let c = HxOverrides.cca(this.input,p);
24284
+ if((c == null ? -1 : c) == 10) {
24285
+ return -1;
24286
+ }
24287
+ let tmp;
24288
+ let tmp1;
24289
+ if(p + 1 < this.length) {
24290
+ let c = HxOverrides.cca(this.input,p);
24291
+ tmp1 = (c == null ? -1 : c) == 42;
24292
+ } else {
24293
+ tmp1 = false;
24294
+ }
24295
+ if(tmp1) {
24296
+ let c = HxOverrides.cca(this.input,p + 1);
24297
+ tmp = (c == null ? -1 : c) == 47;
24298
+ } else {
24299
+ tmp = false;
24300
+ }
24301
+ if(tmp) {
24302
+ p += 2;
24303
+ break;
24304
+ }
24305
+ ++p;
24306
+ }
24307
+ continue;
24308
+ }
24309
+ if(ic == 34) {
24310
+ p = this.scanStringEnd(p,allowTags);
24311
+ if(p == -1) {
24312
+ return -1;
24313
+ }
24314
+ continue;
24315
+ }
24316
+ if(ic == 123) {
24317
+ ++depth;
24318
+ } else if(ic == 125) {
24319
+ --depth;
24320
+ }
24321
+ ++p;
24322
+ }
24323
+ if(depth != 0) {
24324
+ return -1;
24325
+ }
24326
+ continue;
24327
+ }
24328
+ if(next == 36) {
24329
+ p += 2;
24330
+ continue;
24331
+ }
24332
+ if(next >= 97 && next <= 122 || next >= 65 && next <= 90 || next == 95) {
24333
+ ++p;
24334
+ while(true) {
24335
+ let tmp;
24336
+ if(p < this.length) {
24337
+ let c = HxOverrides.cca(this.input,p);
24338
+ let c1 = c == null ? -1 : c;
24339
+ tmp = c1 >= 97 && c1 <= 122 || c1 >= 65 && c1 <= 90 || c1 == 95 || c1 >= 48 && c1 <= 57;
24340
+ } else {
24341
+ tmp = false;
24342
+ }
24343
+ if(!tmp) {
24344
+ break;
24345
+ }
24346
+ ++p;
24347
+ }
24348
+ p = this.scanAccessorChain(p,allowTags);
24349
+ if(p == -1) {
24350
+ return -1;
24351
+ }
24352
+ continue;
24353
+ }
24354
+ }
24355
+ ++p;
24356
+ }
24357
+ return -1;
24358
+ }
24359
+ scanAccessorChain(p,allowTags) {
24360
+ while(p < this.length) {
24361
+ let c = HxOverrides.cca(this.input,p);
24362
+ let c1 = c == null ? -1 : c;
24363
+ let tmp;
24364
+ if(c1 == 46 && p + 1 < this.length) {
24365
+ let c = HxOverrides.cca(this.input,p + 1);
24366
+ let c1 = c == null ? -1 : c;
24367
+ tmp = c1 >= 97 && c1 <= 122 || c1 >= 65 && c1 <= 90 || c1 == 95;
24368
+ } else {
24369
+ tmp = false;
24370
+ }
24371
+ if(tmp) {
24372
+ ++p;
24373
+ while(true) {
24374
+ let tmp;
24375
+ if(p < this.length) {
24376
+ let c = HxOverrides.cca(this.input,p);
24377
+ let c1 = c == null ? -1 : c;
24378
+ tmp = c1 >= 97 && c1 <= 122 || c1 >= 65 && c1 <= 90 || c1 == 95 || c1 >= 48 && c1 <= 57;
24379
+ } else {
24380
+ tmp = false;
24381
+ }
24382
+ if(!tmp) {
24383
+ break;
24384
+ }
24385
+ ++p;
24386
+ }
24387
+ } else if(c1 == 91 || c1 == 40) {
24388
+ let close = c1 == 91 ? 93 : 41;
24389
+ ++p;
24390
+ let depth = 1;
24391
+ while(p < this.length && depth > 0) {
24392
+ let c = HxOverrides.cca(this.input,p);
24393
+ let ic = c == null ? -1 : c;
24394
+ if(ic == 92) {
24395
+ p += 2;
24396
+ continue;
24397
+ }
24398
+ if(ic == 10) {
24399
+ return -1;
24400
+ }
24401
+ let tmp;
24402
+ if(ic == 47 && p + 1 < this.length) {
24403
+ let c = HxOverrides.cca(this.input,p + 1);
24404
+ tmp = (c == null ? -1 : c) == 47;
24405
+ } else {
24406
+ tmp = false;
24407
+ }
24408
+ if(tmp) {
24409
+ return -1;
24410
+ }
24411
+ let tmp1;
24412
+ if(ic == 47 && p + 1 < this.length) {
24413
+ let c = HxOverrides.cca(this.input,p + 1);
24414
+ tmp1 = (c == null ? -1 : c) == 42;
24415
+ } else {
24416
+ tmp1 = false;
24417
+ }
24418
+ if(tmp1) {
24419
+ p += 2;
24420
+ while(true) {
24421
+ if(p >= this.length) {
24422
+ return -1;
24423
+ }
24424
+ let c = HxOverrides.cca(this.input,p);
24425
+ if((c == null ? -1 : c) == 10) {
24426
+ return -1;
24427
+ }
24428
+ let tmp;
24429
+ let tmp1;
24430
+ if(p + 1 < this.length) {
24431
+ let c = HxOverrides.cca(this.input,p);
24432
+ tmp1 = (c == null ? -1 : c) == 42;
24433
+ } else {
24434
+ tmp1 = false;
24435
+ }
24436
+ if(tmp1) {
24437
+ let c = HxOverrides.cca(this.input,p + 1);
24438
+ tmp = (c == null ? -1 : c) == 47;
24439
+ } else {
24440
+ tmp = false;
24441
+ }
24442
+ if(tmp) {
24443
+ p += 2;
24444
+ break;
24445
+ }
24446
+ ++p;
24447
+ }
24448
+ continue;
24449
+ }
24450
+ if(ic == 34) {
24451
+ p = this.scanStringEnd(p,allowTags);
24452
+ if(p == -1) {
24453
+ return -1;
24454
+ }
24455
+ continue;
24456
+ }
24457
+ if(ic == c1) {
24458
+ ++depth;
24459
+ } else if(ic == close) {
24460
+ --depth;
24461
+ }
24462
+ ++p;
24463
+ }
24464
+ if(depth != 0) {
24465
+ return -1;
24466
+ }
24467
+ } else {
24468
+ break;
24469
+ }
24470
+ }
24471
+ return p;
24472
+ }
22875
24473
  tryReadUnquotedString() {
22876
24474
  if(this.isStrict()) {
22877
24475
  return null;
@@ -22892,7 +24490,7 @@ class loreline_Lexer {
22892
24490
  return null;
22893
24491
  }
22894
24492
  }
22895
- if(c1 == 123 || c1 == 125 || c1 == 91 || c1 == 93 || c1 == 34 || c1 == 58 || c1 == 35 || (c1 == 32 || c1 == 9)) {
24493
+ if(c1 == 123 || c1 == 125 || c1 == 91 || c1 == 93 || c1 == 58 || c1 == 35 || (c1 == 32 || c1 == 9)) {
22896
24494
  return null;
22897
24495
  }
22898
24496
  let parent = this.parentBlockType();
@@ -22900,7 +24498,7 @@ class loreline_Lexer {
22900
24498
  return null;
22901
24499
  }
22902
24500
  let inBrackets = this.isInsideBrackets();
22903
- let isAssignValue = false;
24501
+ let isAssignValue = this.followsUnquotedAssign();
22904
24502
  let labelIdentifierIndex = this.afterLabelIdentifierToken(false);
22905
24503
  if(labelIdentifierIndex != -1 && this.tokenized[labelIdentifierIndex].pos.line < this.line) {
22906
24504
  if(this.tokenized[labelIdentifierIndex].pos.column >= this.column) {
@@ -22913,11 +24511,12 @@ class loreline_Lexer {
22913
24511
  let multilineIndent = labelIdentifierIndex != -1 ? this.isStartingMultilineDialogue(labelIdentifierIndex) : -1;
22914
24512
  let isAfterLabel = labelIdentifierIndex != -1;
22915
24513
  let isValue = parent == loreline_TokenType.KwState || parent == loreline_TokenType.KwCharacter || inBrackets || isAssignValue;
24514
+ let identifier = this.matchIdentifier(this.pos);
22916
24515
  if(isValue) {
22917
24516
  if(this.isCallStart(this.pos) || this.isLabelStart(this.pos)) {
22918
24517
  return null;
22919
24518
  }
22920
- } else if(!isAfterLabel && (this.isIdentifierExpressionStart(this.pos,true) || this.isIfStart(this.pos) || this.isCallStart(this.pos) || this.isAssignStart(this.pos,false))) {
24519
+ } else if(!isAfterLabel && identifier != "true" && identifier != "false" && identifier != "null" && (this.keepOrphanExpressions && this.isIdentifierExpressionStart(this.pos,true) || this.isIfStart(this.pos) || this.isCallStart(this.pos) || this.isAssignStart(this.pos,false))) {
22921
24520
  return null;
22922
24521
  }
22923
24522
  if(!isValue) {
@@ -22929,8 +24528,10 @@ class loreline_Lexer {
22929
24528
  if(this.isInsertionStart(this.pos)) {
22930
24529
  return null;
22931
24530
  }
24531
+ if(this.isChoiceOnceStart(this.pos)) {
24532
+ return null;
24533
+ }
22932
24534
  }
22933
- let identifier = this.matchIdentifier(this.pos);
22934
24535
  if(identifier != null) {
22935
24536
  if(identifier == "function") {
22936
24537
  return null;
@@ -22939,30 +24540,181 @@ class loreline_Lexer {
22939
24540
  if(identifier != "if" && identifier != "null" && identifier != "true" && identifier != "false" && identifier != "and" && identifier != "or" && Object.prototype.hasOwnProperty.call(loreline_Lexer.KEYWORDS.h,identifier)) {
22940
24541
  return null;
22941
24542
  }
22942
- if(this.isColon(this.pos + identifier.length)) {
24543
+ if(this.isColon(this.pos + identifier.length)) {
24544
+ return null;
24545
+ }
24546
+ }
24547
+ }
24548
+ let allowTags = !isValue;
24549
+ let isDialogue = false;
24550
+ if(isValue) {
24551
+ if(inBrackets) {
24552
+ if(!isAfterLabel && !this.followsOnlyWhitespacesOrCommentsInLine() && !this.isAfterComma() && !this.isAfterLBracket()) {
24553
+ return null;
24554
+ }
24555
+ } else if(!isAssignValue && !isAfterLabel) {
24556
+ return null;
24557
+ }
24558
+ } else {
24559
+ isDialogue = this.followsOnlyLabelOrCommentsInLine();
24560
+ if(!isDialogue && !this.followsOnlyWhitespacesOrCommentsInLine() && !this.followsChoiceOncePrefix()) {
24561
+ return null;
24562
+ }
24563
+ if(!isDialogue) {
24564
+ if(cc == 62 && c1 == 45) {
24565
+ return null;
24566
+ }
24567
+ }
24568
+ }
24569
+ if(c1 == 34) {
24570
+ let scanEndPos = this.scanStringEnd(this.pos,parent == loreline_TokenType.KwBeat);
24571
+ if(scanEndPos == -1) {
24572
+ return null;
24573
+ }
24574
+ let hasSameLineContent = false;
24575
+ let eolPos = scanEndPos;
24576
+ while(eolPos < this.length) {
24577
+ let c = HxOverrides.cca(this.input,eolPos);
24578
+ let sc = c == null ? -1 : c;
24579
+ if(sc == 32 || sc == 9) {
24580
+ ++eolPos;
24581
+ continue;
24582
+ }
24583
+ if(sc == 10 || sc == 13) {
24584
+ break;
24585
+ }
24586
+ let tmp;
24587
+ if(sc == 47 && eolPos + 1 < this.length) {
24588
+ let c = HxOverrides.cca(this.input,eolPos + 1);
24589
+ if((c == null ? -1 : c) != 47) {
24590
+ let c = HxOverrides.cca(this.input,eolPos + 1);
24591
+ tmp = (c == null ? -1 : c) == 42;
24592
+ } else {
24593
+ tmp = true;
24594
+ }
24595
+ } else {
24596
+ tmp = false;
24597
+ }
24598
+ if(tmp) {
24599
+ break;
24600
+ }
24601
+ if(sc == 93 || sc == 125 || sc == 41 || sc == 44) {
24602
+ break;
24603
+ }
24604
+ if(sc == 35) {
24605
+ break;
24606
+ }
24607
+ hasSameLineContent = true;
24608
+ break;
24609
+ }
24610
+ if(!hasSameLineContent && !isValue) {
24611
+ let stopNextLine = true;
24612
+ if(stopNextLine == null) {
24613
+ stopNextLine = false;
24614
+ }
24615
+ let nextLinePos = this._skipWhitespaceAndComments(eolPos,stopNextLine);
24616
+ if(nextLinePos <= eolPos || nextLinePos >= this.length) {
24617
+ return null;
24618
+ }
24619
+ let c = HxOverrides.cca(this.input,nextLinePos);
24620
+ let nextChar = c == null ? -1 : c;
24621
+ let tmp;
24622
+ if(!(nextChar == 10 || nextChar == 13 || nextChar == 34)) {
24623
+ if(nextChar == 47 && nextLinePos + 1 < this.length) {
24624
+ let c = HxOverrides.cca(this.input,nextLinePos + 1);
24625
+ if((c == null ? -1 : c) != 47) {
24626
+ let c = HxOverrides.cca(this.input,nextLinePos + 1);
24627
+ tmp = (c == null ? -1 : c) == 42;
24628
+ } else {
24629
+ tmp = true;
24630
+ }
24631
+ } else {
24632
+ tmp = false;
24633
+ }
24634
+ } else {
24635
+ tmp = true;
24636
+ }
24637
+ if(tmp) {
24638
+ return null;
24639
+ }
24640
+ let nextIndent = 0;
24641
+ let tmpPos = nextLinePos;
24642
+ while(true) {
24643
+ let tmp;
24644
+ if(tmpPos > 0) {
24645
+ let c = HxOverrides.cca(this.input,tmpPos - 1);
24646
+ if((c == null ? -1 : c) != 32) {
24647
+ let c = HxOverrides.cca(this.input,tmpPos - 1);
24648
+ tmp = (c == null ? -1 : c) == 9;
24649
+ } else {
24650
+ tmp = true;
24651
+ }
24652
+ } else {
24653
+ tmp = false;
24654
+ }
24655
+ if(!tmp) {
24656
+ break;
24657
+ }
24658
+ ++nextIndent;
24659
+ --tmpPos;
24660
+ }
24661
+ let expectedIndent = multilineIndent != -1 ? multilineIndent : this.column - 1;
24662
+ if(nextIndent != expectedIndent) {
24663
+ return null;
24664
+ }
24665
+ let tmp1;
24666
+ if(nextChar == 45 && nextLinePos + 1 < this.length) {
24667
+ let c = HxOverrides.cca(this.input,nextLinePos + 1);
24668
+ tmp1 = (c == null ? -1 : c) == 62;
24669
+ } else {
24670
+ tmp1 = false;
24671
+ }
24672
+ if(tmp1) {
22943
24673
  return null;
22944
24674
  }
22945
- }
22946
- }
22947
- let allowTags = !isValue;
22948
- let isDialogue = false;
22949
- if(isValue) {
22950
- if(inBrackets) {
22951
- if(!isAfterLabel && !this.followsOnlyWhitespacesOrCommentsInLine() && !this.isAfterComma() && !this.isAfterLBracket()) {
24675
+ if(nextChar == 43) {
22952
24676
  return null;
22953
24677
  }
22954
- } else if(!isAssignValue && !isAfterLabel) {
22955
- return null;
22956
- }
22957
- } else {
22958
- isDialogue = this.followsOnlyLabelOrCommentsInLine();
22959
- if(!isDialogue && !this.followsOnlyWhitespacesOrCommentsInLine()) {
22960
- return null;
22961
- }
22962
- if(!isDialogue) {
22963
- if(cc == 62 && c1 == 45) {
24678
+ if(this.isAssignStart(nextLinePos,false)) {
24679
+ return null;
24680
+ }
24681
+ if(this.isCallStart(nextLinePos)) {
22964
24682
  return null;
22965
24683
  }
24684
+ if(this.isLabelStart(nextLinePos)) {
24685
+ return null;
24686
+ }
24687
+ if(this.isIfStart(nextLinePos)) {
24688
+ return null;
24689
+ }
24690
+ if(this.isIdentifierExpressionStart(nextLinePos,true)) {
24691
+ return null;
24692
+ }
24693
+ if(nextChar >= 97 && nextChar <= 122 || nextChar >= 65 && nextChar <= 90 || nextChar == 95) {
24694
+ let wordEnd = nextLinePos;
24695
+ while(true) {
24696
+ let tmp;
24697
+ if(wordEnd < this.length) {
24698
+ let c = HxOverrides.cca(this.input,wordEnd);
24699
+ let c1 = c == null ? -1 : c;
24700
+ tmp = c1 >= 97 && c1 <= 122 || c1 >= 65 && c1 <= 90 || c1 == 95 || c1 >= 48 && c1 <= 57;
24701
+ } else {
24702
+ tmp = false;
24703
+ }
24704
+ if(!tmp) {
24705
+ break;
24706
+ }
24707
+ ++wordEnd;
24708
+ }
24709
+ let str = this.input;
24710
+ let len = wordEnd - nextLinePos;
24711
+ let kw = len != null ? HxOverrides.substr(str,nextLinePos,len) : HxOverrides.substr(str,nextLinePos,null);
24712
+ if(kw != "null" && kw != "true" && kw != "false" && Object.prototype.hasOwnProperty.call(loreline_Lexer.KEYWORDS.h,kw)) {
24713
+ return null;
24714
+ }
24715
+ }
24716
+ } else if(!hasSameLineContent) {
24717
+ return null;
22966
24718
  }
22967
24719
  }
22968
24720
  let start = new loreline_Position(this.startLine,this.startColumn,this.pos);
@@ -23489,7 +25241,7 @@ class loreline_Lexer {
23489
25241
  content = StringTools.rtrim(content);
23490
25242
  let contentLength = content.length;
23491
25243
  let rtrimmedOffset = rawContentLength - contentLength;
23492
- if(contentLength > 0 && this.hasNonSpecialChar(content) && !this.isNumber(content) && content != "null" && content != "true" && content != "false") {
25244
+ if(contentLength > 0 && this.hasNonSpecialChar(content) && (isValue ? !this.isNumber(content) && content != "null" && content != "true" && content != "false" : true)) {
23493
25245
  if(multilineIndent == -1 && !isAfterLabel && !this.inChoiceRoot()) {
23494
25246
  let savedLine = this.line;
23495
25247
  let savedColumn = this.column;
@@ -23943,10 +25695,10 @@ class loreline_Lexer {
23943
25695
  currentColumn += tokenLength;
23944
25696
  }
23945
25697
  switch(token.type._hx_index) {
23946
- case 43:
25698
+ case 45:
23947
25699
  ++braceLevel;
23948
25700
  break;
23949
- case 44:
25701
+ case 46:
23950
25702
  --braceLevel;
23951
25703
  break;
23952
25704
  default:
@@ -25736,6 +27488,9 @@ class loreline_Loreline {
25736
27488
  let printer = new loreline_Printer(tmp != null ? tmp : " ",tmp1 != null ? tmp1 : "\n");
25737
27489
  return printer.print(script);
25738
27490
  }
27491
+ static update(delta) {
27492
+ loreline_Timer.update(delta);
27493
+ }
25739
27494
  }
25740
27495
  $hxClasses["loreline.Loreline"] = $hx_exports["loreline"]["Loreline"] = loreline_Loreline;
25741
27496
  loreline_Loreline.__name__ = "loreline.Loreline";
@@ -26065,6 +27820,9 @@ class loreline_Node {
26065
27820
  }
26066
27821
  each(handleNode) {
26067
27822
  }
27823
+ static fromJson(json) {
27824
+ return loreline_JsonToAst.nodeFromJson(json);
27825
+ }
26068
27826
  }
26069
27827
  $hxClasses["loreline.Node"] = $hx_exports["loreline"]["Node"] = loreline_Node;
26070
27828
  loreline_Node.__name__ = "loreline.Node";
@@ -26705,6 +28463,7 @@ class loreline_NChoiceOption extends loreline_AstNode {
26705
28463
  this.conditionStyle = conditionStyle;
26706
28464
  this.body = body;
26707
28465
  this.style = 0;
28466
+ this.once = false;
26708
28467
  }
26709
28468
  type() {
26710
28469
  return "Option";
@@ -26757,6 +28516,9 @@ class loreline_NChoiceOption extends loreline_AstNode {
26757
28516
  }
26758
28517
  json.body = _g;
26759
28518
  json.style = loreline_BlockStyle.toString(this.style);
28519
+ if(this.once) {
28520
+ json.once = true;
28521
+ }
26760
28522
  return json;
26761
28523
  }
26762
28524
  }
@@ -26972,6 +28734,30 @@ class loreline_NAlternative extends loreline_AstNode {
26972
28734
  }
26973
28735
  json.items = _g;
26974
28736
  json.style = loreline_BlockStyle.toString(this.style);
28737
+ if(this.separatorComments != null) {
28738
+ let _g = [];
28739
+ let _g1 = 0;
28740
+ let _g2 = this.separatorComments;
28741
+ while(_g1 < _g2.length) {
28742
+ let comments = _g2[_g1];
28743
+ ++_g1;
28744
+ let tmp;
28745
+ if(comments != null) {
28746
+ let _g = [];
28747
+ let _g1 = 0;
28748
+ while(_g1 < comments.length) {
28749
+ let c = comments[_g1];
28750
+ ++_g1;
28751
+ _g.push(c.toJson());
28752
+ }
28753
+ tmp = _g;
28754
+ } else {
28755
+ tmp = null;
28756
+ }
28757
+ _g.push(tmp);
28758
+ }
28759
+ json.separatorComments = _g;
28760
+ }
26975
28761
  return json;
26976
28762
  }
26977
28763
  }
@@ -27372,6 +29158,45 @@ loreline_NUnary.__super__ = loreline_NExpr;
27372
29158
  Object.assign(loreline_NUnary.prototype, {
27373
29159
  __class__: loreline_NUnary
27374
29160
  });
29161
+ class loreline_NTernary extends loreline_NExpr {
29162
+ constructor(id,pos,condition,trueExpr,falseExpr,leadingComments,trailingComments) {
29163
+ super(id,pos,leadingComments,trailingComments);
29164
+ this.condition = condition;
29165
+ this.trueExpr = trueExpr;
29166
+ this.falseExpr = falseExpr;
29167
+ }
29168
+ type() {
29169
+ return "Ternary";
29170
+ }
29171
+ each(handleNode) {
29172
+ super.each(handleNode);
29173
+ if(this.condition != null) {
29174
+ handleNode(this.condition,this);
29175
+ this.condition.each(handleNode);
29176
+ }
29177
+ if(this.trueExpr != null) {
29178
+ handleNode(this.trueExpr,this);
29179
+ this.trueExpr.each(handleNode);
29180
+ }
29181
+ if(this.falseExpr != null) {
29182
+ handleNode(this.falseExpr,this);
29183
+ this.falseExpr.each(handleNode);
29184
+ }
29185
+ }
29186
+ toJson() {
29187
+ let json = super.toJson();
29188
+ json.condition = this.condition.toJson();
29189
+ json.trueExpr = this.trueExpr.toJson();
29190
+ json.falseExpr = this.falseExpr.toJson();
29191
+ return json;
29192
+ }
29193
+ }
29194
+ $hxClasses["loreline.NTernary"] = loreline_NTernary;
29195
+ loreline_NTernary.__name__ = "loreline.NTernary";
29196
+ loreline_NTernary.__super__ = loreline_NExpr;
29197
+ Object.assign(loreline_NTernary.prototype, {
29198
+ __class__: loreline_NTernary
29199
+ });
27375
29200
  class loreline_NImportStatement extends loreline_AstNode {
27376
29201
  constructor(id,pos,path,script,leadingComments,trailingComments) {
27377
29202
  super(id,pos,leadingComments,trailingComments);
@@ -27391,6 +29216,9 @@ class loreline_NImportStatement extends loreline_AstNode {
27391
29216
  toJson() {
27392
29217
  let json = super.toJson();
27393
29218
  json.path = this.path.toJson();
29219
+ if(this.script != null) {
29220
+ json.script = this.script.toJson();
29221
+ }
27394
29222
  return json;
27395
29223
  }
27396
29224
  }
@@ -27485,6 +29313,9 @@ class loreline_Objects {
27485
29313
  static getMapHelper(interpreter,name) {
27486
29314
  return interpreter.mapHelpers.h[name];
27487
29315
  }
29316
+ static getBeatHelper(interpreter,name) {
29317
+ return interpreter.beatHelpers.h[name];
29318
+ }
27488
29319
  static createFields(interpreter,type,node) {
27489
29320
  if(interpreter != null && interpreter.customCreateFields != null) {
27490
29321
  let customInstance = interpreter.customCreateFields(interpreter,type,node);
@@ -27599,19 +29430,19 @@ class loreline_Parser {
27599
29430
  while(i < this.tokens.length) {
27600
29431
  let _g = this.tokens[i].type;
27601
29432
  switch(_g._hx_index) {
27602
- case 49:
29433
+ case 51:
27603
29434
  let _g1 = _g.content;
27604
29435
  ++i;
27605
29436
  break;
27606
- case 50:
29437
+ case 52:
27607
29438
  let _g2 = _g.content;
27608
29439
  ++i;
27609
29440
  break;
27610
- case 51:
29441
+ case 53:
27611
29442
  let _g3 = _g.content;
27612
29443
  ++i;
27613
29444
  break;
27614
- case 54:
29445
+ case 56:
27615
29446
  ++i;
27616
29447
  break;
27617
29448
  default:
@@ -27632,28 +29463,28 @@ class loreline_Parser {
27632
29463
  this.current++;
27633
29464
  let _g = this.tokens[this.current].type;
27634
29465
  switch(_g._hx_index) {
27635
- case 49:
29466
+ case 51:
27636
29467
  let content = _g.content;
27637
29468
  if(this.pendingComments == null) {
27638
29469
  this.pendingComments = [];
27639
29470
  }
27640
29471
  this.pendingComments.push(new loreline_Comment(this.nextNodeId(4),this.currentPos(),content,false));
27641
29472
  break;
27642
- case 50:
29473
+ case 52:
27643
29474
  let content1 = _g.content;
27644
29475
  if(this.pendingComments == null) {
27645
29476
  this.pendingComments = [];
27646
29477
  }
27647
29478
  this.pendingComments.push(new loreline_Comment(this.nextNodeId(4),this.currentPos(),content1,true));
27648
29479
  break;
27649
- case 51:
29480
+ case 53:
27650
29481
  let content2 = _g.content;
27651
29482
  if(this.pendingComments == null) {
27652
29483
  this.pendingComments = [];
27653
29484
  }
27654
29485
  this.pendingComments.push(new loreline_Comment(this.nextNodeId(4),this.currentPos(),content2,false,true));
27655
29486
  break;
27656
- case 54:
29487
+ case 56:
27657
29488
  this.lastLineBreak = this.currentPos();
27658
29489
  this.lineBreakAfterToken = true;
27659
29490
  break;
@@ -27694,16 +29525,16 @@ class loreline_Parser {
27694
29525
  while(n >= 0) {
27695
29526
  let _g = this.tokens[n].type;
27696
29527
  switch(_g._hx_index) {
27697
- case 49:
29528
+ case 51:
27698
29529
  let _g1 = _g.content;
27699
29530
  break;
27700
- case 50:
29531
+ case 52:
27701
29532
  let _g2 = _g.content;
27702
29533
  break;
27703
- case 51:
29534
+ case 53:
27704
29535
  let _g3 = _g.content;
27705
29536
  break;
27706
- case 52:case 53:case 54:
29537
+ case 54:case 55:case 56:
27707
29538
  break;
27708
29539
  default:
27709
29540
  return this.tokens[n];
@@ -27717,16 +29548,16 @@ class loreline_Parser {
27717
29548
  while(n < this.tokens.length) {
27718
29549
  let _g = this.tokens[n].type;
27719
29550
  switch(_g._hx_index) {
27720
- case 49:
29551
+ case 51:
27721
29552
  let _g1 = _g.content;
27722
29553
  break;
27723
- case 50:
29554
+ case 52:
27724
29555
  let _g2 = _g.content;
27725
29556
  break;
27726
- case 51:
29557
+ case 53:
27727
29558
  let _g3 = _g.content;
27728
29559
  break;
27729
- case 52:case 53:case 54:
29560
+ case 54:case 55:case 56:
27730
29561
  break;
27731
29562
  default:
27732
29563
  return this.tokens[n];
@@ -27740,16 +29571,16 @@ class loreline_Parser {
27740
29571
  while(n < this.tokens.length) {
27741
29572
  let _g = this.tokens[n].type;
27742
29573
  switch(_g._hx_index) {
27743
- case 49:
29574
+ case 51:
27744
29575
  let _g1 = _g.content;
27745
29576
  break;
27746
- case 50:
29577
+ case 52:
27747
29578
  let _g2 = _g.content;
27748
29579
  break;
27749
- case 51:
29580
+ case 53:
27750
29581
  let _g3 = _g.content;
27751
29582
  break;
27752
- case 54:
29583
+ case 56:
27753
29584
  break;
27754
29585
  default:
27755
29586
  return this.tokens[n];
@@ -27783,7 +29614,7 @@ class loreline_Parser {
27783
29614
  if(this.isAtEnd()) {
27784
29615
  return false;
27785
29616
  }
27786
- if(type._hx_index == 40) {
29617
+ if(type._hx_index == 41) {
27787
29618
  return this.tokens[this.current].type == loreline_TokenType.Colon;
27788
29619
  } else {
27789
29620
  return loreline_TokenTypeHelpers.equals(this.tokens[this.current].type,type);
@@ -27809,13 +29640,13 @@ class loreline_Parser {
27809
29640
  }
27810
29641
  isComment(type) {
27811
29642
  switch(type._hx_index) {
27812
- case 49:
29643
+ case 51:
27813
29644
  let _g = type.content;
27814
29645
  return true;
27815
- case 50:
29646
+ case 52:
27816
29647
  let _g1 = type.content;
27817
29648
  return true;
27818
- case 51:
29649
+ case 53:
27819
29650
  let _g2 = type.content;
27820
29651
  return true;
27821
29652
  default:
@@ -27837,15 +29668,15 @@ class loreline_Parser {
27837
29668
  let _g = this.tokens[this.current].type;
27838
29669
  let tmp3;
27839
29670
  switch(_g._hx_index) {
27840
- case 49:
29671
+ case 51:
27841
29672
  let content = _g.content;
27842
29673
  tmp3 = content;
27843
29674
  break;
27844
- case 50:
29675
+ case 52:
27845
29676
  let content1 = _g.content;
27846
29677
  tmp3 = content1;
27847
29678
  break;
27848
- case 51:
29679
+ case 53:
27849
29680
  let content2 = _g.content;
27850
29681
  tmp3 = content2;
27851
29682
  break;
@@ -27854,7 +29685,7 @@ class loreline_Parser {
27854
29685
  }
27855
29686
  let _g1 = this.tokens[this.current].type;
27856
29687
  let tmp4;
27857
- if(_g1._hx_index == 50) {
29688
+ if(_g1._hx_index == 52) {
27858
29689
  let _g = _g1.content;
27859
29690
  tmp4 = true;
27860
29691
  } else {
@@ -27862,7 +29693,7 @@ class loreline_Parser {
27862
29693
  }
27863
29694
  let _g2 = this.tokens[this.current].type;
27864
29695
  let tmp5;
27865
- if(_g2._hx_index == 51) {
29696
+ if(_g2._hx_index == 53) {
27866
29697
  let _g = _g2.content;
27867
29698
  tmp5 = true;
27868
29699
  } else {
@@ -27992,7 +29823,7 @@ class loreline_Parser {
27992
29823
  }
27993
29824
  }
27994
29825
  break;
27995
- case 25:
29826
+ case 26:
27996
29827
  let node7 = this.parseInsertion();
27997
29828
  if(topLevel) {
27998
29829
  return _gthis.wrapInRootBeat(node7);
@@ -28000,7 +29831,7 @@ class loreline_Parser {
28000
29831
  return node7;
28001
29832
  }
28002
29833
  break;
28003
- case 18:case 26:case 38:case 43:case 45:case 47:
29834
+ case 18:case 27:case 39:case 45:case 47:case 49:
28004
29835
  let node8 = this.parseExpressionStatement();
28005
29836
  if(topLevel) {
28006
29837
  return _gthis.wrapInRootBeat(node8);
@@ -28008,7 +29839,7 @@ class loreline_Parser {
28008
29839
  return node8;
28009
29840
  }
28010
29841
  break;
28011
- case 39:
29842
+ case 40:
28012
29843
  let node9 = this.parseTransition();
28013
29844
  if(topLevel) {
28014
29845
  return _gthis.wrapInRootBeat(node9);
@@ -28364,6 +30195,9 @@ class loreline_Parser {
28364
30195
  isInsertion = true;
28365
30196
  choiceOption.insertion = this.parseInsertion();
28366
30197
  } else {
30198
+ if(this.match(loreline_TokenType.OpMinus)) {
30199
+ choiceOption.once = true;
30200
+ }
28367
30201
  choiceOption.text = this.parseStringLiteral();
28368
30202
  }
28369
30203
  } catch( _g ) {
@@ -28380,30 +30214,30 @@ class loreline_Parser {
28380
30214
  throw _g;
28381
30215
  }
28382
30216
  }
28383
- if(!isInsertion) {
28384
- if(this.match(loreline_TokenType.KwIf)) {
28385
- let ifPos = this.previous().pos;
28386
- let offset = this.currentPos().offset;
28387
- try {
28388
- if(this.check(loreline_TokenType.LParen)) {
28389
- choiceOption.conditionStyle = 2;
28390
- }
28391
- choiceOption.condition = this.parseConditionExpression();
28392
- choiceOption.conditionPos = ifPos.extendedTo(this.prevNonWhitespaceOrComment().pos);
28393
- } catch( _g ) {
28394
- let _g1 = haxe_Exception.caught(_g).unwrap();
28395
- if(((_g1) instanceof loreline_ParseError)) {
28396
- let e = _g1;
28397
- this.addError(e);
28398
- errorPos = this.currentPos();
28399
- if(this.currentPos().offset == offset) {
28400
- this.advance();
28401
- }
28402
- } else {
28403
- throw _g;
30217
+ if(this.match(loreline_TokenType.KwIf)) {
30218
+ let ifPos = this.previous().pos;
30219
+ let offset = this.currentPos().offset;
30220
+ try {
30221
+ if(this.check(loreline_TokenType.LParen)) {
30222
+ choiceOption.conditionStyle = 2;
30223
+ }
30224
+ choiceOption.condition = this.parseConditionExpression();
30225
+ choiceOption.conditionPos = ifPos.extendedTo(this.prevNonWhitespaceOrComment().pos);
30226
+ } catch( _g ) {
30227
+ let _g1 = haxe_Exception.caught(_g).unwrap();
30228
+ if(((_g1) instanceof loreline_ParseError)) {
30229
+ let e = _g1;
30230
+ this.addError(e);
30231
+ errorPos = this.currentPos();
30232
+ if(this.currentPos().offset == offset) {
30233
+ this.advance();
28404
30234
  }
30235
+ } else {
30236
+ throw _g;
28405
30237
  }
28406
30238
  }
30239
+ }
30240
+ if(!isInsertion) {
28407
30241
  if(this.checkBlockStart()) {
28408
30242
  choiceOption.body = [];
28409
30243
  let offset = this.currentPos().offset;
@@ -28477,7 +30311,7 @@ class loreline_Parser {
28477
30311
  return true;
28478
30312
  }
28479
30313
  break;
28480
- case 18:case 26:case 38:case 43:case 45:case 47:
30314
+ case 18:case 27:case 39:case 45:case 47:case 49:
28481
30315
  return true;
28482
30316
  default:
28483
30317
  return false;
@@ -28485,7 +30319,7 @@ class loreline_Parser {
28485
30319
  }
28486
30320
  parseExpressionStatement() {
28487
30321
  let expr = this.parseExpression();
28488
- if(this.match(loreline_TokenType.OpAssign) || this.match(loreline_TokenType.OpPlusAssign) || this.match(loreline_TokenType.OpMinusAssign) || this.match(loreline_TokenType.OpMultiplyAssign) || this.match(loreline_TokenType.OpDivideAssign)) {
30322
+ if(this.match(loreline_TokenType.OpAssign) || this.match(loreline_TokenType.OpPlusAssign) || this.match(loreline_TokenType.OpMinusAssign) || this.match(loreline_TokenType.OpMultiplyAssign) || this.match(loreline_TokenType.OpDivideAssign) || this.match(loreline_TokenType.OpUnquotedAssign)) {
28489
30323
  let op = this.previous().type;
28490
30324
  let assignment = this.attachComments(new loreline_NAssign(this.nextNodeId(4),expr.pos,expr,op,null));
28491
30325
  assignment.value = this.parseExpression();
@@ -28512,7 +30346,7 @@ class loreline_Parser {
28512
30346
  return false;
28513
30347
  }
28514
30348
  break;
28515
- case 1:case 2:case 3:case 4:case 5:case 39:
30349
+ case 1:case 2:case 3:case 4:case 5:case 40:
28516
30350
  return true;
28517
30351
  default:
28518
30352
  return false;
@@ -28648,8 +30482,8 @@ class loreline_Parser {
28648
30482
  }
28649
30483
  parseExpression() {
28650
30484
  try {
28651
- let expr = this.parseLogicalOr();
28652
- if(this.check(loreline_TokenType.OpAssign) || this.check(loreline_TokenType.OpPlusAssign) || this.check(loreline_TokenType.OpMinusAssign) || this.check(loreline_TokenType.OpMultiplyAssign) || this.check(loreline_TokenType.OpDivideAssign)) {
30485
+ let expr = this.parseTernary();
30486
+ if(this.check(loreline_TokenType.OpAssign) || this.check(loreline_TokenType.OpPlusAssign) || this.check(loreline_TokenType.OpMinusAssign) || this.check(loreline_TokenType.OpMultiplyAssign) || this.check(loreline_TokenType.OpDivideAssign) || this.check(loreline_TokenType.OpUnquotedAssign)) {
28653
30487
  let op = this.tokens[this.current].type;
28654
30488
  this.advance();
28655
30489
  let assignment = this.attachComments(new loreline_NAssign(this.nextNodeId(4),expr.pos,expr,op,null));
@@ -28666,6 +30500,17 @@ class loreline_Parser {
28666
30500
  return new loreline_NLiteral(this.nextNodeId(4),this.currentPos(),null,loreline_LiteralType.Null);
28667
30501
  }
28668
30502
  }
30503
+ parseTernary() {
30504
+ let expr = this.parseLogicalOr();
30505
+ if(this.match(loreline_TokenType.Question)) {
30506
+ let trueExpr = this.parseTernary();
30507
+ this.expect(loreline_TokenType.Colon);
30508
+ let falseExpr = this.parseTernary();
30509
+ expr = this.attachComments(new loreline_NTernary(this.nextNodeId(4),expr.pos,expr,trueExpr,falseExpr));
30510
+ expr.pos = expr.pos.extendedTo(falseExpr.pos);
30511
+ }
30512
+ return expr;
30513
+ }
28669
30514
  parseLogicalOr() {
28670
30515
  let expr = this.parseLogicalAnd();
28671
30516
  while(this.match(loreline_TokenType.OpOr(false))) {
@@ -28772,14 +30617,14 @@ class loreline_Parser {
28772
30617
  return this.parseIdentifierExpression(startPos,name);
28773
30618
  }
28774
30619
  break;
28775
- case 43:
28776
- return this.parsePostfix(startPos,this.parseObjectLiteral());
28777
30620
  case 45:
30621
+ return this.parsePostfix(startPos,this.parseObjectLiteral());
30622
+ case 47:
28778
30623
  this.advance();
28779
30624
  let expr = this.parseExpression();
28780
30625
  this.expect(loreline_TokenType.RParen);
28781
30626
  return this.parsePostfix(startPos,expr);
28782
- case 47:
30627
+ case 49:
28783
30628
  return this.parsePostfix(startPos,this.parseArrayLiteral());
28784
30629
  default:
28785
30630
  throw haxe_Exception.thrown(new loreline_ParseError("Unexpected token in expression",this.currentPos()));
@@ -28958,7 +30803,7 @@ class loreline_Parser {
28958
30803
  }
28959
30804
  prevIsDot = false;
28960
30805
  break;
28961
- case 42:
30806
+ case 44:
28962
30807
  if(target == null) {
28963
30808
  this.addError(new loreline_ParseError("Leading dot in field access",token.pos));
28964
30809
  let tmp = this.nextNodeId(4);
@@ -28969,7 +30814,7 @@ class loreline_Parser {
28969
30814
  }
28970
30815
  prevIsDot = true;
28971
30816
  break;
28972
- case 45:
30817
+ case 47:
28973
30818
  if(target == null) {
28974
30819
  this.addError(new loreline_ParseError("Function call without target",token.pos));
28975
30820
  let tmp = this.nextNodeId(4);
@@ -28986,7 +30831,7 @@ class loreline_Parser {
28986
30831
  let t = tokens[i];
28987
30832
  ++i;
28988
30833
  switch(t.type._hx_index) {
28989
- case 41:
30834
+ case 43:
28990
30835
  if(parenLevel == 1) {
28991
30836
  if(currentArgTokens.length > 0) {
28992
30837
  argTokens.push(currentArgTokens);
@@ -28996,11 +30841,11 @@ class loreline_Parser {
28996
30841
  currentArgTokens.push(t);
28997
30842
  }
28998
30843
  break;
28999
- case 45:
30844
+ case 47:
29000
30845
  ++parenLevel;
29001
30846
  currentArgTokens.push(t);
29002
30847
  break;
29003
- case 46:
30848
+ case 48:
29004
30849
  --parenLevel;
29005
30850
  if(parenLevel > 0) {
29006
30851
  currentArgTokens.push(t);
@@ -29034,7 +30879,7 @@ class loreline_Parser {
29034
30879
  target = this.attachComments(new loreline_NCall(this.nextNodeId(4),callStart.extendedTo(tokens[i - 1].pos),target,args));
29035
30880
  prevIsDot = false;
29036
30881
  break;
29037
- case 47:
30882
+ case 49:
29038
30883
  if(target == null) {
29039
30884
  this.addError(new loreline_ParseError("Array access without target",token.pos));
29040
30885
  let tmp = this.nextNodeId(4);
@@ -29051,11 +30896,11 @@ class loreline_Parser {
29051
30896
  let t = tokens[i];
29052
30897
  ++i;
29053
30898
  switch(t.type._hx_index) {
29054
- case 47:
30899
+ case 49:
29055
30900
  ++bracketLevel;
29056
30901
  arrayTokens.push(t);
29057
30902
  break;
29058
- case 48:
30903
+ case 50:
29059
30904
  --bracketLevel;
29060
30905
  if(bracketLevel > 0) {
29061
30906
  arrayTokens.push(t);
@@ -29358,7 +31203,7 @@ class loreline_Parser {
29358
31203
  } else {
29359
31204
  let error = new loreline_ParseError("Expected " + loreline_TokenTypeHelpers.toCodeString(type) + ", got " + (this.isAtEnd() ? "end of file" : this.currentTokenTypeToString()),this.tokens[Math.min(this.current,this.tokens.length - 1) | 0].pos);
29360
31205
  switch(type._hx_index) {
29361
- case 44:case 46:case 53:
31206
+ case 46:case 48:case 55:
29362
31207
  this.addError(error);
29363
31208
  return new loreline_Token(type,this.currentPos());
29364
31209
  default:
@@ -29457,13 +31302,13 @@ class loreline_Parser {
29457
31302
  }
29458
31303
  this.advance();
29459
31304
  break;
29460
- case 39:
31305
+ case 40:
29461
31306
  this.advance();
29462
31307
  if(this.check(loreline_TokenType.Dot) || loreline_TokenTypeHelpers.isIdentifier(this.tokens[this.current].type)) {
29463
31308
  this.advance();
29464
31309
  }
29465
31310
  return;
29466
- case 1:case 2:case 3:case 4:case 5:case 44:case 52:
31311
+ case 1:case 2:case 3:case 4:case 5:case 46:case 54:
29467
31312
  return;
29468
31313
  default:
29469
31314
  this.advance();
@@ -29472,7 +31317,7 @@ class loreline_Parser {
29472
31317
  }
29473
31318
  requiresNewLine() {
29474
31319
  switch(this.tokens[this.current].type._hx_index) {
29475
- case 6:case 39:case 44:
31320
+ case 6:case 40:case 46:
29476
31321
  return false;
29477
31322
  default:
29478
31323
  return true;
@@ -29843,6 +31688,9 @@ class loreline_Printer {
29843
31688
  case loreline_NStringLiteral:
29844
31689
  this.printStringLiteral(node);
29845
31690
  break;
31691
+ case loreline_NTernary:
31692
+ this.printTernary(node);
31693
+ break;
29846
31694
  case loreline_NTextStatement:
29847
31695
  this.printTextStatement(node);
29848
31696
  break;
@@ -30126,6 +31974,9 @@ class loreline_Printer {
30126
31974
  this.newline();
30127
31975
  this._noLn = 0;
30128
31976
  this.printLeadingComments(option);
31977
+ if(option.once) {
31978
+ this.write("- ");
31979
+ }
30129
31980
  if(option.insertion != null) {
30130
31981
  this.printNode(option.insertion);
30131
31982
  } else {
@@ -30478,20 +32329,53 @@ class loreline_Printer {
30478
32329
  this.write("null");
30479
32330
  break;
30480
32331
  case 3:
30481
- let first = true;
30482
- this.write("[");
32332
+ let hasMultilineUnquoted = false;
30483
32333
  let _g1 = 0;
30484
32334
  let _g2 = lit.value;
30485
32335
  while(_g1 < _g2.length) {
30486
32336
  let elem = _g2[_g1];
30487
32337
  ++_g1;
30488
- if(!first) {
30489
- this.write(", ");
32338
+ if(this.hasRealNewlines(elem)) {
32339
+ hasMultilineUnquoted = true;
32340
+ break;
30490
32341
  }
30491
- first = false;
30492
- this.printNode(elem);
30493
32342
  }
30494
- this.write("]");
32343
+ if(hasMultilineUnquoted) {
32344
+ this.write("[");
32345
+ this.newline();
32346
+ this._level++;
32347
+ let first = true;
32348
+ let _g = 0;
32349
+ let _g1 = lit.value;
32350
+ while(_g < _g1.length) {
32351
+ let elem = _g1[_g];
32352
+ ++_g;
32353
+ if(!first) {
32354
+ this.write(",");
32355
+ this.newline();
32356
+ }
32357
+ first = false;
32358
+ this.printNode(elem);
32359
+ }
32360
+ this.newline();
32361
+ this._level--;
32362
+ this.write("]");
32363
+ } else {
32364
+ let first = true;
32365
+ this.write("[");
32366
+ let _g = 0;
32367
+ let _g1 = lit.value;
32368
+ while(_g < _g1.length) {
32369
+ let elem = _g1[_g];
32370
+ ++_g;
32371
+ if(!first) {
32372
+ this.write(", ");
32373
+ }
32374
+ first = false;
32375
+ this.printNode(elem);
32376
+ }
32377
+ this.write("]");
32378
+ }
30495
32379
  break;
30496
32380
  case 4:
30497
32381
  let style = _g.style;
@@ -30502,18 +32386,18 @@ class loreline_Printer {
30502
32386
  this.newline();
30503
32387
  }
30504
32388
  this._level++;
30505
- let first1 = true;
32389
+ let first = true;
30506
32390
  let _g3 = 0;
30507
32391
  let _g4 = lit.value;
30508
32392
  while(_g3 < _g4.length) {
30509
32393
  let field = _g4[_g3];
30510
32394
  ++_g3;
30511
- if(!first1) {
32395
+ if(!first) {
30512
32396
  if(this._beginLine == 0) {
30513
32397
  this.newline();
30514
32398
  }
30515
32399
  }
30516
- first1 = false;
32400
+ first = false;
30517
32401
  this.printLeadingComments(field);
30518
32402
  this.write("" + field.name + ": ");
30519
32403
  this.printTrailingComments(field);
@@ -30573,11 +32457,11 @@ class loreline_Printer {
30573
32457
  if(!skipParen) {
30574
32458
  let _g = binary.op;
30575
32459
  switch(_g._hx_index) {
30576
- case 36:
32460
+ case 37:
30577
32461
  let word = _g.word;
30578
32462
  needsParens = true;
30579
32463
  break;
30580
- case 37:
32464
+ case 38:
30581
32465
  let word1 = _g.word;
30582
32466
  needsParens = true;
30583
32467
  break;
@@ -30604,6 +32488,15 @@ class loreline_Printer {
30604
32488
  this.printTrailingComments(unary);
30605
32489
  this.printNode(unary.operand);
30606
32490
  }
32491
+ printTernary(ternary) {
32492
+ this.printLeadingComments(ternary);
32493
+ this.printNode(ternary.condition);
32494
+ this.write(" ? ");
32495
+ this.printNode(ternary.trueExpr);
32496
+ this.write(" : ");
32497
+ this.printNode(ternary.falseExpr);
32498
+ this.printTrailingComments(ternary);
32499
+ }
30607
32500
  printAssignment(assign) {
30608
32501
  this.printLeadingComments(assign);
30609
32502
  this.printNode(assign.target);
@@ -30678,42 +32571,44 @@ class loreline_Printer {
30678
32571
  case 24:
30679
32572
  return "/=";
30680
32573
  case 25:
30681
- return "+";
32574
+ return ":=";
30682
32575
  case 26:
30683
- return "-";
32576
+ return "+";
30684
32577
  case 27:
30685
- return "*";
32578
+ return "-";
30686
32579
  case 28:
30687
- return "/";
32580
+ return "*";
30688
32581
  case 29:
30689
- return "%";
32582
+ return "/";
30690
32583
  case 30:
30691
- return "==";
32584
+ return "%";
30692
32585
  case 31:
30693
- return "!=";
32586
+ return "==";
30694
32587
  case 32:
30695
- return ">";
32588
+ return "!=";
30696
32589
  case 33:
30697
- return "<";
32590
+ return ">";
30698
32591
  case 34:
30699
- return ">=";
32592
+ return "<";
30700
32593
  case 35:
30701
- return "<=";
32594
+ return ">=";
30702
32595
  case 36:
32596
+ return "<=";
32597
+ case 37:
30703
32598
  if(op.word) {
30704
32599
  return "and";
30705
32600
  } else {
30706
32601
  return "&&";
30707
32602
  }
30708
32603
  break;
30709
- case 37:
32604
+ case 38:
30710
32605
  if(op.word) {
30711
32606
  return "or";
30712
32607
  } else {
30713
32608
  return "||";
30714
32609
  }
30715
32610
  break;
30716
- case 38:
32611
+ case 39:
30717
32612
  return "!";
30718
32613
  default:
30719
32614
  throw haxe_Exception.thrown("Unsupported operator: " + Std.string(op));
@@ -30790,6 +32685,7 @@ class loreline_Script extends loreline_AstNode {
30790
32685
  _g.push(decl.toJson());
30791
32686
  }
30792
32687
  json.body = _g;
32688
+ json.indentSize = this.indentSize;
30793
32689
  return json;
30794
32690
  }
30795
32691
  type() {
@@ -30826,6 +32722,9 @@ class loreline_Script extends loreline_AstNode {
30826
32722
  iterator() {
30827
32723
  return new loreline__$Script_ScriptBodyIterator(this.body);
30828
32724
  }
32725
+ static fromJson(json) {
32726
+ return loreline_JsonToAst.scriptFromJson(json);
32727
+ }
30829
32728
  }
30830
32729
  $hxClasses["loreline.Script"] = $hx_exports["loreline"]["Script"] = loreline_Script;
30831
32730
  loreline_Script.__name__ = "loreline.Script";
@@ -30869,6 +32768,38 @@ loreline__$Script_ScriptBodyIterator.__name__ = "loreline._Script.ScriptBodyIter
30869
32768
  Object.assign(loreline__$Script_ScriptBodyIterator.prototype, {
30870
32769
  __class__: loreline__$Script_ScriptBodyIterator
30871
32770
  });
32771
+ class loreline__$Timer_PendingTimer {
32772
+ constructor(remaining,done) {
32773
+ this.remaining = remaining;
32774
+ this.done = done;
32775
+ }
32776
+ }
32777
+ $hxClasses["loreline._Timer.PendingTimer"] = loreline__$Timer_PendingTimer;
32778
+ loreline__$Timer_PendingTimer.__name__ = "loreline._Timer.PendingTimer";
32779
+ Object.assign(loreline__$Timer_PendingTimer.prototype, {
32780
+ __class__: loreline__$Timer_PendingTimer
32781
+ });
32782
+ class loreline_Timer {
32783
+ static register(seconds,done) {
32784
+ loreline_Timer.timers.push(new loreline__$Timer_PendingTimer(seconds,done));
32785
+ }
32786
+ static update(delta) {
32787
+ if(loreline_Timer.timers.length == 0) {
32788
+ return;
32789
+ }
32790
+ let i = loreline_Timer.timers.length;
32791
+ while(--i >= 0) {
32792
+ let t = loreline_Timer.timers[i];
32793
+ t.remaining -= delta;
32794
+ if(t.remaining <= 0.0) {
32795
+ loreline_Timer.timers.splice(i,1);
32796
+ t.done();
32797
+ }
32798
+ }
32799
+ }
32800
+ }
32801
+ $hxClasses["loreline.Timer"] = loreline_Timer;
32802
+ loreline_Timer.__name__ = "loreline.Timer";
30872
32803
  class loreline_Utf8 {
30873
32804
  static uLength(str) {
30874
32805
  return str.length;
@@ -31020,6 +32951,7 @@ loreline_AlternativeMode.Pick = 3;
31020
32951
  loreline_AlternativeMode.Shuffle = 4;
31021
32952
  loreline_Quotes.Unquoted = 0;
31022
32953
  loreline_Quotes.DoubleQuotes = 1;
32954
+ loreline_Timer.timers = [];
31023
32955
  loreline_lib_Library.main();
31024
32956
  })(runtime, globals);
31025
32957