loreline 0.8.0 → 0.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/js/loreline.js CHANGED
@@ -17496,6 +17496,11 @@ class loreline_Interpreter {
17496
17496
  if(loreline_Arrays.isArray(target1) && (typeof(index) == "number" && ((index | 0) === index) || typeof(index) == "number")) {
17497
17497
  let i = index | 0;
17498
17498
  return loreline_RuntimeAccess.ArrayAccess(arrAccess.pos,target1,i);
17499
+ } else if(typeof(index) == "string") {
17500
+ if(target1 == null) {
17501
+ throw haxe_Exception.thrown(new loreline_RuntimeError("Cannot access field '" + (index == null ? "null" : Std.string(index)) + "' of null",arrAccess.pos));
17502
+ }
17503
+ return loreline_RuntimeAccess.FieldAccess(arrAccess.pos,target1,index);
17499
17504
  } else {
17500
17505
  throw haxe_Exception.thrown(new loreline_RuntimeError("Invalid array access target",arrAccess.pos));
17501
17506
  }
@@ -20798,6 +20803,7 @@ Object.assign(loreline_Token.prototype, {
20798
20803
  });
20799
20804
  class loreline_Lexer {
20800
20805
  constructor(input) {
20806
+ this.keepOrphanExpressions = false;
20801
20807
  this.errors = null;
20802
20808
  this.allowTabs = true;
20803
20809
  this.detectedIndentSize = 2;
@@ -23067,6 +23073,13 @@ class loreline_Lexer {
23067
23073
  while(pos < this.length && bracketLevel > 0) {
23068
23074
  let c = HxOverrides.cca(this.input,pos);
23069
23075
  c1 = c == null ? -1 : c;
23076
+ if(c1 == 34) {
23077
+ pos = this.scanStringEnd(pos,false);
23078
+ if(pos == -1) {
23079
+ return false;
23080
+ }
23081
+ continue;
23082
+ }
23070
23083
  if(c1 == 91) {
23071
23084
  ++bracketLevel;
23072
23085
  }
@@ -23351,7 +23364,16 @@ class loreline_Lexer {
23351
23364
  ++pos;
23352
23365
  while(pos < this.length) {
23353
23366
  let c = HxOverrides.cca(this.input,pos);
23354
- if((c == null ? -1 : c) == 93) {
23367
+ let bc = c == null ? -1 : c;
23368
+ if(bc == 34) {
23369
+ pos = this.scanStringEnd(pos,false);
23370
+ if(pos == -1) {
23371
+ pos = startPos;
23372
+ return false;
23373
+ }
23374
+ continue;
23375
+ }
23376
+ if(bc == 93) {
23355
23377
  ++pos;
23356
23378
  break;
23357
23379
  }
@@ -23421,7 +23443,18 @@ class loreline_Lexer {
23421
23443
  let c1 = c == null ? -1 : c;
23422
23444
  let tmp;
23423
23445
  if(!isEscape) {
23424
- if(c1 != 61) {
23446
+ let tmp1;
23447
+ if(c1 == 61) {
23448
+ if(pos + 1 < this.length) {
23449
+ let c = HxOverrides.cca(this.input,pos + 1);
23450
+ tmp1 = (c == null ? -1 : c) != 61;
23451
+ } else {
23452
+ tmp1 = true;
23453
+ }
23454
+ } else {
23455
+ tmp1 = false;
23456
+ }
23457
+ if(!tmp1) {
23425
23458
  let c = HxOverrides.cca(this.input,pos + 1);
23426
23459
  tmp = (c == null ? -1 : c) == 61 && (c1 == 43 || c1 == 45 || c1 == 42 || c1 == 47 || c1 == 58);
23427
23460
  } else {
@@ -23481,7 +23514,15 @@ class loreline_Lexer {
23481
23514
  ++pos;
23482
23515
  while(pos < this.length) {
23483
23516
  let c = HxOverrides.cca(this.input,pos);
23484
- if((c == null ? -1 : c) == 93) {
23517
+ let bc = c == null ? -1 : c;
23518
+ if(bc == 34) {
23519
+ pos = this.scanStringEnd(pos,false);
23520
+ if(pos == -1) {
23521
+ return false;
23522
+ }
23523
+ continue;
23524
+ }
23525
+ if(bc == 93) {
23485
23526
  ++pos;
23486
23527
  break;
23487
23528
  }
@@ -23495,6 +23536,11 @@ class loreline_Lexer {
23495
23536
  ++pos;
23496
23537
  } else if(c1 == 13 || c1 == 10) {
23497
23538
  return false;
23539
+ } else if(c1 == 34) {
23540
+ pos = this.scanStringEnd(pos,false);
23541
+ if(pos == -1) {
23542
+ return false;
23543
+ }
23498
23544
  } else if(c1 >= 97 && c1 <= 122 || c1 >= 65 && c1 <= 90 || c1 == 95) {
23499
23545
  let result = true;
23500
23546
  let startPos = pos;
@@ -23535,7 +23581,18 @@ class loreline_Lexer {
23535
23581
  return false;
23536
23582
  }
23537
23583
  } else {
23538
- ++pos;
23584
+ let tmp;
23585
+ if((c1 == 61 || c1 == 33 || c1 == 60 || c1 == 62) && pos + 1 < this.length) {
23586
+ let c = HxOverrides.cca(this.input,pos + 1);
23587
+ tmp = (c == null ? -1 : c) == 61;
23588
+ } else {
23589
+ tmp = false;
23590
+ }
23591
+ if(tmp) {
23592
+ pos += 2;
23593
+ } else {
23594
+ ++pos;
23595
+ }
23539
23596
  }
23540
23597
  }
23541
23598
  return false;
@@ -24459,7 +24516,7 @@ class loreline_Lexer {
24459
24516
  if(this.isCallStart(this.pos) || this.isLabelStart(this.pos)) {
24460
24517
  return null;
24461
24518
  }
24462
- } else if(!isAfterLabel && identifier != "true" && identifier != "false" && identifier != "null" && (this.isIdentifierExpressionStart(this.pos,true) || this.isIfStart(this.pos) || this.isCallStart(this.pos) || this.isAssignStart(this.pos,false))) {
24519
+ } else if(!isAfterLabel && identifier != "true" && identifier != "false" && identifier != "null" && (this.keepOrphanExpressions && this.isIdentifierExpressionStart(this.pos,true) || this.isIfStart(this.pos) || this.isCallStart(this.pos) || this.isAssignStart(this.pos,false))) {
24463
24520
  return null;
24464
24521
  }
24465
24522
  if(!isValue) {