loreline 0.9.1 → 0.10.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/README.md +18 -4
- package/js/loreline.d.ts +9 -5
- package/js/loreline.js +1595 -375
- package/js/loreline.min.js +55 -55
- package/package.json +1 -1
package/js/loreline.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
let runtime = {}; let globals = {}; // Generated by Haxe 4.3.
|
|
1
|
+
let runtime = {}; let globals = {}; // Generated by Haxe 4.3.7
|
|
2
2
|
(function ($hx_exports, $global) { "use strict";
|
|
3
3
|
$hx_exports["loreline"] = $hx_exports["loreline"] || {};
|
|
4
4
|
var $hxClasses = {},$estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_;
|
|
@@ -4211,11 +4211,13 @@ class loreline_CodeToLorscript {
|
|
|
4211
4211
|
this.length = 0;
|
|
4212
4212
|
this.lineOutput = null;
|
|
4213
4213
|
this.output = null;
|
|
4214
|
+
this.inputText = null;
|
|
4214
4215
|
this.input = null;
|
|
4215
4216
|
this.index = 0;
|
|
4216
4217
|
}
|
|
4217
4218
|
process(input) {
|
|
4218
4219
|
input = StringTools.rtrim(input) + "\n//<END>";
|
|
4220
|
+
this.inputText = input;
|
|
4219
4221
|
this.input = input;
|
|
4220
4222
|
this.index = 0;
|
|
4221
4223
|
this.output = new StringBuf();
|
|
@@ -4238,7 +4240,7 @@ class loreline_CodeToLorscript {
|
|
|
4238
4240
|
let min = this.inputPosFromProcessedPos(pmin);
|
|
4239
4241
|
let max = this.inputPosFromProcessedPos(pmax);
|
|
4240
4242
|
let len = max + 1 - min;
|
|
4241
|
-
return funcPos.withOffset(this.
|
|
4243
|
+
return funcPos.withOffset(this.inputText,min,len,funcPos.offset);
|
|
4242
4244
|
}
|
|
4243
4245
|
inputPosFromProcessedPos(pos) {
|
|
4244
4246
|
if(pos < 0) {
|
|
@@ -5058,7 +5060,7 @@ class loreline_CodeToLorscript {
|
|
|
5058
5060
|
if(this.inStatementsBlock() || this.inObjectBlock() || this.inArrayBlock()) {
|
|
5059
5061
|
let indent = this.nextLineIndentOffset(line,this.index);
|
|
5060
5062
|
if(StringTools.trim(line).length != 0) {
|
|
5061
|
-
if(indent > 0 && !this.endsOrFollowsWithChar(line,123,this.index,{ fileName : "src/loreline/CodeToLorscript.hx", lineNumber :
|
|
5063
|
+
if(indent > 0 && !this.endsOrFollowsWithChar(line,123,this.index,{ fileName : "src/loreline/CodeToLorscript.hx", lineNumber : 1070, className : "loreline.CodeToLorscript", methodName : "_add"}) && !this.endsOrFollowsWithChar(line,91,this.index,{ fileName : "src/loreline/CodeToLorscript.hx", lineNumber : 1070, className : "loreline.CodeToLorscript", methodName : "_add"})) {
|
|
5062
5064
|
let trimmedLine = StringTools.ltrim(line);
|
|
5063
5065
|
let isCaseLabel = trimmedLine.startsWith("case ") || trimmedLine.startsWith("case\t") || (trimmedLine == "default" || trimmedLine.startsWith("default ") || trimmedLine.startsWith("default\t"));
|
|
5064
5066
|
if(isCaseLabel) {
|
|
@@ -5080,7 +5082,7 @@ class loreline_CodeToLorscript {
|
|
|
5080
5082
|
this.posOffsets.push(this.currentPosOffset);
|
|
5081
5083
|
}
|
|
5082
5084
|
} else if(indent < 0 && this.stack.length > 0 && (this.stack[this.stack.length - 1] == 3 || this.stack[this.stack.length - 1] == 4)) {
|
|
5083
|
-
if(!this.inObjectBlock() && !this.endsOrFollowsWithChar(line,59,this.index,{ fileName : "src/loreline/CodeToLorscript.hx", lineNumber :
|
|
5085
|
+
if(!this.inObjectBlock() && !this.endsOrFollowsWithChar(line,59,this.index,{ fileName : "src/loreline/CodeToLorscript.hx", lineNumber : 1099, className : "loreline.CodeToLorscript", methodName : "_add"})) {
|
|
5084
5086
|
this.currentPosOffset++;
|
|
5085
5087
|
this.output.b += String.fromCodePoint(59);
|
|
5086
5088
|
this.posOffsets.push(this.currentPosOffset);
|
|
@@ -5102,7 +5104,7 @@ class loreline_CodeToLorscript {
|
|
|
5102
5104
|
this.posOffsets.push(this.currentPosOffset);
|
|
5103
5105
|
}
|
|
5104
5106
|
}
|
|
5105
|
-
} else if(indent == 0 && !this.endsOrFollowsWithChar(line,59,this.index,{ fileName : "src/loreline/CodeToLorscript.hx", lineNumber :
|
|
5107
|
+
} else if(indent == 0 && !this.endsOrFollowsWithChar(line,59,this.index,{ fileName : "src/loreline/CodeToLorscript.hx", lineNumber : 1124, className : "loreline.CodeToLorscript", methodName : "_add"}) && !this.endsOrFollowsWithChar(line,44,this.index,{ fileName : "src/loreline/CodeToLorscript.hx", lineNumber : 1124, className : "loreline.CodeToLorscript", methodName : "_add"})) {
|
|
5106
5108
|
if(this.inObjectBlock()) {
|
|
5107
5109
|
this.currentPosOffset++;
|
|
5108
5110
|
this.output.b += String.fromCodePoint(44);
|
|
@@ -5172,7 +5174,7 @@ class loreline_CodeToLorscript {
|
|
|
5172
5174
|
}
|
|
5173
5175
|
}
|
|
5174
5176
|
error(message) {
|
|
5175
|
-
throw haxe_Exception.thrown(new loreline_Error(message,loreline_Position.fromContentAndIndex(this.
|
|
5177
|
+
throw haxe_Exception.thrown(new loreline_Error(message,loreline_Position.fromContentAndIndex(this.inputText,this.index)));
|
|
5176
5178
|
}
|
|
5177
5179
|
}
|
|
5178
5180
|
$hxClasses["loreline.CodeToLorscript"] = loreline_CodeToLorscript;
|
|
@@ -5185,6 +5187,9 @@ class loreline_Equal {
|
|
|
5185
5187
|
if(a == b) {
|
|
5186
5188
|
return true;
|
|
5187
5189
|
}
|
|
5190
|
+
if(a == null || b == null) {
|
|
5191
|
+
return false;
|
|
5192
|
+
}
|
|
5188
5193
|
if(loreline_Arrays.isArray(a)) {
|
|
5189
5194
|
if(loreline_Arrays.isArray(b)) {
|
|
5190
5195
|
return loreline_Equal.arrayEqual(interpreter,a,b);
|
|
@@ -5750,7 +5755,7 @@ class loreline_Functions {
|
|
|
5750
5755
|
return null;
|
|
5751
5756
|
}
|
|
5752
5757
|
has_beat(name) {
|
|
5753
|
-
if((
|
|
5758
|
+
if(loreline_RuntimeBeatRef.beatOf(name) != null) {
|
|
5754
5759
|
return true;
|
|
5755
5760
|
}
|
|
5756
5761
|
let nameStr = name;
|
|
@@ -5786,8 +5791,8 @@ class loreline_Functions {
|
|
|
5786
5791
|
--i;
|
|
5787
5792
|
}
|
|
5788
5793
|
return 0;
|
|
5789
|
-
} else if((
|
|
5790
|
-
return this.interpreter.getBeatVisitCount(name);
|
|
5794
|
+
} else if(loreline_RuntimeBeatRef.beatOf(name) != null) {
|
|
5795
|
+
return this.interpreter.getBeatVisitCount(loreline_RuntimeBeatRef.beatOf(name));
|
|
5791
5796
|
} else {
|
|
5792
5797
|
let beat = this.interpreter.resolveBeatByName(name);
|
|
5793
5798
|
if(beat == null) {
|
|
@@ -6871,11 +6876,12 @@ var loreline_RuntimeAccess = $hxEnums["loreline.RuntimeAccess"] = { __ename__:"l
|
|
|
6871
6876
|
,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"],$_)
|
|
6872
6877
|
,CharacterAccess: ($_=function(pos,name) { return {_hx_index:2,pos:pos,name:name,__enum__:"loreline.RuntimeAccess",toString:$estr}; },$_._hx_name="CharacterAccess",$_.__params__ = ["pos","name"],$_)
|
|
6873
6878
|
,FunctionAccess: ($_=function(pos,name) { return {_hx_index:3,pos:pos,name:name,__enum__:"loreline.RuntimeAccess",toString:$estr}; },$_._hx_name="FunctionAccess",$_.__params__ = ["pos","name"],$_)
|
|
6874
|
-
,BeatAccess: ($_=function(pos,
|
|
6879
|
+
,BeatAccess: ($_=function(pos,ref) { return {_hx_index:4,pos:pos,ref:ref,__enum__:"loreline.RuntimeAccess",toString:$estr}; },$_._hx_name="BeatAccess",$_.__params__ = ["pos","ref"],$_)
|
|
6875
6880
|
};
|
|
6876
6881
|
loreline_RuntimeAccess.__constructs__ = [loreline_RuntimeAccess.FieldAccess,loreline_RuntimeAccess.ArrayAccess,loreline_RuntimeAccess.CharacterAccess,loreline_RuntimeAccess.FunctionAccess,loreline_RuntimeAccess.BeatAccess];
|
|
6877
6882
|
class loreline_RuntimeScope {
|
|
6878
|
-
constructor(id,beat,node,beats,state,head,insertion) {
|
|
6883
|
+
constructor(id,beat,node,beats,state,head,insertion,captured) {
|
|
6884
|
+
this.captured = null;
|
|
6879
6885
|
this.insertion = null;
|
|
6880
6886
|
this.head = null;
|
|
6881
6887
|
this.state = null;
|
|
@@ -6898,6 +6904,9 @@ class loreline_RuntimeScope {
|
|
|
6898
6904
|
if(insertion != null) {
|
|
6899
6905
|
this.insertion = insertion;
|
|
6900
6906
|
}
|
|
6907
|
+
if(captured != null) {
|
|
6908
|
+
this.captured = captured;
|
|
6909
|
+
}
|
|
6901
6910
|
}
|
|
6902
6911
|
beatByName(name) {
|
|
6903
6912
|
if(this.beats == null) {
|
|
@@ -6920,6 +6929,35 @@ loreline_RuntimeScope.__name__ = "loreline.RuntimeScope";
|
|
|
6920
6929
|
Object.assign(loreline_RuntimeScope.prototype, {
|
|
6921
6930
|
__class__: loreline_RuntimeScope
|
|
6922
6931
|
});
|
|
6932
|
+
class loreline_RuntimeBeatRef {
|
|
6933
|
+
constructor(beat,stack) {
|
|
6934
|
+
this.beat = beat;
|
|
6935
|
+
this.stack = stack;
|
|
6936
|
+
}
|
|
6937
|
+
static beatOf(value) {
|
|
6938
|
+
if(((value) instanceof loreline_NBeatDecl)) {
|
|
6939
|
+
return value;
|
|
6940
|
+
}
|
|
6941
|
+
if(((value) instanceof loreline_RuntimeBeatRef)) {
|
|
6942
|
+
let ref = value;
|
|
6943
|
+
return ref.beat;
|
|
6944
|
+
}
|
|
6945
|
+
return null;
|
|
6946
|
+
}
|
|
6947
|
+
static beatNameOf(value) {
|
|
6948
|
+
let beat = loreline_RuntimeBeatRef.beatOf(value);
|
|
6949
|
+
if(beat != null) {
|
|
6950
|
+
return beat.name;
|
|
6951
|
+
} else {
|
|
6952
|
+
return null;
|
|
6953
|
+
}
|
|
6954
|
+
}
|
|
6955
|
+
}
|
|
6956
|
+
$hxClasses["loreline.RuntimeBeatRef"] = $hx_exports["loreline"]["RuntimeBeatRef"] = loreline_RuntimeBeatRef;
|
|
6957
|
+
loreline_RuntimeBeatRef.__name__ = "loreline.RuntimeBeatRef";
|
|
6958
|
+
Object.assign(loreline_RuntimeBeatRef.prototype, {
|
|
6959
|
+
__class__: loreline_RuntimeBeatRef
|
|
6960
|
+
});
|
|
6923
6961
|
class loreline_RuntimeInsertion {
|
|
6924
6962
|
constructor(id,origin) {
|
|
6925
6963
|
this.parentNextOptionIndex = 0;
|
|
@@ -6985,6 +7023,10 @@ Object.assign(loreline_EvalNext.prototype, {
|
|
|
6985
7023
|
});
|
|
6986
7024
|
class loreline_Interpreter {
|
|
6987
7025
|
constructor(script,handleDialogue,handleChoice,handleFinish,options) {
|
|
7026
|
+
this._restoreInsertionsCache = null;
|
|
7027
|
+
this._restoreSavedInsertions = null;
|
|
7028
|
+
this._serializingScopes = [];
|
|
7029
|
+
this._saveInsertions = null;
|
|
6988
7030
|
this._choiceEvalEnabled = [];
|
|
6989
7031
|
this._choiceEvalTexts = [];
|
|
6990
7032
|
this.pendingChoiceOptions = null;
|
|
@@ -7044,7 +7086,10 @@ class loreline_Interpreter {
|
|
|
7044
7086
|
}
|
|
7045
7087
|
}
|
|
7046
7088
|
get_currentInsertion() {
|
|
7047
|
-
|
|
7089
|
+
return this.insertionAtOrBelow(this.stack.length - 1);
|
|
7090
|
+
}
|
|
7091
|
+
insertionAtOrBelow(scopeLevel) {
|
|
7092
|
+
let i = scopeLevel;
|
|
7048
7093
|
while(i >= 0) {
|
|
7049
7094
|
let scope = this.stack[i];
|
|
7050
7095
|
if(scope.insertion != null) {
|
|
@@ -7138,6 +7183,7 @@ class loreline_Interpreter {
|
|
|
7138
7183
|
}
|
|
7139
7184
|
save() {
|
|
7140
7185
|
let insertions = { };
|
|
7186
|
+
this._saveInsertions = insertions;
|
|
7141
7187
|
let _g = [];
|
|
7142
7188
|
let _g1 = 0;
|
|
7143
7189
|
let _g2 = this.stack;
|
|
@@ -7175,6 +7221,7 @@ class loreline_Interpreter {
|
|
|
7175
7221
|
if(Reflect.fields(insertions).length > 0) {
|
|
7176
7222
|
result.insertions = insertions;
|
|
7177
7223
|
}
|
|
7224
|
+
this._saveInsertions = null;
|
|
7178
7225
|
return result;
|
|
7179
7226
|
}
|
|
7180
7227
|
restore(saveData) {
|
|
@@ -7188,10 +7235,12 @@ class loreline_Interpreter {
|
|
|
7188
7235
|
this.pendingChoiceOptions = null;
|
|
7189
7236
|
this._choiceEvalTexts.length = 0;
|
|
7190
7237
|
this._choiceEvalEnabled.length = 0;
|
|
7238
|
+
let restoredInsertions = new haxe_ds_IntMap();
|
|
7239
|
+
this._restoreSavedInsertions = saveData.insertions;
|
|
7240
|
+
this._restoreInsertionsCache = restoredInsertions;
|
|
7191
7241
|
this.restoreState(this.topLevelState,saveData.state);
|
|
7192
7242
|
this.restoreCharacters(saveData.characters);
|
|
7193
7243
|
this.restoreNodeStates(saveData.nodeStates);
|
|
7194
|
-
let restoredInsertions = new haxe_ds_IntMap();
|
|
7195
7244
|
if(!this.restoreStack(saveData.stack,saveData.insertions,restoredInsertions)) {
|
|
7196
7245
|
this.beatToResume = this.restoreBeatToResume(saveData.stack);
|
|
7197
7246
|
}
|
|
@@ -7220,6 +7269,8 @@ class loreline_Interpreter {
|
|
|
7220
7269
|
this._choiceEvalEnabled.push(entry.disabled != true);
|
|
7221
7270
|
}
|
|
7222
7271
|
}
|
|
7272
|
+
this._restoreSavedInsertions = null;
|
|
7273
|
+
this._restoreInsertionsCache = null;
|
|
7223
7274
|
}
|
|
7224
7275
|
resume() {
|
|
7225
7276
|
if(this.stack.length == 0) {
|
|
@@ -7257,25 +7308,50 @@ class loreline_Interpreter {
|
|
|
7257
7308
|
let fields = this.topLevelCharacters.h[character].fields;
|
|
7258
7309
|
loreline_Objects.setField(this,fields,name,value);
|
|
7259
7310
|
}
|
|
7260
|
-
|
|
7261
|
-
|
|
7311
|
+
eachResolutionScope(startIndex,visit) {
|
|
7312
|
+
this.walkResolutionScopes(this.stack,startIndex == -1 ? this.stack.length - 1 : startIndex,visit);
|
|
7313
|
+
}
|
|
7314
|
+
walkResolutionScopes(scopes,startIndex,visit) {
|
|
7315
|
+
let i = startIndex;
|
|
7262
7316
|
while(i >= 0) {
|
|
7263
|
-
let scope =
|
|
7317
|
+
let scope = scopes[i];
|
|
7318
|
+
if(visit(scope)) {
|
|
7319
|
+
return;
|
|
7320
|
+
}
|
|
7321
|
+
if(scope.captured != null) {
|
|
7322
|
+
this.walkResolutionScopes(scope.captured,scope.captured.length - 1,visit);
|
|
7323
|
+
return;
|
|
7324
|
+
}
|
|
7325
|
+
--i;
|
|
7326
|
+
}
|
|
7327
|
+
}
|
|
7328
|
+
getStateField(name) {
|
|
7329
|
+
let found = false;
|
|
7330
|
+
let result = null;
|
|
7331
|
+
let _gthis = this;
|
|
7332
|
+
this.eachResolutionScope(-1,function(scope) {
|
|
7264
7333
|
if(scope.state != null) {
|
|
7265
|
-
if(loreline_Objects.fieldExists(
|
|
7266
|
-
|
|
7334
|
+
if(loreline_Objects.fieldExists(_gthis,scope.state.fields,name)) {
|
|
7335
|
+
result = loreline_Objects.getField(_gthis,scope.state.fields,name);
|
|
7336
|
+
found = true;
|
|
7337
|
+
return true;
|
|
7267
7338
|
}
|
|
7268
7339
|
}
|
|
7269
7340
|
if(scope.node != null) {
|
|
7270
7341
|
let key = scope.node.id.thisVal;
|
|
7271
|
-
let stateInNode =
|
|
7342
|
+
let stateInNode = _gthis.nodeStates.map._get(key.high,key.low);
|
|
7272
7343
|
if(stateInNode != null) {
|
|
7273
|
-
if(loreline_Objects.fieldExists(
|
|
7274
|
-
|
|
7344
|
+
if(loreline_Objects.fieldExists(_gthis,stateInNode.fields,name)) {
|
|
7345
|
+
result = loreline_Objects.getField(_gthis,stateInNode.fields,name);
|
|
7346
|
+
found = true;
|
|
7347
|
+
return true;
|
|
7275
7348
|
}
|
|
7276
7349
|
}
|
|
7277
7350
|
}
|
|
7278
|
-
|
|
7351
|
+
return false;
|
|
7352
|
+
});
|
|
7353
|
+
if(found) {
|
|
7354
|
+
return result;
|
|
7279
7355
|
}
|
|
7280
7356
|
if(loreline_Objects.fieldExists(this,this.topLevelState.fields,name)) {
|
|
7281
7357
|
return loreline_Objects.getField(this,this.topLevelState.fields,name);
|
|
@@ -7283,26 +7359,31 @@ class loreline_Interpreter {
|
|
|
7283
7359
|
return null;
|
|
7284
7360
|
}
|
|
7285
7361
|
setStateField(name,value) {
|
|
7286
|
-
let
|
|
7287
|
-
|
|
7288
|
-
|
|
7362
|
+
let done = false;
|
|
7363
|
+
let _gthis = this;
|
|
7364
|
+
this.eachResolutionScope(-1,function(scope) {
|
|
7289
7365
|
if(scope.state != null) {
|
|
7290
|
-
if(loreline_Objects.fieldExists(
|
|
7291
|
-
loreline_Objects.setField(
|
|
7292
|
-
|
|
7366
|
+
if(loreline_Objects.fieldExists(_gthis,scope.state.fields,name)) {
|
|
7367
|
+
loreline_Objects.setField(_gthis,scope.state.fields,name,value);
|
|
7368
|
+
done = true;
|
|
7369
|
+
return true;
|
|
7293
7370
|
}
|
|
7294
7371
|
}
|
|
7295
7372
|
if(scope.node != null) {
|
|
7296
7373
|
let key = scope.node.id.thisVal;
|
|
7297
|
-
let stateInNode =
|
|
7374
|
+
let stateInNode = _gthis.nodeStates.map._get(key.high,key.low);
|
|
7298
7375
|
if(stateInNode != null) {
|
|
7299
|
-
if(loreline_Objects.fieldExists(
|
|
7300
|
-
loreline_Objects.setField(
|
|
7301
|
-
|
|
7376
|
+
if(loreline_Objects.fieldExists(_gthis,stateInNode.fields,name)) {
|
|
7377
|
+
loreline_Objects.setField(_gthis,stateInNode.fields,name,value);
|
|
7378
|
+
done = true;
|
|
7379
|
+
return true;
|
|
7302
7380
|
}
|
|
7303
7381
|
}
|
|
7304
7382
|
}
|
|
7305
|
-
|
|
7383
|
+
return false;
|
|
7384
|
+
});
|
|
7385
|
+
if(done) {
|
|
7386
|
+
return;
|
|
7306
7387
|
}
|
|
7307
7388
|
loreline_Objects.setField(this,this.topLevelState.fields,name,value);
|
|
7308
7389
|
}
|
|
@@ -7332,6 +7413,7 @@ class loreline_Interpreter {
|
|
|
7332
7413
|
}
|
|
7333
7414
|
serializeScope(scope,insertions) {
|
|
7334
7415
|
let result = { id : scope.id};
|
|
7416
|
+
this._serializingScopes.push(scope);
|
|
7335
7417
|
if(scope.beat != null) {
|
|
7336
7418
|
result.beat = this.serializeBeatReference(scope.beat);
|
|
7337
7419
|
}
|
|
@@ -7358,6 +7440,18 @@ class loreline_Interpreter {
|
|
|
7358
7440
|
if(scope.insertion != null) {
|
|
7359
7441
|
result.insertion = this.serializeInsertion(scope.insertion,insertions);
|
|
7360
7442
|
}
|
|
7443
|
+
if(scope.captured != null) {
|
|
7444
|
+
let _g = [];
|
|
7445
|
+
let _g1 = 0;
|
|
7446
|
+
let _g2 = scope.captured;
|
|
7447
|
+
while(_g1 < _g2.length) {
|
|
7448
|
+
let captured = _g2[_g1];
|
|
7449
|
+
++_g1;
|
|
7450
|
+
_g.push(this.serializeScope(captured,insertions));
|
|
7451
|
+
}
|
|
7452
|
+
result.captured = _g;
|
|
7453
|
+
}
|
|
7454
|
+
this._serializingScopes.pop();
|
|
7361
7455
|
return result;
|
|
7362
7456
|
}
|
|
7363
7457
|
serializeInsertion(insertion,insertions) {
|
|
@@ -7529,6 +7623,17 @@ class loreline_Interpreter {
|
|
|
7529
7623
|
result[key] = this.serializeValue(value);
|
|
7530
7624
|
}
|
|
7531
7625
|
}
|
|
7626
|
+
} else if(js_Boot.getClass(fields) == null) {
|
|
7627
|
+
let _g = 0;
|
|
7628
|
+
let _g1 = Reflect.fields(fields);
|
|
7629
|
+
while(_g < _g1.length) {
|
|
7630
|
+
let key = _g1[_g];
|
|
7631
|
+
++_g;
|
|
7632
|
+
let value = Reflect.field(fields,key);
|
|
7633
|
+
if(originalFields == null || !loreline_Objects.fieldExists(this,originalFields,key) || !loreline_Equal.equal(this,loreline_Objects.getField(this,originalFields,key),value)) {
|
|
7634
|
+
result[key] = this.serializeValue(value);
|
|
7635
|
+
}
|
|
7636
|
+
}
|
|
7532
7637
|
} else {
|
|
7533
7638
|
let cls = js_Boot.getClass(fields);
|
|
7534
7639
|
if(cls != null) {
|
|
@@ -7569,6 +7674,39 @@ class loreline_Interpreter {
|
|
|
7569
7674
|
}
|
|
7570
7675
|
return arr;
|
|
7571
7676
|
}
|
|
7677
|
+
let asBeat = loreline_RuntimeBeatRef.beatOf(value);
|
|
7678
|
+
if(asBeat != null) {
|
|
7679
|
+
let serializedRef = { type : "$beatRef", beat : this.serializeBeatReference(asBeat)};
|
|
7680
|
+
if(((value) instanceof loreline_RuntimeBeatRef)) {
|
|
7681
|
+
let ref = value;
|
|
7682
|
+
if(ref.stack.length > 0) {
|
|
7683
|
+
let cyclic = false;
|
|
7684
|
+
let _g = 0;
|
|
7685
|
+
let _g1 = ref.stack;
|
|
7686
|
+
while(_g < _g1.length) {
|
|
7687
|
+
let captured = _g1[_g];
|
|
7688
|
+
++_g;
|
|
7689
|
+
if(this._serializingScopes.indexOf(captured) != -1) {
|
|
7690
|
+
cyclic = true;
|
|
7691
|
+
break;
|
|
7692
|
+
}
|
|
7693
|
+
}
|
|
7694
|
+
if(!cyclic) {
|
|
7695
|
+
let insertions = this._saveInsertions != null ? this._saveInsertions : { };
|
|
7696
|
+
let _g = [];
|
|
7697
|
+
let _g1 = 0;
|
|
7698
|
+
let _g2 = ref.stack;
|
|
7699
|
+
while(_g1 < _g2.length) {
|
|
7700
|
+
let captured = _g2[_g1];
|
|
7701
|
+
++_g1;
|
|
7702
|
+
_g.push(this.serializeScope(captured,insertions));
|
|
7703
|
+
}
|
|
7704
|
+
serializedRef.stack = _g;
|
|
7705
|
+
}
|
|
7706
|
+
}
|
|
7707
|
+
}
|
|
7708
|
+
return serializedRef;
|
|
7709
|
+
}
|
|
7572
7710
|
return this.serializeFields(value);
|
|
7573
7711
|
}
|
|
7574
7712
|
resumeNode(node,scopeLevel,next) {
|
|
@@ -7579,6 +7717,9 @@ class loreline_Interpreter {
|
|
|
7579
7717
|
case loreline_NAlternative:
|
|
7580
7718
|
this.resumeAlternative(node,scopeLevel,next);
|
|
7581
7719
|
break;
|
|
7720
|
+
case loreline_NBeatCall:
|
|
7721
|
+
this.resumeBeatCall(node,scopeLevel,next);
|
|
7722
|
+
break;
|
|
7582
7723
|
case loreline_NBeatDecl:
|
|
7583
7724
|
this.resumeBeatRun(node,scopeLevel,next);
|
|
7584
7725
|
break;
|
|
@@ -7608,6 +7749,9 @@ class loreline_Interpreter {
|
|
|
7608
7749
|
case loreline_NAlternative:
|
|
7609
7750
|
this.evalAlternative(node,next);
|
|
7610
7751
|
break;
|
|
7752
|
+
case loreline_NBeatCall:
|
|
7753
|
+
this.evalBeatCall(node,next);
|
|
7754
|
+
break;
|
|
7611
7755
|
case loreline_NCall:
|
|
7612
7756
|
if(!this.isBeatCall(node)) {
|
|
7613
7757
|
this.evalCall(node,next);
|
|
@@ -7645,7 +7789,7 @@ class loreline_Interpreter {
|
|
|
7645
7789
|
throw haxe_Exception.thrown(new loreline_RuntimeError("Failed to resolve head in scope when resuming through body",node.pos));
|
|
7646
7790
|
}
|
|
7647
7791
|
}
|
|
7648
|
-
let currentInsertion = this.
|
|
7792
|
+
let currentInsertion = this.insertionAtOrBelow(scopeLevel);
|
|
7649
7793
|
let moveNext = null;
|
|
7650
7794
|
let _gthis = this;
|
|
7651
7795
|
moveNext = function() {
|
|
@@ -7688,13 +7832,23 @@ class loreline_Interpreter {
|
|
|
7688
7832
|
if(scopeLevel + 1 < this.stack.length) {
|
|
7689
7833
|
this.resumeNodeBody(option,scopeLevel + 1,option.body,next);
|
|
7690
7834
|
} else {
|
|
7691
|
-
this.evalNodeBody(currentScope.beat,option,option.body,null,next);
|
|
7835
|
+
this.evalNodeBody(currentScope.beat,option,option.body,null,null,null,next);
|
|
7692
7836
|
}
|
|
7693
7837
|
} else if(currentScope.insertion != null) {
|
|
7694
7838
|
let insertionNode = currentScope.node;
|
|
7695
7839
|
let insertion = currentScope.insertion;
|
|
7696
7840
|
if(((insertionNode) instanceof loreline_NBeatDecl)) {
|
|
7697
7841
|
let beat = insertionNode;
|
|
7842
|
+
let isRootPhase1 = true;
|
|
7843
|
+
let _g = 0;
|
|
7844
|
+
let _g1 = scopeLevel;
|
|
7845
|
+
while(_g < _g1) {
|
|
7846
|
+
let i = _g++;
|
|
7847
|
+
if(this.stack[i].insertion != null) {
|
|
7848
|
+
isRootPhase1 = false;
|
|
7849
|
+
break;
|
|
7850
|
+
}
|
|
7851
|
+
}
|
|
7698
7852
|
this.resumeNodeBody(beat,scopeLevel,beat.body,function() {
|
|
7699
7853
|
let options = insertion.parentPartialOptions != null ? insertion.parentPartialOptions : [];
|
|
7700
7854
|
if(insertion.options != null) {
|
|
@@ -7711,7 +7865,7 @@ class loreline_Interpreter {
|
|
|
7711
7865
|
let optionsDone = _gthis.wrapNext(function() {
|
|
7712
7866
|
_gthis.presentChoice(choice,options,next);
|
|
7713
7867
|
});
|
|
7714
|
-
_gthis.evalChoiceOptionsAndInsertions(parentBeat,choice,options,optionsDone.cb,nextIndex,
|
|
7868
|
+
_gthis.evalChoiceOptionsAndInsertions(parentBeat,choice,options,optionsDone.cb,nextIndex,isRootPhase1);
|
|
7715
7869
|
optionsDone.sync = false;
|
|
7716
7870
|
});
|
|
7717
7871
|
} else {
|
|
@@ -7759,32 +7913,20 @@ class loreline_Interpreter {
|
|
|
7759
7913
|
throw haxe_Exception.thrown(new loreline_RuntimeError("Failed to resume alternative: head not found in any item",alt.pos));
|
|
7760
7914
|
}
|
|
7761
7915
|
resumeCall(call,scopeLevel,next) {
|
|
7762
|
-
|
|
7763
|
-
|
|
7764
|
-
|
|
7765
|
-
|
|
7766
|
-
let resolvedBeat = null;
|
|
7767
|
-
let i = this.stack.length - 1;
|
|
7768
|
-
while(i >= 0) {
|
|
7769
|
-
let scope = this.stack[i];
|
|
7770
|
-
let beatInScope = scope.beatByName(beatName);
|
|
7771
|
-
if(beatInScope != null) {
|
|
7772
|
-
resolvedBeat = beatInScope;
|
|
7773
|
-
break;
|
|
7774
|
-
}
|
|
7775
|
-
--i;
|
|
7776
|
-
}
|
|
7777
|
-
if(resolvedBeat == null && Object.prototype.hasOwnProperty.call(this.topLevelBeats.h,beatName)) {
|
|
7778
|
-
resolvedBeat = this.topLevelBeats.h[beatName];
|
|
7779
|
-
}
|
|
7780
|
-
if(resolvedBeat != null) {
|
|
7781
|
-
this.resumeBeatRun(resolvedBeat,scopeLevel,next);
|
|
7782
|
-
return;
|
|
7783
|
-
}
|
|
7784
|
-
}
|
|
7916
|
+
let resolvedRef = this.resolveBeatRefFromCall(call);
|
|
7917
|
+
if(resolvedRef != null) {
|
|
7918
|
+
this.resumeBeatRun(resolvedRef.beat,scopeLevel,next);
|
|
7919
|
+
return;
|
|
7785
7920
|
}
|
|
7786
7921
|
throw haxe_Exception.thrown(new loreline_RuntimeError("Cannot resume through a function call that is not at the bottom of the stack",call.pos));
|
|
7787
7922
|
}
|
|
7923
|
+
resumeBeatCall(call,scopeLevel,next) {
|
|
7924
|
+
if(scopeLevel >= 0 && scopeLevel < this.stack.length && ((this.stack[scopeLevel].node) instanceof loreline_NBeatDecl)) {
|
|
7925
|
+
this.resumeBeatRun(this.stack[scopeLevel].node,scopeLevel,next);
|
|
7926
|
+
return;
|
|
7927
|
+
}
|
|
7928
|
+
throw haxe_Exception.thrown(new loreline_RuntimeError("Cannot resume through a beat call that is not at the bottom of the stack",call.pos));
|
|
7929
|
+
}
|
|
7788
7930
|
restoreStack(savedStack,savedInsertions,restoredInsertions) {
|
|
7789
7931
|
let result = [];
|
|
7790
7932
|
if(restoredInsertions == null) {
|
|
@@ -7842,7 +7984,22 @@ class loreline_Interpreter {
|
|
|
7842
7984
|
if(savedScope.insertion != null && savedInsertions != null) {
|
|
7843
7985
|
insertion = this.restoreInsertion(savedScope.insertion,savedInsertions,restoredInsertions);
|
|
7844
7986
|
}
|
|
7845
|
-
|
|
7987
|
+
let captured = null;
|
|
7988
|
+
if(savedScope.captured != null) {
|
|
7989
|
+
captured = [];
|
|
7990
|
+
let _g = 0;
|
|
7991
|
+
let _g1 = savedScope.captured;
|
|
7992
|
+
while(_g < _g1.length) {
|
|
7993
|
+
let savedCaptured = _g1[_g];
|
|
7994
|
+
++_g;
|
|
7995
|
+
let capturedScope = this.restoreScopeItem(savedCaptured,savedInsertions,restoredInsertions);
|
|
7996
|
+
if(capturedScope == null) {
|
|
7997
|
+
return null;
|
|
7998
|
+
}
|
|
7999
|
+
captured.push(capturedScope);
|
|
8000
|
+
}
|
|
8001
|
+
}
|
|
8002
|
+
return new loreline_RuntimeScope(null,beat,node,beats,state,head,insertion,captured);
|
|
7846
8003
|
}
|
|
7847
8004
|
restoreInsertion(insertionId,savedInsertions,restoredInsertions) {
|
|
7848
8005
|
if(restoredInsertions.h.hasOwnProperty(insertionId)) {
|
|
@@ -8065,6 +8222,31 @@ class loreline_Interpreter {
|
|
|
8065
8222
|
}
|
|
8066
8223
|
return arr;
|
|
8067
8224
|
}
|
|
8225
|
+
if(Reflect.field(value,"type") == "$beatRef") {
|
|
8226
|
+
let savedRef = value;
|
|
8227
|
+
let beat = this.restoreBeat(savedRef.beat);
|
|
8228
|
+
if(beat == null) {
|
|
8229
|
+
return null;
|
|
8230
|
+
}
|
|
8231
|
+
let chain = [];
|
|
8232
|
+
if(savedRef.stack != null) {
|
|
8233
|
+
let savedInsertions = this._restoreSavedInsertions != null ? this._restoreSavedInsertions : { };
|
|
8234
|
+
let cache = this._restoreInsertionsCache != null ? this._restoreInsertionsCache : new haxe_ds_IntMap();
|
|
8235
|
+
let _g = 0;
|
|
8236
|
+
let _g1 = savedRef.stack;
|
|
8237
|
+
while(_g < _g1.length) {
|
|
8238
|
+
let savedScope = _g1[_g];
|
|
8239
|
+
++_g;
|
|
8240
|
+
let scope = this.restoreScopeItem(savedScope,savedInsertions,cache);
|
|
8241
|
+
if(scope == null) {
|
|
8242
|
+
chain = [];
|
|
8243
|
+
break;
|
|
8244
|
+
}
|
|
8245
|
+
chain.push(scope);
|
|
8246
|
+
}
|
|
8247
|
+
}
|
|
8248
|
+
return new loreline_RuntimeBeatRef(beat,chain);
|
|
8249
|
+
}
|
|
8068
8250
|
return this.restoreFields(null,value);
|
|
8069
8251
|
}
|
|
8070
8252
|
initializeTopLevelFunctions(functions) {
|
|
@@ -8282,13 +8464,52 @@ class loreline_Interpreter {
|
|
|
8282
8464
|
}
|
|
8283
8465
|
}
|
|
8284
8466
|
}
|
|
8467
|
+
evaluateBeatArgs(beat,args,pos) {
|
|
8468
|
+
if(args == null || args.length == 0) {
|
|
8469
|
+
return null;
|
|
8470
|
+
}
|
|
8471
|
+
let numParams = beat.params != null ? beat.params.length : 0;
|
|
8472
|
+
if(args.length > numParams) {
|
|
8473
|
+
throw haxe_Exception.thrown(new loreline_RuntimeError("Beat " + beat.name + " expects at most " + numParams + " argument(s), got " + args.length,pos));
|
|
8474
|
+
}
|
|
8475
|
+
let _g = [];
|
|
8476
|
+
let _g1 = 0;
|
|
8477
|
+
while(_g1 < args.length) {
|
|
8478
|
+
let arg = args[_g1];
|
|
8479
|
+
++_g1;
|
|
8480
|
+
_g.push(this.evaluateExpression(arg));
|
|
8481
|
+
}
|
|
8482
|
+
return _g;
|
|
8483
|
+
}
|
|
8484
|
+
seedBeatParams(scope,beat,values) {
|
|
8485
|
+
let params = beat.params;
|
|
8486
|
+
if(params == null || params.length == 0) {
|
|
8487
|
+
return;
|
|
8488
|
+
}
|
|
8489
|
+
if(scope.state == null) {
|
|
8490
|
+
scope.state = new loreline_RuntimeState(this,beat,null,null);
|
|
8491
|
+
}
|
|
8492
|
+
let _g = 0;
|
|
8493
|
+
let _g1 = params.length;
|
|
8494
|
+
while(_g < _g1) {
|
|
8495
|
+
let i = _g++;
|
|
8496
|
+
let param = params[i];
|
|
8497
|
+
let value = null;
|
|
8498
|
+
if(values != null && i < values.length) {
|
|
8499
|
+
value = values[i];
|
|
8500
|
+
} else if(param.defaultValue != null) {
|
|
8501
|
+
value = this.evaluateExpression(param.defaultValue);
|
|
8502
|
+
}
|
|
8503
|
+
loreline_Objects.setField(this,scope.state.fields,param.name,value);
|
|
8504
|
+
}
|
|
8505
|
+
}
|
|
8285
8506
|
finish() {
|
|
8286
8507
|
this.finishTrigger = null;
|
|
8287
8508
|
if(this.handleFinish != null) {
|
|
8288
8509
|
this.handleFinish(this);
|
|
8289
8510
|
}
|
|
8290
8511
|
}
|
|
8291
|
-
transitionToBeat(beat) {
|
|
8512
|
+
transitionToBeat(beat,argValues,capturedChain) {
|
|
8292
8513
|
while(this.pop()) {
|
|
8293
8514
|
}
|
|
8294
8515
|
this.nextScopeId = 1;
|
|
@@ -8298,7 +8519,7 @@ class loreline_Interpreter {
|
|
|
8298
8519
|
this._choiceEvalEnabled.length = 0;
|
|
8299
8520
|
let done = this.wrapNext($bind(this,this.finish));
|
|
8300
8521
|
this.finishTrigger = done;
|
|
8301
|
-
this.evalBeatRun(beat,done.cb);
|
|
8522
|
+
this.evalBeatRun(beat,done.cb,argValues,capturedChain);
|
|
8302
8523
|
done.sync = false;
|
|
8303
8524
|
}
|
|
8304
8525
|
evalNode(node,next) {
|
|
@@ -8309,6 +8530,9 @@ class loreline_Interpreter {
|
|
|
8309
8530
|
case loreline_NAssign:
|
|
8310
8531
|
this.evalAssignment(node,next);
|
|
8311
8532
|
break;
|
|
8533
|
+
case loreline_NBeatCall:
|
|
8534
|
+
this.evalBeatCall(node,next);
|
|
8535
|
+
break;
|
|
8312
8536
|
case loreline_NBeatDecl:
|
|
8313
8537
|
this.evalBeatDecl(node,next);
|
|
8314
8538
|
break;
|
|
@@ -8350,8 +8574,14 @@ class loreline_Interpreter {
|
|
|
8350
8574
|
this.get_currentScope().beats.push(beat);
|
|
8351
8575
|
next();
|
|
8352
8576
|
}
|
|
8353
|
-
evalNodeBody(beat,node,body,insertion,next) {
|
|
8354
|
-
this.push(new loreline_RuntimeScope(null,beat,node,null,null,null,insertion));
|
|
8577
|
+
evalNodeBody(beat,node,body,insertion,argValues,capturedChain,next) {
|
|
8578
|
+
this.push(new loreline_RuntimeScope(null,beat,node,null,null,null,insertion,null));
|
|
8579
|
+
if(node == beat && beat != null && beat.params != null) {
|
|
8580
|
+
this.seedBeatParams(this.get_currentScope(),beat,argValues);
|
|
8581
|
+
}
|
|
8582
|
+
if(node == beat && beat != null && capturedChain != null && capturedChain.length > 0) {
|
|
8583
|
+
this.get_currentScope().captured = capturedChain;
|
|
8584
|
+
}
|
|
8355
8585
|
let index = 0;
|
|
8356
8586
|
let moveNext = null;
|
|
8357
8587
|
let currentInsertion = this.get_currentInsertion();
|
|
@@ -8374,9 +8604,9 @@ class loreline_Interpreter {
|
|
|
8374
8604
|
};
|
|
8375
8605
|
moveNext();
|
|
8376
8606
|
}
|
|
8377
|
-
evalBeatRun(beat,next) {
|
|
8607
|
+
evalBeatRun(beat,next,argValues,capturedChain) {
|
|
8378
8608
|
this.incrementBeatVisitCount(beat);
|
|
8379
|
-
this.evalNodeBody(beat,beat,beat.body,null,next);
|
|
8609
|
+
this.evalNodeBody(beat,beat,beat.body,null,argValues,capturedChain,next);
|
|
8380
8610
|
}
|
|
8381
8611
|
evalStateDecl(state,next) {
|
|
8382
8612
|
this.initializeState(state,this.get_currentScope());
|
|
@@ -8473,7 +8703,7 @@ class loreline_Interpreter {
|
|
|
8473
8703
|
_gthis.stack.push(scope);
|
|
8474
8704
|
}
|
|
8475
8705
|
let lastScope = _gthis.stack[_gthis.stack.length - 1];
|
|
8476
|
-
_gthis.push(new loreline_RuntimeScope(null,lastScope.beat,_gthis.lens.getParentNode(option.node),null,null,option.node,null));
|
|
8706
|
+
_gthis.push(new loreline_RuntimeScope(null,lastScope.beat,_gthis.lens.getParentNode(option.node),null,null,option.node,null,null));
|
|
8477
8707
|
_gthis.resumeFromLevel(scopeLevel,wrappedNext);
|
|
8478
8708
|
} else {
|
|
8479
8709
|
_gthis.evalChoiceOption(option.node,wrappedNext);
|
|
@@ -8517,10 +8747,6 @@ class loreline_Interpreter {
|
|
|
8517
8747
|
let i = _g++;
|
|
8518
8748
|
let opt = insertion.options[i];
|
|
8519
8749
|
result.push(opt);
|
|
8520
|
-
if(isChoiceRoot) {
|
|
8521
|
-
_gthis._choiceEvalTexts.push(opt.text);
|
|
8522
|
-
_gthis._choiceEvalEnabled.push(opt.enabled);
|
|
8523
|
-
}
|
|
8524
8750
|
}
|
|
8525
8751
|
insertion = null;
|
|
8526
8752
|
}
|
|
@@ -8534,10 +8760,8 @@ class loreline_Interpreter {
|
|
|
8534
8760
|
let str = _gthis.getTranslatedString(option,option.text);
|
|
8535
8761
|
let content = _gthis.evaluateString(str);
|
|
8536
8762
|
result.push(new loreline_ChoiceOption(content.text,content.tags,enabled,option,_gthis.get_currentInsertion()));
|
|
8537
|
-
|
|
8538
|
-
|
|
8539
|
-
_gthis._choiceEvalEnabled.push(enabled);
|
|
8540
|
-
}
|
|
8763
|
+
_gthis._choiceEvalTexts.push(content.text);
|
|
8764
|
+
_gthis._choiceEvalEnabled.push(enabled);
|
|
8541
8765
|
done.cb();
|
|
8542
8766
|
done.sync = false;
|
|
8543
8767
|
} else if(option.insertion != null) {
|
|
@@ -8561,36 +8785,36 @@ class loreline_Interpreter {
|
|
|
8561
8785
|
moveNext();
|
|
8562
8786
|
}
|
|
8563
8787
|
evalInsertion(insertion,next) {
|
|
8564
|
-
let
|
|
8565
|
-
let
|
|
8566
|
-
|
|
8567
|
-
|
|
8568
|
-
|
|
8569
|
-
|
|
8570
|
-
|
|
8571
|
-
|
|
8572
|
-
|
|
8573
|
-
|
|
8574
|
-
--i;
|
|
8575
|
-
}
|
|
8576
|
-
if(resolvedBeat == null) {
|
|
8577
|
-
if(Object.prototype.hasOwnProperty.call(this.topLevelBeats.h,beatName)) {
|
|
8578
|
-
resolvedBeat = this.topLevelBeats.h[beatName];
|
|
8788
|
+
let origin = insertion.origin;
|
|
8789
|
+
let resolvedRef = null;
|
|
8790
|
+
if(origin.targetExpr != null) {
|
|
8791
|
+
let value = this.evaluateExpression(origin.targetExpr);
|
|
8792
|
+
resolvedRef = this.resolveDynamicBeatTarget(value,origin);
|
|
8793
|
+
} else {
|
|
8794
|
+
let beatName = origin.target;
|
|
8795
|
+
resolvedRef = this.resolveBeatRefFromNode(beatName,origin);
|
|
8796
|
+
if(resolvedRef == null) {
|
|
8797
|
+
throw haxe_Exception.thrown(this.beatNotFoundError(beatName,origin));
|
|
8579
8798
|
}
|
|
8580
8799
|
}
|
|
8581
|
-
|
|
8582
|
-
|
|
8583
|
-
|
|
8584
|
-
|
|
8800
|
+
let resolvedBeat = resolvedRef.beat;
|
|
8801
|
+
let argValues = this.evaluateBeatArgs(resolvedBeat,origin.args,origin.pos);
|
|
8802
|
+
this.evalNodeBody(resolvedBeat,resolvedBeat,resolvedBeat.body,insertion,argValues,resolvedRef.stack.length > 0 ? resolvedRef.stack : null,next);
|
|
8803
|
+
}
|
|
8804
|
+
evalBeatCall(call,next) {
|
|
8805
|
+
let value = this.evaluateExpression(call.targetExpr);
|
|
8806
|
+
let resolvedRef = this.resolveDynamicBeatTarget(value,call);
|
|
8807
|
+
let argValues = this.evaluateBeatArgs(resolvedRef.beat,call.args,call.pos);
|
|
8808
|
+
this.evalBeatRun(resolvedRef.beat,next,argValues,resolvedRef.stack.length > 0 ? resolvedRef.stack : null);
|
|
8585
8809
|
}
|
|
8586
8810
|
evalChoiceOption(option,next) {
|
|
8587
|
-
this.evalNodeBody(this.get_currentScope().beat,option,option.body,null,next);
|
|
8811
|
+
this.evalNodeBody(this.get_currentScope().beat,option,option.body,null,null,null,next);
|
|
8588
8812
|
}
|
|
8589
8813
|
evalIf(ifStmt,next) {
|
|
8590
8814
|
let isTrue = this.evaluateCondition(ifStmt.condition);
|
|
8591
8815
|
let branch = isTrue ? ifStmt.thenBranch : ifStmt.elseBranch;
|
|
8592
8816
|
if(branch != null && branch.body.length > 0) {
|
|
8593
|
-
this.evalNodeBody(this.get_currentScope().beat,branch,branch.body,null,next);
|
|
8817
|
+
this.evalNodeBody(this.get_currentScope().beat,branch,branch.body,null,null,null,next);
|
|
8594
8818
|
} else {
|
|
8595
8819
|
next();
|
|
8596
8820
|
}
|
|
@@ -8606,14 +8830,14 @@ class loreline_Interpreter {
|
|
|
8606
8830
|
let idx = visitCount < alt.items.length ? visitCount : alt.items.length - 1;
|
|
8607
8831
|
this.setAlternativeVisitCount(alt,visitCount + 1);
|
|
8608
8832
|
let item = alt.items[idx];
|
|
8609
|
-
this.evalNodeBody(this.get_currentScope().beat,item,item.body,null,next);
|
|
8833
|
+
this.evalNodeBody(this.get_currentScope().beat,item,item.body,null,null,null,next);
|
|
8610
8834
|
break;
|
|
8611
8835
|
case 1:
|
|
8612
8836
|
let visitCount1 = this.getAlternativeVisitCount(alt);
|
|
8613
8837
|
let idx1 = visitCount1 % alt.items.length;
|
|
8614
8838
|
this.setAlternativeVisitCount(alt,visitCount1 + 1);
|
|
8615
8839
|
let item1 = alt.items[idx1];
|
|
8616
|
-
this.evalNodeBody(this.get_currentScope().beat,item1,item1.body,null,next);
|
|
8840
|
+
this.evalNodeBody(this.get_currentScope().beat,item1,item1.body,null,null,null,next);
|
|
8617
8841
|
break;
|
|
8618
8842
|
case 2:
|
|
8619
8843
|
let visitCount2 = this.getAlternativeVisitCount(alt);
|
|
@@ -8623,12 +8847,12 @@ class loreline_Interpreter {
|
|
|
8623
8847
|
}
|
|
8624
8848
|
this.setAlternativeVisitCount(alt,visitCount2 + 1);
|
|
8625
8849
|
let item2 = alt.items[visitCount2];
|
|
8626
|
-
this.evalNodeBody(this.get_currentScope().beat,item2,item2.body,null,next);
|
|
8850
|
+
this.evalNodeBody(this.get_currentScope().beat,item2,item2.body,null,null,null,next);
|
|
8627
8851
|
break;
|
|
8628
8852
|
case 3:
|
|
8629
8853
|
let idx2 = this.builtins.random(0,alt.items.length - 1);
|
|
8630
8854
|
let item3 = alt.items[idx2];
|
|
8631
|
-
this.evalNodeBody(this.get_currentScope().beat,item3,item3.body,null,next);
|
|
8855
|
+
this.evalNodeBody(this.get_currentScope().beat,item3,item3.body,null,null,null,next);
|
|
8632
8856
|
break;
|
|
8633
8857
|
case 4:
|
|
8634
8858
|
let _g = [];
|
|
@@ -8658,7 +8882,7 @@ class loreline_Interpreter {
|
|
|
8658
8882
|
}
|
|
8659
8883
|
let item = alt.items[indices[idx]];
|
|
8660
8884
|
let _gthis = this;
|
|
8661
|
-
this.evalNodeBody(this.get_currentScope().beat,item,item.body,null,function() {
|
|
8885
|
+
this.evalNodeBody(this.get_currentScope().beat,item,item.body,null,null,null,function() {
|
|
8662
8886
|
_gthis.evalShuffledItems(alt,indices,idx + 1,next);
|
|
8663
8887
|
});
|
|
8664
8888
|
}
|
|
@@ -8835,7 +9059,16 @@ class loreline_Interpreter {
|
|
|
8835
9059
|
scopeLevel = -1;
|
|
8836
9060
|
}
|
|
8837
9061
|
if(((node) instanceof loreline_NCall)) {
|
|
8838
|
-
return this.
|
|
9062
|
+
return this.resolveBeatRefFromCall(node) != null;
|
|
9063
|
+
}
|
|
9064
|
+
return false;
|
|
9065
|
+
}
|
|
9066
|
+
isDynamicCallForm(call) {
|
|
9067
|
+
if(((call.target) instanceof loreline_NAccess)) {
|
|
9068
|
+
let access = call.target;
|
|
9069
|
+
if(access.target == null && access.name == "call") {
|
|
9070
|
+
return !this.resolvesExistingBinding("call");
|
|
9071
|
+
}
|
|
8839
9072
|
}
|
|
8840
9073
|
return false;
|
|
8841
9074
|
}
|
|
@@ -8843,65 +9076,171 @@ class loreline_Interpreter {
|
|
|
8843
9076
|
if(scopeLevel == null) {
|
|
8844
9077
|
scopeLevel = -1;
|
|
8845
9078
|
}
|
|
8846
|
-
let
|
|
8847
|
-
|
|
8848
|
-
let b =
|
|
9079
|
+
let result = null;
|
|
9080
|
+
this.eachResolutionScope(scopeLevel,function(scope) {
|
|
9081
|
+
let b = scope.beatByName(name);
|
|
8849
9082
|
if(b != null) {
|
|
8850
|
-
|
|
9083
|
+
result = b;
|
|
9084
|
+
return true;
|
|
8851
9085
|
}
|
|
8852
|
-
|
|
9086
|
+
return false;
|
|
9087
|
+
});
|
|
9088
|
+
if(result != null) {
|
|
9089
|
+
return result;
|
|
8853
9090
|
}
|
|
8854
9091
|
return this.topLevelBeats.h[name];
|
|
8855
9092
|
}
|
|
8856
|
-
|
|
8857
|
-
|
|
8858
|
-
|
|
9093
|
+
resolveBeatRefByName(name) {
|
|
9094
|
+
let result = null;
|
|
9095
|
+
let walk = null;
|
|
9096
|
+
walk = function(scopes,startIndex) {
|
|
9097
|
+
let i = startIndex;
|
|
9098
|
+
while(i >= 0) {
|
|
9099
|
+
let scope = scopes[i];
|
|
9100
|
+
let b = scope.beatByName(name);
|
|
9101
|
+
if(b != null) {
|
|
9102
|
+
result = new loreline_RuntimeBeatRef(b,scopes.slice(0,i + 1));
|
|
9103
|
+
return;
|
|
9104
|
+
}
|
|
9105
|
+
if(scope.captured != null) {
|
|
9106
|
+
walk(scope.captured,scope.captured.length - 1);
|
|
9107
|
+
return;
|
|
9108
|
+
}
|
|
9109
|
+
--i;
|
|
9110
|
+
}
|
|
9111
|
+
};
|
|
9112
|
+
walk(this.stack,this.stack.length - 1);
|
|
9113
|
+
if(result != null) {
|
|
9114
|
+
return result;
|
|
9115
|
+
}
|
|
9116
|
+
let topLevel = this.topLevelBeats.h[name];
|
|
9117
|
+
if(topLevel != null) {
|
|
9118
|
+
return new loreline_RuntimeBeatRef(topLevel,[]);
|
|
9119
|
+
}
|
|
9120
|
+
return null;
|
|
9121
|
+
}
|
|
9122
|
+
resolveBeatRefFromNode(name,node) {
|
|
9123
|
+
if(node == null) {
|
|
9124
|
+
return this.resolveBeatRefByName(name);
|
|
8859
9125
|
}
|
|
9126
|
+
let lexical = this.lens.findBeatByNameFromNode(name,node);
|
|
9127
|
+
if(lexical == null) {
|
|
9128
|
+
return null;
|
|
9129
|
+
}
|
|
9130
|
+
return new loreline_RuntimeBeatRef(lexical,this.captureChainForBeat(lexical));
|
|
9131
|
+
}
|
|
9132
|
+
captureChainForBeat(beat) {
|
|
9133
|
+
let parentBeat = this.lens.getFirstParentOfType(beat,loreline_NBeatDecl);
|
|
9134
|
+
if(parentBeat == null) {
|
|
9135
|
+
return [];
|
|
9136
|
+
}
|
|
9137
|
+
let result = null;
|
|
9138
|
+
let walk = null;
|
|
9139
|
+
walk = function(scopes,startIndex) {
|
|
9140
|
+
let i = startIndex;
|
|
9141
|
+
let parentMatch = -1;
|
|
9142
|
+
while(i >= 0) {
|
|
9143
|
+
let scope = scopes[i];
|
|
9144
|
+
if(scope.beats != null && scope.beats.indexOf(beat) != -1) {
|
|
9145
|
+
result = scopes.slice(0,i + 1);
|
|
9146
|
+
return;
|
|
9147
|
+
}
|
|
9148
|
+
if(parentMatch == -1 && scope.beat == parentBeat) {
|
|
9149
|
+
parentMatch = i;
|
|
9150
|
+
}
|
|
9151
|
+
if(scope.captured != null) {
|
|
9152
|
+
walk(scope.captured,scope.captured.length - 1);
|
|
9153
|
+
if(result == null && parentMatch != -1) {
|
|
9154
|
+
result = scopes.slice(0,parentMatch + 1);
|
|
9155
|
+
}
|
|
9156
|
+
return;
|
|
9157
|
+
}
|
|
9158
|
+
--i;
|
|
9159
|
+
}
|
|
9160
|
+
if(result == null && parentMatch != -1) {
|
|
9161
|
+
result = scopes.slice(0,parentMatch + 1);
|
|
9162
|
+
}
|
|
9163
|
+
};
|
|
9164
|
+
walk(this.stack,this.stack.length - 1);
|
|
9165
|
+
if(result != null) {
|
|
9166
|
+
return result;
|
|
9167
|
+
} else {
|
|
9168
|
+
return [];
|
|
9169
|
+
}
|
|
9170
|
+
}
|
|
9171
|
+
resolveDynamicBeatTarget(value,node) {
|
|
9172
|
+
if(((value) instanceof loreline_RuntimeBeatRef)) {
|
|
9173
|
+
return value;
|
|
9174
|
+
}
|
|
9175
|
+
if(((value) instanceof loreline_NBeatDecl)) {
|
|
9176
|
+
return new loreline_RuntimeBeatRef(value,[]);
|
|
9177
|
+
}
|
|
9178
|
+
if(typeof(value) == "string") {
|
|
9179
|
+
let name = value;
|
|
9180
|
+
let resolved = this.resolveBeatRefFromNode(name,node);
|
|
9181
|
+
if(resolved == null) {
|
|
9182
|
+
throw haxe_Exception.thrown(this.beatNotFoundError(name,node));
|
|
9183
|
+
}
|
|
9184
|
+
return resolved;
|
|
9185
|
+
}
|
|
9186
|
+
throw haxe_Exception.thrown(new loreline_RuntimeError("Invalid dynamic beat target: " + this.valueToString(value),node.pos));
|
|
9187
|
+
}
|
|
9188
|
+
beatNotFoundError(name,node) {
|
|
9189
|
+
let pos = node != null ? node.pos : this.script.pos;
|
|
9190
|
+
let _g = 0;
|
|
9191
|
+
let _g1 = this.lens.getNodesOfType(loreline_NBeatDecl,true);
|
|
9192
|
+
while(_g < _g1.length) {
|
|
9193
|
+
let decl = _g1[_g];
|
|
9194
|
+
++_g;
|
|
9195
|
+
if(decl.name == name) {
|
|
9196
|
+
return new loreline_RuntimeError("Beat " + name + " is not visible from this scope. Store a reference (ref = " + name + ") while it is in scope to use it from elsewhere.",pos);
|
|
9197
|
+
}
|
|
9198
|
+
}
|
|
9199
|
+
return new loreline_RuntimeError("Beat " + name + " not found",pos);
|
|
9200
|
+
}
|
|
9201
|
+
resolveBeatRefFromCall(call) {
|
|
8860
9202
|
if(((call.target) instanceof loreline_NAccess)) {
|
|
8861
9203
|
let access = call.target;
|
|
8862
9204
|
if(access.target == null) {
|
|
8863
|
-
|
|
8864
|
-
if(resolvedBeat != null) {
|
|
8865
|
-
return resolvedBeat;
|
|
8866
|
-
}
|
|
9205
|
+
return this.resolveBeatRefFromNode(access.name,access);
|
|
8867
9206
|
}
|
|
8868
9207
|
}
|
|
8869
9208
|
return null;
|
|
8870
9209
|
}
|
|
8871
9210
|
evalCall(call,next) {
|
|
8872
|
-
let
|
|
8873
|
-
if(
|
|
8874
|
-
this.
|
|
9211
|
+
let resolvedRef = this.resolveBeatRefFromCall(call);
|
|
9212
|
+
if(resolvedRef != null) {
|
|
9213
|
+
let argValues = this.evaluateBeatArgs(resolvedRef.beat,call.args,call.pos);
|
|
9214
|
+
this.evalBeatRun(resolvedRef.beat,next,argValues,resolvedRef.stack.length > 0 ? resolvedRef.stack : null);
|
|
8875
9215
|
return;
|
|
8876
9216
|
}
|
|
8877
9217
|
this.evaluateFunctionCall(call,next);
|
|
8878
9218
|
}
|
|
8879
9219
|
evalTransition(transition) {
|
|
8880
|
-
let
|
|
8881
|
-
if(
|
|
8882
|
-
this.
|
|
8883
|
-
|
|
8884
|
-
|
|
8885
|
-
|
|
8886
|
-
|
|
8887
|
-
|
|
8888
|
-
|
|
8889
|
-
let beatInScope = scope.beatByName(beatName);
|
|
8890
|
-
if(beatInScope != null) {
|
|
8891
|
-
resolvedBeat = beatInScope;
|
|
8892
|
-
break;
|
|
9220
|
+
let resolvedRef = null;
|
|
9221
|
+
if(transition.targetExpr != null) {
|
|
9222
|
+
let value = this.evaluateExpression(transition.targetExpr);
|
|
9223
|
+
if(typeof(value) == "string" && value == ".") {
|
|
9224
|
+
if(transition.args != null && transition.args.length > 0) {
|
|
9225
|
+
throw haxe_Exception.thrown(new loreline_RuntimeError("Cannot pass arguments when ending the script",transition.pos));
|
|
9226
|
+
}
|
|
9227
|
+
this.finish();
|
|
9228
|
+
return;
|
|
8893
9229
|
}
|
|
8894
|
-
|
|
8895
|
-
}
|
|
8896
|
-
|
|
8897
|
-
if(
|
|
8898
|
-
|
|
9230
|
+
resolvedRef = this.resolveDynamicBeatTarget(value,transition);
|
|
9231
|
+
} else {
|
|
9232
|
+
let beatName = transition.target;
|
|
9233
|
+
if(beatName == ".") {
|
|
9234
|
+
this.finish();
|
|
9235
|
+
return;
|
|
9236
|
+
}
|
|
9237
|
+
resolvedRef = this.resolveBeatRefFromNode(beatName,transition);
|
|
9238
|
+
if(resolvedRef == null) {
|
|
9239
|
+
throw haxe_Exception.thrown(this.beatNotFoundError(beatName,transition));
|
|
8899
9240
|
}
|
|
8900
9241
|
}
|
|
8901
|
-
|
|
8902
|
-
|
|
8903
|
-
}
|
|
8904
|
-
this.transitionToBeat(resolvedBeat);
|
|
9242
|
+
let argValues = this.evaluateBeatArgs(resolvedRef.beat,transition.args,transition.pos);
|
|
9243
|
+
this.transitionToBeat(resolvedRef.beat,argValues,resolvedRef.stack.length > 0 ? resolvedRef.stack : null);
|
|
8905
9244
|
}
|
|
8906
9245
|
getTranslatedString(node,str) {
|
|
8907
9246
|
if(this.translations != null) {
|
|
@@ -8981,7 +9320,8 @@ class loreline_Interpreter {
|
|
|
8981
9320
|
if(!keepIndents) {
|
|
8982
9321
|
text = this.stripStringIndent(text);
|
|
8983
9322
|
}
|
|
8984
|
-
let
|
|
9323
|
+
let chars = text;
|
|
9324
|
+
let len = chars.length;
|
|
8985
9325
|
if(len > 0) {
|
|
8986
9326
|
keepWhitespace = true;
|
|
8987
9327
|
}
|
|
@@ -8992,7 +9332,7 @@ class loreline_Interpreter {
|
|
|
8992
9332
|
let _g3 = len;
|
|
8993
9333
|
while(_g1 < _g3) {
|
|
8994
9334
|
let i = _g1++;
|
|
8995
|
-
let c = HxOverrides.cca(
|
|
9335
|
+
let c = HxOverrides.cca(chars,i);
|
|
8996
9336
|
let c1 = c == null ? -1 : c;
|
|
8997
9337
|
if(escaped) {
|
|
8998
9338
|
if(c1 == 110) {
|
|
@@ -9306,15 +9646,16 @@ class loreline_Interpreter {
|
|
|
9306
9646
|
return content;
|
|
9307
9647
|
}
|
|
9308
9648
|
stripStringComments(content) {
|
|
9649
|
+
let chars = content;
|
|
9309
9650
|
let result_b = "";
|
|
9310
|
-
let len =
|
|
9651
|
+
let len = chars.length;
|
|
9311
9652
|
let i = 0;
|
|
9312
9653
|
while(i < len) {
|
|
9313
|
-
let c = HxOverrides.cca(
|
|
9654
|
+
let c = HxOverrides.cca(chars,i);
|
|
9314
9655
|
let c1 = c == null ? -1 : c;
|
|
9315
9656
|
let tmp;
|
|
9316
9657
|
if(c1 == 47 && i + 1 < len) {
|
|
9317
|
-
let c = HxOverrides.cca(
|
|
9658
|
+
let c = HxOverrides.cca(chars,i + 1);
|
|
9318
9659
|
tmp = (c == null ? -1 : c) == 47;
|
|
9319
9660
|
} else {
|
|
9320
9661
|
tmp = false;
|
|
@@ -9323,7 +9664,7 @@ class loreline_Interpreter {
|
|
|
9323
9664
|
while(true) {
|
|
9324
9665
|
let tmp;
|
|
9325
9666
|
if(i < len) {
|
|
9326
|
-
let c = HxOverrides.cca(
|
|
9667
|
+
let c = HxOverrides.cca(chars,i);
|
|
9327
9668
|
tmp = (c == null ? -1 : c) != 10;
|
|
9328
9669
|
} else {
|
|
9329
9670
|
tmp = false;
|
|
@@ -9337,7 +9678,7 @@ class loreline_Interpreter {
|
|
|
9337
9678
|
}
|
|
9338
9679
|
let tmp1;
|
|
9339
9680
|
if(c1 == 47 && i + 1 < len) {
|
|
9340
|
-
let c = HxOverrides.cca(
|
|
9681
|
+
let c = HxOverrides.cca(chars,i + 1);
|
|
9341
9682
|
tmp1 = (c == null ? -1 : c) == 42;
|
|
9342
9683
|
} else {
|
|
9343
9684
|
tmp1 = false;
|
|
@@ -9345,7 +9686,7 @@ class loreline_Interpreter {
|
|
|
9345
9686
|
if(tmp1) {
|
|
9346
9687
|
let hadSpaceBefore;
|
|
9347
9688
|
if(i > 0) {
|
|
9348
|
-
let c = HxOverrides.cca(
|
|
9689
|
+
let c = HxOverrides.cca(chars,i - 1);
|
|
9349
9690
|
hadSpaceBefore = (c == null ? -1 : c) == 32;
|
|
9350
9691
|
} else {
|
|
9351
9692
|
hadSpaceBefore = false;
|
|
@@ -9355,9 +9696,9 @@ class loreline_Interpreter {
|
|
|
9355
9696
|
let tmp;
|
|
9356
9697
|
if(i + 1 < len) {
|
|
9357
9698
|
let tmp1;
|
|
9358
|
-
let c = HxOverrides.cca(
|
|
9699
|
+
let c = HxOverrides.cca(chars,i);
|
|
9359
9700
|
if((c == null ? -1 : c) == 42) {
|
|
9360
|
-
let c = HxOverrides.cca(
|
|
9701
|
+
let c = HxOverrides.cca(chars,i + 1);
|
|
9361
9702
|
tmp1 = (c == null ? -1 : c) == 47;
|
|
9362
9703
|
} else {
|
|
9363
9704
|
tmp1 = false;
|
|
@@ -9374,7 +9715,7 @@ class loreline_Interpreter {
|
|
|
9374
9715
|
i += 2;
|
|
9375
9716
|
let hasSpaceAfter;
|
|
9376
9717
|
if(i < len) {
|
|
9377
|
-
let c = HxOverrides.cca(
|
|
9718
|
+
let c = HxOverrides.cca(chars,i);
|
|
9378
9719
|
hasSpaceAfter = (c == null ? -1 : c) == 32;
|
|
9379
9720
|
} else {
|
|
9380
9721
|
hasSpaceAfter = false;
|
|
@@ -9408,10 +9749,104 @@ class loreline_Interpreter {
|
|
|
9408
9749
|
return value != null;
|
|
9409
9750
|
}
|
|
9410
9751
|
}
|
|
9752
|
+
callFunctionValue(fn,args,pos,next) {
|
|
9753
|
+
try {
|
|
9754
|
+
let result = fn.apply(null,args);
|
|
9755
|
+
if(result != null && ((result) instanceof loreline_Async)) {
|
|
9756
|
+
if(next == null) {
|
|
9757
|
+
throw haxe_Exception.thrown(new loreline_RuntimeError("Cannot call async function in expression",pos));
|
|
9758
|
+
} else {
|
|
9759
|
+
let asyncResult = result;
|
|
9760
|
+
asyncResult.func(next);
|
|
9761
|
+
}
|
|
9762
|
+
} else if(next != null) {
|
|
9763
|
+
next();
|
|
9764
|
+
}
|
|
9765
|
+
return result;
|
|
9766
|
+
} catch( _g ) {
|
|
9767
|
+
let e = haxe_Exception.caught(_g).unwrap();
|
|
9768
|
+
if(((e) instanceof loreline_lorscript_Error)) {
|
|
9769
|
+
let lorscriptErr = e;
|
|
9770
|
+
throw haxe_Exception.thrown(new loreline_RuntimeError("Error when evaluating function (" + lorscriptErr.pmin + "-" + lorscriptErr.pmax + "): " + Std.string(lorscriptErr.e),pos));
|
|
9771
|
+
}
|
|
9772
|
+
throw haxe_Exception.thrown(new loreline_RuntimeError("Error when calling function: " + Std.string(e),pos));
|
|
9773
|
+
}
|
|
9774
|
+
}
|
|
9775
|
+
resolvesExistingBinding(name) {
|
|
9776
|
+
let found = false;
|
|
9777
|
+
let _gthis = this;
|
|
9778
|
+
this.eachResolutionScope(-1,function(scope) {
|
|
9779
|
+
if(scope.state != null && loreline_Objects.fieldExists(_gthis,scope.state.fields,name)) {
|
|
9780
|
+
found = true;
|
|
9781
|
+
return true;
|
|
9782
|
+
}
|
|
9783
|
+
if(scope.node != null) {
|
|
9784
|
+
let key = scope.node.id.thisVal;
|
|
9785
|
+
let stateInNode = _gthis.nodeStates.map._get(key.high,key.low);
|
|
9786
|
+
if(stateInNode != null && loreline_Objects.fieldExists(_gthis,stateInNode.fields,name)) {
|
|
9787
|
+
found = true;
|
|
9788
|
+
return true;
|
|
9789
|
+
}
|
|
9790
|
+
}
|
|
9791
|
+
return false;
|
|
9792
|
+
});
|
|
9793
|
+
if(found) {
|
|
9794
|
+
return true;
|
|
9795
|
+
}
|
|
9796
|
+
if(loreline_Objects.fieldExists(this,this.topLevelState.fields,name)) {
|
|
9797
|
+
return true;
|
|
9798
|
+
}
|
|
9799
|
+
if(Object.prototype.hasOwnProperty.call(this.topLevelCharacters.h,name)) {
|
|
9800
|
+
return true;
|
|
9801
|
+
}
|
|
9802
|
+
if(Object.prototype.hasOwnProperty.call(this.topLevelFunctions.h,name)) {
|
|
9803
|
+
return true;
|
|
9804
|
+
}
|
|
9805
|
+
if(this.resolveBeatByName(name) != null) {
|
|
9806
|
+
return true;
|
|
9807
|
+
}
|
|
9808
|
+
return false;
|
|
9809
|
+
}
|
|
9810
|
+
evaluateDynamicCall(call,next) {
|
|
9811
|
+
if(call.args.length == 0) {
|
|
9812
|
+
throw haxe_Exception.thrown(new loreline_RuntimeError("call() requires a target argument",call.pos));
|
|
9813
|
+
}
|
|
9814
|
+
let targetValue = this.evaluateExpression(call.args[0]);
|
|
9815
|
+
if(loreline_RuntimeBeatRef.beatOf(targetValue) != null) {
|
|
9816
|
+
throw haxe_Exception.thrown(new loreline_RuntimeError("call() can only call functions. Use beat(...) to call a beat.",call.pos));
|
|
9817
|
+
}
|
|
9818
|
+
let fn = null;
|
|
9819
|
+
if(Reflect.isFunction(targetValue)) {
|
|
9820
|
+
fn = targetValue;
|
|
9821
|
+
} else if(typeof(targetValue) == "string") {
|
|
9822
|
+
let name = targetValue;
|
|
9823
|
+
if(this.resolveBeatByName(name) != null) {
|
|
9824
|
+
throw haxe_Exception.thrown(new loreline_RuntimeError("call() can only call functions. Use beat(...) to call a beat.",call.pos));
|
|
9825
|
+
}
|
|
9826
|
+
if(Object.prototype.hasOwnProperty.call(this.topLevelFunctions.h,name)) {
|
|
9827
|
+
fn = this.topLevelFunctions.h[name];
|
|
9828
|
+
}
|
|
9829
|
+
}
|
|
9830
|
+
if(fn != null) {
|
|
9831
|
+
let _g = [];
|
|
9832
|
+
let _g1 = 1;
|
|
9833
|
+
let _g2 = call.args.length;
|
|
9834
|
+
while(_g1 < _g2) {
|
|
9835
|
+
let i = _g1++;
|
|
9836
|
+
_g.push(this.evaluateExpression(call.args[i]));
|
|
9837
|
+
}
|
|
9838
|
+
let values = _g;
|
|
9839
|
+
return this.callFunctionValue(fn,values,call.pos,next);
|
|
9840
|
+
}
|
|
9841
|
+
throw haxe_Exception.thrown(new loreline_RuntimeError("call() target is not a function: " + this.valueToString(targetValue),call.pos));
|
|
9842
|
+
}
|
|
9411
9843
|
evaluateFunctionCall(call,next) {
|
|
9412
9844
|
if(((call.target) instanceof loreline_NAccess)) {
|
|
9413
9845
|
let access = call.target;
|
|
9414
9846
|
if(access.target == null) {
|
|
9847
|
+
if(access.name == "call" && !this.resolvesExistingBinding("call")) {
|
|
9848
|
+
return this.evaluateDynamicCall(call,next);
|
|
9849
|
+
}
|
|
9415
9850
|
let target = this.evaluateExpression(call.target);
|
|
9416
9851
|
if(target != null) {
|
|
9417
9852
|
if(Reflect.isFunction(target)) {
|
|
@@ -9424,37 +9859,18 @@ class loreline_Interpreter {
|
|
|
9424
9859
|
_g.push(this.evaluateExpression(arg));
|
|
9425
9860
|
}
|
|
9426
9861
|
let args = _g;
|
|
9427
|
-
|
|
9428
|
-
let result = target.apply(null,args);
|
|
9429
|
-
if(result != null && ((result) instanceof loreline_Async)) {
|
|
9430
|
-
if(next == null) {
|
|
9431
|
-
throw haxe_Exception.thrown(new loreline_RuntimeError("Cannot call async function in expression",call.pos));
|
|
9432
|
-
} else {
|
|
9433
|
-
let asyncResult = result;
|
|
9434
|
-
asyncResult.func(next);
|
|
9435
|
-
}
|
|
9436
|
-
} else if(next != null) {
|
|
9437
|
-
next();
|
|
9438
|
-
}
|
|
9439
|
-
return result;
|
|
9440
|
-
} catch( _g ) {
|
|
9441
|
-
let e = haxe_Exception.caught(_g).unwrap();
|
|
9442
|
-
if(((e) instanceof loreline_lorscript_Error)) {
|
|
9443
|
-
let lorscriptErr = e;
|
|
9444
|
-
throw haxe_Exception.thrown(new loreline_RuntimeError("Error when evaluating function (" + lorscriptErr.pmin + "-" + lorscriptErr.pmax + "): " + Std.string(lorscriptErr.e),call.pos));
|
|
9445
|
-
}
|
|
9446
|
-
throw haxe_Exception.thrown(new loreline_RuntimeError("Error when calling function: " + Std.string(e),call.pos));
|
|
9447
|
-
}
|
|
9862
|
+
return this.callFunctionValue(target,args,call.pos,next);
|
|
9448
9863
|
}
|
|
9449
9864
|
}
|
|
9450
9865
|
} else {
|
|
9451
9866
|
let obj = this.evaluateExpression(access.target);
|
|
9452
9867
|
let helper = null;
|
|
9868
|
+
let objBeat = loreline_RuntimeBeatRef.beatOf(obj);
|
|
9453
9869
|
if(typeof(obj) == "string") {
|
|
9454
9870
|
helper = loreline_Objects.getStringHelper(this,access.name);
|
|
9455
9871
|
} else if(loreline_Arrays.isArray(obj)) {
|
|
9456
9872
|
helper = loreline_Objects.getArrayHelper(this,access.name);
|
|
9457
|
-
} else if(
|
|
9873
|
+
} else if(objBeat != null) {
|
|
9458
9874
|
helper = loreline_Objects.getBeatHelper(this,access.name);
|
|
9459
9875
|
} else if(loreline_Objects.isFields(obj)) {
|
|
9460
9876
|
helper = loreline_Objects.getMapHelper(this,access.name);
|
|
@@ -9469,7 +9885,7 @@ class loreline_Interpreter {
|
|
|
9469
9885
|
_g.push(this.evaluateExpression(arg));
|
|
9470
9886
|
}
|
|
9471
9887
|
let args = _g;
|
|
9472
|
-
args.splice(0,0,obj);
|
|
9888
|
+
args.splice(0,0,objBeat != null ? objBeat : obj);
|
|
9473
9889
|
let result = helper.apply(null,args);
|
|
9474
9890
|
if(result != null && ((result) instanceof loreline_Async)) {
|
|
9475
9891
|
if(next == null) {
|
|
@@ -9531,14 +9947,12 @@ class loreline_Interpreter {
|
|
|
9531
9947
|
return _g;
|
|
9532
9948
|
}
|
|
9533
9949
|
evaluateObjectLiteral(expr) {
|
|
9534
|
-
let obj =
|
|
9950
|
+
let obj = { };
|
|
9535
9951
|
let _g = 0;
|
|
9536
9952
|
while(_g < expr.length) {
|
|
9537
9953
|
let field = expr[_g];
|
|
9538
9954
|
++_g;
|
|
9539
|
-
|
|
9540
|
-
let value = this.evaluateExpression(field.value);
|
|
9541
|
-
obj.h[key] = value;
|
|
9955
|
+
obj[field.name] = this.evaluateExpression(field.value);
|
|
9542
9956
|
}
|
|
9543
9957
|
return obj;
|
|
9544
9958
|
}
|
|
@@ -9693,8 +10107,8 @@ class loreline_Interpreter {
|
|
|
9693
10107
|
break;
|
|
9694
10108
|
case 4:
|
|
9695
10109
|
let pos4 = access.pos;
|
|
9696
|
-
let
|
|
9697
|
-
return
|
|
10110
|
+
let ref = access.ref;
|
|
10111
|
+
return ref;
|
|
9698
10112
|
}
|
|
9699
10113
|
}
|
|
9700
10114
|
writeAccess(access,value) {
|
|
@@ -9724,8 +10138,8 @@ class loreline_Interpreter {
|
|
|
9724
10138
|
throw haxe_Exception.thrown(new loreline_RuntimeError("Cannot overwrite function: " + name2,pos3));
|
|
9725
10139
|
case 4:
|
|
9726
10140
|
let pos4 = access.pos;
|
|
9727
|
-
let
|
|
9728
|
-
throw haxe_Exception.thrown(new loreline_RuntimeError("Cannot overwrite beat: " + beat.name,pos4));
|
|
10141
|
+
let ref = access.ref;
|
|
10142
|
+
throw haxe_Exception.thrown(new loreline_RuntimeError("Cannot overwrite beat: " + ref.beat.name,pos4));
|
|
9729
10143
|
}
|
|
9730
10144
|
}
|
|
9731
10145
|
resolveAssignmentTarget(target) {
|
|
@@ -9762,42 +10176,47 @@ class loreline_Interpreter {
|
|
|
9762
10176
|
}
|
|
9763
10177
|
return loreline_RuntimeAccess.FieldAccess(target.pos,evaluated,name);
|
|
9764
10178
|
}
|
|
9765
|
-
let
|
|
9766
|
-
|
|
9767
|
-
|
|
10179
|
+
let scopeAccess = null;
|
|
10180
|
+
let _gthis = this;
|
|
10181
|
+
this.eachResolutionScope(-1,function(scope) {
|
|
9768
10182
|
if(scope.state != null) {
|
|
9769
|
-
if(loreline_Objects.fieldExists(
|
|
10183
|
+
if(loreline_Objects.fieldExists(_gthis,scope.state.fields,name)) {
|
|
9770
10184
|
let tmp = access != null ? access.pos : null;
|
|
9771
10185
|
let tmp1;
|
|
9772
10186
|
if(tmp != null) {
|
|
9773
10187
|
tmp1 = tmp;
|
|
9774
10188
|
} else {
|
|
9775
|
-
let tmp =
|
|
10189
|
+
let tmp = _gthis.get_currentScope();
|
|
9776
10190
|
let tmp2 = tmp != null ? tmp.node : null;
|
|
9777
10191
|
tmp1 = tmp2 != null ? tmp2.pos : null;
|
|
9778
10192
|
}
|
|
9779
|
-
|
|
10193
|
+
scopeAccess = loreline_RuntimeAccess.FieldAccess(tmp1 != null ? tmp1 : _gthis.script.pos,scope.state.fields,name);
|
|
10194
|
+
return true;
|
|
9780
10195
|
}
|
|
9781
10196
|
}
|
|
9782
10197
|
if(scope.node != null) {
|
|
9783
10198
|
let key = scope.node.id.thisVal;
|
|
9784
|
-
let stateInNode =
|
|
10199
|
+
let stateInNode = _gthis.nodeStates.map._get(key.high,key.low);
|
|
9785
10200
|
if(stateInNode != null) {
|
|
9786
|
-
if(loreline_Objects.fieldExists(
|
|
10201
|
+
if(loreline_Objects.fieldExists(_gthis,stateInNode.fields,name)) {
|
|
9787
10202
|
let tmp = access != null ? access.pos : null;
|
|
9788
10203
|
let tmp1;
|
|
9789
10204
|
if(tmp != null) {
|
|
9790
10205
|
tmp1 = tmp;
|
|
9791
10206
|
} else {
|
|
9792
|
-
let tmp =
|
|
10207
|
+
let tmp = _gthis.get_currentScope();
|
|
9793
10208
|
let tmp2 = tmp != null ? tmp.node : null;
|
|
9794
10209
|
tmp1 = tmp2 != null ? tmp2.pos : null;
|
|
9795
10210
|
}
|
|
9796
|
-
|
|
10211
|
+
scopeAccess = loreline_RuntimeAccess.FieldAccess(tmp1 != null ? tmp1 : _gthis.script.pos,stateInNode.fields,name);
|
|
10212
|
+
return true;
|
|
9797
10213
|
}
|
|
9798
10214
|
}
|
|
9799
10215
|
}
|
|
9800
|
-
|
|
10216
|
+
return false;
|
|
10217
|
+
});
|
|
10218
|
+
if(scopeAccess != null) {
|
|
10219
|
+
return scopeAccess;
|
|
9801
10220
|
}
|
|
9802
10221
|
if(loreline_Objects.fieldExists(this,this.topLevelState.fields,name)) {
|
|
9803
10222
|
let tmp = access != null ? access.pos : null;
|
|
@@ -9835,8 +10254,8 @@ class loreline_Interpreter {
|
|
|
9835
10254
|
}
|
|
9836
10255
|
return loreline_RuntimeAccess.FunctionAccess(tmp1 != null ? tmp1 : this.script.pos,name);
|
|
9837
10256
|
}
|
|
9838
|
-
let
|
|
9839
|
-
if(
|
|
10257
|
+
let beatRef = this.resolveBeatRefFromNode(name,access);
|
|
10258
|
+
if(beatRef != null) {
|
|
9840
10259
|
let tmp = access != null ? access.pos : null;
|
|
9841
10260
|
let tmp1;
|
|
9842
10261
|
if(tmp != null) {
|
|
@@ -9846,7 +10265,7 @@ class loreline_Interpreter {
|
|
|
9846
10265
|
let tmp2 = tmp != null ? tmp.node : null;
|
|
9847
10266
|
tmp1 = tmp2 != null ? tmp2.pos : null;
|
|
9848
10267
|
}
|
|
9849
|
-
return loreline_RuntimeAccess.BeatAccess(tmp1 != null ? tmp1 : this.script.pos,
|
|
10268
|
+
return loreline_RuntimeAccess.BeatAccess(tmp1 != null ? tmp1 : this.script.pos,beatRef);
|
|
9850
10269
|
}
|
|
9851
10270
|
if(!this.strictAccess) {
|
|
9852
10271
|
let tmp = access != null ? access.pos : null;
|
|
@@ -9860,16 +10279,17 @@ class loreline_Interpreter {
|
|
|
9860
10279
|
}
|
|
9861
10280
|
return loreline_RuntimeAccess.FieldAccess(tmp1 != null ? tmp1 : this.script.pos,this.topLevelState.fields,name);
|
|
9862
10281
|
}
|
|
9863
|
-
let tmp =
|
|
9864
|
-
let tmp1;
|
|
9865
|
-
|
|
9866
|
-
|
|
10282
|
+
let tmp = "Undefined variable: " + name;
|
|
10283
|
+
let tmp1 = access != null ? access.pos : null;
|
|
10284
|
+
let tmp2;
|
|
10285
|
+
if(tmp1 != null) {
|
|
10286
|
+
tmp2 = tmp1;
|
|
9867
10287
|
} else {
|
|
9868
10288
|
let tmp = this.get_currentScope();
|
|
9869
|
-
let
|
|
9870
|
-
|
|
10289
|
+
let tmp1 = tmp != null ? tmp.node : null;
|
|
10290
|
+
tmp2 = tmp1 != null ? tmp1.pos : null;
|
|
9871
10291
|
}
|
|
9872
|
-
throw haxe_Exception.thrown(new loreline_RuntimeError(
|
|
10292
|
+
throw haxe_Exception.thrown(new loreline_RuntimeError(tmp,tmp2 != null ? tmp2 : this.script.pos));
|
|
9873
10293
|
}
|
|
9874
10294
|
getTypeName(t) {
|
|
9875
10295
|
switch(t._hx_index) {
|
|
@@ -10143,7 +10563,9 @@ class loreline_Interpreter {
|
|
|
10143
10563
|
}
|
|
10144
10564
|
break;
|
|
10145
10565
|
case 31:case 32:
|
|
10146
|
-
let
|
|
10566
|
+
let leftBeat = loreline_RuntimeBeatRef.beatOf(left);
|
|
10567
|
+
let rightBeat = loreline_RuntimeBeatRef.beatOf(right);
|
|
10568
|
+
let result = leftBeat != null && typeof(right) == "string" ? leftBeat.name == right : typeof(left) == "string" && rightBeat != null ? left == rightBeat.name : leftBeat != null && rightBeat != null ? leftBeat.name == rightBeat.name : left == right;
|
|
10147
10569
|
switch(op._hx_index) {
|
|
10148
10570
|
case 31:
|
|
10149
10571
|
return result;
|
|
@@ -10363,9 +10785,10 @@ class loreline_Interpreter {
|
|
|
10363
10785
|
seen.pop();
|
|
10364
10786
|
return buf_b;
|
|
10365
10787
|
}
|
|
10366
|
-
|
|
10788
|
+
let asBeat = loreline_RuntimeBeatRef.beatOf(value);
|
|
10789
|
+
if(asBeat != null) {
|
|
10367
10790
|
seen.pop();
|
|
10368
|
-
return
|
|
10791
|
+
return asBeat.name;
|
|
10369
10792
|
}
|
|
10370
10793
|
if(loreline_Objects.isFields(value)) {
|
|
10371
10794
|
let keys = loreline_Objects.getFields(this,value);
|
|
@@ -10475,6 +10898,8 @@ class loreline_JsonToAst {
|
|
|
10475
10898
|
return loreline_JsonToAst.assignFromJson(json);
|
|
10476
10899
|
case "Beat":
|
|
10477
10900
|
return loreline_JsonToAst.beatFromJson(json);
|
|
10901
|
+
case "BeatCall":
|
|
10902
|
+
return loreline_JsonToAst.beatCallFromJson(json);
|
|
10478
10903
|
case "Binary":
|
|
10479
10904
|
return loreline_JsonToAst.binaryFromJson(json);
|
|
10480
10905
|
case "Block":
|
|
@@ -10585,6 +11010,17 @@ class loreline_JsonToAst {
|
|
|
10585
11010
|
let comments = loreline_JsonToAst.extractComments(json);
|
|
10586
11011
|
let node = new loreline_NBeatDecl(id,pos,json.name,body,comments.leading,comments.trailing);
|
|
10587
11012
|
node.style = loreline_JsonToAst.blockStyleFromString(json.style);
|
|
11013
|
+
if(json.params != null) {
|
|
11014
|
+
let paramsArr = json.params;
|
|
11015
|
+
let _g = [];
|
|
11016
|
+
let _g1 = 0;
|
|
11017
|
+
while(_g1 < paramsArr.length) {
|
|
11018
|
+
let p = paramsArr[_g1];
|
|
11019
|
+
++_g1;
|
|
11020
|
+
_g.push(new loreline_NBeatParam(p.name,loreline_JsonToAst.positionFromJson(p.namePos),p.defaultValue != null ? loreline_JsonToAst.nodeFromJson(p.defaultValue) : null));
|
|
11021
|
+
}
|
|
11022
|
+
node.params = _g;
|
|
11023
|
+
}
|
|
10588
11024
|
return node;
|
|
10589
11025
|
}
|
|
10590
11026
|
static stringPartFromJson(json) {
|
|
@@ -10833,14 +11269,64 @@ class loreline_JsonToAst {
|
|
|
10833
11269
|
let pos = loreline_JsonToAst.positionFromJson(json.pos);
|
|
10834
11270
|
let targetPos = loreline_JsonToAst.positionFromJson(json.targetPos);
|
|
10835
11271
|
let comments = loreline_JsonToAst.extractComments(json);
|
|
10836
|
-
|
|
11272
|
+
let node = new loreline_NTransition(id,pos,json.target,targetPos,comments.leading,comments.trailing);
|
|
11273
|
+
if(json.targetExpr != null) {
|
|
11274
|
+
node.targetExpr = loreline_JsonToAst.nodeFromJson(json.targetExpr);
|
|
11275
|
+
}
|
|
11276
|
+
if(json.args != null) {
|
|
11277
|
+
let argsArr = json.args;
|
|
11278
|
+
let _g = [];
|
|
11279
|
+
let _g1 = 0;
|
|
11280
|
+
while(_g1 < argsArr.length) {
|
|
11281
|
+
let a = argsArr[_g1];
|
|
11282
|
+
++_g1;
|
|
11283
|
+
_g.push(loreline_JsonToAst.nodeFromJson(a));
|
|
11284
|
+
}
|
|
11285
|
+
node.args = _g;
|
|
11286
|
+
}
|
|
11287
|
+
return node;
|
|
11288
|
+
}
|
|
11289
|
+
static beatCallFromJson(json) {
|
|
11290
|
+
let id = loreline_JsonToAst.idFromJson(json);
|
|
11291
|
+
let pos = loreline_JsonToAst.positionFromJson(json.pos);
|
|
11292
|
+
let targetPos = loreline_JsonToAst.positionFromJson(json.targetPos);
|
|
11293
|
+
let targetExpr = loreline_JsonToAst.nodeFromJson(json.targetExpr);
|
|
11294
|
+
let comments = loreline_JsonToAst.extractComments(json);
|
|
11295
|
+
let node = new loreline_NBeatCall(id,pos,targetExpr,targetPos,comments.leading,comments.trailing);
|
|
11296
|
+
if(json.args != null) {
|
|
11297
|
+
let argsArr = json.args;
|
|
11298
|
+
let _g = [];
|
|
11299
|
+
let _g1 = 0;
|
|
11300
|
+
while(_g1 < argsArr.length) {
|
|
11301
|
+
let a = argsArr[_g1];
|
|
11302
|
+
++_g1;
|
|
11303
|
+
_g.push(loreline_JsonToAst.nodeFromJson(a));
|
|
11304
|
+
}
|
|
11305
|
+
node.args = _g;
|
|
11306
|
+
}
|
|
11307
|
+
return node;
|
|
10837
11308
|
}
|
|
10838
11309
|
static insertionFromJson(json) {
|
|
10839
11310
|
let id = loreline_JsonToAst.idFromJson(json);
|
|
10840
11311
|
let pos = loreline_JsonToAst.positionFromJson(json.pos);
|
|
10841
11312
|
let targetPos = loreline_JsonToAst.positionFromJson(json.targetPos);
|
|
10842
11313
|
let comments = loreline_JsonToAst.extractComments(json);
|
|
10843
|
-
|
|
11314
|
+
let node = new loreline_NInsertion(id,pos,json.target,targetPos,comments.leading,comments.trailing);
|
|
11315
|
+
if(json.targetExpr != null) {
|
|
11316
|
+
node.targetExpr = loreline_JsonToAst.nodeFromJson(json.targetExpr);
|
|
11317
|
+
}
|
|
11318
|
+
if(json.args != null) {
|
|
11319
|
+
let argsArr = json.args;
|
|
11320
|
+
let _g = [];
|
|
11321
|
+
let _g1 = 0;
|
|
11322
|
+
while(_g1 < argsArr.length) {
|
|
11323
|
+
let a = argsArr[_g1];
|
|
11324
|
+
++_g1;
|
|
11325
|
+
_g.push(loreline_JsonToAst.nodeFromJson(a));
|
|
11326
|
+
}
|
|
11327
|
+
node.args = _g;
|
|
11328
|
+
}
|
|
11329
|
+
return node;
|
|
10844
11330
|
}
|
|
10845
11331
|
static functionDeclFromJson(json) {
|
|
10846
11332
|
let id = loreline_JsonToAst.idFromJson(json);
|
|
@@ -11138,7 +11624,7 @@ class loreline_FuncLorscript {
|
|
|
11138
11624
|
let e = haxe_Exception.caught(_g).unwrap();
|
|
11139
11625
|
if(((e) instanceof loreline_Error)) {
|
|
11140
11626
|
this.error = e;
|
|
11141
|
-
this.error.pos = func.pos.withOffset(this.codeToLorscript.
|
|
11627
|
+
this.error.pos = func.pos.withOffset(this.codeToLorscript.inputText,this.error.pos.offset,this.error.pos.length,func.pos.offset);
|
|
11142
11628
|
}
|
|
11143
11629
|
this.lorscript = this.codeToLorscript.output.b;
|
|
11144
11630
|
}
|
|
@@ -11199,7 +11685,7 @@ class loreline_FuncLorscript {
|
|
|
11199
11685
|
this.error = new loreline_WrappedError(lorscriptError,tmp,this.codeToLorscript.toLorelinePos(func.pos,lorscriptError.pmin,lorscriptError.pmax));
|
|
11200
11686
|
} else if(((e) instanceof loreline_Error)) {
|
|
11201
11687
|
this.error = e;
|
|
11202
|
-
this.error.pos = func.pos.withOffset(this.codeToLorscript.
|
|
11688
|
+
this.error.pos = func.pos.withOffset(this.codeToLorscript.inputText,this.error.pos.offset,this.error.pos.length,func.pos.offset);
|
|
11203
11689
|
}
|
|
11204
11690
|
}
|
|
11205
11691
|
try {
|
|
@@ -12247,10 +12733,88 @@ class loreline_Lens {
|
|
|
12247
12733
|
}
|
|
12248
12734
|
return null;
|
|
12249
12735
|
}
|
|
12736
|
+
findBeatParamFromAccess(access) {
|
|
12737
|
+
if(access.target != null || access.name == null) {
|
|
12738
|
+
return null;
|
|
12739
|
+
}
|
|
12740
|
+
let parentBeat = this.getFirstParentOfType(access,loreline_NBeatDecl);
|
|
12741
|
+
while(parentBeat != null) {
|
|
12742
|
+
if(parentBeat.params != null) {
|
|
12743
|
+
let _g = 0;
|
|
12744
|
+
let _g1 = parentBeat.params;
|
|
12745
|
+
while(_g < _g1.length) {
|
|
12746
|
+
let param = _g1[_g];
|
|
12747
|
+
++_g;
|
|
12748
|
+
if(param.name == access.name) {
|
|
12749
|
+
return { param : param, beat : parentBeat};
|
|
12750
|
+
}
|
|
12751
|
+
}
|
|
12752
|
+
}
|
|
12753
|
+
parentBeat = this.getFirstParentOfType(parentBeat,loreline_NBeatDecl);
|
|
12754
|
+
}
|
|
12755
|
+
return null;
|
|
12756
|
+
}
|
|
12757
|
+
findCallArgument(node) {
|
|
12758
|
+
let child = node;
|
|
12759
|
+
let parent = this.getParentNode(child);
|
|
12760
|
+
while(parent != null) {
|
|
12761
|
+
switch(js_Boot.getClass(parent)) {
|
|
12762
|
+
case loreline_NBeatCall:
|
|
12763
|
+
let beatCall = parent;
|
|
12764
|
+
if(beatCall.args != null) {
|
|
12765
|
+
let index = beatCall.args.indexOf(child);
|
|
12766
|
+
if(index != -1) {
|
|
12767
|
+
return { owner : parent, index : index};
|
|
12768
|
+
}
|
|
12769
|
+
}
|
|
12770
|
+
return null;
|
|
12771
|
+
case loreline_NCall:
|
|
12772
|
+
let call = parent;
|
|
12773
|
+
if(call.args != null) {
|
|
12774
|
+
let index = call.args.indexOf(child);
|
|
12775
|
+
if(index != -1) {
|
|
12776
|
+
return { owner : parent, index : index};
|
|
12777
|
+
}
|
|
12778
|
+
}
|
|
12779
|
+
return null;
|
|
12780
|
+
case loreline_NInsertion:
|
|
12781
|
+
let insertion = parent;
|
|
12782
|
+
if(insertion.args != null) {
|
|
12783
|
+
let index = insertion.args.indexOf(child);
|
|
12784
|
+
if(index != -1) {
|
|
12785
|
+
return { owner : parent, index : index};
|
|
12786
|
+
}
|
|
12787
|
+
}
|
|
12788
|
+
return null;
|
|
12789
|
+
case loreline_NTransition:
|
|
12790
|
+
let transition = parent;
|
|
12791
|
+
if(transition.args != null) {
|
|
12792
|
+
let index = transition.args.indexOf(child);
|
|
12793
|
+
if(index != -1) {
|
|
12794
|
+
return { owner : parent, index : index};
|
|
12795
|
+
}
|
|
12796
|
+
}
|
|
12797
|
+
return null;
|
|
12798
|
+
default:
|
|
12799
|
+
if(!((parent) instanceof loreline_NExpr)) {
|
|
12800
|
+
return null;
|
|
12801
|
+
}
|
|
12802
|
+
}
|
|
12803
|
+
child = parent;
|
|
12804
|
+
parent = this.getParentNode(child);
|
|
12805
|
+
}
|
|
12806
|
+
return null;
|
|
12807
|
+
}
|
|
12250
12808
|
findBeatFromTransition(transition) {
|
|
12809
|
+
if(transition.targetExpr != null) {
|
|
12810
|
+
return null;
|
|
12811
|
+
}
|
|
12251
12812
|
return this.findBeatByNameFromNode(transition.target,transition);
|
|
12252
12813
|
}
|
|
12253
12814
|
findBeatFromInsertion(insertion) {
|
|
12815
|
+
if(insertion.targetExpr != null) {
|
|
12816
|
+
return null;
|
|
12817
|
+
}
|
|
12254
12818
|
return this.findBeatByNameFromNode(insertion.target,insertion);
|
|
12255
12819
|
}
|
|
12256
12820
|
findBeatByPathFromNode(path,node) {
|
|
@@ -12559,22 +13123,26 @@ class loreline_Lens {
|
|
|
12559
13123
|
break;
|
|
12560
13124
|
case loreline_NInsertion:
|
|
12561
13125
|
let insertion = node;
|
|
12562
|
-
|
|
12563
|
-
|
|
12564
|
-
|
|
12565
|
-
|
|
12566
|
-
|
|
12567
|
-
|
|
13126
|
+
if(insertion.targetExpr == null) {
|
|
13127
|
+
let targetBeat = _gthis.findBeatByNameFromNode(insertion.target,insertion);
|
|
13128
|
+
if(targetBeat != null) {
|
|
13129
|
+
let key = targetBeat.id;
|
|
13130
|
+
let value = new loreline_Reference(targetBeat,insertion);
|
|
13131
|
+
let key1 = key.thisVal;
|
|
13132
|
+
targetBeats_map._set(key1.high,key1.low,value);
|
|
13133
|
+
}
|
|
12568
13134
|
}
|
|
12569
13135
|
break;
|
|
12570
13136
|
case loreline_NTransition:
|
|
12571
13137
|
let transition = node;
|
|
12572
|
-
|
|
12573
|
-
|
|
12574
|
-
|
|
12575
|
-
|
|
12576
|
-
|
|
12577
|
-
|
|
13138
|
+
if(transition.targetExpr == null) {
|
|
13139
|
+
let targetBeat = _gthis.findBeatByNameFromNode(transition.target,transition);
|
|
13140
|
+
if(targetBeat != null) {
|
|
13141
|
+
let key = targetBeat.id;
|
|
13142
|
+
let value = new loreline_Reference(targetBeat,transition);
|
|
13143
|
+
let key1 = key.thisVal;
|
|
13144
|
+
targetBeats_map._set(key1.high,key1.low,value);
|
|
13145
|
+
}
|
|
12578
13146
|
}
|
|
12579
13147
|
break;
|
|
12580
13148
|
default:
|
|
@@ -13811,7 +14379,54 @@ class loreline_Lexer {
|
|
|
13811
14379
|
this.nextBlock = 3;
|
|
13812
14380
|
break;
|
|
13813
14381
|
case 2:
|
|
13814
|
-
|
|
14382
|
+
let prevIndex = tokens.length - 2;
|
|
14383
|
+
_hx_loop3: while(prevIndex >= 0) {
|
|
14384
|
+
let _g = tokens[prevIndex].type;
|
|
14385
|
+
switch(_g._hx_index) {
|
|
14386
|
+
case 51:
|
|
14387
|
+
let _g1 = _g.content;
|
|
14388
|
+
--prevIndex;
|
|
14389
|
+
break;
|
|
14390
|
+
case 52:
|
|
14391
|
+
let _g2 = _g.content;
|
|
14392
|
+
--prevIndex;
|
|
14393
|
+
break;
|
|
14394
|
+
default:
|
|
14395
|
+
break _hx_loop3;
|
|
14396
|
+
}
|
|
14397
|
+
}
|
|
14398
|
+
let isDynamicTargetKeyword;
|
|
14399
|
+
if(prevIndex >= 0) {
|
|
14400
|
+
switch(tokens[prevIndex].type._hx_index) {
|
|
14401
|
+
case 26:case 40:
|
|
14402
|
+
isDynamicTargetKeyword = true;
|
|
14403
|
+
break;
|
|
14404
|
+
default:
|
|
14405
|
+
isDynamicTargetKeyword = false;
|
|
14406
|
+
}
|
|
14407
|
+
} else {
|
|
14408
|
+
isDynamicTargetKeyword = false;
|
|
14409
|
+
}
|
|
14410
|
+
let lookahead = this.pos;
|
|
14411
|
+
while(lookahead < this.length) {
|
|
14412
|
+
let c = HxOverrides.cca(this.input,lookahead);
|
|
14413
|
+
let c1 = c == null ? -1 : c;
|
|
14414
|
+
if(c1 == 32 || c1 == 9) {
|
|
14415
|
+
++lookahead;
|
|
14416
|
+
} else {
|
|
14417
|
+
break;
|
|
14418
|
+
}
|
|
14419
|
+
}
|
|
14420
|
+
let isBeatCallStatement;
|
|
14421
|
+
if(lookahead < this.length) {
|
|
14422
|
+
let c = HxOverrides.cca(this.input,lookahead);
|
|
14423
|
+
isBeatCallStatement = (c == null ? -1 : c) == 40;
|
|
14424
|
+
} else {
|
|
14425
|
+
isBeatCallStatement = false;
|
|
14426
|
+
}
|
|
14427
|
+
if(!isDynamicTargetKeyword && !isBeatCallStatement) {
|
|
14428
|
+
this.nextBlock = 7;
|
|
14429
|
+
}
|
|
13815
14430
|
break;
|
|
13816
14431
|
case 3:
|
|
13817
14432
|
this.nextBlock = 5;
|
|
@@ -15701,68 +16316,33 @@ class loreline_Lexer {
|
|
|
15701
16316
|
}
|
|
15702
16317
|
let c1 = HxOverrides.cca(this.input,pos);
|
|
15703
16318
|
let c2 = c1 == null ? -1 : c1;
|
|
15704
|
-
|
|
15705
|
-
|
|
15706
|
-
|
|
15707
|
-
|
|
15708
|
-
|
|
15709
|
-
|
|
15710
|
-
|
|
15711
|
-
} else {
|
|
15712
|
-
let tmp;
|
|
15713
|
-
let tmp1;
|
|
15714
|
-
let tmp2;
|
|
15715
|
-
if(pos + 1 < len) {
|
|
15716
|
-
let c = HxOverrides.cca(_gthis.input,pos);
|
|
15717
|
-
tmp2 = (c == null ? -1 : c) == 111;
|
|
15718
|
-
} else {
|
|
15719
|
-
tmp2 = false;
|
|
15720
|
-
}
|
|
15721
|
-
if(tmp2) {
|
|
15722
|
-
let c = HxOverrides.cca(_gthis.input,pos + 1);
|
|
15723
|
-
tmp1 = (c == null ? -1 : c) == 114;
|
|
15724
|
-
} else {
|
|
15725
|
-
tmp1 = false;
|
|
15726
|
-
}
|
|
15727
|
-
if(tmp1) {
|
|
15728
|
-
if(pos + 2 < len) {
|
|
15729
|
-
let c = HxOverrides.cca(_gthis.input,pos + 2);
|
|
15730
|
-
let c1 = c == null ? -1 : c;
|
|
15731
|
-
tmp = !(c1 >= 97 && c1 <= 122 || c1 >= 65 && c1 <= 90 || c1 == 95);
|
|
15732
|
-
} else {
|
|
15733
|
-
tmp = true;
|
|
15734
|
-
}
|
|
15735
|
-
} else {
|
|
15736
|
-
tmp = false;
|
|
15737
|
-
}
|
|
15738
|
-
if(tmp) {
|
|
16319
|
+
while(c2 == 46 || c2 == 91) {
|
|
16320
|
+
if(c2 == 46) {
|
|
16321
|
+
++pos;
|
|
16322
|
+
pos = this._skipWhitespaceAndComments(pos,false);
|
|
16323
|
+
let result = true;
|
|
16324
|
+
let len = _gthis.length;
|
|
16325
|
+
if(pos >= len) {
|
|
15739
16326
|
result = false;
|
|
15740
16327
|
} else {
|
|
15741
16328
|
let tmp;
|
|
15742
16329
|
let tmp1;
|
|
15743
16330
|
let tmp2;
|
|
15744
|
-
|
|
15745
|
-
if(pos + 2 < len) {
|
|
16331
|
+
if(pos + 1 < len) {
|
|
15746
16332
|
let c = HxOverrides.cca(_gthis.input,pos);
|
|
15747
|
-
|
|
15748
|
-
} else {
|
|
15749
|
-
tmp3 = false;
|
|
15750
|
-
}
|
|
15751
|
-
if(tmp3) {
|
|
15752
|
-
let c = HxOverrides.cca(_gthis.input,pos + 1);
|
|
15753
|
-
tmp2 = (c == null ? -1 : c) == 110;
|
|
16333
|
+
tmp2 = (c == null ? -1 : c) == 111;
|
|
15754
16334
|
} else {
|
|
15755
16335
|
tmp2 = false;
|
|
15756
16336
|
}
|
|
15757
16337
|
if(tmp2) {
|
|
15758
|
-
let c = HxOverrides.cca(_gthis.input,pos +
|
|
15759
|
-
tmp1 = (c == null ? -1 : c) ==
|
|
16338
|
+
let c = HxOverrides.cca(_gthis.input,pos + 1);
|
|
16339
|
+
tmp1 = (c == null ? -1 : c) == 114;
|
|
15760
16340
|
} else {
|
|
15761
16341
|
tmp1 = false;
|
|
15762
16342
|
}
|
|
15763
16343
|
if(tmp1) {
|
|
15764
|
-
if(pos +
|
|
15765
|
-
let c = HxOverrides.cca(_gthis.input,pos +
|
|
16344
|
+
if(pos + 2 < len) {
|
|
16345
|
+
let c = HxOverrides.cca(_gthis.input,pos + 2);
|
|
15766
16346
|
let c1 = c == null ? -1 : c;
|
|
15767
16347
|
tmp = !(c1 >= 97 && c1 <= 122 || c1 >= 65 && c1 <= 90 || c1 == 95);
|
|
15768
16348
|
} else {
|
|
@@ -15774,47 +16354,77 @@ class loreline_Lexer {
|
|
|
15774
16354
|
if(tmp) {
|
|
15775
16355
|
result = false;
|
|
15776
16356
|
} else {
|
|
15777
|
-
let
|
|
15778
|
-
let
|
|
15779
|
-
|
|
16357
|
+
let tmp;
|
|
16358
|
+
let tmp1;
|
|
16359
|
+
let tmp2;
|
|
16360
|
+
let tmp3;
|
|
16361
|
+
if(pos + 2 < len) {
|
|
16362
|
+
let c = HxOverrides.cca(_gthis.input,pos);
|
|
16363
|
+
tmp3 = (c == null ? -1 : c) == 97;
|
|
16364
|
+
} else {
|
|
16365
|
+
tmp3 = false;
|
|
16366
|
+
}
|
|
16367
|
+
if(tmp3) {
|
|
16368
|
+
let c = HxOverrides.cca(_gthis.input,pos + 1);
|
|
16369
|
+
tmp2 = (c == null ? -1 : c) == 110;
|
|
16370
|
+
} else {
|
|
16371
|
+
tmp2 = false;
|
|
16372
|
+
}
|
|
16373
|
+
if(tmp2) {
|
|
16374
|
+
let c = HxOverrides.cca(_gthis.input,pos + 2);
|
|
16375
|
+
tmp1 = (c == null ? -1 : c) == 100;
|
|
16376
|
+
} else {
|
|
16377
|
+
tmp1 = false;
|
|
16378
|
+
}
|
|
16379
|
+
if(tmp1) {
|
|
16380
|
+
if(pos + 3 < len) {
|
|
16381
|
+
let c = HxOverrides.cca(_gthis.input,pos + 3);
|
|
16382
|
+
let c1 = c == null ? -1 : c;
|
|
16383
|
+
tmp = !(c1 >= 97 && c1 <= 122 || c1 >= 65 && c1 <= 90 || c1 == 95);
|
|
16384
|
+
} else {
|
|
16385
|
+
tmp = true;
|
|
16386
|
+
}
|
|
16387
|
+
} else {
|
|
16388
|
+
tmp = false;
|
|
16389
|
+
}
|
|
16390
|
+
if(tmp) {
|
|
15780
16391
|
result = false;
|
|
15781
16392
|
} else {
|
|
15782
|
-
|
|
15783
|
-
|
|
15784
|
-
|
|
15785
|
-
|
|
15786
|
-
|
|
15787
|
-
break;
|
|
15788
|
-
}
|
|
16393
|
+
let c = HxOverrides.cca(_gthis.input,pos);
|
|
16394
|
+
let c1 = c == null ? -1 : c;
|
|
16395
|
+
if(!(c1 >= 97 && c1 <= 122 || c1 >= 65 && c1 <= 90 || c1 == 95)) {
|
|
16396
|
+
result = false;
|
|
16397
|
+
} else {
|
|
15789
16398
|
++pos;
|
|
16399
|
+
while(pos < _gthis.length) {
|
|
16400
|
+
let c = HxOverrides.cca(_gthis.input,pos);
|
|
16401
|
+
c1 = c == null ? -1 : c;
|
|
16402
|
+
if(!(c1 >= 97 && c1 <= 122 || c1 >= 65 && c1 <= 90 || c1 == 95 || c1 >= 48 && c1 <= 57)) {
|
|
16403
|
+
break;
|
|
16404
|
+
}
|
|
16405
|
+
++pos;
|
|
16406
|
+
}
|
|
15790
16407
|
}
|
|
15791
16408
|
}
|
|
15792
16409
|
}
|
|
15793
16410
|
}
|
|
15794
|
-
|
|
15795
|
-
|
|
15796
|
-
return true;
|
|
15797
|
-
}
|
|
15798
|
-
pos = this._skipWhitespaceAndComments(pos,false);
|
|
15799
|
-
if(pos >= this.length) {
|
|
15800
|
-
return true;
|
|
15801
|
-
}
|
|
15802
|
-
let c = HxOverrides.cca(this.input,pos);
|
|
15803
|
-
c2 = c == null ? -1 : c;
|
|
15804
|
-
}
|
|
15805
|
-
if(c2 == 91) {
|
|
15806
|
-
++pos;
|
|
15807
|
-
let bracketLevel = 1;
|
|
15808
|
-
while(pos < this.length && bracketLevel > 0) {
|
|
15809
|
-
let c = HxOverrides.cca(this.input,pos);
|
|
15810
|
-
c2 = c == null ? -1 : c;
|
|
15811
|
-
if(c2 == 91) {
|
|
15812
|
-
++bracketLevel;
|
|
15813
|
-
}
|
|
15814
|
-
if(c2 == 93) {
|
|
15815
|
-
--bracketLevel;
|
|
16411
|
+
if(!result) {
|
|
16412
|
+
return true;
|
|
15816
16413
|
}
|
|
16414
|
+
} else {
|
|
15817
16415
|
++pos;
|
|
16416
|
+
let bracketLevel = 1;
|
|
16417
|
+
while(pos < this.length && bracketLevel > 0) {
|
|
16418
|
+
let c = HxOverrides.cca(this.input,pos);
|
|
16419
|
+
c2 = c == null ? -1 : c;
|
|
16420
|
+
if(c2 == 91) {
|
|
16421
|
+
++bracketLevel;
|
|
16422
|
+
}
|
|
16423
|
+
if(c2 == 93) {
|
|
16424
|
+
--bracketLevel;
|
|
16425
|
+
}
|
|
16426
|
+
++pos;
|
|
16427
|
+
}
|
|
15818
16428
|
}
|
|
15819
16429
|
pos = this._skipWhitespaceAndComments(pos,false);
|
|
15820
16430
|
if(pos >= this.length) {
|
|
@@ -16125,6 +16735,19 @@ class loreline_Lexer {
|
|
|
16125
16735
|
}
|
|
16126
16736
|
++pos;
|
|
16127
16737
|
}
|
|
16738
|
+
let tmp;
|
|
16739
|
+
if(pos < this.length) {
|
|
16740
|
+
let c = HxOverrides.cca(this.input,pos);
|
|
16741
|
+
tmp = (c == null ? -1 : c) == 40;
|
|
16742
|
+
} else {
|
|
16743
|
+
tmp = false;
|
|
16744
|
+
}
|
|
16745
|
+
if(tmp) {
|
|
16746
|
+
pos = this.skipBalancedParens(pos,this.parentBlockType() == loreline_TokenType.KwBeat);
|
|
16747
|
+
if(pos == -1) {
|
|
16748
|
+
return false;
|
|
16749
|
+
}
|
|
16750
|
+
}
|
|
16128
16751
|
} else {
|
|
16129
16752
|
return false;
|
|
16130
16753
|
}
|
|
@@ -16172,6 +16795,19 @@ class loreline_Lexer {
|
|
|
16172
16795
|
}
|
|
16173
16796
|
++pos;
|
|
16174
16797
|
}
|
|
16798
|
+
let tmp;
|
|
16799
|
+
if(pos < this.length) {
|
|
16800
|
+
let c = HxOverrides.cca(this.input,pos);
|
|
16801
|
+
tmp = (c == null ? -1 : c) == 40;
|
|
16802
|
+
} else {
|
|
16803
|
+
tmp = false;
|
|
16804
|
+
}
|
|
16805
|
+
if(tmp) {
|
|
16806
|
+
pos = this.skipBalancedParens(pos,this.parentBlockType() == loreline_TokenType.KwBeat);
|
|
16807
|
+
if(pos == -1) {
|
|
16808
|
+
return false;
|
|
16809
|
+
}
|
|
16810
|
+
}
|
|
16175
16811
|
} else {
|
|
16176
16812
|
return false;
|
|
16177
16813
|
}
|
|
@@ -17126,11 +17762,11 @@ class loreline_Lexer {
|
|
|
17126
17762
|
let token = this.tokenized[i];
|
|
17127
17763
|
let _g = token.type;
|
|
17128
17764
|
switch(_g._hx_index) {
|
|
17765
|
+
case 2:case 48:case 50:
|
|
17766
|
+
return true;
|
|
17129
17767
|
case 19:
|
|
17130
17768
|
let _g1 = _g.name;
|
|
17131
17769
|
return true;
|
|
17132
|
-
case 48:case 50:
|
|
17133
|
-
return true;
|
|
17134
17770
|
case 51:
|
|
17135
17771
|
let _g2 = _g.content;
|
|
17136
17772
|
break;
|
|
@@ -17463,6 +18099,97 @@ class loreline_Lexer {
|
|
|
17463
18099
|
}
|
|
17464
18100
|
return p;
|
|
17465
18101
|
}
|
|
18102
|
+
skipBalancedParens(p,allowTags) {
|
|
18103
|
+
let tmp;
|
|
18104
|
+
if(p < this.length) {
|
|
18105
|
+
let c = HxOverrides.cca(this.input,p);
|
|
18106
|
+
tmp = (c == null ? -1 : c) != 40;
|
|
18107
|
+
} else {
|
|
18108
|
+
tmp = true;
|
|
18109
|
+
}
|
|
18110
|
+
if(tmp) {
|
|
18111
|
+
return -1;
|
|
18112
|
+
}
|
|
18113
|
+
++p;
|
|
18114
|
+
let depth = 1;
|
|
18115
|
+
while(p < this.length && depth > 0) {
|
|
18116
|
+
let c = HxOverrides.cca(this.input,p);
|
|
18117
|
+
let ic = c == null ? -1 : c;
|
|
18118
|
+
if(ic == 92) {
|
|
18119
|
+
p += 2;
|
|
18120
|
+
continue;
|
|
18121
|
+
}
|
|
18122
|
+
if(ic == 10) {
|
|
18123
|
+
return -1;
|
|
18124
|
+
}
|
|
18125
|
+
let tmp;
|
|
18126
|
+
if(ic == 47 && p + 1 < this.length) {
|
|
18127
|
+
let c = HxOverrides.cca(this.input,p + 1);
|
|
18128
|
+
tmp = (c == null ? -1 : c) == 47;
|
|
18129
|
+
} else {
|
|
18130
|
+
tmp = false;
|
|
18131
|
+
}
|
|
18132
|
+
if(tmp) {
|
|
18133
|
+
return -1;
|
|
18134
|
+
}
|
|
18135
|
+
let tmp1;
|
|
18136
|
+
if(ic == 47 && p + 1 < this.length) {
|
|
18137
|
+
let c = HxOverrides.cca(this.input,p + 1);
|
|
18138
|
+
tmp1 = (c == null ? -1 : c) == 42;
|
|
18139
|
+
} else {
|
|
18140
|
+
tmp1 = false;
|
|
18141
|
+
}
|
|
18142
|
+
if(tmp1) {
|
|
18143
|
+
p += 2;
|
|
18144
|
+
while(true) {
|
|
18145
|
+
if(p >= this.length) {
|
|
18146
|
+
return -1;
|
|
18147
|
+
}
|
|
18148
|
+
let c = HxOverrides.cca(this.input,p);
|
|
18149
|
+
if((c == null ? -1 : c) == 10) {
|
|
18150
|
+
return -1;
|
|
18151
|
+
}
|
|
18152
|
+
let tmp;
|
|
18153
|
+
let tmp1;
|
|
18154
|
+
if(p + 1 < this.length) {
|
|
18155
|
+
let c = HxOverrides.cca(this.input,p);
|
|
18156
|
+
tmp1 = (c == null ? -1 : c) == 42;
|
|
18157
|
+
} else {
|
|
18158
|
+
tmp1 = false;
|
|
18159
|
+
}
|
|
18160
|
+
if(tmp1) {
|
|
18161
|
+
let c = HxOverrides.cca(this.input,p + 1);
|
|
18162
|
+
tmp = (c == null ? -1 : c) == 47;
|
|
18163
|
+
} else {
|
|
18164
|
+
tmp = false;
|
|
18165
|
+
}
|
|
18166
|
+
if(tmp) {
|
|
18167
|
+
p += 2;
|
|
18168
|
+
break;
|
|
18169
|
+
}
|
|
18170
|
+
++p;
|
|
18171
|
+
}
|
|
18172
|
+
continue;
|
|
18173
|
+
}
|
|
18174
|
+
if(ic == 34) {
|
|
18175
|
+
p = this.scanStringEnd(p,allowTags);
|
|
18176
|
+
if(p == -1) {
|
|
18177
|
+
return -1;
|
|
18178
|
+
}
|
|
18179
|
+
continue;
|
|
18180
|
+
}
|
|
18181
|
+
if(ic == 40) {
|
|
18182
|
+
++depth;
|
|
18183
|
+
} else if(ic == 41) {
|
|
18184
|
+
--depth;
|
|
18185
|
+
}
|
|
18186
|
+
++p;
|
|
18187
|
+
}
|
|
18188
|
+
if(depth != 0) {
|
|
18189
|
+
return -1;
|
|
18190
|
+
}
|
|
18191
|
+
return p;
|
|
18192
|
+
}
|
|
17466
18193
|
tryReadUnquotedString() {
|
|
17467
18194
|
if(this.isStrict()) {
|
|
17468
18195
|
return null;
|
|
@@ -21808,9 +22535,35 @@ loreline_NCharacterDecl.__super__ = loreline_AstNode;
|
|
|
21808
22535
|
Object.assign(loreline_NCharacterDecl.prototype, {
|
|
21809
22536
|
__class__: loreline_NCharacterDecl
|
|
21810
22537
|
});
|
|
22538
|
+
class loreline_NBeatParam {
|
|
22539
|
+
constructor(name,namePos,defaultValue) {
|
|
22540
|
+
this.name = name;
|
|
22541
|
+
this.namePos = namePos;
|
|
22542
|
+
this.defaultValue = defaultValue;
|
|
22543
|
+
}
|
|
22544
|
+
toJson() {
|
|
22545
|
+
let json = { name : this.name, namePos : this.namePos.toJson()};
|
|
22546
|
+
if(this.defaultValue != null) {
|
|
22547
|
+
json.defaultValue = this.defaultValue.toJson();
|
|
22548
|
+
}
|
|
22549
|
+
return json;
|
|
22550
|
+
}
|
|
22551
|
+
}
|
|
22552
|
+
$hxClasses["loreline.NBeatParam"] = loreline_NBeatParam;
|
|
22553
|
+
loreline_NBeatParam.__name__ = "loreline.NBeatParam";
|
|
22554
|
+
Object.assign(loreline_NBeatParam.prototype, {
|
|
22555
|
+
__class__: loreline_NBeatParam
|
|
22556
|
+
});
|
|
21811
22557
|
class loreline_NBeatDecl extends loreline_AstNode {
|
|
21812
22558
|
constructor(id,pos,name,body,leadingComments,trailingComments) {
|
|
21813
|
-
|
|
22559
|
+
loreline_Node._hx_skip_constructor = true;
|
|
22560
|
+
super();
|
|
22561
|
+
loreline_Node._hx_skip_constructor = false;
|
|
22562
|
+
this._hx_constructor(id,pos,name,body,leadingComments,trailingComments);
|
|
22563
|
+
}
|
|
22564
|
+
_hx_constructor(id,pos,name,body,leadingComments,trailingComments) {
|
|
22565
|
+
this.params = null;
|
|
22566
|
+
super._hx_constructor(id,pos,leadingComments,trailingComments);
|
|
21814
22567
|
this.name = name;
|
|
21815
22568
|
this.body = body;
|
|
21816
22569
|
this.style = 0;
|
|
@@ -21820,6 +22573,18 @@ class loreline_NBeatDecl extends loreline_AstNode {
|
|
|
21820
22573
|
}
|
|
21821
22574
|
each(handleNode) {
|
|
21822
22575
|
super.each(handleNode);
|
|
22576
|
+
if(this.params != null) {
|
|
22577
|
+
let _g = 0;
|
|
22578
|
+
let _g1 = this.params;
|
|
22579
|
+
while(_g < _g1.length) {
|
|
22580
|
+
let param = _g1[_g];
|
|
22581
|
+
++_g;
|
|
22582
|
+
if(param.defaultValue != null) {
|
|
22583
|
+
handleNode(param.defaultValue,this);
|
|
22584
|
+
param.defaultValue.each(handleNode);
|
|
22585
|
+
}
|
|
22586
|
+
}
|
|
22587
|
+
}
|
|
21823
22588
|
if(this.body != null) {
|
|
21824
22589
|
let _g = 0;
|
|
21825
22590
|
let _g1 = this.body.length;
|
|
@@ -21834,6 +22599,17 @@ class loreline_NBeatDecl extends loreline_AstNode {
|
|
|
21834
22599
|
toJson() {
|
|
21835
22600
|
let json = super.toJson();
|
|
21836
22601
|
json.name = this.name;
|
|
22602
|
+
if(this.params != null) {
|
|
22603
|
+
let _g = [];
|
|
22604
|
+
let _g1 = 0;
|
|
22605
|
+
let _g2 = this.params;
|
|
22606
|
+
while(_g1 < _g2.length) {
|
|
22607
|
+
let param = _g2[_g1];
|
|
22608
|
+
++_g1;
|
|
22609
|
+
_g.push(param.toJson());
|
|
22610
|
+
}
|
|
22611
|
+
json.params = _g;
|
|
22612
|
+
}
|
|
21837
22613
|
let _g = [];
|
|
21838
22614
|
let _g1 = 0;
|
|
21839
22615
|
let _g2 = this.body;
|
|
@@ -22481,17 +23257,57 @@ Object.assign(loreline_NCall.prototype, {
|
|
|
22481
23257
|
});
|
|
22482
23258
|
class loreline_NTransition extends loreline_AstNode {
|
|
22483
23259
|
constructor(id,pos,target,targetPos,leadingComments,trailingComments) {
|
|
22484
|
-
|
|
23260
|
+
loreline_Node._hx_skip_constructor = true;
|
|
23261
|
+
super();
|
|
23262
|
+
loreline_Node._hx_skip_constructor = false;
|
|
23263
|
+
this._hx_constructor(id,pos,target,targetPos,leadingComments,trailingComments);
|
|
23264
|
+
}
|
|
23265
|
+
_hx_constructor(id,pos,target,targetPos,leadingComments,trailingComments) {
|
|
23266
|
+
this.args = null;
|
|
23267
|
+
this.targetExpr = null;
|
|
23268
|
+
super._hx_constructor(id,pos,leadingComments,trailingComments);
|
|
22485
23269
|
this.target = target;
|
|
22486
23270
|
this.targetPos = targetPos;
|
|
22487
23271
|
}
|
|
22488
23272
|
type() {
|
|
22489
23273
|
return "Transition";
|
|
22490
23274
|
}
|
|
23275
|
+
each(handleNode) {
|
|
23276
|
+
super.each(handleNode);
|
|
23277
|
+
if(this.targetExpr != null) {
|
|
23278
|
+
handleNode(this.targetExpr,this);
|
|
23279
|
+
this.targetExpr.each(handleNode);
|
|
23280
|
+
}
|
|
23281
|
+
if(this.args != null) {
|
|
23282
|
+
let _g = 0;
|
|
23283
|
+
let _g1 = this.args;
|
|
23284
|
+
while(_g < _g1.length) {
|
|
23285
|
+
let arg = _g1[_g];
|
|
23286
|
+
++_g;
|
|
23287
|
+
handleNode(arg,this);
|
|
23288
|
+
arg.each(handleNode);
|
|
23289
|
+
}
|
|
23290
|
+
}
|
|
23291
|
+
}
|
|
22491
23292
|
toJson() {
|
|
22492
23293
|
let json = super.toJson();
|
|
22493
|
-
|
|
23294
|
+
if(this.targetExpr != null) {
|
|
23295
|
+
json.targetExpr = this.targetExpr.toJson();
|
|
23296
|
+
} else {
|
|
23297
|
+
json.target = this.target;
|
|
23298
|
+
}
|
|
22494
23299
|
json.targetPos = this.targetPos.toJson();
|
|
23300
|
+
if(this.args != null) {
|
|
23301
|
+
let _g = [];
|
|
23302
|
+
let _g1 = 0;
|
|
23303
|
+
let _g2 = this.args;
|
|
23304
|
+
while(_g1 < _g2.length) {
|
|
23305
|
+
let arg = _g2[_g1];
|
|
23306
|
+
++_g1;
|
|
23307
|
+
_g.push(arg.toJson());
|
|
23308
|
+
}
|
|
23309
|
+
json.args = _g;
|
|
23310
|
+
}
|
|
22495
23311
|
return json;
|
|
22496
23312
|
}
|
|
22497
23313
|
}
|
|
@@ -22503,17 +23319,57 @@ Object.assign(loreline_NTransition.prototype, {
|
|
|
22503
23319
|
});
|
|
22504
23320
|
class loreline_NInsertion extends loreline_AstNode {
|
|
22505
23321
|
constructor(id,pos,target,targetPos,leadingComments,trailingComments) {
|
|
22506
|
-
|
|
23322
|
+
loreline_Node._hx_skip_constructor = true;
|
|
23323
|
+
super();
|
|
23324
|
+
loreline_Node._hx_skip_constructor = false;
|
|
23325
|
+
this._hx_constructor(id,pos,target,targetPos,leadingComments,trailingComments);
|
|
23326
|
+
}
|
|
23327
|
+
_hx_constructor(id,pos,target,targetPos,leadingComments,trailingComments) {
|
|
23328
|
+
this.args = null;
|
|
23329
|
+
this.targetExpr = null;
|
|
23330
|
+
super._hx_constructor(id,pos,leadingComments,trailingComments);
|
|
22507
23331
|
this.target = target;
|
|
22508
23332
|
this.targetPos = targetPos;
|
|
22509
23333
|
}
|
|
22510
23334
|
type() {
|
|
22511
23335
|
return "Insertion";
|
|
22512
23336
|
}
|
|
23337
|
+
each(handleNode) {
|
|
23338
|
+
super.each(handleNode);
|
|
23339
|
+
if(this.targetExpr != null) {
|
|
23340
|
+
handleNode(this.targetExpr,this);
|
|
23341
|
+
this.targetExpr.each(handleNode);
|
|
23342
|
+
}
|
|
23343
|
+
if(this.args != null) {
|
|
23344
|
+
let _g = 0;
|
|
23345
|
+
let _g1 = this.args;
|
|
23346
|
+
while(_g < _g1.length) {
|
|
23347
|
+
let arg = _g1[_g];
|
|
23348
|
+
++_g;
|
|
23349
|
+
handleNode(arg,this);
|
|
23350
|
+
arg.each(handleNode);
|
|
23351
|
+
}
|
|
23352
|
+
}
|
|
23353
|
+
}
|
|
22513
23354
|
toJson() {
|
|
22514
23355
|
let json = super.toJson();
|
|
22515
|
-
|
|
23356
|
+
if(this.targetExpr != null) {
|
|
23357
|
+
json.targetExpr = this.targetExpr.toJson();
|
|
23358
|
+
} else {
|
|
23359
|
+
json.target = this.target;
|
|
23360
|
+
}
|
|
22516
23361
|
json.targetPos = this.targetPos.toJson();
|
|
23362
|
+
if(this.args != null) {
|
|
23363
|
+
let _g = [];
|
|
23364
|
+
let _g1 = 0;
|
|
23365
|
+
let _g2 = this.args;
|
|
23366
|
+
while(_g1 < _g2.length) {
|
|
23367
|
+
let arg = _g2[_g1];
|
|
23368
|
+
++_g1;
|
|
23369
|
+
_g.push(arg.toJson());
|
|
23370
|
+
}
|
|
23371
|
+
json.args = _g;
|
|
23372
|
+
}
|
|
22517
23373
|
return json;
|
|
22518
23374
|
}
|
|
22519
23375
|
}
|
|
@@ -22523,6 +23379,63 @@ loreline_NInsertion.__super__ = loreline_AstNode;
|
|
|
22523
23379
|
Object.assign(loreline_NInsertion.prototype, {
|
|
22524
23380
|
__class__: loreline_NInsertion
|
|
22525
23381
|
});
|
|
23382
|
+
class loreline_NBeatCall extends loreline_AstNode {
|
|
23383
|
+
constructor(id,pos,targetExpr,targetPos,leadingComments,trailingComments) {
|
|
23384
|
+
loreline_Node._hx_skip_constructor = true;
|
|
23385
|
+
super();
|
|
23386
|
+
loreline_Node._hx_skip_constructor = false;
|
|
23387
|
+
this._hx_constructor(id,pos,targetExpr,targetPos,leadingComments,trailingComments);
|
|
23388
|
+
}
|
|
23389
|
+
_hx_constructor(id,pos,targetExpr,targetPos,leadingComments,trailingComments) {
|
|
23390
|
+
this.args = null;
|
|
23391
|
+
super._hx_constructor(id,pos,leadingComments,trailingComments);
|
|
23392
|
+
this.targetExpr = targetExpr;
|
|
23393
|
+
this.targetPos = targetPos;
|
|
23394
|
+
}
|
|
23395
|
+
type() {
|
|
23396
|
+
return "BeatCall";
|
|
23397
|
+
}
|
|
23398
|
+
each(handleNode) {
|
|
23399
|
+
super.each(handleNode);
|
|
23400
|
+
if(this.targetExpr != null) {
|
|
23401
|
+
handleNode(this.targetExpr,this);
|
|
23402
|
+
this.targetExpr.each(handleNode);
|
|
23403
|
+
}
|
|
23404
|
+
if(this.args != null) {
|
|
23405
|
+
let _g = 0;
|
|
23406
|
+
let _g1 = this.args;
|
|
23407
|
+
while(_g < _g1.length) {
|
|
23408
|
+
let arg = _g1[_g];
|
|
23409
|
+
++_g;
|
|
23410
|
+
handleNode(arg,this);
|
|
23411
|
+
arg.each(handleNode);
|
|
23412
|
+
}
|
|
23413
|
+
}
|
|
23414
|
+
}
|
|
23415
|
+
toJson() {
|
|
23416
|
+
let json = super.toJson();
|
|
23417
|
+
json.targetExpr = this.targetExpr.toJson();
|
|
23418
|
+
json.targetPos = this.targetPos.toJson();
|
|
23419
|
+
if(this.args != null) {
|
|
23420
|
+
let _g = [];
|
|
23421
|
+
let _g1 = 0;
|
|
23422
|
+
let _g2 = this.args;
|
|
23423
|
+
while(_g1 < _g2.length) {
|
|
23424
|
+
let arg = _g2[_g1];
|
|
23425
|
+
++_g1;
|
|
23426
|
+
_g.push(arg.toJson());
|
|
23427
|
+
}
|
|
23428
|
+
json.args = _g;
|
|
23429
|
+
}
|
|
23430
|
+
return json;
|
|
23431
|
+
}
|
|
23432
|
+
}
|
|
23433
|
+
$hxClasses["loreline.NBeatCall"] = loreline_NBeatCall;
|
|
23434
|
+
loreline_NBeatCall.__name__ = "loreline.NBeatCall";
|
|
23435
|
+
loreline_NBeatCall.__super__ = loreline_AstNode;
|
|
23436
|
+
Object.assign(loreline_NBeatCall.prototype, {
|
|
23437
|
+
__class__: loreline_NBeatCall
|
|
23438
|
+
});
|
|
22526
23439
|
class loreline_NFunctionDecl extends loreline_NExpr {
|
|
22527
23440
|
constructor(id,pos,name,args,code,external,leadingComments,trailingComments) {
|
|
22528
23441
|
super(id,pos,leadingComments,trailingComments);
|
|
@@ -22895,7 +23808,9 @@ Object.assign(loreline_NImportStatement.prototype, {
|
|
|
22895
23808
|
});
|
|
22896
23809
|
class loreline_Objects {
|
|
22897
23810
|
static isFields(value) {
|
|
22898
|
-
if(
|
|
23811
|
+
if(value == null) {
|
|
23812
|
+
return false;
|
|
23813
|
+
} else if(js_Boot.__implements(value,loreline_Fields)) {
|
|
22899
23814
|
return true;
|
|
22900
23815
|
} else if(((value) instanceof haxe_ds_StringMap)) {
|
|
22901
23816
|
return true;
|
|
@@ -22996,7 +23911,8 @@ class loreline_Objects {
|
|
|
22996
23911
|
}
|
|
22997
23912
|
return instance;
|
|
22998
23913
|
}
|
|
22999
|
-
|
|
23914
|
+
let fields = { };
|
|
23915
|
+
return fields;
|
|
23000
23916
|
}
|
|
23001
23917
|
}
|
|
23002
23918
|
$hxClasses["loreline.Objects"] = loreline_Objects;
|
|
@@ -23389,7 +24305,17 @@ class loreline_Parser {
|
|
|
23389
24305
|
case 1:
|
|
23390
24306
|
return this.parseStateDecl(false);
|
|
23391
24307
|
case 2:
|
|
23392
|
-
|
|
24308
|
+
if(this.peek().type == loreline_TokenType.LParen) {
|
|
24309
|
+
let node = this.parseBeatCall();
|
|
24310
|
+
if(topLevel) {
|
|
24311
|
+
return _gthis.wrapInRootBeat(node);
|
|
24312
|
+
} else {
|
|
24313
|
+
return node;
|
|
24314
|
+
}
|
|
24315
|
+
} else {
|
|
24316
|
+
return this.parseBeatDecl();
|
|
24317
|
+
}
|
|
24318
|
+
break;
|
|
23393
24319
|
case 3:
|
|
23394
24320
|
if(topLevel) {
|
|
23395
24321
|
return this.parseCharacterDecl();
|
|
@@ -23883,6 +24809,34 @@ class loreline_Parser {
|
|
|
23883
24809
|
this.expect(loreline_TokenType.KwBeat);
|
|
23884
24810
|
beatNode.pos = startPos.extendedTo(this.currentPos());
|
|
23885
24811
|
beatNode.name = this.expectIdentifier();
|
|
24812
|
+
if(this.match(loreline_TokenType.LParen)) {
|
|
24813
|
+
let params = [];
|
|
24814
|
+
if(!this.check(loreline_TokenType.RParen)) {
|
|
24815
|
+
do {
|
|
24816
|
+
while(this.match(loreline_TokenType.LineBreak)) {
|
|
24817
|
+
}
|
|
24818
|
+
let paramPos = this.currentPos();
|
|
24819
|
+
let paramName = this.expectIdentifier();
|
|
24820
|
+
let defaultValue = null;
|
|
24821
|
+
if(this.match(loreline_TokenType.OpAssign)) {
|
|
24822
|
+
defaultValue = this.parseExpression();
|
|
24823
|
+
}
|
|
24824
|
+
let _g = 0;
|
|
24825
|
+
while(_g < params.length) {
|
|
24826
|
+
let existing = params[_g];
|
|
24827
|
+
++_g;
|
|
24828
|
+
if(existing.name == paramName) {
|
|
24829
|
+
this.addError(new loreline_ParseError("Duplicate beat parameter: " + paramName,paramPos));
|
|
24830
|
+
}
|
|
24831
|
+
}
|
|
24832
|
+
params.push(new loreline_NBeatParam(paramName,paramPos,defaultValue));
|
|
24833
|
+
while(this.match(loreline_TokenType.LineBreak)) {
|
|
24834
|
+
}
|
|
24835
|
+
} while(this.match(loreline_TokenType.Comma));
|
|
24836
|
+
}
|
|
24837
|
+
this.expect(loreline_TokenType.RParen);
|
|
24838
|
+
beatNode.params = params;
|
|
24839
|
+
}
|
|
23886
24840
|
let blockStart = this.parseBlockStart();
|
|
23887
24841
|
let blockEnd = blockStart.type == loreline_TokenType.Indent ? loreline_TokenType.Unindent : loreline_TokenType.RBrace;
|
|
23888
24842
|
beatNode.style = blockEnd == loreline_TokenType.RBrace ? 1 : 0;
|
|
@@ -24295,14 +25249,72 @@ class loreline_Parser {
|
|
|
24295
25249
|
if(this.match(loreline_TokenType.Dot)) {
|
|
24296
25250
|
return this.attachComments(new loreline_NTransition(this.nextNodeId(4),startPos.extendedTo(this.prevNonWhitespaceOrComment().pos),".",this.prevNonWhitespaceOrComment().pos));
|
|
24297
25251
|
}
|
|
25252
|
+
if(this.check(loreline_TokenType.KwBeat)) {
|
|
25253
|
+
let targetStart = this.currentPos();
|
|
25254
|
+
this.advance();
|
|
25255
|
+
this.expect(loreline_TokenType.LParen);
|
|
25256
|
+
let callArgs = this.parseCallArguments();
|
|
25257
|
+
if(callArgs.length == 0) {
|
|
25258
|
+
this.addError(new loreline_ParseError("beat() requires a target expression",targetStart));
|
|
25259
|
+
}
|
|
25260
|
+
let node = new loreline_NTransition(this.nextNodeId(4),startPos.extendedTo(this.prevNonWhitespaceOrComment().pos),null,targetStart.extendedTo(this.prevNonWhitespaceOrComment().pos));
|
|
25261
|
+
node.targetExpr = callArgs.length > 0 ? callArgs[0] : null;
|
|
25262
|
+
if(callArgs.length > 1) {
|
|
25263
|
+
node.args = callArgs.slice(1);
|
|
25264
|
+
}
|
|
25265
|
+
return this.attachComments(node);
|
|
25266
|
+
}
|
|
24298
25267
|
let target = this.expectIdentifier();
|
|
24299
|
-
|
|
25268
|
+
let targetPos = this.prevNonWhitespaceOrComment().pos;
|
|
25269
|
+
let args = null;
|
|
25270
|
+
if(this.match(loreline_TokenType.LParen)) {
|
|
25271
|
+
args = this.parseCallArguments();
|
|
25272
|
+
}
|
|
25273
|
+
let node = new loreline_NTransition(this.nextNodeId(4),startPos.extendedTo(this.prevNonWhitespaceOrComment().pos),target,targetPos);
|
|
25274
|
+
node.args = args;
|
|
25275
|
+
return this.attachComments(node);
|
|
24300
25276
|
}
|
|
24301
25277
|
parseInsertion() {
|
|
24302
25278
|
let startPos = this.currentPos();
|
|
24303
25279
|
this.expect(loreline_TokenType.OpPlus);
|
|
25280
|
+
if(this.check(loreline_TokenType.KwBeat)) {
|
|
25281
|
+
let targetStart = this.currentPos();
|
|
25282
|
+
this.advance();
|
|
25283
|
+
this.expect(loreline_TokenType.LParen);
|
|
25284
|
+
let callArgs = this.parseCallArguments();
|
|
25285
|
+
if(callArgs.length == 0) {
|
|
25286
|
+
this.addError(new loreline_ParseError("beat() requires a target expression",targetStart));
|
|
25287
|
+
}
|
|
25288
|
+
let node = new loreline_NInsertion(this.nextNodeId(4),startPos.extendedTo(this.prevNonWhitespaceOrComment().pos),null,targetStart.extendedTo(this.prevNonWhitespaceOrComment().pos));
|
|
25289
|
+
node.targetExpr = callArgs.length > 0 ? callArgs[0] : null;
|
|
25290
|
+
if(callArgs.length > 1) {
|
|
25291
|
+
node.args = callArgs.slice(1);
|
|
25292
|
+
}
|
|
25293
|
+
return this.attachComments(node);
|
|
25294
|
+
}
|
|
24304
25295
|
let target = this.expectIdentifier();
|
|
24305
|
-
|
|
25296
|
+
let targetPos = this.prevNonWhitespaceOrComment().pos;
|
|
25297
|
+
let args = null;
|
|
25298
|
+
if(this.match(loreline_TokenType.LParen)) {
|
|
25299
|
+
args = this.parseCallArguments();
|
|
25300
|
+
}
|
|
25301
|
+
let node = new loreline_NInsertion(this.nextNodeId(4),startPos.extendedTo(this.prevNonWhitespaceOrComment().pos),target,targetPos);
|
|
25302
|
+
node.args = args;
|
|
25303
|
+
return this.attachComments(node);
|
|
25304
|
+
}
|
|
25305
|
+
parseBeatCall() {
|
|
25306
|
+
let startPos = this.currentPos();
|
|
25307
|
+
this.expect(loreline_TokenType.KwBeat);
|
|
25308
|
+
this.expect(loreline_TokenType.LParen);
|
|
25309
|
+
let callArgs = this.parseCallArguments();
|
|
25310
|
+
if(callArgs.length == 0) {
|
|
25311
|
+
this.addError(new loreline_ParseError("beat() requires a target expression",startPos));
|
|
25312
|
+
}
|
|
25313
|
+
let node = new loreline_NBeatCall(this.nextNodeId(4),startPos.extendedTo(this.prevNonWhitespaceOrComment().pos),callArgs.length > 0 ? callArgs[0] : null,startPos.extendedTo(this.prevNonWhitespaceOrComment().pos));
|
|
25314
|
+
if(callArgs.length > 1) {
|
|
25315
|
+
node.args = callArgs.slice(1);
|
|
25316
|
+
}
|
|
25317
|
+
return this.attachComments(node);
|
|
24306
25318
|
}
|
|
24307
25319
|
parseFunction() {
|
|
24308
25320
|
let startPos = this.currentPos();
|
|
@@ -25487,6 +26499,9 @@ class loreline_Printer {
|
|
|
25487
26499
|
case loreline_NAssign:
|
|
25488
26500
|
this.printAssignment(node);
|
|
25489
26501
|
break;
|
|
26502
|
+
case loreline_NBeatCall:
|
|
26503
|
+
this.printBeatCall(node);
|
|
26504
|
+
break;
|
|
25490
26505
|
case loreline_NBeatDecl:
|
|
25491
26506
|
this.printBeatDecl(node);
|
|
25492
26507
|
break;
|
|
@@ -25700,7 +26715,29 @@ class loreline_Printer {
|
|
|
25700
26715
|
this.newline();
|
|
25701
26716
|
this.newline();
|
|
25702
26717
|
this.printLeadingComments(beat);
|
|
25703
|
-
this.write("beat " + beat.name
|
|
26718
|
+
this.write("beat " + beat.name);
|
|
26719
|
+
if(beat.params != null) {
|
|
26720
|
+
let savedComments = this.enableComments;
|
|
26721
|
+
this.enableComments = false;
|
|
26722
|
+
this.write("(");
|
|
26723
|
+
let _g = 0;
|
|
26724
|
+
let _g1 = beat.params.length;
|
|
26725
|
+
while(_g < _g1) {
|
|
26726
|
+
let i = _g++;
|
|
26727
|
+
if(i > 0) {
|
|
26728
|
+
this.write(", ");
|
|
26729
|
+
}
|
|
26730
|
+
let param = beat.params[i];
|
|
26731
|
+
this.write(param.name);
|
|
26732
|
+
if(param.defaultValue != null) {
|
|
26733
|
+
this.write(" = ");
|
|
26734
|
+
this.printNode(param.defaultValue);
|
|
26735
|
+
}
|
|
26736
|
+
}
|
|
26737
|
+
this.write(")");
|
|
26738
|
+
this.enableComments = savedComments;
|
|
26739
|
+
}
|
|
26740
|
+
this.write(" ");
|
|
25704
26741
|
this.printTrailingComments(beat);
|
|
25705
26742
|
if(beat.style == 1) {
|
|
25706
26743
|
this.write("{");
|
|
@@ -26005,7 +27042,18 @@ class loreline_Printer {
|
|
|
26005
27042
|
this.newline();
|
|
26006
27043
|
}
|
|
26007
27044
|
this.printLeadingComments(trans);
|
|
26008
|
-
|
|
27045
|
+
if(trans.targetExpr != null) {
|
|
27046
|
+
this.write("-> beat(");
|
|
27047
|
+
this.printTargetExprAndArgs(trans.targetExpr,trans.args);
|
|
27048
|
+
this.write(")");
|
|
27049
|
+
} else {
|
|
27050
|
+
this.write("-> " + trans.target);
|
|
27051
|
+
if(trans.args != null) {
|
|
27052
|
+
this.write("(");
|
|
27053
|
+
this.printTargetExprAndArgs(null,trans.args);
|
|
27054
|
+
this.write(")");
|
|
27055
|
+
}
|
|
27056
|
+
}
|
|
26009
27057
|
this.printTrailingComments(trans);
|
|
26010
27058
|
}
|
|
26011
27059
|
printInsertion(insert) {
|
|
@@ -26013,9 +27061,52 @@ class loreline_Printer {
|
|
|
26013
27061
|
this.newline();
|
|
26014
27062
|
}
|
|
26015
27063
|
this.printLeadingComments(insert);
|
|
26016
|
-
|
|
27064
|
+
if(insert.targetExpr != null) {
|
|
27065
|
+
this.write("+ beat(");
|
|
27066
|
+
this.printTargetExprAndArgs(insert.targetExpr,insert.args);
|
|
27067
|
+
this.write(")");
|
|
27068
|
+
} else {
|
|
27069
|
+
this.write("+ " + insert.target);
|
|
27070
|
+
if(insert.args != null) {
|
|
27071
|
+
this.write("(");
|
|
27072
|
+
this.printTargetExprAndArgs(null,insert.args);
|
|
27073
|
+
this.write(")");
|
|
27074
|
+
}
|
|
27075
|
+
}
|
|
26017
27076
|
this.printTrailingComments(insert);
|
|
26018
27077
|
}
|
|
27078
|
+
printBeatCall(call) {
|
|
27079
|
+
if(this._prevLevel == this._level) {
|
|
27080
|
+
this.newline();
|
|
27081
|
+
}
|
|
27082
|
+
this.printLeadingComments(call);
|
|
27083
|
+
this.write("beat(");
|
|
27084
|
+
this.printTargetExprAndArgs(call.targetExpr,call.args);
|
|
27085
|
+
this.write(")");
|
|
27086
|
+
this.printTrailingComments(call);
|
|
27087
|
+
}
|
|
27088
|
+
printTargetExprAndArgs(targetExpr,args) {
|
|
27089
|
+
let savedComments = this.enableComments;
|
|
27090
|
+
this.enableComments = false;
|
|
27091
|
+
let first = true;
|
|
27092
|
+
if(targetExpr != null) {
|
|
27093
|
+
this.printNode(targetExpr);
|
|
27094
|
+
first = false;
|
|
27095
|
+
}
|
|
27096
|
+
if(args != null) {
|
|
27097
|
+
let _g = 0;
|
|
27098
|
+
while(_g < args.length) {
|
|
27099
|
+
let arg = args[_g];
|
|
27100
|
+
++_g;
|
|
27101
|
+
if(!first) {
|
|
27102
|
+
this.write(", ");
|
|
27103
|
+
}
|
|
27104
|
+
first = false;
|
|
27105
|
+
this.printNode(arg);
|
|
27106
|
+
}
|
|
27107
|
+
}
|
|
27108
|
+
this.enableComments = savedComments;
|
|
27109
|
+
}
|
|
26019
27110
|
printStringLiteral(str) {
|
|
26020
27111
|
let surroundWithQuotes = str.quotes == 1;
|
|
26021
27112
|
if(surroundWithQuotes) {
|
|
@@ -26683,9 +27774,84 @@ class loreline_Utf8 {
|
|
|
26683
27774
|
static uCharAt(str,pos) {
|
|
26684
27775
|
return str.charAt(pos);
|
|
26685
27776
|
}
|
|
27777
|
+
static toCodes(str) {
|
|
27778
|
+
let len = str.length;
|
|
27779
|
+
let v = new Array(len);
|
|
27780
|
+
let _g = 0;
|
|
27781
|
+
let _g1 = len;
|
|
27782
|
+
while(_g < _g1) {
|
|
27783
|
+
let i = _g++;
|
|
27784
|
+
v[i] = str.charCodeAt(i);
|
|
27785
|
+
}
|
|
27786
|
+
return v;
|
|
27787
|
+
}
|
|
26686
27788
|
}
|
|
26687
27789
|
$hxClasses["loreline.Utf8"] = loreline_Utf8;
|
|
26688
27790
|
loreline_Utf8.__name__ = "loreline.Utf8";
|
|
27791
|
+
class loreline_Utf8Vector {
|
|
27792
|
+
static uLength(v) {
|
|
27793
|
+
return v.length;
|
|
27794
|
+
}
|
|
27795
|
+
static uCharCodeAt(v,pos) {
|
|
27796
|
+
if(pos < 0 || pos >= v.length) {
|
|
27797
|
+
return -1;
|
|
27798
|
+
} else {
|
|
27799
|
+
return v[pos];
|
|
27800
|
+
}
|
|
27801
|
+
}
|
|
27802
|
+
static uSubstr(v,pos,len) {
|
|
27803
|
+
return loreline_Utf8Vector.slice(v,pos,len != null ? pos + len : v.length);
|
|
27804
|
+
}
|
|
27805
|
+
static uSubstring(v,startIndex,endIndex) {
|
|
27806
|
+
return loreline_Utf8Vector.slice(v,startIndex,endIndex != null ? endIndex : v.length);
|
|
27807
|
+
}
|
|
27808
|
+
static uCharAt(v,pos) {
|
|
27809
|
+
if(pos < 0 || pos >= v.length) {
|
|
27810
|
+
return "";
|
|
27811
|
+
} else {
|
|
27812
|
+
return loreline_Utf8Vector.slice(v,pos,pos + 1);
|
|
27813
|
+
}
|
|
27814
|
+
}
|
|
27815
|
+
static uIndexOf(v,substr,startIndex) {
|
|
27816
|
+
let needle = loreline_Utf8.toCodes(substr);
|
|
27817
|
+
let nlen = needle.length;
|
|
27818
|
+
if(nlen == 0) {
|
|
27819
|
+
if(startIndex != null) {
|
|
27820
|
+
return startIndex;
|
|
27821
|
+
} else {
|
|
27822
|
+
return 0;
|
|
27823
|
+
}
|
|
27824
|
+
}
|
|
27825
|
+
let i = startIndex != null && startIndex > 0 ? startIndex : 0;
|
|
27826
|
+
let last = v.length - nlen;
|
|
27827
|
+
while(i <= last) {
|
|
27828
|
+
let k = 0;
|
|
27829
|
+
while(k < nlen && v[i + k] == needle[k]) ++k;
|
|
27830
|
+
if(k == nlen) {
|
|
27831
|
+
return i;
|
|
27832
|
+
}
|
|
27833
|
+
++i;
|
|
27834
|
+
}
|
|
27835
|
+
return -1;
|
|
27836
|
+
}
|
|
27837
|
+
static slice(v,start,end) {
|
|
27838
|
+
if(start < 0) {
|
|
27839
|
+
start = 0;
|
|
27840
|
+
}
|
|
27841
|
+
if(end > v.length) {
|
|
27842
|
+
end = v.length;
|
|
27843
|
+
}
|
|
27844
|
+
let buf_b = "";
|
|
27845
|
+
let i = start;
|
|
27846
|
+
while(i < end) {
|
|
27847
|
+
buf_b += String.fromCodePoint(v[i]);
|
|
27848
|
+
++i;
|
|
27849
|
+
}
|
|
27850
|
+
return buf_b;
|
|
27851
|
+
}
|
|
27852
|
+
}
|
|
27853
|
+
$hxClasses["loreline.Utf8Vector"] = loreline_Utf8Vector;
|
|
27854
|
+
loreline_Utf8Vector.__name__ = "loreline.Utf8Vector";
|
|
26689
27855
|
class loreline_WrappedError extends loreline_Error {
|
|
26690
27856
|
constructor(wrapped,message,pos) {
|
|
26691
27857
|
super(message,pos);
|
|
@@ -30411,9 +31577,9 @@ class loreline_lorscript_Interp {
|
|
|
30411
31577
|
if(Object.prototype.hasOwnProperty.call(this.interpreter.topLevelFunctions.h,id)) {
|
|
30412
31578
|
return this.interpreter.topLevelFunctions.h[id];
|
|
30413
31579
|
}
|
|
30414
|
-
let
|
|
30415
|
-
if(
|
|
30416
|
-
return
|
|
31580
|
+
let beatRef = this.interpreter.resolveBeatRefByName(id);
|
|
31581
|
+
if(beatRef != null) {
|
|
31582
|
+
return beatRef;
|
|
30417
31583
|
}
|
|
30418
31584
|
let e = new loreline_lorscript_Error(loreline_lorscript_ErrorDef.EUnknownVariable(id),this.curExpr.pmin,this.curExpr.pmax,this.curExpr.origin,this.curExpr.line);
|
|
30419
31585
|
throw haxe_Exception.thrown(e);
|
|
@@ -30515,16 +31681,25 @@ class loreline_lorscript_Interp {
|
|
|
30515
31681
|
args.push(this.expr(p));
|
|
30516
31682
|
}
|
|
30517
31683
|
let _g3 = e7.e;
|
|
30518
|
-
|
|
30519
|
-
|
|
30520
|
-
let
|
|
30521
|
-
|
|
31684
|
+
switch(_g3._hx_index) {
|
|
31685
|
+
case 1:
|
|
31686
|
+
let id1 = _g3.v;
|
|
31687
|
+
if(id1 == "call" && !this.callIsShadowed()) {
|
|
31688
|
+
return this.dynamicCall(args);
|
|
31689
|
+
} else {
|
|
31690
|
+
return this.call(null,this.expr(e7),args);
|
|
31691
|
+
}
|
|
31692
|
+
break;
|
|
31693
|
+
case 5:
|
|
31694
|
+
let e8 = _g3.e;
|
|
31695
|
+
let f2 = _g3.f;
|
|
31696
|
+
let obj = this.expr(e8);
|
|
30522
31697
|
if(obj == null) {
|
|
30523
|
-
let e = new loreline_lorscript_Error(loreline_lorscript_ErrorDef.EInvalidAccess(
|
|
31698
|
+
let e = new loreline_lorscript_Error(loreline_lorscript_ErrorDef.EInvalidAccess(f2),this.curExpr.pmin,this.curExpr.pmax,this.curExpr.origin,this.curExpr.line);
|
|
30524
31699
|
throw haxe_Exception.thrown(e);
|
|
30525
31700
|
}
|
|
30526
|
-
return this.fcall(obj,
|
|
30527
|
-
|
|
31701
|
+
return this.fcall(obj,f2,args);
|
|
31702
|
+
default:
|
|
30528
31703
|
return this.call(null,this.expr(e7),args);
|
|
30529
31704
|
}
|
|
30530
31705
|
break;
|
|
@@ -30542,14 +31717,14 @@ class loreline_lorscript_Interp {
|
|
|
30542
31717
|
break;
|
|
30543
31718
|
case 10:
|
|
30544
31719
|
let econd1 = e1.cond;
|
|
30545
|
-
let
|
|
30546
|
-
this.whileLoop(econd1,
|
|
31720
|
+
let e9 = e1.e;
|
|
31721
|
+
this.whileLoop(econd1,e9);
|
|
30547
31722
|
return null;
|
|
30548
31723
|
case 11:
|
|
30549
31724
|
let v2 = e1.v;
|
|
30550
31725
|
let it = e1.it;
|
|
30551
|
-
let
|
|
30552
|
-
this.forLoop(v2,it,
|
|
31726
|
+
let e10 = e1.e;
|
|
31727
|
+
this.forLoop(v2,it,e10);
|
|
30553
31728
|
return null;
|
|
30554
31729
|
case 12:
|
|
30555
31730
|
throw haxe_Exception.thrown(loreline_lorscript__$Interp_Stop.SBreak);
|
|
@@ -30574,7 +31749,7 @@ class loreline_lorscript_Interp {
|
|
|
30574
31749
|
minParams += 1;
|
|
30575
31750
|
}
|
|
30576
31751
|
}
|
|
30577
|
-
let
|
|
31752
|
+
let f3 = function(args) {
|
|
30578
31753
|
if((args == null ? 0 : args.length) != params1.length) {
|
|
30579
31754
|
if(args.length < minParams) {
|
|
30580
31755
|
let str = "Invalid number of parameters. Got " + args.length + ", required " + minParams;
|
|
@@ -30634,26 +31809,26 @@ class loreline_lorscript_Interp {
|
|
|
30634
31809
|
me.depth = depth;
|
|
30635
31810
|
return r;
|
|
30636
31811
|
};
|
|
30637
|
-
let
|
|
31812
|
+
let f4 = Reflect.makeVarArgs(f3);
|
|
30638
31813
|
if(name != null) {
|
|
30639
31814
|
if(this.depth == 0) {
|
|
30640
|
-
this.variables.h[name] =
|
|
31815
|
+
this.variables.h[name] = f4;
|
|
30641
31816
|
} else {
|
|
30642
31817
|
this.declared.push({ n : name, old : this.locals.h[name]});
|
|
30643
|
-
let ref = { r :
|
|
31818
|
+
let ref = { r : f4};
|
|
30644
31819
|
this.locals.h[name] = ref;
|
|
30645
31820
|
capturedLocals.h[name] = ref;
|
|
30646
31821
|
}
|
|
30647
31822
|
}
|
|
30648
|
-
return
|
|
31823
|
+
return f4;
|
|
30649
31824
|
case 15:
|
|
30650
|
-
let
|
|
30651
|
-
this.returnValue =
|
|
31825
|
+
let e13 = e1.e;
|
|
31826
|
+
this.returnValue = e13 == null ? null : this.expr(e13);
|
|
30652
31827
|
throw haxe_Exception.thrown(loreline_lorscript__$Interp_Stop.SReturn);
|
|
30653
31828
|
case 16:
|
|
30654
|
-
let
|
|
31829
|
+
let e14 = e1.e;
|
|
30655
31830
|
let index = e1.index;
|
|
30656
|
-
let arr = this.expr(
|
|
31831
|
+
let arr = this.expr(e14);
|
|
30657
31832
|
let index1 = this.expr(index);
|
|
30658
31833
|
if(loreline_Arrays.isArray(arr)) {
|
|
30659
31834
|
return loreline_Arrays.arrayGet(arr,index1);
|
|
@@ -30727,18 +31902,18 @@ class loreline_lorscript_Interp {
|
|
|
30727
31902
|
}
|
|
30728
31903
|
return this.cnew(cl,a);
|
|
30729
31904
|
case 19:
|
|
30730
|
-
let
|
|
30731
|
-
throw haxe_Exception.thrown(this.expr(
|
|
31905
|
+
let e15 = e1.e;
|
|
31906
|
+
throw haxe_Exception.thrown(this.expr(e15));
|
|
30732
31907
|
case 20:
|
|
30733
31908
|
let _g7 = e1.t;
|
|
30734
|
-
let
|
|
31909
|
+
let e16 = e1.e;
|
|
30735
31910
|
let n1 = e1.v;
|
|
30736
31911
|
let ecatch = e1.ecatch;
|
|
30737
31912
|
let old1 = this.declared.length;
|
|
30738
31913
|
let oldTry = this.inTry;
|
|
30739
31914
|
try {
|
|
30740
31915
|
this.inTry = true;
|
|
30741
|
-
let v = this.expr(
|
|
31916
|
+
let v = this.expr(e16);
|
|
30742
31917
|
this.restore(old1);
|
|
30743
31918
|
this.inTry = oldTry;
|
|
30744
31919
|
return v;
|
|
@@ -30772,19 +31947,19 @@ class loreline_lorscript_Interp {
|
|
|
30772
31947
|
return o;
|
|
30773
31948
|
case 22:
|
|
30774
31949
|
let econd2 = e1.cond;
|
|
30775
|
-
let
|
|
31950
|
+
let e17 = e1.e1;
|
|
30776
31951
|
let e23 = e1.e2;
|
|
30777
31952
|
if(this.expr(econd2) == true) {
|
|
30778
|
-
return this.expr(
|
|
31953
|
+
return this.expr(e17);
|
|
30779
31954
|
} else {
|
|
30780
31955
|
return this.expr(e23);
|
|
30781
31956
|
}
|
|
30782
31957
|
break;
|
|
30783
31958
|
case 23:
|
|
30784
|
-
let
|
|
31959
|
+
let e18 = e1.e;
|
|
30785
31960
|
let cases = e1.cases;
|
|
30786
31961
|
let def = e1.defaultExpr;
|
|
30787
|
-
let val = this.expr(
|
|
31962
|
+
let val = this.expr(e18);
|
|
30788
31963
|
let match = false;
|
|
30789
31964
|
let _g9 = 0;
|
|
30790
31965
|
while(_g9 < cases.length) {
|
|
@@ -30811,18 +31986,18 @@ class loreline_lorscript_Interp {
|
|
|
30811
31986
|
return val;
|
|
30812
31987
|
case 24:
|
|
30813
31988
|
let econd3 = e1.cond;
|
|
30814
|
-
let
|
|
30815
|
-
this.doWhileLoop(econd3,
|
|
31989
|
+
let e19 = e1.e;
|
|
31990
|
+
this.doWhileLoop(econd3,e19);
|
|
30816
31991
|
return null;
|
|
30817
31992
|
case 25:
|
|
30818
31993
|
let _g10 = e1.name;
|
|
30819
31994
|
let _g11 = e1.args;
|
|
30820
|
-
let e19 = e1.e;
|
|
30821
|
-
return this.expr(e19);
|
|
30822
|
-
case 26:
|
|
30823
|
-
let _g12 = e1.t;
|
|
30824
31995
|
let e20 = e1.e;
|
|
30825
31996
|
return this.expr(e20);
|
|
31997
|
+
case 26:
|
|
31998
|
+
let _g12 = e1.t;
|
|
31999
|
+
let e24 = e1.e;
|
|
32000
|
+
return this.expr(e24);
|
|
30826
32001
|
}
|
|
30827
32002
|
}
|
|
30828
32003
|
doWhileLoop(econd,e) {
|
|
@@ -31061,17 +32236,18 @@ class loreline_lorscript_Interp {
|
|
|
31061
32236
|
}
|
|
31062
32237
|
fcall(o,f,args) {
|
|
31063
32238
|
let helper = null;
|
|
32239
|
+
let oBeat = loreline_RuntimeBeatRef.beatOf(o);
|
|
31064
32240
|
if(typeof(o) == "string") {
|
|
31065
32241
|
helper = loreline_Objects.getStringHelper(this.interpreter,f);
|
|
31066
32242
|
} else if(loreline_Arrays.isArray(o)) {
|
|
31067
32243
|
helper = loreline_Objects.getArrayHelper(this.interpreter,f);
|
|
31068
|
-
} else if(
|
|
32244
|
+
} else if(oBeat != null) {
|
|
31069
32245
|
helper = loreline_Objects.getBeatHelper(this.interpreter,f);
|
|
31070
32246
|
} else if(loreline_Objects.isFields(o)) {
|
|
31071
32247
|
helper = loreline_Objects.getMapHelper(this.interpreter,f);
|
|
31072
32248
|
}
|
|
31073
32249
|
if(helper != null && Reflect.isFunction(helper)) {
|
|
31074
|
-
args.splice(0,0,o);
|
|
32250
|
+
args.splice(0,0,oBeat != null ? oBeat : o);
|
|
31075
32251
|
return this.call(null,helper,args);
|
|
31076
32252
|
}
|
|
31077
32253
|
return this.call(o,this.get(o,f),args);
|
|
@@ -31079,6 +32255,57 @@ class loreline_lorscript_Interp {
|
|
|
31079
32255
|
call(o,f,args) {
|
|
31080
32256
|
return f.apply(o,args);
|
|
31081
32257
|
}
|
|
32258
|
+
callIsShadowed() {
|
|
32259
|
+
if(Object.prototype.hasOwnProperty.call(this.locals.h,"call")) {
|
|
32260
|
+
return true;
|
|
32261
|
+
}
|
|
32262
|
+
if(Object.prototype.hasOwnProperty.call(this.variables.h,"call")) {
|
|
32263
|
+
return true;
|
|
32264
|
+
}
|
|
32265
|
+
if(loreline_Objects.fieldExists(this.interpreter,this.interpreter.topLevelState.fields,"call")) {
|
|
32266
|
+
return true;
|
|
32267
|
+
}
|
|
32268
|
+
if(Object.prototype.hasOwnProperty.call(this.interpreter.topLevelCharacters.h,"call")) {
|
|
32269
|
+
return true;
|
|
32270
|
+
}
|
|
32271
|
+
if(Object.prototype.hasOwnProperty.call(this.interpreter.topLevelFunctions.h,"call")) {
|
|
32272
|
+
return true;
|
|
32273
|
+
}
|
|
32274
|
+
if(this.interpreter.resolveBeatByName("call") != null) {
|
|
32275
|
+
return true;
|
|
32276
|
+
}
|
|
32277
|
+
return false;
|
|
32278
|
+
}
|
|
32279
|
+
dynamicCall(args) {
|
|
32280
|
+
if(args.length == 0) {
|
|
32281
|
+
let e = new loreline_lorscript_Error(loreline_lorscript_ErrorDef.ECustom("call() requires a target argument"),this.curExpr.pmin,this.curExpr.pmax,this.curExpr.origin,this.curExpr.line);
|
|
32282
|
+
throw haxe_Exception.thrown(e);
|
|
32283
|
+
}
|
|
32284
|
+
let target = args[0];
|
|
32285
|
+
let rest = args.slice(1);
|
|
32286
|
+
if(loreline_RuntimeBeatRef.beatOf(target) != null) {
|
|
32287
|
+
let e = new loreline_lorscript_Error(loreline_lorscript_ErrorDef.ECustom("call() can only call functions. Beats cannot run inside function code."),this.curExpr.pmin,this.curExpr.pmax,this.curExpr.origin,this.curExpr.line);
|
|
32288
|
+
throw haxe_Exception.thrown(e);
|
|
32289
|
+
}
|
|
32290
|
+
if(typeof(target) == "string") {
|
|
32291
|
+
let name = target;
|
|
32292
|
+
if(this.interpreter.resolveBeatByName(name) != null) {
|
|
32293
|
+
let e = new loreline_lorscript_Error(loreline_lorscript_ErrorDef.ECustom("call() can only call functions. Beats cannot run inside function code."),this.curExpr.pmin,this.curExpr.pmax,this.curExpr.origin,this.curExpr.line);
|
|
32294
|
+
throw haxe_Exception.thrown(e);
|
|
32295
|
+
}
|
|
32296
|
+
if(Object.prototype.hasOwnProperty.call(this.interpreter.topLevelFunctions.h,name)) {
|
|
32297
|
+
target = this.interpreter.topLevelFunctions.h[name];
|
|
32298
|
+
} else {
|
|
32299
|
+
let e = new loreline_lorscript_Error(loreline_lorscript_ErrorDef.ECustom("call() target not found: " + name),this.curExpr.pmin,this.curExpr.pmax,this.curExpr.origin,this.curExpr.line);
|
|
32300
|
+
throw haxe_Exception.thrown(e);
|
|
32301
|
+
}
|
|
32302
|
+
}
|
|
32303
|
+
if(!Reflect.isFunction(target)) {
|
|
32304
|
+
let e = new loreline_lorscript_Error(loreline_lorscript_ErrorDef.ECustom("call() target is not a function"),this.curExpr.pmin,this.curExpr.pmax,this.curExpr.origin,this.curExpr.line);
|
|
32305
|
+
throw haxe_Exception.thrown(e);
|
|
32306
|
+
}
|
|
32307
|
+
return this.call(null,target,rest);
|
|
32308
|
+
}
|
|
31082
32309
|
cnew(cl,args) {
|
|
31083
32310
|
let c = $hxClasses[cl];
|
|
31084
32311
|
if(c == null) {
|
|
@@ -35797,15 +37024,16 @@ class loreline_translation_CsvTranslation {
|
|
|
35797
37024
|
let field = new StringBuf();
|
|
35798
37025
|
let inQuotes = false;
|
|
35799
37026
|
let i = 0;
|
|
35800
|
-
let
|
|
37027
|
+
let chars = content;
|
|
37028
|
+
let len = chars.length;
|
|
35801
37029
|
while(i < len) {
|
|
35802
|
-
let c = HxOverrides.cca(
|
|
37030
|
+
let c = HxOverrides.cca(chars,i);
|
|
35803
37031
|
let c1 = c == null ? -1 : c;
|
|
35804
37032
|
if(inQuotes) {
|
|
35805
37033
|
if(c1 == 34) {
|
|
35806
37034
|
let tmp;
|
|
35807
37035
|
if(i + 1 < len) {
|
|
35808
|
-
let c = HxOverrides.cca(
|
|
37036
|
+
let c = HxOverrides.cca(chars,i + 1);
|
|
35809
37037
|
tmp = (c == null ? -1 : c) == 34;
|
|
35810
37038
|
} else {
|
|
35811
37039
|
tmp = false;
|
|
@@ -35837,7 +37065,7 @@ class loreline_translation_CsvTranslation {
|
|
|
35837
37065
|
row = [];
|
|
35838
37066
|
let tmp;
|
|
35839
37067
|
if(c1 == 13 && i + 1 < len) {
|
|
35840
|
-
let c = HxOverrides.cca(
|
|
37068
|
+
let c = HxOverrides.cca(chars,i + 1);
|
|
35841
37069
|
tmp = (c == null ? -1 : c) == 10;
|
|
35842
37070
|
} else {
|
|
35843
37071
|
tmp = false;
|
|
@@ -36359,18 +37587,14 @@ class loreline_translation_XliffTranslation {
|
|
|
36359
37587
|
let _g_array = root.children;
|
|
36360
37588
|
while(_g_current < _g_array.length) {
|
|
36361
37589
|
let child = _g_array[_g_current++];
|
|
36362
|
-
let tmp;
|
|
36363
37590
|
if(child.nodeType == 0) {
|
|
36364
37591
|
if(child.nodeType != Xml.Element) {
|
|
36365
37592
|
throw haxe_Exception.thrown("Bad node type, expected Element but found " + (child.nodeType == null ? "null" : XmlType.toString(child.nodeType)));
|
|
36366
37593
|
}
|
|
36367
|
-
|
|
36368
|
-
|
|
36369
|
-
|
|
36370
|
-
|
|
36371
|
-
if(tmp) {
|
|
36372
|
-
xliff = child;
|
|
36373
|
-
break;
|
|
37594
|
+
if(child.nodeName == "xliff") {
|
|
37595
|
+
xliff = child;
|
|
37596
|
+
break;
|
|
37597
|
+
}
|
|
36374
37598
|
}
|
|
36375
37599
|
}
|
|
36376
37600
|
if(xliff == null) {
|
|
@@ -36497,17 +37721,13 @@ class loreline_translation_XliffTranslation {
|
|
|
36497
37721
|
let _g_array = parent.children;
|
|
36498
37722
|
while(_g_current < _g_array.length) {
|
|
36499
37723
|
let c = _g_array[_g_current++];
|
|
36500
|
-
let tmp;
|
|
36501
37724
|
if(c.nodeType == 0) {
|
|
36502
37725
|
if(c.nodeType != Xml.Element) {
|
|
36503
37726
|
throw haxe_Exception.thrown("Bad node type, expected Element but found " + (c.nodeType == null ? "null" : XmlType.toString(c.nodeType)));
|
|
36504
37727
|
}
|
|
36505
|
-
|
|
36506
|
-
|
|
36507
|
-
|
|
36508
|
-
}
|
|
36509
|
-
if(tmp) {
|
|
36510
|
-
return c;
|
|
37728
|
+
if(c.nodeName == name) {
|
|
37729
|
+
return c;
|
|
37730
|
+
}
|
|
36511
37731
|
}
|
|
36512
37732
|
}
|
|
36513
37733
|
return null;
|