loreline 0.7.1 → 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.d.ts +64 -0
- package/js/loreline.js +2220 -345
- package/js/loreline.min.js +40 -40
- package/package.json +1 -1
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
|
|
10887
|
+
case 37:
|
|
10858
10888
|
let _g1 = _g.word;
|
|
10859
10889
|
bin.op = loreline_TokenType.OpAnd(true);
|
|
10860
10890
|
break;
|
|
10861
|
-
case
|
|
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
|
|
10906
|
+
case 37:
|
|
10877
10907
|
let _g1 = _g.word;
|
|
10878
10908
|
bin.op = loreline_TokenType.OpAnd(false);
|
|
10879
10909
|
break;
|
|
10880
|
-
case
|
|
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
|
|
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 ==
|
|
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,
|
|
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
|
|
14782
|
-
|
|
14783
|
-
|
|
14784
|
-
|
|
14785
|
-
|
|
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
|
-
|
|
14798
|
-
|
|
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,
|
|
16250
|
+
_gthis.resumeFromLevel(scopeLevel,wrappedNext);
|
|
16013
16251
|
} else {
|
|
16014
|
-
_gthis.evalChoiceOption(option.node,
|
|
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
|
|
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
|
-
|
|
16057
|
-
|
|
16058
|
-
|
|
16059
|
-
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
17837
|
+
case 27:
|
|
17510
17838
|
opName = "subtract";
|
|
17511
17839
|
break;
|
|
17512
|
-
case
|
|
17840
|
+
case 28:
|
|
17513
17841
|
opName = "multiply";
|
|
17514
17842
|
break;
|
|
17515
|
-
case
|
|
17843
|
+
case 29:
|
|
17516
17844
|
opName = "divide";
|
|
17517
17845
|
break;
|
|
17518
|
-
case
|
|
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
|
|
17868
|
+
case 27:
|
|
17541
17869
|
opName1 = "subtract";
|
|
17542
17870
|
break;
|
|
17543
|
-
case
|
|
17871
|
+
case 28:
|
|
17544
17872
|
opName1 = "multiply";
|
|
17545
17873
|
break;
|
|
17546
|
-
case
|
|
17874
|
+
case 29:
|
|
17547
17875
|
opName1 = "divide";
|
|
17548
17876
|
break;
|
|
17549
|
-
case
|
|
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
|
|
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
|
|
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
|
|
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
|
|
17916
|
+
return leftNum1 > rightNum1;
|
|
17590
17917
|
case 34:
|
|
17591
|
-
return leftNum1
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
-
|
|
17750
|
-
|
|
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
|
-
,
|
|
19061
|
-
,
|
|
19062
|
-
,
|
|
19063
|
-
,
|
|
19064
|
-
,
|
|
19065
|
-
,
|
|
19066
|
-
,
|
|
19067
|
-
,
|
|
19068
|
-
,
|
|
19069
|
-
,
|
|
19070
|
-
,
|
|
19071
|
-
,
|
|
19072
|
-
,
|
|
19073
|
-
,
|
|
19074
|
-
,
|
|
19075
|
-
,
|
|
19076
|
-
,
|
|
19077
|
-
,
|
|
19078
|
-
,
|
|
19079
|
-
,
|
|
19080
|
-
,
|
|
19081
|
-
,
|
|
19082
|
-
,
|
|
19083
|
-
,
|
|
19084
|
-
,
|
|
19085
|
-
,
|
|
19086
|
-
,
|
|
19087
|
-
,
|
|
19088
|
-
,
|
|
19089
|
-
,
|
|
19090
|
-
,
|
|
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
|
|
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
|
|
19386
|
-
if(b._hx_index ==
|
|
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
|
|
19393
|
-
if(b._hx_index ==
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
20598
|
+
case 51:
|
|
19496
20599
|
let _g = a.content;
|
|
19497
20600
|
return true;
|
|
19498
|
-
case
|
|
20601
|
+
case 52:
|
|
19499
20602
|
let _g1 = a.content;
|
|
19500
20603
|
return true;
|
|
19501
|
-
case
|
|
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
|
|
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
|
|
20766
|
+
case 52:
|
|
19660
20767
|
let content1 = a.content;
|
|
19661
20768
|
return "multiline comment";
|
|
19662
|
-
case
|
|
20769
|
+
case 53:
|
|
19663
20770
|
let content2 = a.content;
|
|
19664
20771
|
return "hash comment";
|
|
19665
|
-
case
|
|
20772
|
+
case 54:
|
|
19666
20773
|
return "indent";
|
|
19667
|
-
case
|
|
20774
|
+
case 55:
|
|
19668
20775
|
return "unindent";
|
|
19669
|
-
case
|
|
20776
|
+
case 56:
|
|
19670
20777
|
return "line break";
|
|
19671
|
-
case
|
|
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
|
|
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
|
|
20893
|
+
case 49:
|
|
19787
20894
|
this.stack.push(12);
|
|
19788
20895
|
this.nextBlock = 10;
|
|
19789
20896
|
break;
|
|
19790
|
-
case
|
|
20897
|
+
case 46:case 50:case 55:
|
|
19791
20898
|
this.stack.pop();
|
|
19792
20899
|
this.nextBlock = 10;
|
|
19793
20900
|
break;
|
|
19794
|
-
case
|
|
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
|
-
|
|
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
|
|
19961
|
-
if(
|
|
19962
|
-
return
|
|
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
|
|
20673
|
-
|
|
20674
|
-
|
|
20675
|
-
|
|
20676
|
-
|
|
20677
|
-
|
|
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
|
|
20680
|
-
|
|
20681
|
-
|
|
20682
|
-
|
|
20683
|
-
|
|
20684
|
-
|
|
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
|
-
|
|
20687
|
-
|
|
20688
|
-
|
|
20689
|
-
|
|
20690
|
-
|
|
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
|
-
|
|
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
|
|
20920
|
-
let
|
|
20921
|
-
while(
|
|
20922
|
-
let _ =
|
|
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
|
|
20937
|
-
if(
|
|
20938
|
-
|
|
20939
|
-
}
|
|
20940
|
-
|
|
20941
|
-
let
|
|
20942
|
-
this.previous =
|
|
20943
|
-
return
|
|
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
|
|
20946
|
-
if(
|
|
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
|
|
21021
|
-
if(
|
|
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
|
-
|
|
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
|
-
|
|
22681
|
-
|
|
22682
|
-
|
|
22683
|
-
|
|
22684
|
-
|
|
22685
|
-
|
|
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;
|
|
@@ -22780,19 +24041,19 @@ class loreline_Lexer {
|
|
|
22780
24041
|
let _g1 = _g.name;
|
|
22781
24042
|
this.strictExprs.push(1);
|
|
22782
24043
|
return;
|
|
22783
|
-
case
|
|
24044
|
+
case 48:case 50:
|
|
22784
24045
|
this.strictExprs.push(1);
|
|
22785
24046
|
return;
|
|
22786
|
-
case
|
|
24047
|
+
case 51:
|
|
22787
24048
|
let _g2 = _g.content;
|
|
22788
24049
|
break;
|
|
22789
|
-
case
|
|
24050
|
+
case 52:
|
|
22790
24051
|
let _g3 = _g.content;
|
|
22791
24052
|
break;
|
|
22792
|
-
case
|
|
24053
|
+
case 53:
|
|
22793
24054
|
let _g4 = _g.content;
|
|
22794
24055
|
break;
|
|
22795
|
-
case
|
|
24056
|
+
case 54:case 55:case 56:
|
|
22796
24057
|
break;
|
|
22797
24058
|
default:
|
|
22798
24059
|
this.strictExprs.push(0);
|
|
@@ -22818,18 +24079,18 @@ class loreline_Lexer {
|
|
|
22818
24079
|
case 19:
|
|
22819
24080
|
let _g1 = _g.name;
|
|
22820
24081
|
return true;
|
|
22821
|
-
case
|
|
24082
|
+
case 48:case 50:
|
|
22822
24083
|
return true;
|
|
22823
|
-
case
|
|
24084
|
+
case 51:
|
|
22824
24085
|
let _g2 = _g.content;
|
|
22825
24086
|
break;
|
|
22826
|
-
case
|
|
24087
|
+
case 52:
|
|
22827
24088
|
let _g3 = _g.content;
|
|
22828
24089
|
break;
|
|
22829
|
-
case
|
|
24090
|
+
case 53:
|
|
22830
24091
|
let _g4 = _g.content;
|
|
22831
24092
|
break;
|
|
22832
|
-
case
|
|
24093
|
+
case 54:case 55:case 56:
|
|
22833
24094
|
break;
|
|
22834
24095
|
default:
|
|
22835
24096
|
return false;
|
|
@@ -22858,6 +24119,20 @@ class loreline_Lexer {
|
|
|
22858
24119
|
if(cc == 10) {
|
|
22859
24120
|
break;
|
|
22860
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
|
+
}
|
|
22861
24136
|
buf_b += String.fromCodePoint(cc);
|
|
22862
24137
|
this.pos++;
|
|
22863
24138
|
}
|
|
@@ -22872,6 +24147,272 @@ class loreline_Lexer {
|
|
|
22872
24147
|
return token;
|
|
22873
24148
|
}
|
|
22874
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
|
+
}
|
|
22875
24416
|
tryReadUnquotedString() {
|
|
22876
24417
|
if(this.isStrict()) {
|
|
22877
24418
|
return null;
|
|
@@ -22892,7 +24433,7 @@ class loreline_Lexer {
|
|
|
22892
24433
|
return null;
|
|
22893
24434
|
}
|
|
22894
24435
|
}
|
|
22895
|
-
if(c1 == 123 || c1 == 125 || c1 == 91 || c1 == 93 || c1 ==
|
|
24436
|
+
if(c1 == 123 || c1 == 125 || c1 == 91 || c1 == 93 || c1 == 58 || c1 == 35 || (c1 == 32 || c1 == 9)) {
|
|
22896
24437
|
return null;
|
|
22897
24438
|
}
|
|
22898
24439
|
let parent = this.parentBlockType();
|
|
@@ -22900,7 +24441,7 @@ class loreline_Lexer {
|
|
|
22900
24441
|
return null;
|
|
22901
24442
|
}
|
|
22902
24443
|
let inBrackets = this.isInsideBrackets();
|
|
22903
|
-
let isAssignValue =
|
|
24444
|
+
let isAssignValue = this.followsUnquotedAssign();
|
|
22904
24445
|
let labelIdentifierIndex = this.afterLabelIdentifierToken(false);
|
|
22905
24446
|
if(labelIdentifierIndex != -1 && this.tokenized[labelIdentifierIndex].pos.line < this.line) {
|
|
22906
24447
|
if(this.tokenized[labelIdentifierIndex].pos.column >= this.column) {
|
|
@@ -22913,11 +24454,12 @@ class loreline_Lexer {
|
|
|
22913
24454
|
let multilineIndent = labelIdentifierIndex != -1 ? this.isStartingMultilineDialogue(labelIdentifierIndex) : -1;
|
|
22914
24455
|
let isAfterLabel = labelIdentifierIndex != -1;
|
|
22915
24456
|
let isValue = parent == loreline_TokenType.KwState || parent == loreline_TokenType.KwCharacter || inBrackets || isAssignValue;
|
|
24457
|
+
let identifier = this.matchIdentifier(this.pos);
|
|
22916
24458
|
if(isValue) {
|
|
22917
24459
|
if(this.isCallStart(this.pos) || this.isLabelStart(this.pos)) {
|
|
22918
24460
|
return null;
|
|
22919
24461
|
}
|
|
22920
|
-
} 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))) {
|
|
22921
24463
|
return null;
|
|
22922
24464
|
}
|
|
22923
24465
|
if(!isValue) {
|
|
@@ -22929,8 +24471,10 @@ class loreline_Lexer {
|
|
|
22929
24471
|
if(this.isInsertionStart(this.pos)) {
|
|
22930
24472
|
return null;
|
|
22931
24473
|
}
|
|
24474
|
+
if(this.isChoiceOnceStart(this.pos)) {
|
|
24475
|
+
return null;
|
|
24476
|
+
}
|
|
22932
24477
|
}
|
|
22933
|
-
let identifier = this.matchIdentifier(this.pos);
|
|
22934
24478
|
if(identifier != null) {
|
|
22935
24479
|
if(identifier == "function") {
|
|
22936
24480
|
return null;
|
|
@@ -22939,30 +24483,181 @@ class loreline_Lexer {
|
|
|
22939
24483
|
if(identifier != "if" && identifier != "null" && identifier != "true" && identifier != "false" && identifier != "and" && identifier != "or" && Object.prototype.hasOwnProperty.call(loreline_Lexer.KEYWORDS.h,identifier)) {
|
|
22940
24484
|
return null;
|
|
22941
24485
|
}
|
|
22942
|
-
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) {
|
|
22943
24616
|
return null;
|
|
22944
24617
|
}
|
|
22945
|
-
|
|
22946
|
-
}
|
|
22947
|
-
let allowTags = !isValue;
|
|
22948
|
-
let isDialogue = false;
|
|
22949
|
-
if(isValue) {
|
|
22950
|
-
if(inBrackets) {
|
|
22951
|
-
if(!isAfterLabel && !this.followsOnlyWhitespacesOrCommentsInLine() && !this.isAfterComma() && !this.isAfterLBracket()) {
|
|
24618
|
+
if(nextChar == 43) {
|
|
22952
24619
|
return null;
|
|
22953
24620
|
}
|
|
22954
|
-
|
|
22955
|
-
|
|
22956
|
-
|
|
22957
|
-
|
|
22958
|
-
isDialogue = this.followsOnlyLabelOrCommentsInLine();
|
|
22959
|
-
if(!isDialogue && !this.followsOnlyWhitespacesOrCommentsInLine()) {
|
|
22960
|
-
return null;
|
|
22961
|
-
}
|
|
22962
|
-
if(!isDialogue) {
|
|
22963
|
-
if(cc == 62 && c1 == 45) {
|
|
24621
|
+
if(this.isAssignStart(nextLinePos,false)) {
|
|
24622
|
+
return null;
|
|
24623
|
+
}
|
|
24624
|
+
if(this.isCallStart(nextLinePos)) {
|
|
22964
24625
|
return null;
|
|
22965
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;
|
|
22966
24661
|
}
|
|
22967
24662
|
}
|
|
22968
24663
|
let start = new loreline_Position(this.startLine,this.startColumn,this.pos);
|
|
@@ -23489,7 +25184,7 @@ class loreline_Lexer {
|
|
|
23489
25184
|
content = StringTools.rtrim(content);
|
|
23490
25185
|
let contentLength = content.length;
|
|
23491
25186
|
let rtrimmedOffset = rawContentLength - contentLength;
|
|
23492
|
-
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)) {
|
|
23493
25188
|
if(multilineIndent == -1 && !isAfterLabel && !this.inChoiceRoot()) {
|
|
23494
25189
|
let savedLine = this.line;
|
|
23495
25190
|
let savedColumn = this.column;
|
|
@@ -23943,10 +25638,10 @@ class loreline_Lexer {
|
|
|
23943
25638
|
currentColumn += tokenLength;
|
|
23944
25639
|
}
|
|
23945
25640
|
switch(token.type._hx_index) {
|
|
23946
|
-
case
|
|
25641
|
+
case 45:
|
|
23947
25642
|
++braceLevel;
|
|
23948
25643
|
break;
|
|
23949
|
-
case
|
|
25644
|
+
case 46:
|
|
23950
25645
|
--braceLevel;
|
|
23951
25646
|
break;
|
|
23952
25647
|
default:
|
|
@@ -25736,6 +27431,9 @@ class loreline_Loreline {
|
|
|
25736
27431
|
let printer = new loreline_Printer(tmp != null ? tmp : " ",tmp1 != null ? tmp1 : "\n");
|
|
25737
27432
|
return printer.print(script);
|
|
25738
27433
|
}
|
|
27434
|
+
static update(delta) {
|
|
27435
|
+
loreline_Timer.update(delta);
|
|
27436
|
+
}
|
|
25739
27437
|
}
|
|
25740
27438
|
$hxClasses["loreline.Loreline"] = $hx_exports["loreline"]["Loreline"] = loreline_Loreline;
|
|
25741
27439
|
loreline_Loreline.__name__ = "loreline.Loreline";
|
|
@@ -26065,6 +27763,9 @@ class loreline_Node {
|
|
|
26065
27763
|
}
|
|
26066
27764
|
each(handleNode) {
|
|
26067
27765
|
}
|
|
27766
|
+
static fromJson(json) {
|
|
27767
|
+
return loreline_JsonToAst.nodeFromJson(json);
|
|
27768
|
+
}
|
|
26068
27769
|
}
|
|
26069
27770
|
$hxClasses["loreline.Node"] = $hx_exports["loreline"]["Node"] = loreline_Node;
|
|
26070
27771
|
loreline_Node.__name__ = "loreline.Node";
|
|
@@ -26705,6 +28406,7 @@ class loreline_NChoiceOption extends loreline_AstNode {
|
|
|
26705
28406
|
this.conditionStyle = conditionStyle;
|
|
26706
28407
|
this.body = body;
|
|
26707
28408
|
this.style = 0;
|
|
28409
|
+
this.once = false;
|
|
26708
28410
|
}
|
|
26709
28411
|
type() {
|
|
26710
28412
|
return "Option";
|
|
@@ -26757,6 +28459,9 @@ class loreline_NChoiceOption extends loreline_AstNode {
|
|
|
26757
28459
|
}
|
|
26758
28460
|
json.body = _g;
|
|
26759
28461
|
json.style = loreline_BlockStyle.toString(this.style);
|
|
28462
|
+
if(this.once) {
|
|
28463
|
+
json.once = true;
|
|
28464
|
+
}
|
|
26760
28465
|
return json;
|
|
26761
28466
|
}
|
|
26762
28467
|
}
|
|
@@ -26972,6 +28677,30 @@ class loreline_NAlternative extends loreline_AstNode {
|
|
|
26972
28677
|
}
|
|
26973
28678
|
json.items = _g;
|
|
26974
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
|
+
}
|
|
26975
28704
|
return json;
|
|
26976
28705
|
}
|
|
26977
28706
|
}
|
|
@@ -27372,6 +29101,45 @@ loreline_NUnary.__super__ = loreline_NExpr;
|
|
|
27372
29101
|
Object.assign(loreline_NUnary.prototype, {
|
|
27373
29102
|
__class__: loreline_NUnary
|
|
27374
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
|
+
});
|
|
27375
29143
|
class loreline_NImportStatement extends loreline_AstNode {
|
|
27376
29144
|
constructor(id,pos,path,script,leadingComments,trailingComments) {
|
|
27377
29145
|
super(id,pos,leadingComments,trailingComments);
|
|
@@ -27391,6 +29159,9 @@ class loreline_NImportStatement extends loreline_AstNode {
|
|
|
27391
29159
|
toJson() {
|
|
27392
29160
|
let json = super.toJson();
|
|
27393
29161
|
json.path = this.path.toJson();
|
|
29162
|
+
if(this.script != null) {
|
|
29163
|
+
json.script = this.script.toJson();
|
|
29164
|
+
}
|
|
27394
29165
|
return json;
|
|
27395
29166
|
}
|
|
27396
29167
|
}
|
|
@@ -27485,6 +29256,9 @@ class loreline_Objects {
|
|
|
27485
29256
|
static getMapHelper(interpreter,name) {
|
|
27486
29257
|
return interpreter.mapHelpers.h[name];
|
|
27487
29258
|
}
|
|
29259
|
+
static getBeatHelper(interpreter,name) {
|
|
29260
|
+
return interpreter.beatHelpers.h[name];
|
|
29261
|
+
}
|
|
27488
29262
|
static createFields(interpreter,type,node) {
|
|
27489
29263
|
if(interpreter != null && interpreter.customCreateFields != null) {
|
|
27490
29264
|
let customInstance = interpreter.customCreateFields(interpreter,type,node);
|
|
@@ -27599,19 +29373,19 @@ class loreline_Parser {
|
|
|
27599
29373
|
while(i < this.tokens.length) {
|
|
27600
29374
|
let _g = this.tokens[i].type;
|
|
27601
29375
|
switch(_g._hx_index) {
|
|
27602
|
-
case
|
|
29376
|
+
case 51:
|
|
27603
29377
|
let _g1 = _g.content;
|
|
27604
29378
|
++i;
|
|
27605
29379
|
break;
|
|
27606
|
-
case
|
|
29380
|
+
case 52:
|
|
27607
29381
|
let _g2 = _g.content;
|
|
27608
29382
|
++i;
|
|
27609
29383
|
break;
|
|
27610
|
-
case
|
|
29384
|
+
case 53:
|
|
27611
29385
|
let _g3 = _g.content;
|
|
27612
29386
|
++i;
|
|
27613
29387
|
break;
|
|
27614
|
-
case
|
|
29388
|
+
case 56:
|
|
27615
29389
|
++i;
|
|
27616
29390
|
break;
|
|
27617
29391
|
default:
|
|
@@ -27632,28 +29406,28 @@ class loreline_Parser {
|
|
|
27632
29406
|
this.current++;
|
|
27633
29407
|
let _g = this.tokens[this.current].type;
|
|
27634
29408
|
switch(_g._hx_index) {
|
|
27635
|
-
case
|
|
29409
|
+
case 51:
|
|
27636
29410
|
let content = _g.content;
|
|
27637
29411
|
if(this.pendingComments == null) {
|
|
27638
29412
|
this.pendingComments = [];
|
|
27639
29413
|
}
|
|
27640
29414
|
this.pendingComments.push(new loreline_Comment(this.nextNodeId(4),this.currentPos(),content,false));
|
|
27641
29415
|
break;
|
|
27642
|
-
case
|
|
29416
|
+
case 52:
|
|
27643
29417
|
let content1 = _g.content;
|
|
27644
29418
|
if(this.pendingComments == null) {
|
|
27645
29419
|
this.pendingComments = [];
|
|
27646
29420
|
}
|
|
27647
29421
|
this.pendingComments.push(new loreline_Comment(this.nextNodeId(4),this.currentPos(),content1,true));
|
|
27648
29422
|
break;
|
|
27649
|
-
case
|
|
29423
|
+
case 53:
|
|
27650
29424
|
let content2 = _g.content;
|
|
27651
29425
|
if(this.pendingComments == null) {
|
|
27652
29426
|
this.pendingComments = [];
|
|
27653
29427
|
}
|
|
27654
29428
|
this.pendingComments.push(new loreline_Comment(this.nextNodeId(4),this.currentPos(),content2,false,true));
|
|
27655
29429
|
break;
|
|
27656
|
-
case
|
|
29430
|
+
case 56:
|
|
27657
29431
|
this.lastLineBreak = this.currentPos();
|
|
27658
29432
|
this.lineBreakAfterToken = true;
|
|
27659
29433
|
break;
|
|
@@ -27694,16 +29468,16 @@ class loreline_Parser {
|
|
|
27694
29468
|
while(n >= 0) {
|
|
27695
29469
|
let _g = this.tokens[n].type;
|
|
27696
29470
|
switch(_g._hx_index) {
|
|
27697
|
-
case
|
|
29471
|
+
case 51:
|
|
27698
29472
|
let _g1 = _g.content;
|
|
27699
29473
|
break;
|
|
27700
|
-
case
|
|
29474
|
+
case 52:
|
|
27701
29475
|
let _g2 = _g.content;
|
|
27702
29476
|
break;
|
|
27703
|
-
case
|
|
29477
|
+
case 53:
|
|
27704
29478
|
let _g3 = _g.content;
|
|
27705
29479
|
break;
|
|
27706
|
-
case
|
|
29480
|
+
case 54:case 55:case 56:
|
|
27707
29481
|
break;
|
|
27708
29482
|
default:
|
|
27709
29483
|
return this.tokens[n];
|
|
@@ -27717,16 +29491,16 @@ class loreline_Parser {
|
|
|
27717
29491
|
while(n < this.tokens.length) {
|
|
27718
29492
|
let _g = this.tokens[n].type;
|
|
27719
29493
|
switch(_g._hx_index) {
|
|
27720
|
-
case
|
|
29494
|
+
case 51:
|
|
27721
29495
|
let _g1 = _g.content;
|
|
27722
29496
|
break;
|
|
27723
|
-
case
|
|
29497
|
+
case 52:
|
|
27724
29498
|
let _g2 = _g.content;
|
|
27725
29499
|
break;
|
|
27726
|
-
case
|
|
29500
|
+
case 53:
|
|
27727
29501
|
let _g3 = _g.content;
|
|
27728
29502
|
break;
|
|
27729
|
-
case
|
|
29503
|
+
case 54:case 55:case 56:
|
|
27730
29504
|
break;
|
|
27731
29505
|
default:
|
|
27732
29506
|
return this.tokens[n];
|
|
@@ -27740,16 +29514,16 @@ class loreline_Parser {
|
|
|
27740
29514
|
while(n < this.tokens.length) {
|
|
27741
29515
|
let _g = this.tokens[n].type;
|
|
27742
29516
|
switch(_g._hx_index) {
|
|
27743
|
-
case
|
|
29517
|
+
case 51:
|
|
27744
29518
|
let _g1 = _g.content;
|
|
27745
29519
|
break;
|
|
27746
|
-
case
|
|
29520
|
+
case 52:
|
|
27747
29521
|
let _g2 = _g.content;
|
|
27748
29522
|
break;
|
|
27749
|
-
case
|
|
29523
|
+
case 53:
|
|
27750
29524
|
let _g3 = _g.content;
|
|
27751
29525
|
break;
|
|
27752
|
-
case
|
|
29526
|
+
case 56:
|
|
27753
29527
|
break;
|
|
27754
29528
|
default:
|
|
27755
29529
|
return this.tokens[n];
|
|
@@ -27783,7 +29557,7 @@ class loreline_Parser {
|
|
|
27783
29557
|
if(this.isAtEnd()) {
|
|
27784
29558
|
return false;
|
|
27785
29559
|
}
|
|
27786
|
-
if(type._hx_index ==
|
|
29560
|
+
if(type._hx_index == 41) {
|
|
27787
29561
|
return this.tokens[this.current].type == loreline_TokenType.Colon;
|
|
27788
29562
|
} else {
|
|
27789
29563
|
return loreline_TokenTypeHelpers.equals(this.tokens[this.current].type,type);
|
|
@@ -27809,13 +29583,13 @@ class loreline_Parser {
|
|
|
27809
29583
|
}
|
|
27810
29584
|
isComment(type) {
|
|
27811
29585
|
switch(type._hx_index) {
|
|
27812
|
-
case
|
|
29586
|
+
case 51:
|
|
27813
29587
|
let _g = type.content;
|
|
27814
29588
|
return true;
|
|
27815
|
-
case
|
|
29589
|
+
case 52:
|
|
27816
29590
|
let _g1 = type.content;
|
|
27817
29591
|
return true;
|
|
27818
|
-
case
|
|
29592
|
+
case 53:
|
|
27819
29593
|
let _g2 = type.content;
|
|
27820
29594
|
return true;
|
|
27821
29595
|
default:
|
|
@@ -27837,15 +29611,15 @@ class loreline_Parser {
|
|
|
27837
29611
|
let _g = this.tokens[this.current].type;
|
|
27838
29612
|
let tmp3;
|
|
27839
29613
|
switch(_g._hx_index) {
|
|
27840
|
-
case
|
|
29614
|
+
case 51:
|
|
27841
29615
|
let content = _g.content;
|
|
27842
29616
|
tmp3 = content;
|
|
27843
29617
|
break;
|
|
27844
|
-
case
|
|
29618
|
+
case 52:
|
|
27845
29619
|
let content1 = _g.content;
|
|
27846
29620
|
tmp3 = content1;
|
|
27847
29621
|
break;
|
|
27848
|
-
case
|
|
29622
|
+
case 53:
|
|
27849
29623
|
let content2 = _g.content;
|
|
27850
29624
|
tmp3 = content2;
|
|
27851
29625
|
break;
|
|
@@ -27854,7 +29628,7 @@ class loreline_Parser {
|
|
|
27854
29628
|
}
|
|
27855
29629
|
let _g1 = this.tokens[this.current].type;
|
|
27856
29630
|
let tmp4;
|
|
27857
|
-
if(_g1._hx_index ==
|
|
29631
|
+
if(_g1._hx_index == 52) {
|
|
27858
29632
|
let _g = _g1.content;
|
|
27859
29633
|
tmp4 = true;
|
|
27860
29634
|
} else {
|
|
@@ -27862,7 +29636,7 @@ class loreline_Parser {
|
|
|
27862
29636
|
}
|
|
27863
29637
|
let _g2 = this.tokens[this.current].type;
|
|
27864
29638
|
let tmp5;
|
|
27865
|
-
if(_g2._hx_index ==
|
|
29639
|
+
if(_g2._hx_index == 53) {
|
|
27866
29640
|
let _g = _g2.content;
|
|
27867
29641
|
tmp5 = true;
|
|
27868
29642
|
} else {
|
|
@@ -27992,7 +29766,7 @@ class loreline_Parser {
|
|
|
27992
29766
|
}
|
|
27993
29767
|
}
|
|
27994
29768
|
break;
|
|
27995
|
-
case
|
|
29769
|
+
case 26:
|
|
27996
29770
|
let node7 = this.parseInsertion();
|
|
27997
29771
|
if(topLevel) {
|
|
27998
29772
|
return _gthis.wrapInRootBeat(node7);
|
|
@@ -28000,7 +29774,7 @@ class loreline_Parser {
|
|
|
28000
29774
|
return node7;
|
|
28001
29775
|
}
|
|
28002
29776
|
break;
|
|
28003
|
-
case 18:case
|
|
29777
|
+
case 18:case 27:case 39:case 45:case 47:case 49:
|
|
28004
29778
|
let node8 = this.parseExpressionStatement();
|
|
28005
29779
|
if(topLevel) {
|
|
28006
29780
|
return _gthis.wrapInRootBeat(node8);
|
|
@@ -28008,7 +29782,7 @@ class loreline_Parser {
|
|
|
28008
29782
|
return node8;
|
|
28009
29783
|
}
|
|
28010
29784
|
break;
|
|
28011
|
-
case
|
|
29785
|
+
case 40:
|
|
28012
29786
|
let node9 = this.parseTransition();
|
|
28013
29787
|
if(topLevel) {
|
|
28014
29788
|
return _gthis.wrapInRootBeat(node9);
|
|
@@ -28364,6 +30138,9 @@ class loreline_Parser {
|
|
|
28364
30138
|
isInsertion = true;
|
|
28365
30139
|
choiceOption.insertion = this.parseInsertion();
|
|
28366
30140
|
} else {
|
|
30141
|
+
if(this.match(loreline_TokenType.OpMinus)) {
|
|
30142
|
+
choiceOption.once = true;
|
|
30143
|
+
}
|
|
28367
30144
|
choiceOption.text = this.parseStringLiteral();
|
|
28368
30145
|
}
|
|
28369
30146
|
} catch( _g ) {
|
|
@@ -28380,30 +30157,30 @@ class loreline_Parser {
|
|
|
28380
30157
|
throw _g;
|
|
28381
30158
|
}
|
|
28382
30159
|
}
|
|
28383
|
-
if(
|
|
28384
|
-
|
|
28385
|
-
|
|
28386
|
-
|
|
28387
|
-
|
|
28388
|
-
|
|
28389
|
-
|
|
28390
|
-
|
|
28391
|
-
|
|
28392
|
-
|
|
28393
|
-
|
|
28394
|
-
|
|
28395
|
-
|
|
28396
|
-
|
|
28397
|
-
|
|
28398
|
-
|
|
28399
|
-
|
|
28400
|
-
this.advance();
|
|
28401
|
-
}
|
|
28402
|
-
} else {
|
|
28403
|
-
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();
|
|
28404
30177
|
}
|
|
30178
|
+
} else {
|
|
30179
|
+
throw _g;
|
|
28405
30180
|
}
|
|
28406
30181
|
}
|
|
30182
|
+
}
|
|
30183
|
+
if(!isInsertion) {
|
|
28407
30184
|
if(this.checkBlockStart()) {
|
|
28408
30185
|
choiceOption.body = [];
|
|
28409
30186
|
let offset = this.currentPos().offset;
|
|
@@ -28477,7 +30254,7 @@ class loreline_Parser {
|
|
|
28477
30254
|
return true;
|
|
28478
30255
|
}
|
|
28479
30256
|
break;
|
|
28480
|
-
case 18:case
|
|
30257
|
+
case 18:case 27:case 39:case 45:case 47:case 49:
|
|
28481
30258
|
return true;
|
|
28482
30259
|
default:
|
|
28483
30260
|
return false;
|
|
@@ -28485,7 +30262,7 @@ class loreline_Parser {
|
|
|
28485
30262
|
}
|
|
28486
30263
|
parseExpressionStatement() {
|
|
28487
30264
|
let expr = this.parseExpression();
|
|
28488
|
-
if(this.match(loreline_TokenType.OpAssign) || this.match(loreline_TokenType.OpPlusAssign) || this.match(loreline_TokenType.OpMinusAssign) || this.match(loreline_TokenType.OpMultiplyAssign) || this.match(loreline_TokenType.OpDivideAssign)) {
|
|
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)) {
|
|
28489
30266
|
let op = this.previous().type;
|
|
28490
30267
|
let assignment = this.attachComments(new loreline_NAssign(this.nextNodeId(4),expr.pos,expr,op,null));
|
|
28491
30268
|
assignment.value = this.parseExpression();
|
|
@@ -28512,7 +30289,7 @@ class loreline_Parser {
|
|
|
28512
30289
|
return false;
|
|
28513
30290
|
}
|
|
28514
30291
|
break;
|
|
28515
|
-
case 1:case 2:case 3:case 4:case 5:case
|
|
30292
|
+
case 1:case 2:case 3:case 4:case 5:case 40:
|
|
28516
30293
|
return true;
|
|
28517
30294
|
default:
|
|
28518
30295
|
return false;
|
|
@@ -28648,8 +30425,8 @@ class loreline_Parser {
|
|
|
28648
30425
|
}
|
|
28649
30426
|
parseExpression() {
|
|
28650
30427
|
try {
|
|
28651
|
-
let expr = this.
|
|
28652
|
-
if(this.check(loreline_TokenType.OpAssign) || this.check(loreline_TokenType.OpPlusAssign) || this.check(loreline_TokenType.OpMinusAssign) || this.check(loreline_TokenType.OpMultiplyAssign) || this.check(loreline_TokenType.OpDivideAssign)) {
|
|
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)) {
|
|
28653
30430
|
let op = this.tokens[this.current].type;
|
|
28654
30431
|
this.advance();
|
|
28655
30432
|
let assignment = this.attachComments(new loreline_NAssign(this.nextNodeId(4),expr.pos,expr,op,null));
|
|
@@ -28666,6 +30443,17 @@ class loreline_Parser {
|
|
|
28666
30443
|
return new loreline_NLiteral(this.nextNodeId(4),this.currentPos(),null,loreline_LiteralType.Null);
|
|
28667
30444
|
}
|
|
28668
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
|
+
}
|
|
28669
30457
|
parseLogicalOr() {
|
|
28670
30458
|
let expr = this.parseLogicalAnd();
|
|
28671
30459
|
while(this.match(loreline_TokenType.OpOr(false))) {
|
|
@@ -28772,14 +30560,14 @@ class loreline_Parser {
|
|
|
28772
30560
|
return this.parseIdentifierExpression(startPos,name);
|
|
28773
30561
|
}
|
|
28774
30562
|
break;
|
|
28775
|
-
case 43:
|
|
28776
|
-
return this.parsePostfix(startPos,this.parseObjectLiteral());
|
|
28777
30563
|
case 45:
|
|
30564
|
+
return this.parsePostfix(startPos,this.parseObjectLiteral());
|
|
30565
|
+
case 47:
|
|
28778
30566
|
this.advance();
|
|
28779
30567
|
let expr = this.parseExpression();
|
|
28780
30568
|
this.expect(loreline_TokenType.RParen);
|
|
28781
30569
|
return this.parsePostfix(startPos,expr);
|
|
28782
|
-
case
|
|
30570
|
+
case 49:
|
|
28783
30571
|
return this.parsePostfix(startPos,this.parseArrayLiteral());
|
|
28784
30572
|
default:
|
|
28785
30573
|
throw haxe_Exception.thrown(new loreline_ParseError("Unexpected token in expression",this.currentPos()));
|
|
@@ -28958,7 +30746,7 @@ class loreline_Parser {
|
|
|
28958
30746
|
}
|
|
28959
30747
|
prevIsDot = false;
|
|
28960
30748
|
break;
|
|
28961
|
-
case
|
|
30749
|
+
case 44:
|
|
28962
30750
|
if(target == null) {
|
|
28963
30751
|
this.addError(new loreline_ParseError("Leading dot in field access",token.pos));
|
|
28964
30752
|
let tmp = this.nextNodeId(4);
|
|
@@ -28969,7 +30757,7 @@ class loreline_Parser {
|
|
|
28969
30757
|
}
|
|
28970
30758
|
prevIsDot = true;
|
|
28971
30759
|
break;
|
|
28972
|
-
case
|
|
30760
|
+
case 47:
|
|
28973
30761
|
if(target == null) {
|
|
28974
30762
|
this.addError(new loreline_ParseError("Function call without target",token.pos));
|
|
28975
30763
|
let tmp = this.nextNodeId(4);
|
|
@@ -28986,7 +30774,7 @@ class loreline_Parser {
|
|
|
28986
30774
|
let t = tokens[i];
|
|
28987
30775
|
++i;
|
|
28988
30776
|
switch(t.type._hx_index) {
|
|
28989
|
-
case
|
|
30777
|
+
case 43:
|
|
28990
30778
|
if(parenLevel == 1) {
|
|
28991
30779
|
if(currentArgTokens.length > 0) {
|
|
28992
30780
|
argTokens.push(currentArgTokens);
|
|
@@ -28996,11 +30784,11 @@ class loreline_Parser {
|
|
|
28996
30784
|
currentArgTokens.push(t);
|
|
28997
30785
|
}
|
|
28998
30786
|
break;
|
|
28999
|
-
case
|
|
30787
|
+
case 47:
|
|
29000
30788
|
++parenLevel;
|
|
29001
30789
|
currentArgTokens.push(t);
|
|
29002
30790
|
break;
|
|
29003
|
-
case
|
|
30791
|
+
case 48:
|
|
29004
30792
|
--parenLevel;
|
|
29005
30793
|
if(parenLevel > 0) {
|
|
29006
30794
|
currentArgTokens.push(t);
|
|
@@ -29034,7 +30822,7 @@ class loreline_Parser {
|
|
|
29034
30822
|
target = this.attachComments(new loreline_NCall(this.nextNodeId(4),callStart.extendedTo(tokens[i - 1].pos),target,args));
|
|
29035
30823
|
prevIsDot = false;
|
|
29036
30824
|
break;
|
|
29037
|
-
case
|
|
30825
|
+
case 49:
|
|
29038
30826
|
if(target == null) {
|
|
29039
30827
|
this.addError(new loreline_ParseError("Array access without target",token.pos));
|
|
29040
30828
|
let tmp = this.nextNodeId(4);
|
|
@@ -29051,11 +30839,11 @@ class loreline_Parser {
|
|
|
29051
30839
|
let t = tokens[i];
|
|
29052
30840
|
++i;
|
|
29053
30841
|
switch(t.type._hx_index) {
|
|
29054
|
-
case
|
|
30842
|
+
case 49:
|
|
29055
30843
|
++bracketLevel;
|
|
29056
30844
|
arrayTokens.push(t);
|
|
29057
30845
|
break;
|
|
29058
|
-
case
|
|
30846
|
+
case 50:
|
|
29059
30847
|
--bracketLevel;
|
|
29060
30848
|
if(bracketLevel > 0) {
|
|
29061
30849
|
arrayTokens.push(t);
|
|
@@ -29358,7 +31146,7 @@ class loreline_Parser {
|
|
|
29358
31146
|
} else {
|
|
29359
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);
|
|
29360
31148
|
switch(type._hx_index) {
|
|
29361
|
-
case
|
|
31149
|
+
case 46:case 48:case 55:
|
|
29362
31150
|
this.addError(error);
|
|
29363
31151
|
return new loreline_Token(type,this.currentPos());
|
|
29364
31152
|
default:
|
|
@@ -29457,13 +31245,13 @@ class loreline_Parser {
|
|
|
29457
31245
|
}
|
|
29458
31246
|
this.advance();
|
|
29459
31247
|
break;
|
|
29460
|
-
case
|
|
31248
|
+
case 40:
|
|
29461
31249
|
this.advance();
|
|
29462
31250
|
if(this.check(loreline_TokenType.Dot) || loreline_TokenTypeHelpers.isIdentifier(this.tokens[this.current].type)) {
|
|
29463
31251
|
this.advance();
|
|
29464
31252
|
}
|
|
29465
31253
|
return;
|
|
29466
|
-
case 1:case 2:case 3:case 4:case 5:case
|
|
31254
|
+
case 1:case 2:case 3:case 4:case 5:case 46:case 54:
|
|
29467
31255
|
return;
|
|
29468
31256
|
default:
|
|
29469
31257
|
this.advance();
|
|
@@ -29472,7 +31260,7 @@ class loreline_Parser {
|
|
|
29472
31260
|
}
|
|
29473
31261
|
requiresNewLine() {
|
|
29474
31262
|
switch(this.tokens[this.current].type._hx_index) {
|
|
29475
|
-
case 6:case
|
|
31263
|
+
case 6:case 40:case 46:
|
|
29476
31264
|
return false;
|
|
29477
31265
|
default:
|
|
29478
31266
|
return true;
|
|
@@ -29843,6 +31631,9 @@ class loreline_Printer {
|
|
|
29843
31631
|
case loreline_NStringLiteral:
|
|
29844
31632
|
this.printStringLiteral(node);
|
|
29845
31633
|
break;
|
|
31634
|
+
case loreline_NTernary:
|
|
31635
|
+
this.printTernary(node);
|
|
31636
|
+
break;
|
|
29846
31637
|
case loreline_NTextStatement:
|
|
29847
31638
|
this.printTextStatement(node);
|
|
29848
31639
|
break;
|
|
@@ -30126,6 +31917,9 @@ class loreline_Printer {
|
|
|
30126
31917
|
this.newline();
|
|
30127
31918
|
this._noLn = 0;
|
|
30128
31919
|
this.printLeadingComments(option);
|
|
31920
|
+
if(option.once) {
|
|
31921
|
+
this.write("- ");
|
|
31922
|
+
}
|
|
30129
31923
|
if(option.insertion != null) {
|
|
30130
31924
|
this.printNode(option.insertion);
|
|
30131
31925
|
} else {
|
|
@@ -30478,20 +32272,53 @@ class loreline_Printer {
|
|
|
30478
32272
|
this.write("null");
|
|
30479
32273
|
break;
|
|
30480
32274
|
case 3:
|
|
30481
|
-
let
|
|
30482
|
-
this.write("[");
|
|
32275
|
+
let hasMultilineUnquoted = false;
|
|
30483
32276
|
let _g1 = 0;
|
|
30484
32277
|
let _g2 = lit.value;
|
|
30485
32278
|
while(_g1 < _g2.length) {
|
|
30486
32279
|
let elem = _g2[_g1];
|
|
30487
32280
|
++_g1;
|
|
30488
|
-
if(
|
|
30489
|
-
|
|
32281
|
+
if(this.hasRealNewlines(elem)) {
|
|
32282
|
+
hasMultilineUnquoted = true;
|
|
32283
|
+
break;
|
|
30490
32284
|
}
|
|
30491
|
-
first = false;
|
|
30492
|
-
this.printNode(elem);
|
|
30493
32285
|
}
|
|
30494
|
-
|
|
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
|
+
}
|
|
30495
32322
|
break;
|
|
30496
32323
|
case 4:
|
|
30497
32324
|
let style = _g.style;
|
|
@@ -30502,18 +32329,18 @@ class loreline_Printer {
|
|
|
30502
32329
|
this.newline();
|
|
30503
32330
|
}
|
|
30504
32331
|
this._level++;
|
|
30505
|
-
let
|
|
32332
|
+
let first = true;
|
|
30506
32333
|
let _g3 = 0;
|
|
30507
32334
|
let _g4 = lit.value;
|
|
30508
32335
|
while(_g3 < _g4.length) {
|
|
30509
32336
|
let field = _g4[_g3];
|
|
30510
32337
|
++_g3;
|
|
30511
|
-
if(!
|
|
32338
|
+
if(!first) {
|
|
30512
32339
|
if(this._beginLine == 0) {
|
|
30513
32340
|
this.newline();
|
|
30514
32341
|
}
|
|
30515
32342
|
}
|
|
30516
|
-
|
|
32343
|
+
first = false;
|
|
30517
32344
|
this.printLeadingComments(field);
|
|
30518
32345
|
this.write("" + field.name + ": ");
|
|
30519
32346
|
this.printTrailingComments(field);
|
|
@@ -30573,11 +32400,11 @@ class loreline_Printer {
|
|
|
30573
32400
|
if(!skipParen) {
|
|
30574
32401
|
let _g = binary.op;
|
|
30575
32402
|
switch(_g._hx_index) {
|
|
30576
|
-
case
|
|
32403
|
+
case 37:
|
|
30577
32404
|
let word = _g.word;
|
|
30578
32405
|
needsParens = true;
|
|
30579
32406
|
break;
|
|
30580
|
-
case
|
|
32407
|
+
case 38:
|
|
30581
32408
|
let word1 = _g.word;
|
|
30582
32409
|
needsParens = true;
|
|
30583
32410
|
break;
|
|
@@ -30604,6 +32431,15 @@ class loreline_Printer {
|
|
|
30604
32431
|
this.printTrailingComments(unary);
|
|
30605
32432
|
this.printNode(unary.operand);
|
|
30606
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
|
+
}
|
|
30607
32443
|
printAssignment(assign) {
|
|
30608
32444
|
this.printLeadingComments(assign);
|
|
30609
32445
|
this.printNode(assign.target);
|
|
@@ -30678,42 +32514,44 @@ class loreline_Printer {
|
|
|
30678
32514
|
case 24:
|
|
30679
32515
|
return "/=";
|
|
30680
32516
|
case 25:
|
|
30681
|
-
return "
|
|
32517
|
+
return ":=";
|
|
30682
32518
|
case 26:
|
|
30683
|
-
return "
|
|
32519
|
+
return "+";
|
|
30684
32520
|
case 27:
|
|
30685
|
-
return "
|
|
32521
|
+
return "-";
|
|
30686
32522
|
case 28:
|
|
30687
|
-
return "
|
|
32523
|
+
return "*";
|
|
30688
32524
|
case 29:
|
|
30689
|
-
return "
|
|
32525
|
+
return "/";
|
|
30690
32526
|
case 30:
|
|
30691
|
-
return "
|
|
32527
|
+
return "%";
|
|
30692
32528
|
case 31:
|
|
30693
|
-
return "
|
|
32529
|
+
return "==";
|
|
30694
32530
|
case 32:
|
|
30695
|
-
return "
|
|
32531
|
+
return "!=";
|
|
30696
32532
|
case 33:
|
|
30697
|
-
return "
|
|
32533
|
+
return ">";
|
|
30698
32534
|
case 34:
|
|
30699
|
-
return "
|
|
32535
|
+
return "<";
|
|
30700
32536
|
case 35:
|
|
30701
|
-
return "
|
|
32537
|
+
return ">=";
|
|
30702
32538
|
case 36:
|
|
32539
|
+
return "<=";
|
|
32540
|
+
case 37:
|
|
30703
32541
|
if(op.word) {
|
|
30704
32542
|
return "and";
|
|
30705
32543
|
} else {
|
|
30706
32544
|
return "&&";
|
|
30707
32545
|
}
|
|
30708
32546
|
break;
|
|
30709
|
-
case
|
|
32547
|
+
case 38:
|
|
30710
32548
|
if(op.word) {
|
|
30711
32549
|
return "or";
|
|
30712
32550
|
} else {
|
|
30713
32551
|
return "||";
|
|
30714
32552
|
}
|
|
30715
32553
|
break;
|
|
30716
|
-
case
|
|
32554
|
+
case 39:
|
|
30717
32555
|
return "!";
|
|
30718
32556
|
default:
|
|
30719
32557
|
throw haxe_Exception.thrown("Unsupported operator: " + Std.string(op));
|
|
@@ -30790,6 +32628,7 @@ class loreline_Script extends loreline_AstNode {
|
|
|
30790
32628
|
_g.push(decl.toJson());
|
|
30791
32629
|
}
|
|
30792
32630
|
json.body = _g;
|
|
32631
|
+
json.indentSize = this.indentSize;
|
|
30793
32632
|
return json;
|
|
30794
32633
|
}
|
|
30795
32634
|
type() {
|
|
@@ -30826,6 +32665,9 @@ class loreline_Script extends loreline_AstNode {
|
|
|
30826
32665
|
iterator() {
|
|
30827
32666
|
return new loreline__$Script_ScriptBodyIterator(this.body);
|
|
30828
32667
|
}
|
|
32668
|
+
static fromJson(json) {
|
|
32669
|
+
return loreline_JsonToAst.scriptFromJson(json);
|
|
32670
|
+
}
|
|
30829
32671
|
}
|
|
30830
32672
|
$hxClasses["loreline.Script"] = $hx_exports["loreline"]["Script"] = loreline_Script;
|
|
30831
32673
|
loreline_Script.__name__ = "loreline.Script";
|
|
@@ -30869,6 +32711,38 @@ loreline__$Script_ScriptBodyIterator.__name__ = "loreline._Script.ScriptBodyIter
|
|
|
30869
32711
|
Object.assign(loreline__$Script_ScriptBodyIterator.prototype, {
|
|
30870
32712
|
__class__: loreline__$Script_ScriptBodyIterator
|
|
30871
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";
|
|
30872
32746
|
class loreline_Utf8 {
|
|
30873
32747
|
static uLength(str) {
|
|
30874
32748
|
return str.length;
|
|
@@ -31020,6 +32894,7 @@ loreline_AlternativeMode.Pick = 3;
|
|
|
31020
32894
|
loreline_AlternativeMode.Shuffle = 4;
|
|
31021
32895
|
loreline_Quotes.Unquoted = 0;
|
|
31022
32896
|
loreline_Quotes.DoubleQuotes = 1;
|
|
32897
|
+
loreline_Timer.timers = [];
|
|
31023
32898
|
loreline_lib_Library.main();
|
|
31024
32899
|
})(runtime, globals);
|
|
31025
32900
|
|