loreline 0.7.0 → 0.8.0

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) {
@@ -17271,6 +17586,19 @@ class loreline_Interpreter {
17271
17586
  }
17272
17587
  return loreline_RuntimeAccess.FunctionAccess(tmp1 != null ? tmp1 : this.script.pos,name);
17273
17588
  }
17589
+ let beat = this.resolveBeatByName(name);
17590
+ if(beat != null) {
17591
+ let tmp = access != null ? access.pos : null;
17592
+ let tmp1;
17593
+ if(tmp != null) {
17594
+ tmp1 = tmp;
17595
+ } else {
17596
+ let tmp = this.get_currentScope();
17597
+ let tmp2 = tmp != null ? tmp.node : null;
17598
+ tmp1 = tmp2 != null ? tmp2.pos : null;
17599
+ }
17600
+ return loreline_RuntimeAccess.BeatAccess(tmp1 != null ? tmp1 : this.script.pos,beat);
17601
+ }
17274
17602
  if(!this.strictAccess) {
17275
17603
  let tmp = access != null ? access.pos : null;
17276
17604
  let tmp1;
@@ -17322,7 +17650,7 @@ class loreline_Interpreter {
17322
17650
  let leftType = Type.typeof(left);
17323
17651
  let rightType = Type.typeof(right);
17324
17652
  switch(op._hx_index) {
17325
- case 25:
17653
+ case 26:
17326
17654
  switch(leftType._hx_index) {
17327
17655
  case 1:
17328
17656
  switch(rightType._hx_index) {
@@ -17459,7 +17787,7 @@ class loreline_Interpreter {
17459
17787
  }
17460
17788
  }
17461
17789
  break;
17462
- case 26:case 27:case 28:case 29:
17790
+ case 27:case 28:case 29:case 30:
17463
17791
  switch(leftType._hx_index) {
17464
17792
  case 1:case 2:
17465
17793
  switch(rightType._hx_index) {
@@ -17467,11 +17795,11 @@ class loreline_Interpreter {
17467
17795
  let leftNum = parseFloat(Std.string(left));
17468
17796
  let rightNum = parseFloat(Std.string(right));
17469
17797
  switch(op._hx_index) {
17470
- case 26:
17471
- return leftNum - rightNum;
17472
17798
  case 27:
17473
- return leftNum * rightNum;
17799
+ return leftNum - rightNum;
17474
17800
  case 28:
17801
+ return leftNum * rightNum;
17802
+ case 29:
17475
17803
  if(rightNum == 0) {
17476
17804
  let tmp = pos;
17477
17805
  let tmp1;
@@ -17485,7 +17813,7 @@ class loreline_Interpreter {
17485
17813
  throw haxe_Exception.thrown(new loreline_RuntimeError("Division by zero",tmp1 != null ? tmp1 : this.script.pos));
17486
17814
  }
17487
17815
  return leftNum / rightNum;
17488
- case 29:
17816
+ case 30:
17489
17817
  if(rightNum == 0) {
17490
17818
  let tmp = pos;
17491
17819
  let tmp1;
@@ -17506,16 +17834,16 @@ class loreline_Interpreter {
17506
17834
  default:
17507
17835
  let opName;
17508
17836
  switch(op._hx_index) {
17509
- case 26:
17837
+ case 27:
17510
17838
  opName = "subtract";
17511
17839
  break;
17512
- case 27:
17840
+ case 28:
17513
17841
  opName = "multiply";
17514
17842
  break;
17515
- case 28:
17843
+ case 29:
17516
17844
  opName = "divide";
17517
17845
  break;
17518
- case 29:
17846
+ case 30:
17519
17847
  opName = "modulo";
17520
17848
  break;
17521
17849
  default:
@@ -17537,16 +17865,16 @@ class loreline_Interpreter {
17537
17865
  default:
17538
17866
  let opName1;
17539
17867
  switch(op._hx_index) {
17540
- case 26:
17868
+ case 27:
17541
17869
  opName1 = "subtract";
17542
17870
  break;
17543
- case 27:
17871
+ case 28:
17544
17872
  opName1 = "multiply";
17545
17873
  break;
17546
- case 28:
17874
+ case 29:
17547
17875
  opName1 = "divide";
17548
17876
  break;
17549
- case 29:
17877
+ case 30:
17550
17878
  opName1 = "modulo";
17551
17879
  break;
17552
17880
  default:
@@ -17565,17 +17893,18 @@ class loreline_Interpreter {
17565
17893
  throw haxe_Exception.thrown(new loreline_RuntimeError(tmp9,tmp11 != null ? tmp11 : this.script.pos));
17566
17894
  }
17567
17895
  break;
17568
- case 30:case 31:
17896
+ case 31:case 32:
17897
+ 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
17898
  switch(op._hx_index) {
17570
- case 30:
17571
- return left == right;
17572
17899
  case 31:
17573
- return left != right;
17900
+ return result;
17901
+ case 32:
17902
+ return !result;
17574
17903
  default:
17575
17904
  throw haxe_Exception.thrown("Unreachable");
17576
17905
  }
17577
17906
  break;
17578
- case 32:case 33:case 34:case 35:
17907
+ case 33:case 34:case 35:case 36:
17579
17908
  switch(leftType._hx_index) {
17580
17909
  case 1:case 2:
17581
17910
  switch(rightType._hx_index) {
@@ -17583,13 +17912,13 @@ class loreline_Interpreter {
17583
17912
  let leftNum1 = parseFloat(Std.string(left));
17584
17913
  let rightNum1 = parseFloat(Std.string(right));
17585
17914
  switch(op._hx_index) {
17586
- case 32:
17587
- return leftNum1 > rightNum1;
17588
17915
  case 33:
17589
- return leftNum1 < rightNum1;
17916
+ return leftNum1 > rightNum1;
17590
17917
  case 34:
17591
- return leftNum1 >= rightNum1;
17918
+ return leftNum1 < rightNum1;
17592
17919
  case 35:
17920
+ return leftNum1 >= rightNum1;
17921
+ case 36:
17593
17922
  return leftNum1 <= rightNum1;
17594
17923
  default:
17595
17924
  throw haxe_Exception.thrown("Unreachable");
@@ -17623,12 +17952,12 @@ class loreline_Interpreter {
17623
17952
  throw haxe_Exception.thrown(new loreline_RuntimeError(tmp15,tmp17 != null ? tmp17 : this.script.pos));
17624
17953
  }
17625
17954
  break;
17626
- case 36:
17955
+ case 37:
17627
17956
  let _g = op.word;
17628
17957
  if(leftType._hx_index == 3) {
17629
17958
  if(rightType._hx_index == 3) {
17630
17959
  switch(op._hx_index) {
17631
- case 36:
17960
+ case 37:
17632
17961
  let _g = op.word;
17633
17962
  if(left) {
17634
17963
  return right;
@@ -17636,7 +17965,7 @@ class loreline_Interpreter {
17636
17965
  return false;
17637
17966
  }
17638
17967
  break;
17639
- case 37:
17968
+ case 38:
17640
17969
  let _g1 = op.word;
17641
17970
  if(!left) {
17642
17971
  return right;
@@ -17674,12 +18003,12 @@ class loreline_Interpreter {
17674
18003
  throw haxe_Exception.thrown(new loreline_RuntimeError(tmp,tmp2 != null ? tmp2 : this.script.pos));
17675
18004
  }
17676
18005
  break;
17677
- case 37:
18006
+ case 38:
17678
18007
  let _g1 = op.word;
17679
18008
  if(leftType._hx_index == 3) {
17680
18009
  if(rightType._hx_index == 3) {
17681
18010
  switch(op._hx_index) {
17682
- case 36:
18011
+ case 37:
17683
18012
  let _g = op.word;
17684
18013
  if(left) {
17685
18014
  return right;
@@ -17687,7 +18016,7 @@ class loreline_Interpreter {
17687
18016
  return false;
17688
18017
  }
17689
18018
  break;
17690
- case 37:
18019
+ case 38:
17691
18020
  let _g1 = op.word;
17692
18021
  if(!left) {
17693
18022
  return right;
@@ -17740,14 +18069,92 @@ class loreline_Interpreter {
17740
18069
  }
17741
18070
  }
17742
18071
  valueToString(value) {
18072
+ return this.valueToStringImpl(value,null);
18073
+ }
18074
+ valueToStringImpl(value,seen) {
17743
18075
  if(value == null) {
17744
18076
  return "null";
17745
- } else {
17746
- return Std.string(value);
17747
18077
  }
17748
- }
17749
- printLoreline(node) {
17750
- try {
18078
+ if(typeof(value) == "string") {
18079
+ return value;
18080
+ }
18081
+ if(typeof(value) == "boolean" || typeof(value) == "number" && ((value | 0) === value) || typeof(value) == "number") {
18082
+ if(value == null) {
18083
+ return "null";
18084
+ } else {
18085
+ return Std.string(value);
18086
+ }
18087
+ }
18088
+ if(seen == null) {
18089
+ seen = [];
18090
+ }
18091
+ let _g = 0;
18092
+ while(_g < seen.length) {
18093
+ let s = seen[_g];
18094
+ ++_g;
18095
+ if(s == value) {
18096
+ return "...";
18097
+ }
18098
+ }
18099
+ seen.push(value);
18100
+ if(loreline_Arrays.isArray(value)) {
18101
+ let len = loreline_Arrays.arrayLength(value);
18102
+ let buf_b = "";
18103
+ buf_b += "[";
18104
+ let _g = 0;
18105
+ let _g1 = len;
18106
+ while(_g < _g1) {
18107
+ let i = _g++;
18108
+ if(i > 0) {
18109
+ buf_b += ", ";
18110
+ }
18111
+ buf_b += Std.string(this.valueToStringImpl(loreline_Arrays.arrayGet(value,i),seen));
18112
+ }
18113
+ buf_b += "]";
18114
+ seen.pop();
18115
+ return buf_b;
18116
+ }
18117
+ if(((value) instanceof loreline_NBeatDecl)) {
18118
+ seen.pop();
18119
+ return value.name;
18120
+ }
18121
+ if(loreline_Objects.isFields(value)) {
18122
+ let keys = loreline_Objects.getFields(this,value);
18123
+ keys.sort(function(a,b) {
18124
+ if(a < b) {
18125
+ return -1;
18126
+ } else if(a > b) {
18127
+ return 1;
18128
+ } else {
18129
+ return 0;
18130
+ }
18131
+ });
18132
+ let buf_b = "";
18133
+ buf_b += "{";
18134
+ let _g = 0;
18135
+ let _g1 = keys.length;
18136
+ while(_g < _g1) {
18137
+ let i = _g++;
18138
+ if(i > 0) {
18139
+ buf_b += ", ";
18140
+ }
18141
+ buf_b += Std.string(keys[i]);
18142
+ buf_b += ": ";
18143
+ buf_b += Std.string(this.valueToStringImpl(loreline_Objects.getField(this,value,keys[i]),seen));
18144
+ }
18145
+ buf_b += "}";
18146
+ seen.pop();
18147
+ return buf_b;
18148
+ }
18149
+ seen.pop();
18150
+ if(value == null) {
18151
+ return "null";
18152
+ } else {
18153
+ return Std.string(value);
18154
+ }
18155
+ }
18156
+ printLoreline(node) {
18157
+ try {
17751
18158
  let printer = new loreline_Printer();
17752
18159
  printer.enableComments = false;
17753
18160
  return StringTools.trim(printer.print(node));
@@ -17775,6 +18182,686 @@ class loreline_Json {
17775
18182
  }
17776
18183
  $hxClasses["loreline.Json"] = loreline_Json;
17777
18184
  loreline_Json.__name__ = "loreline.Json";
18185
+ class loreline_JsonToAst {
18186
+ static scriptFromJson(json) {
18187
+ if(json == null) {
18188
+ throw haxe_Exception.thrown("Cannot create Script from null JSON");
18189
+ }
18190
+ let nodeType = json.type;
18191
+ if(nodeType != "Script") {
18192
+ throw haxe_Exception.thrown("Expected Script node, got: " + nodeType);
18193
+ }
18194
+ let id = loreline_JsonToAst.idFromJson(json);
18195
+ let pos = loreline_JsonToAst.positionFromJson(json.pos);
18196
+ let bodyArr = json.body;
18197
+ let _g = [];
18198
+ let _g1 = 0;
18199
+ while(_g1 < bodyArr.length) {
18200
+ let item = bodyArr[_g1];
18201
+ ++_g1;
18202
+ _g.push(loreline_JsonToAst.nodeFromJson(item));
18203
+ }
18204
+ let body = _g;
18205
+ let script = new loreline_Script(id,pos,body);
18206
+ script.indentSize = json.indentSize != null ? json.indentSize : 2;
18207
+ loreline_JsonToAst.applyComments(script,json);
18208
+ return script;
18209
+ }
18210
+ static nodeFromJson(json) {
18211
+ if(json == null) {
18212
+ return null;
18213
+ }
18214
+ let nodeType = json.type;
18215
+ switch(nodeType) {
18216
+ case "Access":
18217
+ return loreline_JsonToAst.accessFromJson(json);
18218
+ case "Alternative":
18219
+ return loreline_JsonToAst.alternativeFromJson(json);
18220
+ case "ArrayAccess":
18221
+ return loreline_JsonToAst.arrayAccessFromJson(json);
18222
+ case "Assign":
18223
+ return loreline_JsonToAst.assignFromJson(json);
18224
+ case "Beat":
18225
+ return loreline_JsonToAst.beatFromJson(json);
18226
+ case "Binary":
18227
+ return loreline_JsonToAst.binaryFromJson(json);
18228
+ case "Block":
18229
+ return loreline_JsonToAst.blockFromJson(json);
18230
+ case "Call":
18231
+ return loreline_JsonToAst.callFromJson(json);
18232
+ case "Character":
18233
+ return loreline_JsonToAst.characterFromJson(json);
18234
+ case "Choice":
18235
+ return loreline_JsonToAst.choiceStatementFromJson(json);
18236
+ case "Comment":
18237
+ return loreline_JsonToAst.commentFromJson(json);
18238
+ case "Dialogue":
18239
+ return loreline_JsonToAst.dialogueStatementFromJson(json);
18240
+ case "Field":
18241
+ return loreline_JsonToAst.objectFieldFromJson(json);
18242
+ case "Function":
18243
+ return loreline_JsonToAst.functionDeclFromJson(json);
18244
+ case "If":
18245
+ return loreline_JsonToAst.ifStatementFromJson(json);
18246
+ case "Import":
18247
+ return loreline_JsonToAst.importStatementFromJson(json);
18248
+ case "Insertion":
18249
+ return loreline_JsonToAst.insertionFromJson(json);
18250
+ case "Literal":
18251
+ return loreline_JsonToAst.literalFromJson(json);
18252
+ case "Option":
18253
+ return loreline_JsonToAst.choiceOptionFromJson(json);
18254
+ case "Part":
18255
+ return loreline_JsonToAst.stringPartFromJson(json);
18256
+ case "Script":
18257
+ return loreline_JsonToAst.scriptFromJson(json);
18258
+ case "State":
18259
+ return loreline_JsonToAst.stateFromJson(json);
18260
+ case "String":
18261
+ return loreline_JsonToAst.stringLiteralFromJson(json);
18262
+ case "Ternary":
18263
+ return loreline_JsonToAst.ternaryFromJson(json);
18264
+ case "Text":
18265
+ return loreline_JsonToAst.textStatementFromJson(json);
18266
+ case "Transition":
18267
+ return loreline_JsonToAst.transitionFromJson(json);
18268
+ case "Unary":
18269
+ return loreline_JsonToAst.unaryFromJson(json);
18270
+ default:
18271
+ throw haxe_Exception.thrown("Unknown node type: " + nodeType);
18272
+ }
18273
+ }
18274
+ static commentFromJson(json) {
18275
+ let id = loreline_JsonToAst.idFromJson(json);
18276
+ let pos = loreline_JsonToAst.positionFromJson(json.pos);
18277
+ let isHash = json.isHash != null && json.isHash;
18278
+ return new loreline_Comment(id,pos,json.content,json.multiline,isHash);
18279
+ }
18280
+ static stateFromJson(json) {
18281
+ let id = loreline_JsonToAst.idFromJson(json);
18282
+ let pos = loreline_JsonToAst.positionFromJson(json.pos);
18283
+ let fieldsArr = json.fields;
18284
+ let _g = [];
18285
+ let _g1 = 0;
18286
+ while(_g1 < fieldsArr.length) {
18287
+ let f = fieldsArr[_g1];
18288
+ ++_g1;
18289
+ _g.push(loreline_JsonToAst.nodeFromJson(f));
18290
+ }
18291
+ let fields = _g;
18292
+ let comments = loreline_JsonToAst.extractComments(json);
18293
+ let node = new loreline_NStateDecl(id,pos,json.temporary,fields,comments.leading,comments.trailing);
18294
+ node.style = loreline_JsonToAst.blockStyleFromString(json.style);
18295
+ return node;
18296
+ }
18297
+ static objectFieldFromJson(json) {
18298
+ let id = loreline_JsonToAst.idFromJson(json);
18299
+ let pos = loreline_JsonToAst.positionFromJson(json.pos);
18300
+ let comments = loreline_JsonToAst.extractComments(json);
18301
+ return new loreline_NObjectField(id,pos,json.name,loreline_JsonToAst.nodeFromJson(json.value),comments.leading,comments.trailing);
18302
+ }
18303
+ static characterFromJson(json) {
18304
+ let id = loreline_JsonToAst.idFromJson(json);
18305
+ let pos = loreline_JsonToAst.positionFromJson(json.pos);
18306
+ let namePos = loreline_JsonToAst.positionFromJson(json.namePos);
18307
+ let fieldsArr = json.fields;
18308
+ let _g = [];
18309
+ let _g1 = 0;
18310
+ while(_g1 < fieldsArr.length) {
18311
+ let f = fieldsArr[_g1];
18312
+ ++_g1;
18313
+ _g.push(loreline_JsonToAst.nodeFromJson(f));
18314
+ }
18315
+ let fields = _g;
18316
+ let comments = loreline_JsonToAst.extractComments(json);
18317
+ let node = new loreline_NCharacterDecl(id,pos,json.name,namePos,fields,comments.leading,comments.trailing);
18318
+ node.style = loreline_JsonToAst.blockStyleFromString(json.style);
18319
+ return node;
18320
+ }
18321
+ static beatFromJson(json) {
18322
+ let id = loreline_JsonToAst.idFromJson(json);
18323
+ let pos = loreline_JsonToAst.positionFromJson(json.pos);
18324
+ let bodyArr = json.body;
18325
+ let _g = [];
18326
+ let _g1 = 0;
18327
+ while(_g1 < bodyArr.length) {
18328
+ let item = bodyArr[_g1];
18329
+ ++_g1;
18330
+ _g.push(loreline_JsonToAst.nodeFromJson(item));
18331
+ }
18332
+ let body = _g;
18333
+ let comments = loreline_JsonToAst.extractComments(json);
18334
+ let node = new loreline_NBeatDecl(id,pos,json.name,body,comments.leading,comments.trailing);
18335
+ node.style = loreline_JsonToAst.blockStyleFromString(json.style);
18336
+ return node;
18337
+ }
18338
+ static stringPartFromJson(json) {
18339
+ let id = loreline_JsonToAst.idFromJson(json);
18340
+ let pos = loreline_JsonToAst.positionFromJson(json.pos);
18341
+ let partStr = json.part;
18342
+ let partType;
18343
+ switch(partStr) {
18344
+ case "Expr":
18345
+ partType = loreline_StringPartType.Expr(loreline_JsonToAst.nodeFromJson(json.expression));
18346
+ break;
18347
+ case "Raw":
18348
+ partType = loreline_StringPartType.Raw(json.text);
18349
+ break;
18350
+ case "Tag":
18351
+ partType = loreline_StringPartType.Tag(json.closing,loreline_JsonToAst.nodeFromJson(json.content));
18352
+ break;
18353
+ default:
18354
+ throw haxe_Exception.thrown("Unknown string part type: " + partStr);
18355
+ }
18356
+ let comments = loreline_JsonToAst.extractComments(json);
18357
+ return new loreline_NStringPart(id,pos,partType,comments.leading,comments.trailing);
18358
+ }
18359
+ static stringLiteralFromJson(json) {
18360
+ let id = loreline_JsonToAst.idFromJson(json);
18361
+ let pos = loreline_JsonToAst.positionFromJson(json.pos);
18362
+ let quotes = loreline_JsonToAst.quotesFromString(json.quotes);
18363
+ let partsArr = json.parts;
18364
+ let _g = [];
18365
+ let _g1 = 0;
18366
+ while(_g1 < partsArr.length) {
18367
+ let p = partsArr[_g1];
18368
+ ++_g1;
18369
+ _g.push(loreline_JsonToAst.nodeFromJson(p));
18370
+ }
18371
+ let parts = _g;
18372
+ let comments = loreline_JsonToAst.extractComments(json);
18373
+ return new loreline_NStringLiteral(id,pos,quotes,parts,comments.leading,comments.trailing);
18374
+ }
18375
+ static textStatementFromJson(json) {
18376
+ let id = loreline_JsonToAst.idFromJson(json);
18377
+ let pos = loreline_JsonToAst.positionFromJson(json.pos);
18378
+ let content = loreline_JsonToAst.nodeFromJson(json.content);
18379
+ let comments = loreline_JsonToAst.extractComments(json);
18380
+ let node = new loreline_NTextStatement(id,pos,content,comments.leading,comments.trailing);
18381
+ if(json.condition != null) {
18382
+ node.condition = loreline_JsonToAst.nodeFromJson(json.condition);
18383
+ node.conditionStyle = loreline_JsonToAst.conditionStyleFromString(json.conditionStyle);
18384
+ node.conditionPos = loreline_JsonToAst.positionFromJson(json.conditionPos);
18385
+ }
18386
+ return node;
18387
+ }
18388
+ static dialogueStatementFromJson(json) {
18389
+ let id = loreline_JsonToAst.idFromJson(json);
18390
+ let pos = loreline_JsonToAst.positionFromJson(json.pos);
18391
+ let characterPos = loreline_JsonToAst.positionFromJson(json.characterPos);
18392
+ let content = loreline_JsonToAst.nodeFromJson(json.content);
18393
+ let comments = loreline_JsonToAst.extractComments(json);
18394
+ let node = new loreline_NDialogueStatement(id,pos,json.character,characterPos,content,comments.leading,comments.trailing);
18395
+ if(json.condition != null) {
18396
+ node.condition = loreline_JsonToAst.nodeFromJson(json.condition);
18397
+ node.conditionStyle = loreline_JsonToAst.conditionStyleFromString(json.conditionStyle);
18398
+ node.conditionPos = loreline_JsonToAst.positionFromJson(json.conditionPos);
18399
+ }
18400
+ return node;
18401
+ }
18402
+ static choiceStatementFromJson(json) {
18403
+ let id = loreline_JsonToAst.idFromJson(json);
18404
+ let pos = loreline_JsonToAst.positionFromJson(json.pos);
18405
+ let optionsArr = json.options;
18406
+ let _g = [];
18407
+ let _g1 = 0;
18408
+ while(_g1 < optionsArr.length) {
18409
+ let o = optionsArr[_g1];
18410
+ ++_g1;
18411
+ _g.push(loreline_JsonToAst.nodeFromJson(o));
18412
+ }
18413
+ let options = _g;
18414
+ let comments = loreline_JsonToAst.extractComments(json);
18415
+ let node = new loreline_NChoiceStatement(id,pos,options,comments.leading,comments.trailing);
18416
+ node.style = loreline_JsonToAst.blockStyleFromString(json.style);
18417
+ return node;
18418
+ }
18419
+ static choiceOptionFromJson(json) {
18420
+ let id = loreline_JsonToAst.idFromJson(json);
18421
+ let pos = loreline_JsonToAst.positionFromJson(json.pos);
18422
+ let text = json.text != null ? loreline_JsonToAst.nodeFromJson(json.text) : null;
18423
+ let insertion = json.insertion != null ? loreline_JsonToAst.nodeFromJson(json.insertion) : null;
18424
+ let condition = json.condition != null ? loreline_JsonToAst.nodeFromJson(json.condition) : null;
18425
+ let condStyle = json.conditionStyle != null ? loreline_JsonToAst.conditionStyleFromString(json.conditionStyle) : 0;
18426
+ let bodyArr = json.body;
18427
+ let _g = [];
18428
+ let _g1 = 0;
18429
+ while(_g1 < bodyArr.length) {
18430
+ let item = bodyArr[_g1];
18431
+ ++_g1;
18432
+ _g.push(loreline_JsonToAst.nodeFromJson(item));
18433
+ }
18434
+ let body = _g;
18435
+ let comments = loreline_JsonToAst.extractComments(json);
18436
+ let node = new loreline_NChoiceOption(id,pos,text,insertion,condition,condStyle,body,comments.leading,comments.trailing);
18437
+ node.style = loreline_JsonToAst.blockStyleFromString(json.style);
18438
+ if(json.once != null && json.once) {
18439
+ node.once = true;
18440
+ }
18441
+ if(json.conditionPos != null) {
18442
+ node.conditionPos = loreline_JsonToAst.positionFromJson(json.conditionPos);
18443
+ }
18444
+ return node;
18445
+ }
18446
+ static blockFromJson(json) {
18447
+ let id = loreline_JsonToAst.idFromJson(json);
18448
+ let pos = loreline_JsonToAst.positionFromJson(json.pos);
18449
+ let bodyArr = json.body;
18450
+ let _g = [];
18451
+ let _g1 = 0;
18452
+ while(_g1 < bodyArr.length) {
18453
+ let item = bodyArr[_g1];
18454
+ ++_g1;
18455
+ _g.push(loreline_JsonToAst.nodeFromJson(item));
18456
+ }
18457
+ let body = _g;
18458
+ let comments = loreline_JsonToAst.extractComments(json);
18459
+ let node = new loreline_NBlock(id,pos,body,comments.leading,comments.trailing);
18460
+ node.style = loreline_JsonToAst.blockStyleFromString(json.style);
18461
+ return node;
18462
+ }
18463
+ static ifStatementFromJson(json) {
18464
+ let id = loreline_JsonToAst.idFromJson(json);
18465
+ let pos = loreline_JsonToAst.positionFromJson(json.pos);
18466
+ let condition = loreline_JsonToAst.nodeFromJson(json.condition);
18467
+ let condStyle = loreline_JsonToAst.conditionStyleFromString(json.conditionStyle);
18468
+ let thenArr = json.thenBranch;
18469
+ let _g = [];
18470
+ let _g1 = 0;
18471
+ while(_g1 < thenArr.length) {
18472
+ let item = thenArr[_g1];
18473
+ ++_g1;
18474
+ _g.push(loreline_JsonToAst.nodeFromJson(item));
18475
+ }
18476
+ let thenBody = _g;
18477
+ let thenBlock = new loreline_NBlock(loreline_NodeId.UNDEFINED,pos,thenBody);
18478
+ thenBlock.style = loreline_JsonToAst.blockStyleFromString(json.thenStyle);
18479
+ let elseBlock = null;
18480
+ if(json.elseBranch != null) {
18481
+ let elseArr = json.elseBranch;
18482
+ let _g = [];
18483
+ let _g1 = 0;
18484
+ while(_g1 < elseArr.length) {
18485
+ let item = elseArr[_g1];
18486
+ ++_g1;
18487
+ _g.push(loreline_JsonToAst.nodeFromJson(item));
18488
+ }
18489
+ let elseBody = _g;
18490
+ elseBlock = new loreline_NBlock(loreline_NodeId.UNDEFINED,pos,elseBody);
18491
+ elseBlock.style = loreline_JsonToAst.blockStyleFromString(json.elseStyle);
18492
+ }
18493
+ let comments = loreline_JsonToAst.extractComments(json);
18494
+ let elseLeading = null;
18495
+ let elseTrailing = null;
18496
+ if(json.comments != null) {
18497
+ if(json.comments.elseLeading != null) {
18498
+ let arr = json.comments.elseLeading;
18499
+ let _g = [];
18500
+ let _g1 = 0;
18501
+ while(_g1 < arr.length) {
18502
+ let c = arr[_g1];
18503
+ ++_g1;
18504
+ _g.push(loreline_JsonToAst.commentFromJson(c));
18505
+ }
18506
+ elseLeading = _g;
18507
+ }
18508
+ if(json.comments.elseTrailing != null) {
18509
+ let arr = json.comments.elseTrailing;
18510
+ let _g = [];
18511
+ let _g1 = 0;
18512
+ while(_g1 < arr.length) {
18513
+ let c = arr[_g1];
18514
+ ++_g1;
18515
+ _g.push(loreline_JsonToAst.commentFromJson(c));
18516
+ }
18517
+ elseTrailing = _g;
18518
+ }
18519
+ }
18520
+ return new loreline_NIfStatement(id,pos,condition,condStyle,thenBlock,elseBlock,comments.leading,comments.trailing,elseLeading,elseTrailing);
18521
+ }
18522
+ static alternativeFromJson(json) {
18523
+ let id = loreline_JsonToAst.idFromJson(json);
18524
+ let pos = loreline_JsonToAst.positionFromJson(json.pos);
18525
+ let mode = loreline_JsonToAst.alternativeModeFromString(json.mode);
18526
+ let itemsArr = json.items;
18527
+ let _g = [];
18528
+ let _g1 = 0;
18529
+ while(_g1 < itemsArr.length) {
18530
+ let item = itemsArr[_g1];
18531
+ ++_g1;
18532
+ _g.push(loreline_JsonToAst.nodeFromJson(item));
18533
+ }
18534
+ let items = _g;
18535
+ let comments = loreline_JsonToAst.extractComments(json);
18536
+ let node = new loreline_NAlternative(id,pos,mode,items,comments.leading,comments.trailing);
18537
+ node.style = loreline_JsonToAst.blockStyleFromString(json.style);
18538
+ if(json.separatorComments != null) {
18539
+ let sepArr = json.separatorComments;
18540
+ let _g = [];
18541
+ let _g1 = 0;
18542
+ while(_g1 < sepArr.length) {
18543
+ let commentsGroup = sepArr[_g1];
18544
+ ++_g1;
18545
+ if(commentsGroup != null) {
18546
+ let group = commentsGroup;
18547
+ let _g1 = [];
18548
+ let _g2 = 0;
18549
+ while(_g2 < group.length) {
18550
+ let c = group[_g2];
18551
+ ++_g2;
18552
+ _g1.push(loreline_JsonToAst.commentFromJson(c));
18553
+ }
18554
+ _g.push(_g1);
18555
+ } else {
18556
+ _g.push(null);
18557
+ }
18558
+ }
18559
+ node.separatorComments = _g;
18560
+ }
18561
+ return node;
18562
+ }
18563
+ static callFromJson(json) {
18564
+ let id = loreline_JsonToAst.idFromJson(json);
18565
+ let pos = loreline_JsonToAst.positionFromJson(json.pos);
18566
+ let target = loreline_JsonToAst.nodeFromJson(json.target);
18567
+ let argsArr = json.args;
18568
+ let _g = [];
18569
+ let _g1 = 0;
18570
+ while(_g1 < argsArr.length) {
18571
+ let a = argsArr[_g1];
18572
+ ++_g1;
18573
+ _g.push(loreline_JsonToAst.nodeFromJson(a));
18574
+ }
18575
+ let args = _g;
18576
+ let comments = loreline_JsonToAst.extractComments(json);
18577
+ return new loreline_NCall(id,pos,target,args,comments.leading,comments.trailing);
18578
+ }
18579
+ static transitionFromJson(json) {
18580
+ let id = loreline_JsonToAst.idFromJson(json);
18581
+ let pos = loreline_JsonToAst.positionFromJson(json.pos);
18582
+ let targetPos = loreline_JsonToAst.positionFromJson(json.targetPos);
18583
+ let comments = loreline_JsonToAst.extractComments(json);
18584
+ return new loreline_NTransition(id,pos,json.target,targetPos,comments.leading,comments.trailing);
18585
+ }
18586
+ static insertionFromJson(json) {
18587
+ let id = loreline_JsonToAst.idFromJson(json);
18588
+ let pos = loreline_JsonToAst.positionFromJson(json.pos);
18589
+ let targetPos = loreline_JsonToAst.positionFromJson(json.targetPos);
18590
+ let comments = loreline_JsonToAst.extractComments(json);
18591
+ return new loreline_NInsertion(id,pos,json.target,targetPos,comments.leading,comments.trailing);
18592
+ }
18593
+ static functionDeclFromJson(json) {
18594
+ let id = loreline_JsonToAst.idFromJson(json);
18595
+ let pos = loreline_JsonToAst.positionFromJson(json.pos);
18596
+ let name = json.name;
18597
+ let argsArr = json.args;
18598
+ let _g = [];
18599
+ let _g1 = 0;
18600
+ while(_g1 < argsArr.length) {
18601
+ let a = argsArr[_g1];
18602
+ ++_g1;
18603
+ _g.push(a);
18604
+ }
18605
+ let args = _g;
18606
+ let comments = loreline_JsonToAst.extractComments(json);
18607
+ return new loreline_NFunctionDecl(id,pos,name,args,json.code,json.external,comments.leading,comments.trailing);
18608
+ }
18609
+ static literalFromJson(json) {
18610
+ let id = loreline_JsonToAst.idFromJson(json);
18611
+ let pos = loreline_JsonToAst.positionFromJson(json.pos);
18612
+ let litStr = json.literal;
18613
+ let comments = loreline_JsonToAst.extractComments(json);
18614
+ let literalType;
18615
+ let value;
18616
+ switch(litStr) {
18617
+ case "Array":
18618
+ literalType = loreline_LiteralType.Array;
18619
+ if(json.value != null) {
18620
+ let arr = json.value;
18621
+ let _g = [];
18622
+ let _g1 = 0;
18623
+ while(_g1 < arr.length) {
18624
+ let elem = arr[_g1];
18625
+ ++_g1;
18626
+ if(Object.prototype.hasOwnProperty.call(elem,"type")) {
18627
+ _g.push(loreline_JsonToAst.nodeFromJson(elem));
18628
+ } else {
18629
+ _g.push(elem);
18630
+ }
18631
+ }
18632
+ value = _g;
18633
+ } else {
18634
+ value = null;
18635
+ }
18636
+ break;
18637
+ case "Boolean":
18638
+ literalType = loreline_LiteralType.Boolean;
18639
+ value = json.value;
18640
+ break;
18641
+ case "Null":
18642
+ literalType = loreline_LiteralType.Null;
18643
+ value = null;
18644
+ break;
18645
+ case "Number":
18646
+ literalType = loreline_LiteralType.Number;
18647
+ value = json.value;
18648
+ break;
18649
+ case "Object":
18650
+ let style = loreline_JsonToAst.blockStyleFromString(json.style);
18651
+ literalType = loreline_LiteralType.Object(style);
18652
+ if(json.value != null) {
18653
+ let arr = json.value;
18654
+ let _g = [];
18655
+ let _g1 = 0;
18656
+ while(_g1 < arr.length) {
18657
+ let f = arr[_g1];
18658
+ ++_g1;
18659
+ _g.push(loreline_JsonToAst.nodeFromJson(f));
18660
+ }
18661
+ value = _g;
18662
+ } else {
18663
+ value = [];
18664
+ }
18665
+ break;
18666
+ default:
18667
+ throw haxe_Exception.thrown("Unknown literal type: " + litStr);
18668
+ }
18669
+ return new loreline_NLiteral(id,pos,value,literalType,comments.leading,comments.trailing);
18670
+ }
18671
+ static accessFromJson(json) {
18672
+ let id = loreline_JsonToAst.idFromJson(json);
18673
+ let pos = loreline_JsonToAst.positionFromJson(json.pos);
18674
+ let target = json.target != null ? loreline_JsonToAst.nodeFromJson(json.target) : null;
18675
+ let comments = loreline_JsonToAst.extractComments(json);
18676
+ return new loreline_NAccess(id,pos,target,json.name,comments.leading,comments.trailing);
18677
+ }
18678
+ static assignFromJson(json) {
18679
+ let id = loreline_JsonToAst.idFromJson(json);
18680
+ let pos = loreline_JsonToAst.positionFromJson(json.pos);
18681
+ let target = loreline_JsonToAst.nodeFromJson(json.target);
18682
+ let op = loreline_JsonToAst.tokenTypeFromString(json.op);
18683
+ let value = loreline_JsonToAst.nodeFromJson(json.value);
18684
+ let comments = loreline_JsonToAst.extractComments(json);
18685
+ return new loreline_NAssign(id,pos,target,op,value,comments.leading,comments.trailing);
18686
+ }
18687
+ static arrayAccessFromJson(json) {
18688
+ let id = loreline_JsonToAst.idFromJson(json);
18689
+ let pos = loreline_JsonToAst.positionFromJson(json.pos);
18690
+ let target = loreline_JsonToAst.nodeFromJson(json.target);
18691
+ let index = loreline_JsonToAst.nodeFromJson(json.index);
18692
+ let comments = loreline_JsonToAst.extractComments(json);
18693
+ return new loreline_NArrayAccess(id,pos,target,index,comments.leading,comments.trailing);
18694
+ }
18695
+ static binaryFromJson(json) {
18696
+ let id = loreline_JsonToAst.idFromJson(json);
18697
+ let pos = loreline_JsonToAst.positionFromJson(json.pos);
18698
+ let left = loreline_JsonToAst.nodeFromJson(json.left);
18699
+ let op = loreline_JsonToAst.tokenTypeFromString(json.op);
18700
+ let right = loreline_JsonToAst.nodeFromJson(json.right);
18701
+ let comments = loreline_JsonToAst.extractComments(json);
18702
+ return new loreline_NBinary(id,pos,left,op,right,comments.leading,comments.trailing);
18703
+ }
18704
+ static unaryFromJson(json) {
18705
+ let id = loreline_JsonToAst.idFromJson(json);
18706
+ let pos = loreline_JsonToAst.positionFromJson(json.pos);
18707
+ let op = loreline_JsonToAst.tokenTypeFromString(json.op);
18708
+ let operand = loreline_JsonToAst.nodeFromJson(json.operand);
18709
+ let comments = loreline_JsonToAst.extractComments(json);
18710
+ return new loreline_NUnary(id,pos,op,operand,comments.leading,comments.trailing);
18711
+ }
18712
+ static ternaryFromJson(json) {
18713
+ let id = loreline_JsonToAst.idFromJson(json);
18714
+ let pos = loreline_JsonToAst.positionFromJson(json.pos);
18715
+ let condition = loreline_JsonToAst.nodeFromJson(json.condition);
18716
+ let trueExpr = loreline_JsonToAst.nodeFromJson(json.trueExpr);
18717
+ let falseExpr = loreline_JsonToAst.nodeFromJson(json.falseExpr);
18718
+ let comments = loreline_JsonToAst.extractComments(json);
18719
+ return new loreline_NTernary(id,pos,condition,trueExpr,falseExpr,comments.leading,comments.trailing);
18720
+ }
18721
+ static importStatementFromJson(json) {
18722
+ let id = loreline_JsonToAst.idFromJson(json);
18723
+ let pos = loreline_JsonToAst.positionFromJson(json.pos);
18724
+ let path = loreline_JsonToAst.nodeFromJson(json.path);
18725
+ let script = json.script != null ? loreline_JsonToAst.scriptFromJson(json.script) : null;
18726
+ let comments = loreline_JsonToAst.extractComments(json);
18727
+ return new loreline_NImportStatement(id,pos,path,script,comments.leading,comments.trailing);
18728
+ }
18729
+ static idFromJson(json) {
18730
+ let idStr = json.id;
18731
+ if(idStr != null) {
18732
+ return loreline_NodeId.fromString(idStr);
18733
+ } else {
18734
+ return loreline_NodeId.UNDEFINED;
18735
+ }
18736
+ }
18737
+ static positionFromJson(json) {
18738
+ if(json == null) {
18739
+ return new loreline_Position(0,0,0,0);
18740
+ }
18741
+ let length = json.length != null ? json.length : 0;
18742
+ return new loreline_Position(json.line,json.column,json.offset,length);
18743
+ }
18744
+ static extractComments(json) {
18745
+ if(json.comments == null) {
18746
+ return { leading : null, trailing : null};
18747
+ }
18748
+ let leading = null;
18749
+ let trailing = null;
18750
+ if(json.comments.leading != null) {
18751
+ let arr = json.comments.leading;
18752
+ let _g = [];
18753
+ let _g1 = 0;
18754
+ while(_g1 < arr.length) {
18755
+ let c = arr[_g1];
18756
+ ++_g1;
18757
+ _g.push(loreline_JsonToAst.commentFromJson(c));
18758
+ }
18759
+ leading = _g;
18760
+ }
18761
+ if(json.comments.trailing != null) {
18762
+ let arr = json.comments.trailing;
18763
+ let _g = [];
18764
+ let _g1 = 0;
18765
+ while(_g1 < arr.length) {
18766
+ let c = arr[_g1];
18767
+ ++_g1;
18768
+ _g.push(loreline_JsonToAst.commentFromJson(c));
18769
+ }
18770
+ trailing = _g;
18771
+ }
18772
+ return { leading : leading, trailing : trailing};
18773
+ }
18774
+ static applyComments(node,json) {
18775
+ let comments = loreline_JsonToAst.extractComments(json);
18776
+ node.leadingComments = comments.leading;
18777
+ node.trailingComments = comments.trailing;
18778
+ }
18779
+ static blockStyleFromString(s) {
18780
+ if(s == "Braces") {
18781
+ return 1;
18782
+ } else {
18783
+ return 0;
18784
+ }
18785
+ }
18786
+ static conditionStyleFromString(s) {
18787
+ if(s == "Parens") {
18788
+ return 2;
18789
+ } else {
18790
+ return 0;
18791
+ }
18792
+ }
18793
+ static alternativeModeFromString(s) {
18794
+ switch(s) {
18795
+ case "Cycle":
18796
+ return 1;
18797
+ case "Once":
18798
+ return 2;
18799
+ case "Pick":
18800
+ return 3;
18801
+ case "Shuffle":
18802
+ return 4;
18803
+ default:
18804
+ return 0;
18805
+ }
18806
+ }
18807
+ static quotesFromString(s) {
18808
+ if(s == "DoubleQuotes") {
18809
+ return 1;
18810
+ } else {
18811
+ return 0;
18812
+ }
18813
+ }
18814
+ static tokenTypeFromString(s) {
18815
+ switch(s) {
18816
+ case "OpAssign":
18817
+ return loreline_TokenType.OpAssign;
18818
+ case "OpDivide":
18819
+ return loreline_TokenType.OpDivide;
18820
+ case "OpDivideAssign":
18821
+ return loreline_TokenType.OpDivideAssign;
18822
+ case "OpEquals":
18823
+ return loreline_TokenType.OpEquals;
18824
+ case "OpGreater":
18825
+ return loreline_TokenType.OpGreater;
18826
+ case "OpGreaterEq":
18827
+ return loreline_TokenType.OpGreaterEq;
18828
+ case "OpLess":
18829
+ return loreline_TokenType.OpLess;
18830
+ case "OpLessEq":
18831
+ return loreline_TokenType.OpLessEq;
18832
+ case "OpMinus":
18833
+ return loreline_TokenType.OpMinus;
18834
+ case "OpMinusAssign":
18835
+ return loreline_TokenType.OpMinusAssign;
18836
+ case "OpModulo":
18837
+ return loreline_TokenType.OpModulo;
18838
+ case "OpMultiply":
18839
+ return loreline_TokenType.OpMultiply;
18840
+ case "OpMultiplyAssign":
18841
+ return loreline_TokenType.OpMultiplyAssign;
18842
+ case "OpNot":
18843
+ return loreline_TokenType.OpNot;
18844
+ case "OpNotEquals":
18845
+ return loreline_TokenType.OpNotEquals;
18846
+ case "OpPlus":
18847
+ return loreline_TokenType.OpPlus;
18848
+ case "OpPlusAssign":
18849
+ return loreline_TokenType.OpPlusAssign;
18850
+ case "OpUnquotedAssign":
18851
+ return loreline_TokenType.OpUnquotedAssign;
18852
+ default:
18853
+ if(s.startsWith("OpAnd")) {
18854
+ return loreline_TokenType.OpAnd(s.indexOf("true") != -1);
18855
+ } else if(s.startsWith("OpOr")) {
18856
+ return loreline_TokenType.OpOr(s.indexOf("true") != -1);
18857
+ } else {
18858
+ throw haxe_Exception.thrown("Unknown operator: " + s);
18859
+ }
18860
+ }
18861
+ }
18862
+ }
18863
+ $hxClasses["loreline.JsonToAst"] = loreline_JsonToAst;
18864
+ loreline_JsonToAst.__name__ = "loreline.JsonToAst";
17778
18865
  class loreline_Reference {
17779
18866
  constructor(target,origin) {
17780
18867
  this.target = target;
@@ -19057,39 +20144,41 @@ var loreline_TokenType = $hxEnums["loreline.TokenType"] = { __ename__:"loreline.
19057
20144
  ,OpMinusAssign: {_hx_name:"OpMinusAssign",_hx_index:22,__enum__:"loreline.TokenType",toString:$estr}
19058
20145
  ,OpMultiplyAssign: {_hx_name:"OpMultiplyAssign",_hx_index:23,__enum__:"loreline.TokenType",toString:$estr}
19059
20146
  ,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}
20147
+ ,OpUnquotedAssign: {_hx_name:"OpUnquotedAssign",_hx_index:25,__enum__:"loreline.TokenType",toString:$estr}
20148
+ ,OpPlus: {_hx_name:"OpPlus",_hx_index:26,__enum__:"loreline.TokenType",toString:$estr}
20149
+ ,OpMinus: {_hx_name:"OpMinus",_hx_index:27,__enum__:"loreline.TokenType",toString:$estr}
20150
+ ,OpMultiply: {_hx_name:"OpMultiply",_hx_index:28,__enum__:"loreline.TokenType",toString:$estr}
20151
+ ,OpDivide: {_hx_name:"OpDivide",_hx_index:29,__enum__:"loreline.TokenType",toString:$estr}
20152
+ ,OpModulo: {_hx_name:"OpModulo",_hx_index:30,__enum__:"loreline.TokenType",toString:$estr}
20153
+ ,OpEquals: {_hx_name:"OpEquals",_hx_index:31,__enum__:"loreline.TokenType",toString:$estr}
20154
+ ,OpNotEquals: {_hx_name:"OpNotEquals",_hx_index:32,__enum__:"loreline.TokenType",toString:$estr}
20155
+ ,OpGreater: {_hx_name:"OpGreater",_hx_index:33,__enum__:"loreline.TokenType",toString:$estr}
20156
+ ,OpLess: {_hx_name:"OpLess",_hx_index:34,__enum__:"loreline.TokenType",toString:$estr}
20157
+ ,OpGreaterEq: {_hx_name:"OpGreaterEq",_hx_index:35,__enum__:"loreline.TokenType",toString:$estr}
20158
+ ,OpLessEq: {_hx_name:"OpLessEq",_hx_index:36,__enum__:"loreline.TokenType",toString:$estr}
20159
+ ,OpAnd: ($_=function(word) { return {_hx_index:37,word:word,__enum__:"loreline.TokenType",toString:$estr}; },$_._hx_name="OpAnd",$_.__params__ = ["word"],$_)
20160
+ ,OpOr: ($_=function(word) { return {_hx_index:38,word:word,__enum__:"loreline.TokenType",toString:$estr}; },$_._hx_name="OpOr",$_.__params__ = ["word"],$_)
20161
+ ,OpNot: {_hx_name:"OpNot",_hx_index:39,__enum__:"loreline.TokenType",toString:$estr}
20162
+ ,Arrow: {_hx_name:"Arrow",_hx_index:40,__enum__:"loreline.TokenType",toString:$estr}
20163
+ ,Colon: {_hx_name:"Colon",_hx_index:41,__enum__:"loreline.TokenType",toString:$estr}
20164
+ ,Question: {_hx_name:"Question",_hx_index:42,__enum__:"loreline.TokenType",toString:$estr}
20165
+ ,Comma: {_hx_name:"Comma",_hx_index:43,__enum__:"loreline.TokenType",toString:$estr}
20166
+ ,Dot: {_hx_name:"Dot",_hx_index:44,__enum__:"loreline.TokenType",toString:$estr}
20167
+ ,LBrace: {_hx_name:"LBrace",_hx_index:45,__enum__:"loreline.TokenType",toString:$estr}
20168
+ ,RBrace: {_hx_name:"RBrace",_hx_index:46,__enum__:"loreline.TokenType",toString:$estr}
20169
+ ,LParen: {_hx_name:"LParen",_hx_index:47,__enum__:"loreline.TokenType",toString:$estr}
20170
+ ,RParen: {_hx_name:"RParen",_hx_index:48,__enum__:"loreline.TokenType",toString:$estr}
20171
+ ,LBracket: {_hx_name:"LBracket",_hx_index:49,__enum__:"loreline.TokenType",toString:$estr}
20172
+ ,RBracket: {_hx_name:"RBracket",_hx_index:50,__enum__:"loreline.TokenType",toString:$estr}
20173
+ ,CommentLine: ($_=function(content) { return {_hx_index:51,content:content,__enum__:"loreline.TokenType",toString:$estr}; },$_._hx_name="CommentLine",$_.__params__ = ["content"],$_)
20174
+ ,CommentMultiLine: ($_=function(content) { return {_hx_index:52,content:content,__enum__:"loreline.TokenType",toString:$estr}; },$_._hx_name="CommentMultiLine",$_.__params__ = ["content"],$_)
20175
+ ,CommentHash: ($_=function(content) { return {_hx_index:53,content:content,__enum__:"loreline.TokenType",toString:$estr}; },$_._hx_name="CommentHash",$_.__params__ = ["content"],$_)
20176
+ ,Indent: {_hx_name:"Indent",_hx_index:54,__enum__:"loreline.TokenType",toString:$estr}
20177
+ ,Unindent: {_hx_name:"Unindent",_hx_index:55,__enum__:"loreline.TokenType",toString:$estr}
20178
+ ,LineBreak: {_hx_name:"LineBreak",_hx_index:56,__enum__:"loreline.TokenType",toString:$estr}
20179
+ ,Eof: {_hx_name:"Eof",_hx_index:57,__enum__:"loreline.TokenType",toString:$estr}
19091
20180
  };
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];
20181
+ 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
20182
  class loreline_TokenTypeHelpers {
19094
20183
  static equals(a,b) {
19095
20184
  switch(a._hx_index) {
@@ -19344,16 +20433,14 @@ class loreline_TokenTypeHelpers {
19344
20433
  }
19345
20434
  break;
19346
20435
  case 36:
19347
- let _g2 = a.word;
19348
20436
  if(b._hx_index == 36) {
19349
- let _g = b.word;
19350
20437
  return true;
19351
20438
  } else {
19352
20439
  return Type.enumEq(a,b);
19353
20440
  }
19354
20441
  break;
19355
20442
  case 37:
19356
- let _g3 = a.word;
20443
+ let _g2 = a.word;
19357
20444
  if(b._hx_index == 37) {
19358
20445
  let _g = b.word;
19359
20446
  return true;
@@ -19362,7 +20449,9 @@ class loreline_TokenTypeHelpers {
19362
20449
  }
19363
20450
  break;
19364
20451
  case 38:
20452
+ let _g3 = a.word;
19365
20453
  if(b._hx_index == 38) {
20454
+ let _g = b.word;
19366
20455
  return true;
19367
20456
  } else {
19368
20457
  return Type.enumEq(a,b);
@@ -19382,15 +20471,15 @@ class loreline_TokenTypeHelpers {
19382
20471
  return Type.enumEq(a,b);
19383
20472
  }
19384
20473
  break;
19385
- case 42:
19386
- if(b._hx_index == 42) {
20474
+ case 41:
20475
+ if(b._hx_index == 41) {
19387
20476
  return true;
19388
20477
  } else {
19389
20478
  return Type.enumEq(a,b);
19390
20479
  }
19391
20480
  break;
19392
- case 43:
19393
- if(b._hx_index == 43) {
20481
+ case 42:
20482
+ if(b._hx_index == 42) {
19394
20483
  return true;
19395
20484
  } else {
19396
20485
  return Type.enumEq(a,b);
@@ -19433,18 +20522,14 @@ class loreline_TokenTypeHelpers {
19433
20522
  break;
19434
20523
  case 49:
19435
20524
  if(b._hx_index == 49) {
19436
- let c2 = b.content;
19437
- let c1 = a.content;
19438
- return c1 == c2;
20525
+ return true;
19439
20526
  } else {
19440
20527
  return Type.enumEq(a,b);
19441
20528
  }
19442
20529
  break;
19443
20530
  case 50:
19444
20531
  if(b._hx_index == 50) {
19445
- let c2 = b.content;
19446
- let c1 = a.content;
19447
- return c1 == c2;
20532
+ return true;
19448
20533
  } else {
19449
20534
  return Type.enumEq(a,b);
19450
20535
  }
@@ -19460,14 +20545,18 @@ class loreline_TokenTypeHelpers {
19460
20545
  break;
19461
20546
  case 52:
19462
20547
  if(b._hx_index == 52) {
19463
- return true;
20548
+ let c2 = b.content;
20549
+ let c1 = a.content;
20550
+ return c1 == c2;
19464
20551
  } else {
19465
20552
  return Type.enumEq(a,b);
19466
20553
  }
19467
20554
  break;
19468
20555
  case 53:
19469
20556
  if(b._hx_index == 53) {
19470
- return true;
20557
+ let c2 = b.content;
20558
+ let c1 = a.content;
20559
+ return c1 == c2;
19471
20560
  } else {
19472
20561
  return Type.enumEq(a,b);
19473
20562
  }
@@ -19486,19 +20575,33 @@ class loreline_TokenTypeHelpers {
19486
20575
  return Type.enumEq(a,b);
19487
20576
  }
19488
20577
  break;
20578
+ case 56:
20579
+ if(b._hx_index == 56) {
20580
+ return true;
20581
+ } else {
20582
+ return Type.enumEq(a,b);
20583
+ }
20584
+ break;
20585
+ case 57:
20586
+ if(b._hx_index == 57) {
20587
+ return true;
20588
+ } else {
20589
+ return Type.enumEq(a,b);
20590
+ }
20591
+ break;
19489
20592
  default:
19490
20593
  return Type.enumEq(a,b);
19491
20594
  }
19492
20595
  }
19493
20596
  static isComment(a) {
19494
20597
  switch(a._hx_index) {
19495
- case 49:
20598
+ case 51:
19496
20599
  let _g = a.content;
19497
20600
  return true;
19498
- case 50:
20601
+ case 52:
19499
20602
  let _g1 = a.content;
19500
20603
  return true;
19501
- case 51:
20604
+ case 53:
19502
20605
  let _g2 = a.content;
19503
20606
  return true;
19504
20607
  default:
@@ -19507,7 +20610,7 @@ class loreline_TokenTypeHelpers {
19507
20610
  }
19508
20611
  static isAssignOp(a) {
19509
20612
  switch(a._hx_index) {
19510
- case 20:case 21:case 22:case 23:case 24:
20613
+ case 20:case 21:case 22:case 23:case 24:case 25:
19511
20614
  return true;
19512
20615
  default:
19513
20616
  return false;
@@ -19594,28 +20697,30 @@ class loreline_TokenTypeHelpers {
19594
20697
  case 24:
19595
20698
  return "/=";
19596
20699
  case 25:
19597
- return "+";
20700
+ return ":=";
19598
20701
  case 26:
19599
- return "-";
20702
+ return "+";
19600
20703
  case 27:
19601
- return "*";
20704
+ return "-";
19602
20705
  case 28:
19603
- return "/";
20706
+ return "*";
19604
20707
  case 29:
19605
- return "%";
20708
+ return "/";
19606
20709
  case 30:
19607
- return "==";
20710
+ return "%";
19608
20711
  case 31:
19609
- return "!=";
20712
+ return "==";
19610
20713
  case 32:
19611
- return ">";
20714
+ return "!=";
19612
20715
  case 33:
19613
- return "<";
20716
+ return ">";
19614
20717
  case 34:
19615
- return ">=";
20718
+ return "<";
19616
20719
  case 35:
19617
- return "<=";
20720
+ return ">=";
19618
20721
  case 36:
20722
+ return "<=";
20723
+ case 37:
19619
20724
  let word = a.word;
19620
20725
  if(word) {
19621
20726
  return "and";
@@ -19623,7 +20728,7 @@ class loreline_TokenTypeHelpers {
19623
20728
  return "&&";
19624
20729
  }
19625
20730
  break;
19626
- case 37:
20731
+ case 38:
19627
20732
  let word1 = a.word;
19628
20733
  if(word1) {
19629
20734
  return "or";
@@ -19631,44 +20736,46 @@ class loreline_TokenTypeHelpers {
19631
20736
  return "||";
19632
20737
  }
19633
20738
  break;
19634
- case 38:
19635
- return "!";
19636
20739
  case 39:
19637
- return "->";
20740
+ return "!";
19638
20741
  case 40:
19639
- return ":";
20742
+ return "->";
19640
20743
  case 41:
19641
- return ",";
20744
+ return ":";
19642
20745
  case 42:
19643
- return ".";
20746
+ return "?";
19644
20747
  case 43:
19645
- return "{";
20748
+ return ",";
19646
20749
  case 44:
19647
- return "}";
20750
+ return ".";
19648
20751
  case 45:
19649
- return "(";
20752
+ return "{";
19650
20753
  case 46:
19651
- return ")";
20754
+ return "}";
19652
20755
  case 47:
19653
- return "[";
20756
+ return "(";
19654
20757
  case 48:
19655
- return "]";
20758
+ return ")";
19656
20759
  case 49:
20760
+ return "[";
20761
+ case 50:
20762
+ return "]";
20763
+ case 51:
19657
20764
  let content = a.content;
19658
20765
  return "comment";
19659
- case 50:
20766
+ case 52:
19660
20767
  let content1 = a.content;
19661
20768
  return "multiline comment";
19662
- case 51:
20769
+ case 53:
19663
20770
  let content2 = a.content;
19664
20771
  return "hash comment";
19665
- case 52:
20772
+ case 54:
19666
20773
  return "indent";
19667
- case 53:
20774
+ case 55:
19668
20775
  return "unindent";
19669
- case 54:
20776
+ case 56:
19670
20777
  return "line break";
19671
- case 55:
20778
+ case 57:
19672
20779
  return "end of file";
19673
20780
  }
19674
20781
  }
@@ -19758,7 +20865,7 @@ class loreline_Lexer {
19758
20865
  case 8:case 9:case 10:case 11:case 12:case 13:
19759
20866
  this.nextBlock = 9;
19760
20867
  break;
19761
- case 43:
20868
+ case 45:
19762
20869
  let tmp;
19763
20870
  switch(this.nextBlock) {
19764
20871
  case 0:case 1:
@@ -19783,15 +20890,15 @@ class loreline_Lexer {
19783
20890
  this.stack.push(tmp);
19784
20891
  this.nextBlock = 10;
19785
20892
  break;
19786
- case 47:
20893
+ case 49:
19787
20894
  this.stack.push(12);
19788
20895
  this.nextBlock = 10;
19789
20896
  break;
19790
- case 44:case 48:case 53:
20897
+ case 46:case 50:case 55:
19791
20898
  this.stack.pop();
19792
20899
  this.nextBlock = 10;
19793
20900
  break;
19794
- case 52:
20901
+ case 54:
19795
20902
  let tmp1;
19796
20903
  switch(this.nextBlock) {
19797
20904
  case 0:case 1:
@@ -19879,7 +20986,13 @@ class loreline_Lexer {
19879
20986
  }
19880
20987
  switch(c1) {
19881
20988
  case 34:
19882
- return this.readString(startPos);
20989
+ let tmp = this.tryReadUnquotedString();
20990
+ if(tmp != null) {
20991
+ return tmp;
20992
+ } else {
20993
+ return this.readString(startPos);
20994
+ }
20995
+ break;
19883
20996
  case 91:
19884
20997
  let _g = 0;
19885
20998
  let _g1 = 1;
@@ -19957,9 +21070,9 @@ class loreline_Lexer {
19957
21070
  this.previous = token2;
19958
21071
  return token2;
19959
21072
  default:
19960
- let tmp = this.tryReadUnquotedString();
19961
- if(tmp != null) {
19962
- return tmp;
21073
+ let tmp1 = this.tryReadUnquotedString();
21074
+ if(tmp1 != null) {
21075
+ return tmp1;
19963
21076
  } else {
19964
21077
  switch(c1) {
19965
21078
  case 33:
@@ -20669,30 +21782,69 @@ class loreline_Lexer {
20669
21782
  }
20670
21783
  break;
20671
21784
  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;
21785
+ let tmp2;
21786
+ if(this.pos + 1 < this.length) {
21787
+ let c = HxOverrides.cca(this.input,this.pos + 1);
21788
+ tmp2 = c == null ? -1 : c;
21789
+ } else {
21790
+ tmp2 = 0;
21791
+ }
21792
+ if(tmp2 == 61) {
21793
+ let count = 2;
21794
+ if(count == null) {
21795
+ count = 1;
20678
21796
  }
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++;
21797
+ let _g = 0;
21798
+ let _g1 = count;
21799
+ while(_g < _g1) {
21800
+ let _ = _g++;
21801
+ if(this.pos >= this.length) {
21802
+ break;
21803
+ }
21804
+ let c = HxOverrides.cca(this.input,this.pos);
21805
+ if((c == null ? -1 : c) == 10) {
21806
+ this.line++;
21807
+ this.column = 1;
21808
+ } else {
21809
+ this.column++;
21810
+ }
21811
+ this.pos++;
20685
21812
  }
20686
- this.pos++;
20687
- }
20688
- let position7 = startPos;
20689
- if(position7 == null) {
20690
- position7 = new loreline_Position(this.startLine,this.startColumn,this.pos);
21813
+ let position = startPos;
21814
+ if(position == null) {
21815
+ position = new loreline_Position(this.startLine,this.startColumn,this.pos);
21816
+ }
21817
+ position.length = this.pos - position.offset;
21818
+ let token = new loreline_Token(loreline_TokenType.OpUnquotedAssign,position);
21819
+ this.previous = token;
21820
+ return token;
21821
+ } else {
21822
+ let _g = 0;
21823
+ let _g1 = 1;
21824
+ while(_g < _g1) {
21825
+ let _ = _g++;
21826
+ if(this.pos >= this.length) {
21827
+ break;
21828
+ }
21829
+ let c = HxOverrides.cca(this.input,this.pos);
21830
+ if((c == null ? -1 : c) == 10) {
21831
+ this.line++;
21832
+ this.column = 1;
21833
+ } else {
21834
+ this.column++;
21835
+ }
21836
+ this.pos++;
21837
+ }
21838
+ let position = startPos;
21839
+ if(position == null) {
21840
+ position = new loreline_Position(this.startLine,this.startColumn,this.pos);
21841
+ }
21842
+ position.length = this.pos - position.offset;
21843
+ let token = new loreline_Token(loreline_TokenType.Colon,position);
21844
+ this.previous = token;
21845
+ return token;
20691
21846
  }
20692
- position7.length = this.pos - position7.offset;
20693
- let token7 = new loreline_Token(loreline_TokenType.Colon,position7);
20694
- this.previous = token7;
20695
- return token7;
21847
+ break;
20696
21848
  case 60:
20697
21849
  let c10 = c1;
20698
21850
  if(c10 >= 48 && c10 <= 57) {
@@ -20915,11 +22067,32 @@ class loreline_Lexer {
20915
22067
  }
20916
22068
  }
20917
22069
  break;
22070
+ case 63:
22071
+ let c13 = c1;
22072
+ if(c13 >= 48 && c13 <= 57) {
22073
+ return this.readNumber();
22074
+ } else {
22075
+ let c = c1;
22076
+ if(c >= 97 && c <= 122 || c >= 65 && c <= 90 || c == 95) {
22077
+ return this.readIdentifier();
22078
+ } else {
22079
+ this.pos++;
22080
+ let position = null;
22081
+ if(position == null) {
22082
+ position = new loreline_Position(this.startLine,this.startColumn,this.pos);
22083
+ }
22084
+ position.length = this.pos - position.offset;
22085
+ let token = new loreline_Token(loreline_TokenType.Question,position);
22086
+ this.previous = token;
22087
+ return token;
22088
+ }
22089
+ }
22090
+ break;
20918
22091
  case 93:
20919
- let _g16 = 0;
20920
- let _g17 = 1;
20921
- while(_g16 < _g17) {
20922
- let _ = _g16++;
22092
+ let _g14 = 0;
22093
+ let _g15 = 1;
22094
+ while(_g14 < _g15) {
22095
+ let _ = _g14++;
20923
22096
  if(this.pos >= this.length) {
20924
22097
  break;
20925
22098
  }
@@ -20933,17 +22106,17 @@ class loreline_Lexer {
20933
22106
  this.pos++;
20934
22107
  }
20935
22108
  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;
22109
+ let position7 = startPos;
22110
+ if(position7 == null) {
22111
+ position7 = new loreline_Position(this.startLine,this.startColumn,this.pos);
22112
+ }
22113
+ position7.length = this.pos - position7.offset;
22114
+ let token7 = new loreline_Token(loreline_TokenType.RBracket,position7);
22115
+ this.previous = token7;
22116
+ return token7;
20944
22117
  case 124:
20945
- let c13 = c1;
20946
- if(c13 >= 48 && c13 <= 57) {
22118
+ let c14 = c1;
22119
+ if(c14 >= 48 && c14 <= 57) {
20947
22120
  return this.readNumber();
20948
22121
  } else {
20949
22122
  let c = c1;
@@ -21017,8 +22190,8 @@ class loreline_Lexer {
21017
22190
  }
21018
22191
  break;
21019
22192
  default:
21020
- let c14 = c1;
21021
- if(c14 >= 48 && c14 <= 57) {
22193
+ let c15 = c1;
22194
+ if(c15 >= 48 && c15 <= 57) {
21022
22195
  return this.readNumber();
21023
22196
  } else {
21024
22197
  let c = c1;
@@ -22007,12 +23180,50 @@ class loreline_Lexer {
22007
23180
  if(pos < this.length) {
22008
23181
  let c = HxOverrides.cca(this.input,pos);
22009
23182
  let c1 = c == null ? -1 : c;
23183
+ let tmp;
23184
+ if(c1 == 105 && pos + 1 < this.length) {
23185
+ let c = HxOverrides.cca(this.input,pos + 1);
23186
+ tmp = (c == null ? -1 : c) == 102;
23187
+ } else {
23188
+ tmp = false;
23189
+ }
23190
+ if(tmp) {
23191
+ let tmp;
23192
+ if(pos + 2 < this.length) {
23193
+ let c = HxOverrides.cca(this.input,pos + 2);
23194
+ let c1 = c == null ? -1 : c;
23195
+ tmp = !(c1 >= 97 && c1 <= 122 || c1 >= 65 && c1 <= 90 || c1 == 95 || c1 >= 48 && c1 <= 57);
23196
+ } else {
23197
+ tmp = true;
23198
+ }
23199
+ if(tmp) {
23200
+ return true;
23201
+ }
23202
+ }
22010
23203
  if(c1 != 10 && c1 != 13 && c1 != 32 && c1 != 9 && c1 != 47) {
22011
23204
  return false;
22012
23205
  }
22013
23206
  }
22014
23207
  return true;
22015
23208
  }
23209
+ isChoiceOnceStart(pos) {
23210
+ if(!this.inChoiceRoot()) {
23211
+ return false;
23212
+ }
23213
+ let c = HxOverrides.cca(this.input,pos);
23214
+ if((c == null ? -1 : c) != 45) {
23215
+ return false;
23216
+ }
23217
+ ++pos;
23218
+ if(pos >= this.length) {
23219
+ return false;
23220
+ }
23221
+ let c1 = HxOverrides.cca(this.input,pos);
23222
+ if((c1 == null ? -1 : c1) != 32) {
23223
+ return false;
23224
+ }
23225
+ return true;
23226
+ }
22016
23227
  isLabelStart(pos) {
22017
23228
  pos = this._skipWhitespaceAndComments(pos,false);
22018
23229
  let c = HxOverrides.cca(this.input,pos);
@@ -22212,7 +23423,7 @@ class loreline_Lexer {
22212
23423
  if(!isEscape) {
22213
23424
  if(c1 != 61) {
22214
23425
  let c = HxOverrides.cca(this.input,pos + 1);
22215
- tmp = (c == null ? -1 : c) == 61 && (c1 == 43 || c1 == 45 || c1 == 42 || c1 == 47);
23426
+ tmp = (c == null ? -1 : c) == 61 && (c1 == 43 || c1 == 45 || c1 == 42 || c1 == 47 || c1 == 58);
22216
23427
  } else {
22217
23428
  tmp = true;
22218
23429
  }
@@ -22436,7 +23647,26 @@ class loreline_Lexer {
22436
23647
  ++pos;
22437
23648
  }
22438
23649
  if(!onlyTagsOnFirstLine) {
22439
- return -1;
23650
+ while(true) {
23651
+ let tmp;
23652
+ let tmp1;
23653
+ if(pos < this.length) {
23654
+ let c = HxOverrides.cca(this.input,pos);
23655
+ tmp1 = (c == null ? -1 : c) != 10;
23656
+ } else {
23657
+ tmp1 = false;
23658
+ }
23659
+ if(tmp1) {
23660
+ let c = HxOverrides.cca(this.input,pos);
23661
+ tmp = (c == null ? -1 : c) != 13;
23662
+ } else {
23663
+ tmp = false;
23664
+ }
23665
+ if(!tmp) {
23666
+ break;
23667
+ }
23668
+ ++pos;
23669
+ }
22440
23670
  }
22441
23671
  let prevPos = pos;
22442
23672
  let stopNextLine = true;
@@ -22638,6 +23868,20 @@ class loreline_Lexer {
22638
23868
  }
22639
23869
  return false;
22640
23870
  }
23871
+ followsUnquotedAssign() {
23872
+ let i = this.tokenized.length - 1;
23873
+ while(i >= 0) {
23874
+ let token = this.tokenized[i];
23875
+ if(loreline_TokenTypeHelpers.isComment(token.type) || token.type == loreline_TokenType.Indent || token.type == loreline_TokenType.Unindent) {
23876
+ --i;
23877
+ } else if(token.type == loreline_TokenType.OpUnquotedAssign) {
23878
+ return true;
23879
+ } else {
23880
+ return false;
23881
+ }
23882
+ }
23883
+ return false;
23884
+ }
22641
23885
  followsOnlyLabelOrCommentsInLine() {
22642
23886
  let foundLabel = false;
22643
23887
  let i = this.tokenized.length - 1;
@@ -22677,12 +23921,29 @@ class loreline_Lexer {
22677
23921
  }
22678
23922
  return true;
22679
23923
  }
22680
- hasNonSpecialChar(str) {
22681
- let _g = 0;
22682
- let _g1 = str.length;
22683
- while(_g < _g1) {
22684
- let i = _g++;
22685
- let found = false;
23924
+ followsChoiceOncePrefix() {
23925
+ if(!this.inChoiceRoot()) {
23926
+ return false;
23927
+ }
23928
+ let i = this.tokenized.length - 1;
23929
+ while(i >= 0) {
23930
+ let token = this.tokenized[i];
23931
+ if(loreline_TokenTypeHelpers.isComment(token.type) || token.type == loreline_TokenType.Indent || token.type == loreline_TokenType.Unindent) {
23932
+ --i;
23933
+ } else if(token.type == loreline_TokenType.OpMinus) {
23934
+ return true;
23935
+ } else {
23936
+ return false;
23937
+ }
23938
+ }
23939
+ return false;
23940
+ }
23941
+ hasNonSpecialChar(str) {
23942
+ let _g = 0;
23943
+ let _g1 = str.length;
23944
+ while(_g < _g1) {
23945
+ let i = _g++;
23946
+ let found = false;
22686
23947
  let c = HxOverrides.cca(str,i);
22687
23948
  let code = c == null ? -1 : c;
22688
23949
  let _g1 = 0;
@@ -22767,6 +24028,10 @@ class loreline_Lexer {
22767
24028
  return pos == length;
22768
24029
  }
22769
24030
  makeLooseOrStrictAfterBracket() {
24031
+ if(this.isStrict()) {
24032
+ this.strictExprs.push(1);
24033
+ return;
24034
+ }
22770
24035
  let i = this.tokenized.length - 1;
22771
24036
  while(i >= 0) {
22772
24037
  let token = this.tokenized[i];
@@ -22776,19 +24041,19 @@ class loreline_Lexer {
22776
24041
  let _g1 = _g.name;
22777
24042
  this.strictExprs.push(1);
22778
24043
  return;
22779
- case 46:case 48:
24044
+ case 48:case 50:
22780
24045
  this.strictExprs.push(1);
22781
24046
  return;
22782
- case 49:
24047
+ case 51:
22783
24048
  let _g2 = _g.content;
22784
24049
  break;
22785
- case 50:
24050
+ case 52:
22786
24051
  let _g3 = _g.content;
22787
24052
  break;
22788
- case 51:
24053
+ case 53:
22789
24054
  let _g4 = _g.content;
22790
24055
  break;
22791
- case 52:case 53:case 54:
24056
+ case 54:case 55:case 56:
22792
24057
  break;
22793
24058
  default:
22794
24059
  this.strictExprs.push(0);
@@ -22814,18 +24079,18 @@ class loreline_Lexer {
22814
24079
  case 19:
22815
24080
  let _g1 = _g.name;
22816
24081
  return true;
22817
- case 46:case 48:
24082
+ case 48:case 50:
22818
24083
  return true;
22819
- case 49:
24084
+ case 51:
22820
24085
  let _g2 = _g.content;
22821
24086
  break;
22822
- case 50:
24087
+ case 52:
22823
24088
  let _g3 = _g.content;
22824
24089
  break;
22825
- case 51:
24090
+ case 53:
22826
24091
  let _g4 = _g.content;
22827
24092
  break;
22828
- case 52:case 53:case 54:
24093
+ case 54:case 55:case 56:
22829
24094
  break;
22830
24095
  default:
22831
24096
  return false;
@@ -22854,6 +24119,20 @@ class loreline_Lexer {
22854
24119
  if(cc == 10) {
22855
24120
  break;
22856
24121
  }
24122
+ if(cc == 47 && this.pos + 1 < this.length) {
24123
+ let c = HxOverrides.cca(this.input,this.pos + 1);
24124
+ let next = c == null ? -1 : c;
24125
+ if(next == 47 || next == 42) {
24126
+ break;
24127
+ }
24128
+ }
24129
+ if(cc == 35 && this.pos + 1 < this.length) {
24130
+ let c = HxOverrides.cca(this.input,this.pos + 1);
24131
+ let next = c == null ? -1 : c;
24132
+ if(next >= 97 && next <= 122 || next >= 65 && next <= 90 || next == 95 || next >= 48 && next <= 57 || next == 45) {
24133
+ break;
24134
+ }
24135
+ }
22857
24136
  buf_b += String.fromCodePoint(cc);
22858
24137
  this.pos++;
22859
24138
  }
@@ -22868,6 +24147,272 @@ class loreline_Lexer {
22868
24147
  return token;
22869
24148
  }
22870
24149
  }
24150
+ scanStringEnd(startPos,allowTags) {
24151
+ let p = startPos + 1;
24152
+ let inTag = false;
24153
+ while(p < this.length) {
24154
+ let c = HxOverrides.cca(this.input,p);
24155
+ let c1 = c == null ? -1 : c;
24156
+ if(c1 == 92) {
24157
+ p += 2;
24158
+ continue;
24159
+ }
24160
+ if(c1 == 10) {
24161
+ return -1;
24162
+ }
24163
+ if(c1 == 34 && !inTag) {
24164
+ return p + 1;
24165
+ }
24166
+ if(allowTags && c1 == 60 && !inTag) {
24167
+ let nc;
24168
+ if(p + 1 < this.length) {
24169
+ let c = HxOverrides.cca(this.input,p + 1);
24170
+ nc = c == null ? -1 : c;
24171
+ } else {
24172
+ nc = 0;
24173
+ }
24174
+ let isClosing = nc == 47;
24175
+ let checkPos = p + (isClosing ? 2 : 1);
24176
+ if(checkPos < this.length) {
24177
+ let c = HxOverrides.cca(this.input,checkPos);
24178
+ let ns = c == null ? -1 : c;
24179
+ if(ns >= 97 && ns <= 122 || ns >= 65 && ns <= 90 || ns == 95 || ns == 95 || ns == 36 || isClosing && ns == 62) {
24180
+ inTag = true;
24181
+ }
24182
+ }
24183
+ }
24184
+ if(c1 == 62 && inTag) {
24185
+ inTag = false;
24186
+ }
24187
+ if(c1 == 36 && p + 1 < this.length) {
24188
+ let c = HxOverrides.cca(this.input,p + 1);
24189
+ let next = c == null ? -1 : c;
24190
+ if(next == 123) {
24191
+ p += 2;
24192
+ let depth = 1;
24193
+ while(p < this.length && depth > 0) {
24194
+ let c = HxOverrides.cca(this.input,p);
24195
+ let ic = c == null ? -1 : c;
24196
+ if(ic == 92) {
24197
+ p += 2;
24198
+ continue;
24199
+ }
24200
+ if(ic == 10) {
24201
+ return -1;
24202
+ }
24203
+ let tmp;
24204
+ if(ic == 47 && p + 1 < this.length) {
24205
+ let c = HxOverrides.cca(this.input,p + 1);
24206
+ tmp = (c == null ? -1 : c) == 47;
24207
+ } else {
24208
+ tmp = false;
24209
+ }
24210
+ if(tmp) {
24211
+ return -1;
24212
+ }
24213
+ let tmp1;
24214
+ if(ic == 47 && p + 1 < this.length) {
24215
+ let c = HxOverrides.cca(this.input,p + 1);
24216
+ tmp1 = (c == null ? -1 : c) == 42;
24217
+ } else {
24218
+ tmp1 = false;
24219
+ }
24220
+ if(tmp1) {
24221
+ p += 2;
24222
+ while(true) {
24223
+ if(p >= this.length) {
24224
+ return -1;
24225
+ }
24226
+ let c = HxOverrides.cca(this.input,p);
24227
+ if((c == null ? -1 : c) == 10) {
24228
+ return -1;
24229
+ }
24230
+ let tmp;
24231
+ let tmp1;
24232
+ if(p + 1 < this.length) {
24233
+ let c = HxOverrides.cca(this.input,p);
24234
+ tmp1 = (c == null ? -1 : c) == 42;
24235
+ } else {
24236
+ tmp1 = false;
24237
+ }
24238
+ if(tmp1) {
24239
+ let c = HxOverrides.cca(this.input,p + 1);
24240
+ tmp = (c == null ? -1 : c) == 47;
24241
+ } else {
24242
+ tmp = false;
24243
+ }
24244
+ if(tmp) {
24245
+ p += 2;
24246
+ break;
24247
+ }
24248
+ ++p;
24249
+ }
24250
+ continue;
24251
+ }
24252
+ if(ic == 34) {
24253
+ p = this.scanStringEnd(p,allowTags);
24254
+ if(p == -1) {
24255
+ return -1;
24256
+ }
24257
+ continue;
24258
+ }
24259
+ if(ic == 123) {
24260
+ ++depth;
24261
+ } else if(ic == 125) {
24262
+ --depth;
24263
+ }
24264
+ ++p;
24265
+ }
24266
+ if(depth != 0) {
24267
+ return -1;
24268
+ }
24269
+ continue;
24270
+ }
24271
+ if(next == 36) {
24272
+ p += 2;
24273
+ continue;
24274
+ }
24275
+ if(next >= 97 && next <= 122 || next >= 65 && next <= 90 || next == 95) {
24276
+ ++p;
24277
+ while(true) {
24278
+ let tmp;
24279
+ if(p < this.length) {
24280
+ let c = HxOverrides.cca(this.input,p);
24281
+ let c1 = c == null ? -1 : c;
24282
+ tmp = c1 >= 97 && c1 <= 122 || c1 >= 65 && c1 <= 90 || c1 == 95 || c1 >= 48 && c1 <= 57;
24283
+ } else {
24284
+ tmp = false;
24285
+ }
24286
+ if(!tmp) {
24287
+ break;
24288
+ }
24289
+ ++p;
24290
+ }
24291
+ p = this.scanAccessorChain(p,allowTags);
24292
+ if(p == -1) {
24293
+ return -1;
24294
+ }
24295
+ continue;
24296
+ }
24297
+ }
24298
+ ++p;
24299
+ }
24300
+ return -1;
24301
+ }
24302
+ scanAccessorChain(p,allowTags) {
24303
+ while(p < this.length) {
24304
+ let c = HxOverrides.cca(this.input,p);
24305
+ let c1 = c == null ? -1 : c;
24306
+ let tmp;
24307
+ if(c1 == 46 && p + 1 < this.length) {
24308
+ let c = HxOverrides.cca(this.input,p + 1);
24309
+ let c1 = c == null ? -1 : c;
24310
+ tmp = c1 >= 97 && c1 <= 122 || c1 >= 65 && c1 <= 90 || c1 == 95;
24311
+ } else {
24312
+ tmp = false;
24313
+ }
24314
+ if(tmp) {
24315
+ ++p;
24316
+ while(true) {
24317
+ let tmp;
24318
+ if(p < this.length) {
24319
+ let c = HxOverrides.cca(this.input,p);
24320
+ let c1 = c == null ? -1 : c;
24321
+ tmp = c1 >= 97 && c1 <= 122 || c1 >= 65 && c1 <= 90 || c1 == 95 || c1 >= 48 && c1 <= 57;
24322
+ } else {
24323
+ tmp = false;
24324
+ }
24325
+ if(!tmp) {
24326
+ break;
24327
+ }
24328
+ ++p;
24329
+ }
24330
+ } else if(c1 == 91 || c1 == 40) {
24331
+ let close = c1 == 91 ? 93 : 41;
24332
+ ++p;
24333
+ let depth = 1;
24334
+ while(p < this.length && depth > 0) {
24335
+ let c = HxOverrides.cca(this.input,p);
24336
+ let ic = c == null ? -1 : c;
24337
+ if(ic == 92) {
24338
+ p += 2;
24339
+ continue;
24340
+ }
24341
+ if(ic == 10) {
24342
+ return -1;
24343
+ }
24344
+ let tmp;
24345
+ if(ic == 47 && p + 1 < this.length) {
24346
+ let c = HxOverrides.cca(this.input,p + 1);
24347
+ tmp = (c == null ? -1 : c) == 47;
24348
+ } else {
24349
+ tmp = false;
24350
+ }
24351
+ if(tmp) {
24352
+ return -1;
24353
+ }
24354
+ let tmp1;
24355
+ if(ic == 47 && p + 1 < this.length) {
24356
+ let c = HxOverrides.cca(this.input,p + 1);
24357
+ tmp1 = (c == null ? -1 : c) == 42;
24358
+ } else {
24359
+ tmp1 = false;
24360
+ }
24361
+ if(tmp1) {
24362
+ p += 2;
24363
+ while(true) {
24364
+ if(p >= this.length) {
24365
+ return -1;
24366
+ }
24367
+ let c = HxOverrides.cca(this.input,p);
24368
+ if((c == null ? -1 : c) == 10) {
24369
+ return -1;
24370
+ }
24371
+ let tmp;
24372
+ let tmp1;
24373
+ if(p + 1 < this.length) {
24374
+ let c = HxOverrides.cca(this.input,p);
24375
+ tmp1 = (c == null ? -1 : c) == 42;
24376
+ } else {
24377
+ tmp1 = false;
24378
+ }
24379
+ if(tmp1) {
24380
+ let c = HxOverrides.cca(this.input,p + 1);
24381
+ tmp = (c == null ? -1 : c) == 47;
24382
+ } else {
24383
+ tmp = false;
24384
+ }
24385
+ if(tmp) {
24386
+ p += 2;
24387
+ break;
24388
+ }
24389
+ ++p;
24390
+ }
24391
+ continue;
24392
+ }
24393
+ if(ic == 34) {
24394
+ p = this.scanStringEnd(p,allowTags);
24395
+ if(p == -1) {
24396
+ return -1;
24397
+ }
24398
+ continue;
24399
+ }
24400
+ if(ic == c1) {
24401
+ ++depth;
24402
+ } else if(ic == close) {
24403
+ --depth;
24404
+ }
24405
+ ++p;
24406
+ }
24407
+ if(depth != 0) {
24408
+ return -1;
24409
+ }
24410
+ } else {
24411
+ break;
24412
+ }
24413
+ }
24414
+ return p;
24415
+ }
22871
24416
  tryReadUnquotedString() {
22872
24417
  if(this.isStrict()) {
22873
24418
  return null;
@@ -22888,7 +24433,7 @@ class loreline_Lexer {
22888
24433
  return null;
22889
24434
  }
22890
24435
  }
22891
- if(c1 == 123 || c1 == 125 || c1 == 91 || c1 == 93 || c1 == 34 || c1 == 58 || c1 == 35 || (c1 == 32 || c1 == 9)) {
24436
+ if(c1 == 123 || c1 == 125 || c1 == 91 || c1 == 93 || c1 == 58 || c1 == 35 || (c1 == 32 || c1 == 9)) {
22892
24437
  return null;
22893
24438
  }
22894
24439
  let parent = this.parentBlockType();
@@ -22896,7 +24441,7 @@ class loreline_Lexer {
22896
24441
  return null;
22897
24442
  }
22898
24443
  let inBrackets = this.isInsideBrackets();
22899
- let isAssignValue = false;
24444
+ let isAssignValue = this.followsUnquotedAssign();
22900
24445
  let labelIdentifierIndex = this.afterLabelIdentifierToken(false);
22901
24446
  if(labelIdentifierIndex != -1 && this.tokenized[labelIdentifierIndex].pos.line < this.line) {
22902
24447
  if(this.tokenized[labelIdentifierIndex].pos.column >= this.column) {
@@ -22909,11 +24454,12 @@ class loreline_Lexer {
22909
24454
  let multilineIndent = labelIdentifierIndex != -1 ? this.isStartingMultilineDialogue(labelIdentifierIndex) : -1;
22910
24455
  let isAfterLabel = labelIdentifierIndex != -1;
22911
24456
  let isValue = parent == loreline_TokenType.KwState || parent == loreline_TokenType.KwCharacter || inBrackets || isAssignValue;
24457
+ let identifier = this.matchIdentifier(this.pos);
22912
24458
  if(isValue) {
22913
24459
  if(this.isCallStart(this.pos) || this.isLabelStart(this.pos)) {
22914
24460
  return null;
22915
24461
  }
22916
- } else if(!isAfterLabel && (this.isIdentifierExpressionStart(this.pos,true) || this.isIfStart(this.pos) || this.isCallStart(this.pos) || this.isAssignStart(this.pos,false))) {
24462
+ } else if(!isAfterLabel && identifier != "true" && identifier != "false" && identifier != "null" && (this.isIdentifierExpressionStart(this.pos,true) || this.isIfStart(this.pos) || this.isCallStart(this.pos) || this.isAssignStart(this.pos,false))) {
22917
24463
  return null;
22918
24464
  }
22919
24465
  if(!isValue) {
@@ -22925,8 +24471,10 @@ class loreline_Lexer {
22925
24471
  if(this.isInsertionStart(this.pos)) {
22926
24472
  return null;
22927
24473
  }
24474
+ if(this.isChoiceOnceStart(this.pos)) {
24475
+ return null;
24476
+ }
22928
24477
  }
22929
- let identifier = this.matchIdentifier(this.pos);
22930
24478
  if(identifier != null) {
22931
24479
  if(identifier == "function") {
22932
24480
  return null;
@@ -22935,30 +24483,181 @@ class loreline_Lexer {
22935
24483
  if(identifier != "if" && identifier != "null" && identifier != "true" && identifier != "false" && identifier != "and" && identifier != "or" && Object.prototype.hasOwnProperty.call(loreline_Lexer.KEYWORDS.h,identifier)) {
22936
24484
  return null;
22937
24485
  }
22938
- if(this.isColon(this.pos + identifier.length)) {
24486
+ if(this.isColon(this.pos + identifier.length)) {
24487
+ return null;
24488
+ }
24489
+ }
24490
+ }
24491
+ let allowTags = !isValue;
24492
+ let isDialogue = false;
24493
+ if(isValue) {
24494
+ if(inBrackets) {
24495
+ if(!isAfterLabel && !this.followsOnlyWhitespacesOrCommentsInLine() && !this.isAfterComma() && !this.isAfterLBracket()) {
24496
+ return null;
24497
+ }
24498
+ } else if(!isAssignValue && !isAfterLabel) {
24499
+ return null;
24500
+ }
24501
+ } else {
24502
+ isDialogue = this.followsOnlyLabelOrCommentsInLine();
24503
+ if(!isDialogue && !this.followsOnlyWhitespacesOrCommentsInLine() && !this.followsChoiceOncePrefix()) {
24504
+ return null;
24505
+ }
24506
+ if(!isDialogue) {
24507
+ if(cc == 62 && c1 == 45) {
24508
+ return null;
24509
+ }
24510
+ }
24511
+ }
24512
+ if(c1 == 34) {
24513
+ let scanEndPos = this.scanStringEnd(this.pos,parent == loreline_TokenType.KwBeat);
24514
+ if(scanEndPos == -1) {
24515
+ return null;
24516
+ }
24517
+ let hasSameLineContent = false;
24518
+ let eolPos = scanEndPos;
24519
+ while(eolPos < this.length) {
24520
+ let c = HxOverrides.cca(this.input,eolPos);
24521
+ let sc = c == null ? -1 : c;
24522
+ if(sc == 32 || sc == 9) {
24523
+ ++eolPos;
24524
+ continue;
24525
+ }
24526
+ if(sc == 10 || sc == 13) {
24527
+ break;
24528
+ }
24529
+ let tmp;
24530
+ if(sc == 47 && eolPos + 1 < this.length) {
24531
+ let c = HxOverrides.cca(this.input,eolPos + 1);
24532
+ if((c == null ? -1 : c) != 47) {
24533
+ let c = HxOverrides.cca(this.input,eolPos + 1);
24534
+ tmp = (c == null ? -1 : c) == 42;
24535
+ } else {
24536
+ tmp = true;
24537
+ }
24538
+ } else {
24539
+ tmp = false;
24540
+ }
24541
+ if(tmp) {
24542
+ break;
24543
+ }
24544
+ if(sc == 93 || sc == 125 || sc == 41 || sc == 44) {
24545
+ break;
24546
+ }
24547
+ if(sc == 35) {
24548
+ break;
24549
+ }
24550
+ hasSameLineContent = true;
24551
+ break;
24552
+ }
24553
+ if(!hasSameLineContent && !isValue) {
24554
+ let stopNextLine = true;
24555
+ if(stopNextLine == null) {
24556
+ stopNextLine = false;
24557
+ }
24558
+ let nextLinePos = this._skipWhitespaceAndComments(eolPos,stopNextLine);
24559
+ if(nextLinePos <= eolPos || nextLinePos >= this.length) {
24560
+ return null;
24561
+ }
24562
+ let c = HxOverrides.cca(this.input,nextLinePos);
24563
+ let nextChar = c == null ? -1 : c;
24564
+ let tmp;
24565
+ if(!(nextChar == 10 || nextChar == 13 || nextChar == 34)) {
24566
+ if(nextChar == 47 && nextLinePos + 1 < this.length) {
24567
+ let c = HxOverrides.cca(this.input,nextLinePos + 1);
24568
+ if((c == null ? -1 : c) != 47) {
24569
+ let c = HxOverrides.cca(this.input,nextLinePos + 1);
24570
+ tmp = (c == null ? -1 : c) == 42;
24571
+ } else {
24572
+ tmp = true;
24573
+ }
24574
+ } else {
24575
+ tmp = false;
24576
+ }
24577
+ } else {
24578
+ tmp = true;
24579
+ }
24580
+ if(tmp) {
24581
+ return null;
24582
+ }
24583
+ let nextIndent = 0;
24584
+ let tmpPos = nextLinePos;
24585
+ while(true) {
24586
+ let tmp;
24587
+ if(tmpPos > 0) {
24588
+ let c = HxOverrides.cca(this.input,tmpPos - 1);
24589
+ if((c == null ? -1 : c) != 32) {
24590
+ let c = HxOverrides.cca(this.input,tmpPos - 1);
24591
+ tmp = (c == null ? -1 : c) == 9;
24592
+ } else {
24593
+ tmp = true;
24594
+ }
24595
+ } else {
24596
+ tmp = false;
24597
+ }
24598
+ if(!tmp) {
24599
+ break;
24600
+ }
24601
+ ++nextIndent;
24602
+ --tmpPos;
24603
+ }
24604
+ let expectedIndent = multilineIndent != -1 ? multilineIndent : this.column - 1;
24605
+ if(nextIndent != expectedIndent) {
24606
+ return null;
24607
+ }
24608
+ let tmp1;
24609
+ if(nextChar == 45 && nextLinePos + 1 < this.length) {
24610
+ let c = HxOverrides.cca(this.input,nextLinePos + 1);
24611
+ tmp1 = (c == null ? -1 : c) == 62;
24612
+ } else {
24613
+ tmp1 = false;
24614
+ }
24615
+ if(tmp1) {
22939
24616
  return null;
22940
24617
  }
22941
- }
22942
- }
22943
- let allowTags = !isValue;
22944
- let isDialogue = false;
22945
- if(isValue) {
22946
- if(inBrackets) {
22947
- if(!isAfterLabel && !this.followsOnlyWhitespacesOrCommentsInLine() && !this.isAfterComma() && !this.isAfterLBracket()) {
24618
+ if(nextChar == 43) {
22948
24619
  return null;
22949
24620
  }
22950
- } else if(!isAssignValue && !isAfterLabel) {
22951
- return null;
22952
- }
22953
- } else {
22954
- isDialogue = this.followsOnlyLabelOrCommentsInLine();
22955
- if(!isDialogue && !this.followsOnlyWhitespacesOrCommentsInLine()) {
22956
- return null;
22957
- }
22958
- if(!isDialogue) {
22959
- if(cc == 62 && c1 == 45) {
24621
+ if(this.isAssignStart(nextLinePos,false)) {
24622
+ return null;
24623
+ }
24624
+ if(this.isCallStart(nextLinePos)) {
22960
24625
  return null;
22961
24626
  }
24627
+ if(this.isLabelStart(nextLinePos)) {
24628
+ return null;
24629
+ }
24630
+ if(this.isIfStart(nextLinePos)) {
24631
+ return null;
24632
+ }
24633
+ if(this.isIdentifierExpressionStart(nextLinePos,true)) {
24634
+ return null;
24635
+ }
24636
+ if(nextChar >= 97 && nextChar <= 122 || nextChar >= 65 && nextChar <= 90 || nextChar == 95) {
24637
+ let wordEnd = nextLinePos;
24638
+ while(true) {
24639
+ let tmp;
24640
+ if(wordEnd < this.length) {
24641
+ let c = HxOverrides.cca(this.input,wordEnd);
24642
+ let c1 = c == null ? -1 : c;
24643
+ tmp = c1 >= 97 && c1 <= 122 || c1 >= 65 && c1 <= 90 || c1 == 95 || c1 >= 48 && c1 <= 57;
24644
+ } else {
24645
+ tmp = false;
24646
+ }
24647
+ if(!tmp) {
24648
+ break;
24649
+ }
24650
+ ++wordEnd;
24651
+ }
24652
+ let str = this.input;
24653
+ let len = wordEnd - nextLinePos;
24654
+ let kw = len != null ? HxOverrides.substr(str,nextLinePos,len) : HxOverrides.substr(str,nextLinePos,null);
24655
+ if(kw != "null" && kw != "true" && kw != "false" && Object.prototype.hasOwnProperty.call(loreline_Lexer.KEYWORDS.h,kw)) {
24656
+ return null;
24657
+ }
24658
+ }
24659
+ } else if(!hasSameLineContent) {
24660
+ return null;
22962
24661
  }
22963
24662
  }
22964
24663
  let start = new loreline_Position(this.startLine,this.startColumn,this.pos);
@@ -23485,7 +25184,7 @@ class loreline_Lexer {
23485
25184
  content = StringTools.rtrim(content);
23486
25185
  let contentLength = content.length;
23487
25186
  let rtrimmedOffset = rawContentLength - contentLength;
23488
- if(contentLength > 0 && this.hasNonSpecialChar(content) && !this.isNumber(content) && content != "null" && content != "true" && content != "false") {
25187
+ if(contentLength > 0 && this.hasNonSpecialChar(content) && (isValue ? !this.isNumber(content) && content != "null" && content != "true" && content != "false" : true)) {
23489
25188
  if(multilineIndent == -1 && !isAfterLabel && !this.inChoiceRoot()) {
23490
25189
  let savedLine = this.line;
23491
25190
  let savedColumn = this.column;
@@ -23939,10 +25638,10 @@ class loreline_Lexer {
23939
25638
  currentColumn += tokenLength;
23940
25639
  }
23941
25640
  switch(token.type._hx_index) {
23942
- case 43:
25641
+ case 45:
23943
25642
  ++braceLevel;
23944
25643
  break;
23945
- case 44:
25644
+ case 46:
23946
25645
  --braceLevel;
23947
25646
  break;
23948
25647
  default:
@@ -25732,6 +27431,9 @@ class loreline_Loreline {
25732
27431
  let printer = new loreline_Printer(tmp != null ? tmp : " ",tmp1 != null ? tmp1 : "\n");
25733
27432
  return printer.print(script);
25734
27433
  }
27434
+ static update(delta) {
27435
+ loreline_Timer.update(delta);
27436
+ }
25735
27437
  }
25736
27438
  $hxClasses["loreline.Loreline"] = $hx_exports["loreline"]["Loreline"] = loreline_Loreline;
25737
27439
  loreline_Loreline.__name__ = "loreline.Loreline";
@@ -26061,6 +27763,9 @@ class loreline_Node {
26061
27763
  }
26062
27764
  each(handleNode) {
26063
27765
  }
27766
+ static fromJson(json) {
27767
+ return loreline_JsonToAst.nodeFromJson(json);
27768
+ }
26064
27769
  }
26065
27770
  $hxClasses["loreline.Node"] = $hx_exports["loreline"]["Node"] = loreline_Node;
26066
27771
  loreline_Node.__name__ = "loreline.Node";
@@ -26701,6 +28406,7 @@ class loreline_NChoiceOption extends loreline_AstNode {
26701
28406
  this.conditionStyle = conditionStyle;
26702
28407
  this.body = body;
26703
28408
  this.style = 0;
28409
+ this.once = false;
26704
28410
  }
26705
28411
  type() {
26706
28412
  return "Option";
@@ -26753,6 +28459,9 @@ class loreline_NChoiceOption extends loreline_AstNode {
26753
28459
  }
26754
28460
  json.body = _g;
26755
28461
  json.style = loreline_BlockStyle.toString(this.style);
28462
+ if(this.once) {
28463
+ json.once = true;
28464
+ }
26756
28465
  return json;
26757
28466
  }
26758
28467
  }
@@ -26968,6 +28677,30 @@ class loreline_NAlternative extends loreline_AstNode {
26968
28677
  }
26969
28678
  json.items = _g;
26970
28679
  json.style = loreline_BlockStyle.toString(this.style);
28680
+ if(this.separatorComments != null) {
28681
+ let _g = [];
28682
+ let _g1 = 0;
28683
+ let _g2 = this.separatorComments;
28684
+ while(_g1 < _g2.length) {
28685
+ let comments = _g2[_g1];
28686
+ ++_g1;
28687
+ let tmp;
28688
+ if(comments != null) {
28689
+ let _g = [];
28690
+ let _g1 = 0;
28691
+ while(_g1 < comments.length) {
28692
+ let c = comments[_g1];
28693
+ ++_g1;
28694
+ _g.push(c.toJson());
28695
+ }
28696
+ tmp = _g;
28697
+ } else {
28698
+ tmp = null;
28699
+ }
28700
+ _g.push(tmp);
28701
+ }
28702
+ json.separatorComments = _g;
28703
+ }
26971
28704
  return json;
26972
28705
  }
26973
28706
  }
@@ -27368,6 +29101,45 @@ loreline_NUnary.__super__ = loreline_NExpr;
27368
29101
  Object.assign(loreline_NUnary.prototype, {
27369
29102
  __class__: loreline_NUnary
27370
29103
  });
29104
+ class loreline_NTernary extends loreline_NExpr {
29105
+ constructor(id,pos,condition,trueExpr,falseExpr,leadingComments,trailingComments) {
29106
+ super(id,pos,leadingComments,trailingComments);
29107
+ this.condition = condition;
29108
+ this.trueExpr = trueExpr;
29109
+ this.falseExpr = falseExpr;
29110
+ }
29111
+ type() {
29112
+ return "Ternary";
29113
+ }
29114
+ each(handleNode) {
29115
+ super.each(handleNode);
29116
+ if(this.condition != null) {
29117
+ handleNode(this.condition,this);
29118
+ this.condition.each(handleNode);
29119
+ }
29120
+ if(this.trueExpr != null) {
29121
+ handleNode(this.trueExpr,this);
29122
+ this.trueExpr.each(handleNode);
29123
+ }
29124
+ if(this.falseExpr != null) {
29125
+ handleNode(this.falseExpr,this);
29126
+ this.falseExpr.each(handleNode);
29127
+ }
29128
+ }
29129
+ toJson() {
29130
+ let json = super.toJson();
29131
+ json.condition = this.condition.toJson();
29132
+ json.trueExpr = this.trueExpr.toJson();
29133
+ json.falseExpr = this.falseExpr.toJson();
29134
+ return json;
29135
+ }
29136
+ }
29137
+ $hxClasses["loreline.NTernary"] = loreline_NTernary;
29138
+ loreline_NTernary.__name__ = "loreline.NTernary";
29139
+ loreline_NTernary.__super__ = loreline_NExpr;
29140
+ Object.assign(loreline_NTernary.prototype, {
29141
+ __class__: loreline_NTernary
29142
+ });
27371
29143
  class loreline_NImportStatement extends loreline_AstNode {
27372
29144
  constructor(id,pos,path,script,leadingComments,trailingComments) {
27373
29145
  super(id,pos,leadingComments,trailingComments);
@@ -27387,6 +29159,9 @@ class loreline_NImportStatement extends loreline_AstNode {
27387
29159
  toJson() {
27388
29160
  let json = super.toJson();
27389
29161
  json.path = this.path.toJson();
29162
+ if(this.script != null) {
29163
+ json.script = this.script.toJson();
29164
+ }
27390
29165
  return json;
27391
29166
  }
27392
29167
  }
@@ -27481,6 +29256,9 @@ class loreline_Objects {
27481
29256
  static getMapHelper(interpreter,name) {
27482
29257
  return interpreter.mapHelpers.h[name];
27483
29258
  }
29259
+ static getBeatHelper(interpreter,name) {
29260
+ return interpreter.beatHelpers.h[name];
29261
+ }
27484
29262
  static createFields(interpreter,type,node) {
27485
29263
  if(interpreter != null && interpreter.customCreateFields != null) {
27486
29264
  let customInstance = interpreter.customCreateFields(interpreter,type,node);
@@ -27595,19 +29373,19 @@ class loreline_Parser {
27595
29373
  while(i < this.tokens.length) {
27596
29374
  let _g = this.tokens[i].type;
27597
29375
  switch(_g._hx_index) {
27598
- case 49:
29376
+ case 51:
27599
29377
  let _g1 = _g.content;
27600
29378
  ++i;
27601
29379
  break;
27602
- case 50:
29380
+ case 52:
27603
29381
  let _g2 = _g.content;
27604
29382
  ++i;
27605
29383
  break;
27606
- case 51:
29384
+ case 53:
27607
29385
  let _g3 = _g.content;
27608
29386
  ++i;
27609
29387
  break;
27610
- case 54:
29388
+ case 56:
27611
29389
  ++i;
27612
29390
  break;
27613
29391
  default:
@@ -27628,28 +29406,28 @@ class loreline_Parser {
27628
29406
  this.current++;
27629
29407
  let _g = this.tokens[this.current].type;
27630
29408
  switch(_g._hx_index) {
27631
- case 49:
29409
+ case 51:
27632
29410
  let content = _g.content;
27633
29411
  if(this.pendingComments == null) {
27634
29412
  this.pendingComments = [];
27635
29413
  }
27636
29414
  this.pendingComments.push(new loreline_Comment(this.nextNodeId(4),this.currentPos(),content,false));
27637
29415
  break;
27638
- case 50:
29416
+ case 52:
27639
29417
  let content1 = _g.content;
27640
29418
  if(this.pendingComments == null) {
27641
29419
  this.pendingComments = [];
27642
29420
  }
27643
29421
  this.pendingComments.push(new loreline_Comment(this.nextNodeId(4),this.currentPos(),content1,true));
27644
29422
  break;
27645
- case 51:
29423
+ case 53:
27646
29424
  let content2 = _g.content;
27647
29425
  if(this.pendingComments == null) {
27648
29426
  this.pendingComments = [];
27649
29427
  }
27650
29428
  this.pendingComments.push(new loreline_Comment(this.nextNodeId(4),this.currentPos(),content2,false,true));
27651
29429
  break;
27652
- case 54:
29430
+ case 56:
27653
29431
  this.lastLineBreak = this.currentPos();
27654
29432
  this.lineBreakAfterToken = true;
27655
29433
  break;
@@ -27690,16 +29468,16 @@ class loreline_Parser {
27690
29468
  while(n >= 0) {
27691
29469
  let _g = this.tokens[n].type;
27692
29470
  switch(_g._hx_index) {
27693
- case 49:
29471
+ case 51:
27694
29472
  let _g1 = _g.content;
27695
29473
  break;
27696
- case 50:
29474
+ case 52:
27697
29475
  let _g2 = _g.content;
27698
29476
  break;
27699
- case 51:
29477
+ case 53:
27700
29478
  let _g3 = _g.content;
27701
29479
  break;
27702
- case 52:case 53:case 54:
29480
+ case 54:case 55:case 56:
27703
29481
  break;
27704
29482
  default:
27705
29483
  return this.tokens[n];
@@ -27713,16 +29491,16 @@ class loreline_Parser {
27713
29491
  while(n < this.tokens.length) {
27714
29492
  let _g = this.tokens[n].type;
27715
29493
  switch(_g._hx_index) {
27716
- case 49:
29494
+ case 51:
27717
29495
  let _g1 = _g.content;
27718
29496
  break;
27719
- case 50:
29497
+ case 52:
27720
29498
  let _g2 = _g.content;
27721
29499
  break;
27722
- case 51:
29500
+ case 53:
27723
29501
  let _g3 = _g.content;
27724
29502
  break;
27725
- case 52:case 53:case 54:
29503
+ case 54:case 55:case 56:
27726
29504
  break;
27727
29505
  default:
27728
29506
  return this.tokens[n];
@@ -27736,16 +29514,16 @@ class loreline_Parser {
27736
29514
  while(n < this.tokens.length) {
27737
29515
  let _g = this.tokens[n].type;
27738
29516
  switch(_g._hx_index) {
27739
- case 49:
29517
+ case 51:
27740
29518
  let _g1 = _g.content;
27741
29519
  break;
27742
- case 50:
29520
+ case 52:
27743
29521
  let _g2 = _g.content;
27744
29522
  break;
27745
- case 51:
29523
+ case 53:
27746
29524
  let _g3 = _g.content;
27747
29525
  break;
27748
- case 54:
29526
+ case 56:
27749
29527
  break;
27750
29528
  default:
27751
29529
  return this.tokens[n];
@@ -27779,7 +29557,7 @@ class loreline_Parser {
27779
29557
  if(this.isAtEnd()) {
27780
29558
  return false;
27781
29559
  }
27782
- if(type._hx_index == 40) {
29560
+ if(type._hx_index == 41) {
27783
29561
  return this.tokens[this.current].type == loreline_TokenType.Colon;
27784
29562
  } else {
27785
29563
  return loreline_TokenTypeHelpers.equals(this.tokens[this.current].type,type);
@@ -27805,13 +29583,13 @@ class loreline_Parser {
27805
29583
  }
27806
29584
  isComment(type) {
27807
29585
  switch(type._hx_index) {
27808
- case 49:
29586
+ case 51:
27809
29587
  let _g = type.content;
27810
29588
  return true;
27811
- case 50:
29589
+ case 52:
27812
29590
  let _g1 = type.content;
27813
29591
  return true;
27814
- case 51:
29592
+ case 53:
27815
29593
  let _g2 = type.content;
27816
29594
  return true;
27817
29595
  default:
@@ -27833,15 +29611,15 @@ class loreline_Parser {
27833
29611
  let _g = this.tokens[this.current].type;
27834
29612
  let tmp3;
27835
29613
  switch(_g._hx_index) {
27836
- case 49:
29614
+ case 51:
27837
29615
  let content = _g.content;
27838
29616
  tmp3 = content;
27839
29617
  break;
27840
- case 50:
29618
+ case 52:
27841
29619
  let content1 = _g.content;
27842
29620
  tmp3 = content1;
27843
29621
  break;
27844
- case 51:
29622
+ case 53:
27845
29623
  let content2 = _g.content;
27846
29624
  tmp3 = content2;
27847
29625
  break;
@@ -27850,7 +29628,7 @@ class loreline_Parser {
27850
29628
  }
27851
29629
  let _g1 = this.tokens[this.current].type;
27852
29630
  let tmp4;
27853
- if(_g1._hx_index == 50) {
29631
+ if(_g1._hx_index == 52) {
27854
29632
  let _g = _g1.content;
27855
29633
  tmp4 = true;
27856
29634
  } else {
@@ -27858,7 +29636,7 @@ class loreline_Parser {
27858
29636
  }
27859
29637
  let _g2 = this.tokens[this.current].type;
27860
29638
  let tmp5;
27861
- if(_g2._hx_index == 51) {
29639
+ if(_g2._hx_index == 53) {
27862
29640
  let _g = _g2.content;
27863
29641
  tmp5 = true;
27864
29642
  } else {
@@ -27988,7 +29766,7 @@ class loreline_Parser {
27988
29766
  }
27989
29767
  }
27990
29768
  break;
27991
- case 25:
29769
+ case 26:
27992
29770
  let node7 = this.parseInsertion();
27993
29771
  if(topLevel) {
27994
29772
  return _gthis.wrapInRootBeat(node7);
@@ -27996,7 +29774,7 @@ class loreline_Parser {
27996
29774
  return node7;
27997
29775
  }
27998
29776
  break;
27999
- case 18:case 26:case 38:case 43:case 45:case 47:
29777
+ case 18:case 27:case 39:case 45:case 47:case 49:
28000
29778
  let node8 = this.parseExpressionStatement();
28001
29779
  if(topLevel) {
28002
29780
  return _gthis.wrapInRootBeat(node8);
@@ -28004,7 +29782,7 @@ class loreline_Parser {
28004
29782
  return node8;
28005
29783
  }
28006
29784
  break;
28007
- case 39:
29785
+ case 40:
28008
29786
  let node9 = this.parseTransition();
28009
29787
  if(topLevel) {
28010
29788
  return _gthis.wrapInRootBeat(node9);
@@ -28360,6 +30138,9 @@ class loreline_Parser {
28360
30138
  isInsertion = true;
28361
30139
  choiceOption.insertion = this.parseInsertion();
28362
30140
  } else {
30141
+ if(this.match(loreline_TokenType.OpMinus)) {
30142
+ choiceOption.once = true;
30143
+ }
28363
30144
  choiceOption.text = this.parseStringLiteral();
28364
30145
  }
28365
30146
  } catch( _g ) {
@@ -28376,30 +30157,30 @@ class loreline_Parser {
28376
30157
  throw _g;
28377
30158
  }
28378
30159
  }
28379
- if(!isInsertion) {
28380
- if(this.match(loreline_TokenType.KwIf)) {
28381
- let ifPos = this.previous().pos;
28382
- let offset = this.currentPos().offset;
28383
- try {
28384
- if(this.check(loreline_TokenType.LParen)) {
28385
- choiceOption.conditionStyle = 2;
28386
- }
28387
- choiceOption.condition = this.parseConditionExpression();
28388
- choiceOption.conditionPos = ifPos.extendedTo(this.prevNonWhitespaceOrComment().pos);
28389
- } catch( _g ) {
28390
- let _g1 = haxe_Exception.caught(_g).unwrap();
28391
- if(((_g1) instanceof loreline_ParseError)) {
28392
- let e = _g1;
28393
- this.addError(e);
28394
- errorPos = this.currentPos();
28395
- if(this.currentPos().offset == offset) {
28396
- this.advance();
28397
- }
28398
- } else {
28399
- throw _g;
30160
+ if(this.match(loreline_TokenType.KwIf)) {
30161
+ let ifPos = this.previous().pos;
30162
+ let offset = this.currentPos().offset;
30163
+ try {
30164
+ if(this.check(loreline_TokenType.LParen)) {
30165
+ choiceOption.conditionStyle = 2;
30166
+ }
30167
+ choiceOption.condition = this.parseConditionExpression();
30168
+ choiceOption.conditionPos = ifPos.extendedTo(this.prevNonWhitespaceOrComment().pos);
30169
+ } catch( _g ) {
30170
+ let _g1 = haxe_Exception.caught(_g).unwrap();
30171
+ if(((_g1) instanceof loreline_ParseError)) {
30172
+ let e = _g1;
30173
+ this.addError(e);
30174
+ errorPos = this.currentPos();
30175
+ if(this.currentPos().offset == offset) {
30176
+ this.advance();
28400
30177
  }
30178
+ } else {
30179
+ throw _g;
28401
30180
  }
28402
30181
  }
30182
+ }
30183
+ if(!isInsertion) {
28403
30184
  if(this.checkBlockStart()) {
28404
30185
  choiceOption.body = [];
28405
30186
  let offset = this.currentPos().offset;
@@ -28473,7 +30254,7 @@ class loreline_Parser {
28473
30254
  return true;
28474
30255
  }
28475
30256
  break;
28476
- case 18:case 26:case 38:case 43:case 45:case 47:
30257
+ case 18:case 27:case 39:case 45:case 47:case 49:
28477
30258
  return true;
28478
30259
  default:
28479
30260
  return false;
@@ -28481,7 +30262,7 @@ class loreline_Parser {
28481
30262
  }
28482
30263
  parseExpressionStatement() {
28483
30264
  let expr = this.parseExpression();
28484
- 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)) {
30265
+ 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)) {
28485
30266
  let op = this.previous().type;
28486
30267
  let assignment = this.attachComments(new loreline_NAssign(this.nextNodeId(4),expr.pos,expr,op,null));
28487
30268
  assignment.value = this.parseExpression();
@@ -28508,7 +30289,7 @@ class loreline_Parser {
28508
30289
  return false;
28509
30290
  }
28510
30291
  break;
28511
- case 1:case 2:case 3:case 4:case 5:case 39:
30292
+ case 1:case 2:case 3:case 4:case 5:case 40:
28512
30293
  return true;
28513
30294
  default:
28514
30295
  return false;
@@ -28644,8 +30425,8 @@ class loreline_Parser {
28644
30425
  }
28645
30426
  parseExpression() {
28646
30427
  try {
28647
- let expr = this.parseLogicalOr();
28648
- 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)) {
30428
+ let expr = this.parseTernary();
30429
+ 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)) {
28649
30430
  let op = this.tokens[this.current].type;
28650
30431
  this.advance();
28651
30432
  let assignment = this.attachComments(new loreline_NAssign(this.nextNodeId(4),expr.pos,expr,op,null));
@@ -28662,6 +30443,17 @@ class loreline_Parser {
28662
30443
  return new loreline_NLiteral(this.nextNodeId(4),this.currentPos(),null,loreline_LiteralType.Null);
28663
30444
  }
28664
30445
  }
30446
+ parseTernary() {
30447
+ let expr = this.parseLogicalOr();
30448
+ if(this.match(loreline_TokenType.Question)) {
30449
+ let trueExpr = this.parseTernary();
30450
+ this.expect(loreline_TokenType.Colon);
30451
+ let falseExpr = this.parseTernary();
30452
+ expr = this.attachComments(new loreline_NTernary(this.nextNodeId(4),expr.pos,expr,trueExpr,falseExpr));
30453
+ expr.pos = expr.pos.extendedTo(falseExpr.pos);
30454
+ }
30455
+ return expr;
30456
+ }
28665
30457
  parseLogicalOr() {
28666
30458
  let expr = this.parseLogicalAnd();
28667
30459
  while(this.match(loreline_TokenType.OpOr(false))) {
@@ -28768,14 +30560,14 @@ class loreline_Parser {
28768
30560
  return this.parseIdentifierExpression(startPos,name);
28769
30561
  }
28770
30562
  break;
28771
- case 43:
28772
- return this.parsePostfix(startPos,this.parseObjectLiteral());
28773
30563
  case 45:
30564
+ return this.parsePostfix(startPos,this.parseObjectLiteral());
30565
+ case 47:
28774
30566
  this.advance();
28775
30567
  let expr = this.parseExpression();
28776
30568
  this.expect(loreline_TokenType.RParen);
28777
30569
  return this.parsePostfix(startPos,expr);
28778
- case 47:
30570
+ case 49:
28779
30571
  return this.parsePostfix(startPos,this.parseArrayLiteral());
28780
30572
  default:
28781
30573
  throw haxe_Exception.thrown(new loreline_ParseError("Unexpected token in expression",this.currentPos()));
@@ -28954,7 +30746,7 @@ class loreline_Parser {
28954
30746
  }
28955
30747
  prevIsDot = false;
28956
30748
  break;
28957
- case 42:
30749
+ case 44:
28958
30750
  if(target == null) {
28959
30751
  this.addError(new loreline_ParseError("Leading dot in field access",token.pos));
28960
30752
  let tmp = this.nextNodeId(4);
@@ -28965,7 +30757,7 @@ class loreline_Parser {
28965
30757
  }
28966
30758
  prevIsDot = true;
28967
30759
  break;
28968
- case 45:
30760
+ case 47:
28969
30761
  if(target == null) {
28970
30762
  this.addError(new loreline_ParseError("Function call without target",token.pos));
28971
30763
  let tmp = this.nextNodeId(4);
@@ -28982,7 +30774,7 @@ class loreline_Parser {
28982
30774
  let t = tokens[i];
28983
30775
  ++i;
28984
30776
  switch(t.type._hx_index) {
28985
- case 41:
30777
+ case 43:
28986
30778
  if(parenLevel == 1) {
28987
30779
  if(currentArgTokens.length > 0) {
28988
30780
  argTokens.push(currentArgTokens);
@@ -28992,11 +30784,11 @@ class loreline_Parser {
28992
30784
  currentArgTokens.push(t);
28993
30785
  }
28994
30786
  break;
28995
- case 45:
30787
+ case 47:
28996
30788
  ++parenLevel;
28997
30789
  currentArgTokens.push(t);
28998
30790
  break;
28999
- case 46:
30791
+ case 48:
29000
30792
  --parenLevel;
29001
30793
  if(parenLevel > 0) {
29002
30794
  currentArgTokens.push(t);
@@ -29030,7 +30822,7 @@ class loreline_Parser {
29030
30822
  target = this.attachComments(new loreline_NCall(this.nextNodeId(4),callStart.extendedTo(tokens[i - 1].pos),target,args));
29031
30823
  prevIsDot = false;
29032
30824
  break;
29033
- case 47:
30825
+ case 49:
29034
30826
  if(target == null) {
29035
30827
  this.addError(new loreline_ParseError("Array access without target",token.pos));
29036
30828
  let tmp = this.nextNodeId(4);
@@ -29047,11 +30839,11 @@ class loreline_Parser {
29047
30839
  let t = tokens[i];
29048
30840
  ++i;
29049
30841
  switch(t.type._hx_index) {
29050
- case 47:
30842
+ case 49:
29051
30843
  ++bracketLevel;
29052
30844
  arrayTokens.push(t);
29053
30845
  break;
29054
- case 48:
30846
+ case 50:
29055
30847
  --bracketLevel;
29056
30848
  if(bracketLevel > 0) {
29057
30849
  arrayTokens.push(t);
@@ -29354,7 +31146,7 @@ class loreline_Parser {
29354
31146
  } else {
29355
31147
  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);
29356
31148
  switch(type._hx_index) {
29357
- case 44:case 46:case 53:
31149
+ case 46:case 48:case 55:
29358
31150
  this.addError(error);
29359
31151
  return new loreline_Token(type,this.currentPos());
29360
31152
  default:
@@ -29453,13 +31245,13 @@ class loreline_Parser {
29453
31245
  }
29454
31246
  this.advance();
29455
31247
  break;
29456
- case 39:
31248
+ case 40:
29457
31249
  this.advance();
29458
31250
  if(this.check(loreline_TokenType.Dot) || loreline_TokenTypeHelpers.isIdentifier(this.tokens[this.current].type)) {
29459
31251
  this.advance();
29460
31252
  }
29461
31253
  return;
29462
- case 1:case 2:case 3:case 4:case 5:case 44:case 52:
31254
+ case 1:case 2:case 3:case 4:case 5:case 46:case 54:
29463
31255
  return;
29464
31256
  default:
29465
31257
  this.advance();
@@ -29468,7 +31260,7 @@ class loreline_Parser {
29468
31260
  }
29469
31261
  requiresNewLine() {
29470
31262
  switch(this.tokens[this.current].type._hx_index) {
29471
- case 6:case 39:case 44:
31263
+ case 6:case 40:case 46:
29472
31264
  return false;
29473
31265
  default:
29474
31266
  return true;
@@ -29839,6 +31631,9 @@ class loreline_Printer {
29839
31631
  case loreline_NStringLiteral:
29840
31632
  this.printStringLiteral(node);
29841
31633
  break;
31634
+ case loreline_NTernary:
31635
+ this.printTernary(node);
31636
+ break;
29842
31637
  case loreline_NTextStatement:
29843
31638
  this.printTextStatement(node);
29844
31639
  break;
@@ -30122,6 +31917,9 @@ class loreline_Printer {
30122
31917
  this.newline();
30123
31918
  this._noLn = 0;
30124
31919
  this.printLeadingComments(option);
31920
+ if(option.once) {
31921
+ this.write("- ");
31922
+ }
30125
31923
  if(option.insertion != null) {
30126
31924
  this.printNode(option.insertion);
30127
31925
  } else {
@@ -30474,20 +32272,53 @@ class loreline_Printer {
30474
32272
  this.write("null");
30475
32273
  break;
30476
32274
  case 3:
30477
- let first = true;
30478
- this.write("[");
32275
+ let hasMultilineUnquoted = false;
30479
32276
  let _g1 = 0;
30480
32277
  let _g2 = lit.value;
30481
32278
  while(_g1 < _g2.length) {
30482
32279
  let elem = _g2[_g1];
30483
32280
  ++_g1;
30484
- if(!first) {
30485
- this.write(", ");
32281
+ if(this.hasRealNewlines(elem)) {
32282
+ hasMultilineUnquoted = true;
32283
+ break;
30486
32284
  }
30487
- first = false;
30488
- this.printNode(elem);
30489
32285
  }
30490
- this.write("]");
32286
+ if(hasMultilineUnquoted) {
32287
+ this.write("[");
32288
+ this.newline();
32289
+ this._level++;
32290
+ let first = true;
32291
+ let _g = 0;
32292
+ let _g1 = lit.value;
32293
+ while(_g < _g1.length) {
32294
+ let elem = _g1[_g];
32295
+ ++_g;
32296
+ if(!first) {
32297
+ this.write(",");
32298
+ this.newline();
32299
+ }
32300
+ first = false;
32301
+ this.printNode(elem);
32302
+ }
32303
+ this.newline();
32304
+ this._level--;
32305
+ this.write("]");
32306
+ } else {
32307
+ let first = true;
32308
+ this.write("[");
32309
+ let _g = 0;
32310
+ let _g1 = lit.value;
32311
+ while(_g < _g1.length) {
32312
+ let elem = _g1[_g];
32313
+ ++_g;
32314
+ if(!first) {
32315
+ this.write(", ");
32316
+ }
32317
+ first = false;
32318
+ this.printNode(elem);
32319
+ }
32320
+ this.write("]");
32321
+ }
30491
32322
  break;
30492
32323
  case 4:
30493
32324
  let style = _g.style;
@@ -30498,18 +32329,18 @@ class loreline_Printer {
30498
32329
  this.newline();
30499
32330
  }
30500
32331
  this._level++;
30501
- let first1 = true;
32332
+ let first = true;
30502
32333
  let _g3 = 0;
30503
32334
  let _g4 = lit.value;
30504
32335
  while(_g3 < _g4.length) {
30505
32336
  let field = _g4[_g3];
30506
32337
  ++_g3;
30507
- if(!first1) {
32338
+ if(!first) {
30508
32339
  if(this._beginLine == 0) {
30509
32340
  this.newline();
30510
32341
  }
30511
32342
  }
30512
- first1 = false;
32343
+ first = false;
30513
32344
  this.printLeadingComments(field);
30514
32345
  this.write("" + field.name + ": ");
30515
32346
  this.printTrailingComments(field);
@@ -30569,11 +32400,11 @@ class loreline_Printer {
30569
32400
  if(!skipParen) {
30570
32401
  let _g = binary.op;
30571
32402
  switch(_g._hx_index) {
30572
- case 36:
32403
+ case 37:
30573
32404
  let word = _g.word;
30574
32405
  needsParens = true;
30575
32406
  break;
30576
- case 37:
32407
+ case 38:
30577
32408
  let word1 = _g.word;
30578
32409
  needsParens = true;
30579
32410
  break;
@@ -30600,6 +32431,15 @@ class loreline_Printer {
30600
32431
  this.printTrailingComments(unary);
30601
32432
  this.printNode(unary.operand);
30602
32433
  }
32434
+ printTernary(ternary) {
32435
+ this.printLeadingComments(ternary);
32436
+ this.printNode(ternary.condition);
32437
+ this.write(" ? ");
32438
+ this.printNode(ternary.trueExpr);
32439
+ this.write(" : ");
32440
+ this.printNode(ternary.falseExpr);
32441
+ this.printTrailingComments(ternary);
32442
+ }
30603
32443
  printAssignment(assign) {
30604
32444
  this.printLeadingComments(assign);
30605
32445
  this.printNode(assign.target);
@@ -30674,42 +32514,44 @@ class loreline_Printer {
30674
32514
  case 24:
30675
32515
  return "/=";
30676
32516
  case 25:
30677
- return "+";
32517
+ return ":=";
30678
32518
  case 26:
30679
- return "-";
32519
+ return "+";
30680
32520
  case 27:
30681
- return "*";
32521
+ return "-";
30682
32522
  case 28:
30683
- return "/";
32523
+ return "*";
30684
32524
  case 29:
30685
- return "%";
32525
+ return "/";
30686
32526
  case 30:
30687
- return "==";
32527
+ return "%";
30688
32528
  case 31:
30689
- return "!=";
32529
+ return "==";
30690
32530
  case 32:
30691
- return ">";
32531
+ return "!=";
30692
32532
  case 33:
30693
- return "<";
32533
+ return ">";
30694
32534
  case 34:
30695
- return ">=";
32535
+ return "<";
30696
32536
  case 35:
30697
- return "<=";
32537
+ return ">=";
30698
32538
  case 36:
32539
+ return "<=";
32540
+ case 37:
30699
32541
  if(op.word) {
30700
32542
  return "and";
30701
32543
  } else {
30702
32544
  return "&&";
30703
32545
  }
30704
32546
  break;
30705
- case 37:
32547
+ case 38:
30706
32548
  if(op.word) {
30707
32549
  return "or";
30708
32550
  } else {
30709
32551
  return "||";
30710
32552
  }
30711
32553
  break;
30712
- case 38:
32554
+ case 39:
30713
32555
  return "!";
30714
32556
  default:
30715
32557
  throw haxe_Exception.thrown("Unsupported operator: " + Std.string(op));
@@ -30786,6 +32628,7 @@ class loreline_Script extends loreline_AstNode {
30786
32628
  _g.push(decl.toJson());
30787
32629
  }
30788
32630
  json.body = _g;
32631
+ json.indentSize = this.indentSize;
30789
32632
  return json;
30790
32633
  }
30791
32634
  type() {
@@ -30822,6 +32665,9 @@ class loreline_Script extends loreline_AstNode {
30822
32665
  iterator() {
30823
32666
  return new loreline__$Script_ScriptBodyIterator(this.body);
30824
32667
  }
32668
+ static fromJson(json) {
32669
+ return loreline_JsonToAst.scriptFromJson(json);
32670
+ }
30825
32671
  }
30826
32672
  $hxClasses["loreline.Script"] = $hx_exports["loreline"]["Script"] = loreline_Script;
30827
32673
  loreline_Script.__name__ = "loreline.Script";
@@ -30865,6 +32711,38 @@ loreline__$Script_ScriptBodyIterator.__name__ = "loreline._Script.ScriptBodyIter
30865
32711
  Object.assign(loreline__$Script_ScriptBodyIterator.prototype, {
30866
32712
  __class__: loreline__$Script_ScriptBodyIterator
30867
32713
  });
32714
+ class loreline__$Timer_PendingTimer {
32715
+ constructor(remaining,done) {
32716
+ this.remaining = remaining;
32717
+ this.done = done;
32718
+ }
32719
+ }
32720
+ $hxClasses["loreline._Timer.PendingTimer"] = loreline__$Timer_PendingTimer;
32721
+ loreline__$Timer_PendingTimer.__name__ = "loreline._Timer.PendingTimer";
32722
+ Object.assign(loreline__$Timer_PendingTimer.prototype, {
32723
+ __class__: loreline__$Timer_PendingTimer
32724
+ });
32725
+ class loreline_Timer {
32726
+ static register(seconds,done) {
32727
+ loreline_Timer.timers.push(new loreline__$Timer_PendingTimer(seconds,done));
32728
+ }
32729
+ static update(delta) {
32730
+ if(loreline_Timer.timers.length == 0) {
32731
+ return;
32732
+ }
32733
+ let i = loreline_Timer.timers.length;
32734
+ while(--i >= 0) {
32735
+ let t = loreline_Timer.timers[i];
32736
+ t.remaining -= delta;
32737
+ if(t.remaining <= 0.0) {
32738
+ loreline_Timer.timers.splice(i,1);
32739
+ t.done();
32740
+ }
32741
+ }
32742
+ }
32743
+ }
32744
+ $hxClasses["loreline.Timer"] = loreline_Timer;
32745
+ loreline_Timer.__name__ = "loreline.Timer";
30868
32746
  class loreline_Utf8 {
30869
32747
  static uLength(str) {
30870
32748
  return str.length;
@@ -31016,6 +32894,7 @@ loreline_AlternativeMode.Pick = 3;
31016
32894
  loreline_AlternativeMode.Shuffle = 4;
31017
32895
  loreline_Quotes.Unquoted = 0;
31018
32896
  loreline_Quotes.DoubleQuotes = 1;
32897
+ loreline_Timer.timers = [];
31019
32898
  loreline_lib_Library.main();
31020
32899
  })(runtime, globals);
31021
32900