wip
This commit is contained in:
parent
9d4717b7b9
commit
cb729f3464
21
build.hxml
21
build.hxml
|
@ -30,22 +30,25 @@ xrfragment
|
|||
#xrfragment
|
||||
#-cpp dist/xrfragment.cpp
|
||||
|
||||
#--next
|
||||
#-dce full
|
||||
#-cp src
|
||||
#xrfragment
|
||||
#-php dist/xrfragment.php
|
||||
#
|
||||
#--next
|
||||
#-dce full
|
||||
#-cp src
|
||||
#xrfragment
|
||||
#-java dist/xrfragment.java
|
||||
|
||||
--next
|
||||
-dce full
|
||||
-cp src
|
||||
|
||||
Test
|
||||
-m Test
|
||||
-python test/generated/test.py
|
||||
|
||||
#--next
|
||||
#
|
||||
#-dce full
|
||||
#-cp src
|
||||
#
|
||||
#xrfragment.Query
|
||||
#-php dist/xrfragment.php5
|
||||
#
|
||||
#--next
|
||||
#
|
||||
#-dce full
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -0,0 +1,706 @@
|
|||
<?php
|
||||
/**
|
||||
*/
|
||||
|
||||
use \haxe\iterators\ArrayIterator as IteratorsArrayIterator;
|
||||
use \php\Boot;
|
||||
use \php\_Boot\HxClosure;
|
||||
use \haxe\iterators\ArrayKeyValueIterator;
|
||||
|
||||
final class Array_hx implements \JsonSerializable, \Countable, \IteratorAggregate, \ArrayAccess {
|
||||
/**
|
||||
* @var mixed[]
|
||||
*/
|
||||
public $arr;
|
||||
/**
|
||||
* @var int
|
||||
* The length of `this` Array.
|
||||
*/
|
||||
public $length;
|
||||
|
||||
/**
|
||||
* @param mixed[] $arr
|
||||
*
|
||||
* @return mixed[]|Array_hx
|
||||
*/
|
||||
public static function wrap ($arr) {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:267: characters 3-23
|
||||
$a = new Array_hx();
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:268: characters 3-14
|
||||
$a->arr = $arr;
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:269: characters 3-31
|
||||
$a->length = count($arr);
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:270: characters 3-11
|
||||
return $a;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new Array.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct () {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:37: characters 9-36
|
||||
$this1 = [];
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:37: characters 3-36
|
||||
$this->arr = $this1;
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:38: characters 3-13
|
||||
$this->length = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a new Array by appending the elements of `a` to the elements of
|
||||
* `this` Array.
|
||||
* This operation does not modify `this` Array.
|
||||
* If `a` is the empty Array `[]`, a copy of `this` Array is returned.
|
||||
* The length of the returned Array is equal to the sum of `this.length`
|
||||
* and `a.length`.
|
||||
* If `a` is `null`, the result is unspecified.
|
||||
*
|
||||
* @param mixed[]|Array_hx $a
|
||||
*
|
||||
* @return mixed[]|Array_hx
|
||||
*/
|
||||
public function concat ($a) {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:42: characters 3-46
|
||||
return Array_hx::wrap(array_merge($this->arr, $a->arr));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether `this` Array contains `x`.
|
||||
* If `x` is found by checking standard equality, the function returns `true`, otherwise
|
||||
* the function returns `false`.
|
||||
*
|
||||
* @param mixed $x
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function contains ($x) {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:60: characters 3-26
|
||||
return $this->indexOf($x) !== -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a shallow copy of `this` Array.
|
||||
* The elements are not copied and retain their identity, so
|
||||
* `a[i] == a.copy()[i]` is true for any valid `i`. However,
|
||||
* `a == a.copy()` is always false.
|
||||
*
|
||||
* @return mixed[]|Array_hx
|
||||
*/
|
||||
public function copy () {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:46: characters 3-28
|
||||
return (clone $this);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function count () {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:257: characters 3-16
|
||||
return $this->length;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an Array containing those elements of `this` for which `f`
|
||||
* returned true.
|
||||
* The individual elements are not duplicated and retain their identity.
|
||||
* If `f` is null, the result is unspecified.
|
||||
*
|
||||
* @param \Closure $f
|
||||
*
|
||||
* @return mixed[]|Array_hx
|
||||
*/
|
||||
public function filter ($f) {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:50: characters 3-35
|
||||
$result = [];
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:51: characters 15-18
|
||||
$data = $this->arr;
|
||||
$_g_current = 0;
|
||||
$_g_length = count($data);
|
||||
$_g_data = $data;
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:51: lines 51-55
|
||||
while ($_g_current < $_g_length) {
|
||||
$item = $_g_data[$_g_current++];
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:52: lines 52-54
|
||||
if ($f($item)) {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:53: characters 5-22
|
||||
$result[] = $item;
|
||||
}
|
||||
}
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:56: characters 3-22
|
||||
return Array_hx::wrap($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Traversable
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function getIterator () {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:250: characters 3-38
|
||||
return new \ArrayIterator($this->arr);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns position of the first occurrence of `x` in `this` Array, searching front to back.
|
||||
* If `x` is found by checking standard equality, the function returns its index.
|
||||
* If `x` is not found, the function returns -1.
|
||||
* If `fromIndex` is specified, it will be used as the starting index to search from,
|
||||
* otherwise search starts with zero index. If it is negative, it will be taken as the
|
||||
* offset from the end of `this` Array to compute the starting index. If given or computed
|
||||
* starting index is less than 0, the whole array will be searched, if it is greater than
|
||||
* or equal to the length of `this` Array, the function returns -1.
|
||||
*
|
||||
* @param mixed $x
|
||||
* @param int $fromIndex
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function indexOf ($x, $fromIndex = null) {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:64: characters 7-69
|
||||
$tmp = null;
|
||||
if (($fromIndex === null) && !($x instanceof HxClosure)) {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:64: characters 53-69
|
||||
$value = $x;
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:64: characters 7-69
|
||||
$tmp = !(is_int($value) || is_float($value));
|
||||
} else {
|
||||
$tmp = false;
|
||||
}
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:64: lines 64-71
|
||||
if ($tmp) {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:65: characters 4-50
|
||||
$index = array_search($x, $this->arr, true);
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:66: lines 66-70
|
||||
if ($index === false) {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:67: characters 5-14
|
||||
return -1;
|
||||
} else {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:69: characters 5-17
|
||||
return $index;
|
||||
}
|
||||
}
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:72: lines 72-79
|
||||
if ($fromIndex === null) {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:73: characters 4-17
|
||||
$fromIndex = 0;
|
||||
} else {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:75: lines 75-76
|
||||
if ($fromIndex < 0) {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:76: characters 5-24
|
||||
$fromIndex += $this->length;
|
||||
}
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:77: lines 77-78
|
||||
if ($fromIndex < 0) {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:78: characters 5-18
|
||||
$fromIndex = 0;
|
||||
}
|
||||
}
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:80: lines 80-84
|
||||
while ($fromIndex < $this->length) {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:81: lines 81-82
|
||||
if (Boot::equal($this->arr[$fromIndex], $x)) {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:82: characters 5-21
|
||||
return $fromIndex;
|
||||
}
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:83: characters 4-15
|
||||
++$fromIndex;
|
||||
}
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:85: characters 3-12
|
||||
return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Inserts the element `x` at the position `pos`.
|
||||
* This operation modifies `this` Array in place.
|
||||
* The offset is calculated like so:
|
||||
* - If `pos` exceeds `this.length`, the offset is `this.length`.
|
||||
* - If `pos` is negative, the offset is calculated from the end of `this`
|
||||
* Array, i.e. `this.length + pos`. If this yields a negative value, the
|
||||
* offset is 0.
|
||||
* - Otherwise, the offset is `pos`.
|
||||
* If the resulting offset does not exceed `this.length`, all elements from
|
||||
* and including that offset to the end of `this` Array are moved one index
|
||||
* ahead.
|
||||
*
|
||||
* @param int $pos
|
||||
* @param mixed $x
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function insert ($pos, $x) {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:89: characters 3-11
|
||||
$this->length++;
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:90: characters 3-56
|
||||
array_splice($this->arr, $pos, 0, [$x]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an iterator of the Array values.
|
||||
*
|
||||
* @return IteratorsArrayIterator
|
||||
*/
|
||||
public function iterator () {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:95: characters 3-48
|
||||
return new IteratorsArrayIterator($this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a string representation of `this` Array, with `sep` separating
|
||||
* each element.
|
||||
* The result of this operation is equal to `Std.string(this[0]) + sep +
|
||||
* Std.string(this[1]) + sep + ... + sep + Std.string(this[this.length-1])`
|
||||
* If `this` is the empty Array `[]`, the result is the empty String `""`.
|
||||
* If `this` has exactly one element, the result is equal to a call to
|
||||
* `Std.string(this[0])`.
|
||||
* If `sep` is null, the result is unspecified.
|
||||
*
|
||||
* @param string $sep
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function join ($sep) {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:104: characters 3-98
|
||||
return implode($sep, array_map((Boot::class??'null') . "::stringify", $this->arr));
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed[]
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function jsonSerialize () {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:263: characters 3-13
|
||||
return $this->arr;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an iterator of the Array indices and values.
|
||||
*
|
||||
* @return ArrayKeyValueIterator
|
||||
*/
|
||||
public function keyValueIterator () {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:100: characters 3-41
|
||||
return new ArrayKeyValueIterator($this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns position of the last occurrence of `x` in `this` Array, searching back to front.
|
||||
* If `x` is found by checking standard equality, the function returns its index.
|
||||
* If `x` is not found, the function returns -1.
|
||||
* If `fromIndex` is specified, it will be used as the starting index to search from,
|
||||
* otherwise search starts with the last element index. If it is negative, it will be
|
||||
* taken as the offset from the end of `this` Array to compute the starting index. If
|
||||
* given or computed starting index is greater than or equal to the length of `this` Array,
|
||||
* the whole array will be searched, if it is less than 0, the function returns -1.
|
||||
*
|
||||
* @param mixed $x
|
||||
* @param int $fromIndex
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function lastIndexOf ($x, $fromIndex = null) {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:108: lines 108-109
|
||||
if (($fromIndex === null) || ($fromIndex >= $this->length)) {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:109: characters 4-26
|
||||
$fromIndex = $this->length - 1;
|
||||
}
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:110: lines 110-111
|
||||
if ($fromIndex < 0) {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:111: characters 4-23
|
||||
$fromIndex += $this->length;
|
||||
}
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:112: lines 112-116
|
||||
while ($fromIndex >= 0) {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:113: lines 113-114
|
||||
if (Boot::equal($this->arr[$fromIndex], $x)) {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:114: characters 5-21
|
||||
return $fromIndex;
|
||||
}
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:115: characters 4-15
|
||||
--$fromIndex;
|
||||
}
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:117: characters 3-12
|
||||
return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new Array by applying function `f` to all elements of `this`.
|
||||
* The order of elements is preserved.
|
||||
* If `f` is null, the result is unspecified.
|
||||
*
|
||||
* @param \Closure $f
|
||||
*
|
||||
* @return mixed[]|Array_hx
|
||||
*/
|
||||
public function map ($f) {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:121: characters 3-35
|
||||
$result = [];
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:122: characters 15-18
|
||||
$data = $this->arr;
|
||||
$_g_current = 0;
|
||||
$_g_length = count($data);
|
||||
$_g_data = $data;
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:122: lines 122-124
|
||||
while ($_g_current < $_g_length) {
|
||||
$item = $_g_data[$_g_current++];
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:123: characters 4-24
|
||||
$result[] = $f($item);
|
||||
}
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:125: characters 3-22
|
||||
return Array_hx::wrap($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $offset
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function offsetExists ($offset) {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:212: characters 3-25
|
||||
return $offset < $this->length;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $offset
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function &offsetGet ($offset) {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:218: lines 218-222
|
||||
try {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:219: characters 4-22
|
||||
return $this->arr[$offset];
|
||||
} catch(\Throwable $_g) {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:221: characters 4-15
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $offset
|
||||
* @param mixed $value
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function offsetSet ($offset, $value) {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:228: lines 228-233
|
||||
if ($this->length <= $offset) {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:229: characters 13-19
|
||||
$_g = $this->length;
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:229: characters 22-32
|
||||
$_g1 = $offset + 1;
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:229: lines 229-231
|
||||
while ($_g < $_g1) {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:229: characters 13-32
|
||||
$i = $_g++;
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:230: characters 5-18
|
||||
$this->arr[$i] = null;
|
||||
}
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:232: characters 4-23
|
||||
$this->length = $offset + 1;
|
||||
}
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:234: characters 3-22
|
||||
$this->arr[$offset] = $value;
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:235: characters 3-35
|
||||
return $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $offset
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function offsetUnset ($offset) {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:241: lines 241-244
|
||||
if (($offset >= 0) && ($offset < $this->length)) {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:242: characters 4-39
|
||||
array_splice($this->arr, $offset, 1);
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:243: characters 4-12
|
||||
--$this->length;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes the last element of `this` Array and returns it.
|
||||
* This operation modifies `this` Array in place.
|
||||
* If `this` has at least one element, `this.length` will decrease by 1.
|
||||
* If `this` is the empty Array `[]`, null is returned and the length
|
||||
* remains 0.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function pop () {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:129: lines 129-130
|
||||
if ($this->length > 0) {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:130: characters 4-12
|
||||
$this->length--;
|
||||
}
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:131: characters 3-31
|
||||
return array_pop($this->arr);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the element `x` at the end of `this` Array and returns the new
|
||||
* length of `this` Array.
|
||||
* This operation modifies `this` Array in place.
|
||||
* `this.length` increases by 1.
|
||||
*
|
||||
* @param mixed $x
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function push ($x) {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:135: characters 3-20
|
||||
$this->arr[$this->length++] = $x;
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:136: characters 3-16
|
||||
return $this->length;
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes the first occurrence of `x` in `this` Array.
|
||||
* This operation modifies `this` Array in place.
|
||||
* If `x` is found by checking standard equality, it is removed from `this`
|
||||
* Array and all following elements are reindexed accordingly. The function
|
||||
* then returns true.
|
||||
* If `x` is not found, `this` Array is not changed and the function
|
||||
* returns false.
|
||||
*
|
||||
* @param mixed $x
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function remove ($x) {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:140: characters 3-22
|
||||
$result = false;
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:141: characters 16-20
|
||||
$_g = 0;
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:141: characters 20-26
|
||||
$_g1 = $this->length;
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:141: lines 141-148
|
||||
while ($_g < $_g1) {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:141: characters 16-26
|
||||
$index = $_g++;
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:142: lines 142-147
|
||||
if (Boot::equal($this->arr[$index], $x)) {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:143: characters 5-39
|
||||
array_splice($this->arr, $index, 1);
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:144: characters 5-13
|
||||
$this->length--;
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:145: characters 5-18
|
||||
$result = true;
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:146: characters 5-10
|
||||
break;
|
||||
}
|
||||
}
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:149: characters 3-16
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the length of the Array.
|
||||
* If `len` is shorter than the array's current size, the last
|
||||
* `length - len` elements will be removed. If `len` is longer, the Array
|
||||
* will be extended, with new elements set to a target-specific default
|
||||
* value:
|
||||
* - always null on dynamic targets
|
||||
* - 0, 0.0 or false for Int, Float and Bool respectively on static targets
|
||||
* - null for other types on static targets
|
||||
*
|
||||
* @param int $len
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function resize ($len) {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:201: lines 201-205
|
||||
if ($this->length < $len) {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:202: characters 4-42
|
||||
$this->arr = array_pad($this->arr, $len, null);
|
||||
} else if ($this->length > $len) {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:204: characters 4-47
|
||||
array_splice($this->arr, $len, $this->length - $len);
|
||||
}
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:206: characters 3-15
|
||||
$this->length = $len;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the order of elements of `this` Array.
|
||||
* This operation modifies `this` Array in place.
|
||||
* If `this.length < 2`, `this` remains unchanged.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function reverse () {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:153: characters 3-34
|
||||
$this->arr = array_reverse($this->arr);
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes the first element of `this` Array and returns it.
|
||||
* This operation modifies `this` Array in place.
|
||||
* If `this` has at least one element, `this`.length and the index of each
|
||||
* remaining element is decreased by 1.
|
||||
* If `this` is the empty Array `[]`, `null` is returned and the length
|
||||
* remains 0.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function shift () {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:157: lines 157-158
|
||||
if ($this->length > 0) {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:158: characters 4-12
|
||||
$this->length--;
|
||||
}
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:159: characters 3-33
|
||||
return array_shift($this->arr);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a shallow copy of the range of `this` Array, starting at and
|
||||
* including `pos`, up to but not including `end`.
|
||||
* This operation does not modify `this` Array.
|
||||
* The elements are not copied and retain their identity.
|
||||
* If `end` is omitted or exceeds `this.length`, it defaults to the end of
|
||||
* `this` Array.
|
||||
* If `pos` or `end` are negative, their offsets are calculated from the
|
||||
* end of `this` Array by `this.length + pos` and `this.length + end`
|
||||
* respectively. If this yields a negative value, 0 is used instead.
|
||||
* If `pos` exceeds `this.length` or if `end` is less than or equals
|
||||
* `pos`, the result is `[]`.
|
||||
*
|
||||
* @param int $pos
|
||||
* @param int $end
|
||||
*
|
||||
* @return mixed[]|Array_hx
|
||||
*/
|
||||
public function slice ($pos, $end = null) {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:163: lines 163-164
|
||||
if ($pos < 0) {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:164: characters 4-17
|
||||
$pos += $this->length;
|
||||
}
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:165: lines 165-166
|
||||
if ($pos < 0) {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:166: characters 4-11
|
||||
$pos = 0;
|
||||
}
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:167: lines 167-177
|
||||
if ($end === null) {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:168: characters 4-45
|
||||
return Array_hx::wrap(array_slice($this->arr, $pos));
|
||||
} else {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:170: lines 170-171
|
||||
if ($end < 0) {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:171: characters 5-18
|
||||
$end += $this->length;
|
||||
}
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:172: lines 172-176
|
||||
if ($end <= $pos) {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:173: characters 5-14
|
||||
return new Array_hx();
|
||||
} else {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:175: characters 5-57
|
||||
return Array_hx::wrap(array_slice($this->arr, $pos, $end - $pos));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sorts `this` Array according to the comparison function `f`, where
|
||||
* `f(x,y)` returns 0 if x == y, a positive Int if x > y and a
|
||||
* negative Int if x < y.
|
||||
* This operation modifies `this` Array in place.
|
||||
* The sort operation is not guaranteed to be stable, which means that the
|
||||
* order of equal elements may not be retained. For a stable Array sorting
|
||||
* algorithm, `haxe.ds.ArraySort.sort()` can be used instead.
|
||||
* If `f` is null, the result is unspecified.
|
||||
*
|
||||
* @param \Closure $f
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function sort ($f) {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:181: characters 3-15
|
||||
usort($this->arr, $f);
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes `len` elements from `this` Array, starting at and including
|
||||
* `pos`, an returns them.
|
||||
* This operation modifies `this` Array in place.
|
||||
* If `len` is < 0 or `pos` exceeds `this`.length, an empty Array [] is
|
||||
* returned and `this` Array is unchanged.
|
||||
* If `pos` is negative, its value is calculated from the end of `this`
|
||||
* Array by `this.length + pos`. If this yields a negative value, 0 is
|
||||
* used instead.
|
||||
* If the sum of the resulting values for `len` and `pos` exceed
|
||||
* `this.length`, this operation will affect the elements from `pos` to the
|
||||
* end of `this` Array.
|
||||
* The length of the returned Array is equal to the new length of `this`
|
||||
* Array subtracted from the original length of `this` Array. In other
|
||||
* words, each element of the original `this` Array either remains in
|
||||
* `this` Array or becomes an element of the returned Array.
|
||||
*
|
||||
* @param int $pos
|
||||
* @param int $len
|
||||
*
|
||||
* @return mixed[]|Array_hx
|
||||
*/
|
||||
public function splice ($pos, $len) {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:185: lines 185-186
|
||||
if ($len < 0) {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:186: characters 4-13
|
||||
return new Array_hx();
|
||||
}
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:187: characters 3-57
|
||||
$result = Array_hx::wrap(array_splice($this->arr, $pos, $len));
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:188: characters 3-26
|
||||
$this->length -= $result->length;
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:189: characters 3-16
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a string representation of `this` Array.
|
||||
* The result will include the individual elements' String representations
|
||||
* separated by comma. The enclosing [ ] may be missing on some platforms,
|
||||
* use `Std.string()` to get a String representation that is consistent
|
||||
* across platforms.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function toString () {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:197: characters 10-54
|
||||
$arr = $this->arr;
|
||||
$strings = [];
|
||||
foreach ($arr as $key => $value) {
|
||||
$strings[$key] = Boot::stringify($value, 9);
|
||||
}
|
||||
return "[" . (implode(",", $strings)??'null') . "]";
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the element `x` at the start of `this` Array.
|
||||
* This operation modifies `this` Array in place.
|
||||
* `this.length` and the index of each Array element increases by 1.
|
||||
*
|
||||
* @param mixed $x
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function unshift ($x) {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:193: characters 3-40
|
||||
$this->length = array_unshift($this->arr, $x);
|
||||
}
|
||||
|
||||
public function __toString() {
|
||||
return $this->toString();
|
||||
}
|
||||
}
|
||||
|
||||
Boot::registerClass(Array_hx::class, 'Array');
|
|
@ -0,0 +1,147 @@
|
|||
<?php
|
||||
/**
|
||||
*/
|
||||
|
||||
use \php\Boot;
|
||||
use \haxe\Exception as HaxeException;
|
||||
|
||||
/**
|
||||
* The EReg class represents regular expressions.
|
||||
* While basic usage and patterns consistently work across platforms, some more
|
||||
* complex operations may yield different results. This is a necessary trade-
|
||||
* off to retain a certain level of performance.
|
||||
* EReg instances can be created by calling the constructor, or with the
|
||||
* special syntax `~/pattern/modifier`
|
||||
* EReg instances maintain an internal state, which is affected by several of
|
||||
* its methods.
|
||||
* A detailed explanation of the supported operations is available at
|
||||
* <https://haxe.org/manual/std-regex.html>
|
||||
*/
|
||||
final class EReg {
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
public $global;
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $last;
|
||||
/**
|
||||
* @var array[]
|
||||
*/
|
||||
public $matches;
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $options;
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $pattern;
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $re;
|
||||
|
||||
/**
|
||||
* Creates a new regular expression with pattern `r` and modifiers `opt`.
|
||||
* This is equivalent to the shorthand syntax `~/r/opt`
|
||||
* If `r` or `opt` are null, the result is unspecified.
|
||||
*
|
||||
* @param string $r
|
||||
* @param string $opt
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct ($r, $opt) {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/EReg.hx:37: characters 3-19
|
||||
$this->pattern = $r;
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/EReg.hx:38: characters 3-45
|
||||
$this->options = str_replace("g", "", $opt);
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/EReg.hx:39: characters 3-26
|
||||
$this->global = $this->options !== $opt;
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/EReg.hx:40: characters 3-49
|
||||
$this->options = str_replace("u", "", $this->options);
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/EReg.hx:41: characters 3-68
|
||||
$this->re = "\"" . (str_replace("\"", "\\\"", $r)??'null') . "\"" . ($this->options??'null');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function handlePregError () {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/EReg.hx:63: characters 3-36
|
||||
$e = preg_last_error();
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/EReg.hx:64: lines 64-72
|
||||
if ($e === PREG_INTERNAL_ERROR) {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/EReg.hx:65: characters 4-9
|
||||
throw HaxeException::thrown("EReg: internal PCRE error");
|
||||
} else if ($e === PREG_BACKTRACK_LIMIT_ERROR) {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/EReg.hx:67: characters 4-9
|
||||
throw HaxeException::thrown("EReg: backtrack limit");
|
||||
} else if ($e === PREG_RECURSION_LIMIT_ERROR) {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/EReg.hx:69: characters 4-9
|
||||
throw HaxeException::thrown("EReg: recursion limit");
|
||||
} else if ($e === PREG_JIT_STACKLIMIT_ERROR) {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/EReg.hx:71: characters 4-9
|
||||
throw HaxeException::thrown("failed due to limited JIT stack space");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Tells if `this` regular expression matches String `s`.
|
||||
* This method modifies the internal state.
|
||||
* If `s` is `null`, the result is unspecified.
|
||||
*
|
||||
* @param string $s
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function match ($s) {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/EReg.hx:45: characters 10-29
|
||||
$p = preg_match(($this->re . "u"), $s, $this->matches, PREG_OFFSET_CAPTURE, 0);
|
||||
if ($p === false) {
|
||||
$this->handlePregError();
|
||||
$p = preg_match($this->re, $s, $this->matches, PREG_OFFSET_CAPTURE);
|
||||
}
|
||||
if ($p > 0) {
|
||||
$this->last = $s;
|
||||
} else {
|
||||
$this->last = null;
|
||||
}
|
||||
return $p > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Splits String `s` at all substrings `this` EReg matches.
|
||||
* If a match is found at the start of `s`, the result contains a leading
|
||||
* empty String "" entry.
|
||||
* If a match is found at the end of `s`, the result contains a trailing
|
||||
* empty String "" entry.
|
||||
* If two matching substrings appear next to each other, the result
|
||||
* contains the empty String `""` between them.
|
||||
* By default, this method splits `s` into two parts at the first matched
|
||||
* substring. If the global g modifier is in place, `s` is split at each
|
||||
* matched substring.
|
||||
* If `s` is null, the result is unspecified.
|
||||
*
|
||||
* @param string $s
|
||||
*
|
||||
* @return string[]|\Array_hx
|
||||
*/
|
||||
public function split ($s) {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/EReg.hx:128: characters 3-96
|
||||
$parts = preg_split(($this->re . "u"), $s, ($this->global ? -1 : 2));
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/EReg.hx:129: lines 129-132
|
||||
if ($parts === false) {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/EReg.hx:130: characters 4-21
|
||||
$this->handlePregError();
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/EReg.hx:131: characters 4-55
|
||||
$parts = preg_split($this->re, $s, ($this->global ? -1 : 2));
|
||||
}
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/EReg.hx:133: characters 3-48
|
||||
return \Array_hx::wrap($parts);
|
||||
}
|
||||
}
|
||||
|
||||
Boot::registerClass(EReg::class, 'EReg');
|
|
@ -0,0 +1,179 @@
|
|||
<?php
|
||||
/**
|
||||
*/
|
||||
|
||||
use \php\Boot;
|
||||
use \php\_Boot\HxClass;
|
||||
|
||||
/**
|
||||
* The Reflect API is a way to manipulate values dynamically through an
|
||||
* abstract interface in an untyped manner. Use with care.
|
||||
* @see https://haxe.org/manual/std-reflection.html
|
||||
*/
|
||||
class Reflect {
|
||||
/**
|
||||
* Removes the field named `field` from structure `o`.
|
||||
* This method is only guaranteed to work on anonymous structures.
|
||||
* If `o` or `field` are null, the result is unspecified.
|
||||
*
|
||||
* @param mixed $o
|
||||
* @param string $field
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function deleteField ($o, $field) {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Reflect.hx:158: lines 158-163
|
||||
if (Reflect::hasField($o, $field)) {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Reflect.hx:159: characters 4-40
|
||||
unset($o->{$field});
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Reflect.hx:160: characters 4-15
|
||||
return true;
|
||||
} else {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Reflect.hx:162: characters 4-16
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the value of the field named `field` on object `o`.
|
||||
* If `o` is not an object or has no field named `field`, the result is
|
||||
* null.
|
||||
* If the field is defined as a property, its accessors are ignored. Refer
|
||||
* to `Reflect.getProperty` for a function supporting property accessors.
|
||||
* If `field` is null, the result is unspecified.
|
||||
*
|
||||
* @param mixed $o
|
||||
* @param string $field
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public static function field ($o, $field) {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Reflect.hx:50: lines 50-52
|
||||
if (is_string($o)) {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Reflect.hx:51: characters 24-45
|
||||
$tmp = Boot::dynamicString($o);
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Reflect.hx:51: characters 4-53
|
||||
return $tmp->{$field};
|
||||
}
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Reflect.hx:53: lines 53-54
|
||||
if (!is_object($o)) {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Reflect.hx:54: characters 4-15
|
||||
return null;
|
||||
}
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Reflect.hx:56: lines 56-58
|
||||
if (($field === "") && (PHP_VERSION_ID < 70100)) {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Reflect.hx:57: characters 4-56
|
||||
return (((array)($o))[$field] ?? null);
|
||||
}
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Reflect.hx:60: lines 60-62
|
||||
if (property_exists($o, $field)) {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Reflect.hx:61: characters 4-33
|
||||
return $o->{$field};
|
||||
}
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Reflect.hx:63: lines 63-65
|
||||
if (method_exists($o, $field)) {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Reflect.hx:64: characters 4-44
|
||||
return Boot::getInstanceClosure($o, $field);
|
||||
}
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Reflect.hx:67: lines 67-78
|
||||
if (($o instanceof HxClass)) {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Reflect.hx:68: characters 4-54
|
||||
$phpClassName = $o->phpClassName;
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Reflect.hx:69: lines 69-71
|
||||
if (defined("" . ($phpClassName??'null') . "::" . ($field??'null'))) {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Reflect.hx:70: characters 5-52
|
||||
return constant("" . ($phpClassName??'null') . "::" . ($field??'null'));
|
||||
}
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Reflect.hx:72: lines 72-74
|
||||
if (property_exists($phpClassName, $field)) {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Reflect.hx:73: characters 5-34
|
||||
return $o->{$field};
|
||||
}
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Reflect.hx:75: lines 75-77
|
||||
if (method_exists($phpClassName, $field)) {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Reflect.hx:76: characters 5-54
|
||||
return Boot::getStaticClosure($phpClassName, $field);
|
||||
}
|
||||
}
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Reflect.hx:80: characters 3-14
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the fields of structure `o`.
|
||||
* This method is only guaranteed to work on anonymous structures. Refer to
|
||||
* `Type.getInstanceFields` for a function supporting class instances.
|
||||
* If `o` is null, the result is unspecified.
|
||||
*
|
||||
* @param mixed $o
|
||||
*
|
||||
* @return string[]|\Array_hx
|
||||
*/
|
||||
public static function fields ($o) {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Reflect.hx:117: lines 117-119
|
||||
if (is_object($o)) {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Reflect.hx:118: characters 4-77
|
||||
return \Array_hx::wrap(array_keys(get_object_vars($o)));
|
||||
}
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Reflect.hx:120: characters 3-12
|
||||
return new \Array_hx();
|
||||
}
|
||||
|
||||
/**
|
||||
* Tells if structure `o` has a field named `field`.
|
||||
* This is only guaranteed to work for anonymous structures. Refer to
|
||||
* `Type.getInstanceFields` for a function supporting class instances.
|
||||
* If `o` or `field` are null, the result is unspecified.
|
||||
*
|
||||
* @param mixed $o
|
||||
* @param string $field
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function hasField ($o, $field) {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Reflect.hx:34: lines 34-35
|
||||
if (!is_object($o)) {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Reflect.hx:35: characters 4-16
|
||||
return false;
|
||||
}
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Reflect.hx:36: lines 36-37
|
||||
if (property_exists($o, $field)) {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Reflect.hx:37: characters 4-15
|
||||
return true;
|
||||
}
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Reflect.hx:39: lines 39-44
|
||||
if (($o instanceof HxClass)) {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Reflect.hx:40: characters 4-54
|
||||
$phpClassName = $o->phpClassName;
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Reflect.hx:41: lines 41-43
|
||||
if (!(property_exists($phpClassName, $field) || method_exists($phpClassName, $field))) {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Reflect.hx:43: characters 8-47
|
||||
return defined("" . ($phpClassName??'null') . "::" . ($field??'null'));
|
||||
} else {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Reflect.hx:41: lines 41-43
|
||||
return true;
|
||||
}
|
||||
}
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Reflect.hx:46: characters 3-15
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the field named `field` of object `o` to value `value`.
|
||||
* If `o` has no field named `field`, this function is only guaranteed to
|
||||
* work for anonymous structures.
|
||||
* If `o` or `field` are null, the result is unspecified.
|
||||
*
|
||||
* @param mixed $o
|
||||
* @param string $field
|
||||
* @param mixed $value
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function setField ($o, $field, $value) {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Reflect.hx:84: characters 3-35
|
||||
$o->{$field} = $value;
|
||||
}
|
||||
}
|
||||
|
||||
Boot::registerClass(Reflect::class, 'Reflect');
|
|
@ -0,0 +1,125 @@
|
|||
<?php
|
||||
/**
|
||||
*/
|
||||
|
||||
use \php\Boot;
|
||||
use \php\_Boot\HxString;
|
||||
|
||||
/**
|
||||
* The Std class provides standard methods for manipulating basic types.
|
||||
*/
|
||||
class Std {
|
||||
/**
|
||||
* Converts a `String` to a `Float`.
|
||||
* The parsing rules for `parseInt` apply here as well, with the exception of invalid input
|
||||
* resulting in a `NaN` value instead of null.
|
||||
* Additionally, decimal notation may contain a single `.` to denote the start of the fractions.
|
||||
*
|
||||
* @param string $x
|
||||
*
|
||||
* @return float
|
||||
*/
|
||||
public static function parseFloat ($x) {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Std.hx:74: characters 3-35
|
||||
$result = floatval($x);
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Std.hx:75: lines 75-76
|
||||
if (!Boot::equal($result, 0)) {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Std.hx:76: characters 4-17
|
||||
return $result;
|
||||
}
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Std.hx:78: characters 3-22
|
||||
$x = ltrim($x);
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Std.hx:79: characters 3-53
|
||||
$firstCharIndex = (mb_substr($x, 0, 1) === "-" ? 1 : 0);
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Std.hx:80: characters 3-47
|
||||
$charCode = HxString::charCodeAt($x, $firstCharIndex);
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Std.hx:82: lines 82-84
|
||||
if ($charCode === 46) {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Std.hx:83: characters 4-47
|
||||
$charCode = HxString::charCodeAt($x, $firstCharIndex + 1);
|
||||
}
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Std.hx:86: lines 86-90
|
||||
if (($charCode !== null) && ($charCode >= 48) && ($charCode <= 57)) {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Std.hx:87: characters 4-14
|
||||
return 0.0;
|
||||
} else {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Std.hx:89: characters 4-20
|
||||
return NAN;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts a `String` to an `Int`.
|
||||
* Leading whitespaces are ignored.
|
||||
* If `x` starts with 0x or 0X, hexadecimal notation is recognized where the following digits may
|
||||
* contain 0-9 and A-F.
|
||||
* Otherwise `x` is read as decimal number with 0-9 being allowed characters. `x` may also start with
|
||||
* a - to denote a negative value.
|
||||
* In decimal mode, parsing continues until an invalid character is detected, in which case the
|
||||
* result up to that point is returned. For hexadecimal notation, the effect of invalid characters
|
||||
* is unspecified.
|
||||
* Leading 0s that are not part of the 0x/0X hexadecimal notation are ignored, which means octal
|
||||
* notation is not supported.
|
||||
* If `x` is null, the result is unspecified.
|
||||
* If `x` cannot be parsed as integer, the result is `null`.
|
||||
*
|
||||
* @param string $x
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public static function parseInt ($x) {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Std.hx:55: lines 55-70
|
||||
if (is_numeric($x)) {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Std.hx:56: characters 4-31
|
||||
return intval($x, 10);
|
||||
} else {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Std.hx:58: characters 4-23
|
||||
$x = ltrim($x);
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Std.hx:59: characters 4-54
|
||||
$firstCharIndex = (mb_substr($x, 0, 1) === "-" ? 1 : 0);
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Std.hx:60: characters 4-53
|
||||
$firstCharCode = HxString::charCodeAt($x, $firstCharIndex);
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Std.hx:61: lines 61-63
|
||||
if (!(($firstCharCode !== null) && ($firstCharCode >= 48) && ($firstCharCode <= 57))) {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Std.hx:62: characters 5-16
|
||||
return null;
|
||||
}
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Std.hx:64: characters 21-49
|
||||
$index = $firstCharIndex + 1;
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Std.hx:64: characters 4-50
|
||||
$secondChar = ($index < 0 ? "" : mb_substr($x, $index, 1));
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Std.hx:65: lines 65-69
|
||||
if (($secondChar === "x") || ($secondChar === "X")) {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Std.hx:66: characters 5-31
|
||||
return intval($x, 0);
|
||||
} else {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Std.hx:68: characters 5-32
|
||||
return intval($x, 10);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts any value to a String.
|
||||
* If `s` is of `String`, `Int`, `Float` or `Bool`, its value is returned.
|
||||
* If `s` is an instance of a class and that class or one of its parent classes has
|
||||
* a `toString` method, that method is called. If no such method is present, the result
|
||||
* is unspecified.
|
||||
* If `s` is an enum constructor without argument, the constructor's name is returned. If
|
||||
* arguments exists, the constructor's name followed by the String representations of
|
||||
* the arguments is returned.
|
||||
* If `s` is a structure, the field names along with their values are returned. The field order
|
||||
* and the operator separating field names and values are unspecified.
|
||||
* If s is null, "null" is returned.
|
||||
*
|
||||
* @param mixed $s
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function string ($s) {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Std.hx:47: characters 3-27
|
||||
return Boot::stringify($s);
|
||||
}
|
||||
}
|
||||
|
||||
Boot::registerClass(Std::class, 'Std');
|
|
@ -0,0 +1,40 @@
|
|||
<?php
|
||||
/**
|
||||
*/
|
||||
|
||||
use \php\Boot;
|
||||
|
||||
/**
|
||||
* This class provides advanced methods on Strings. It is ideally used with
|
||||
* `using StringTools` and then acts as an [extension](https://haxe.org/manual/lf-static-extension.html)
|
||||
* to the `String` class.
|
||||
* If the first argument to any of the methods is null, the result is
|
||||
* unspecified.
|
||||
*/
|
||||
class StringTools {
|
||||
/**
|
||||
* Replace all occurrences of the String `sub` in the String `s` by the
|
||||
* String `by`.
|
||||
* If `sub` is the empty String `""`, `by` is inserted after each character
|
||||
* of `s` except the last one. If `by` is also the empty String `""`, `s`
|
||||
* remains unchanged.
|
||||
* If `sub` or `by` are null, the result is unspecified.
|
||||
*
|
||||
* @param string $s
|
||||
* @param string $sub
|
||||
* @param string $by
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function replace ($s, $sub, $by) {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/StringTools.hx:104: lines 104-106
|
||||
if ($sub === "") {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/StringTools.hx:105: characters 4-89
|
||||
return implode($by, preg_split("//u", $s, -1, PREG_SPLIT_NO_EMPTY));
|
||||
}
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/StringTools.hx:107: characters 3-40
|
||||
return str_replace($sub, $by, $s);
|
||||
}
|
||||
}
|
||||
|
||||
Boot::registerClass(StringTools::class, 'StringTools');
|
|
@ -0,0 +1,125 @@
|
|||
<?php
|
||||
/**
|
||||
*/
|
||||
|
||||
namespace haxe;
|
||||
|
||||
use \php\Boot;
|
||||
|
||||
/**
|
||||
* Base class for exceptions.
|
||||
* If this class (or derivatives) is used to catch an exception, then
|
||||
* `haxe.CallStack.exceptionStack()` will not return a stack for the exception
|
||||
* caught. Use `haxe.Exception.stack` property instead:
|
||||
* ```haxe
|
||||
* try {
|
||||
* throwSomething();
|
||||
* } catch(e:Exception) {
|
||||
* trace(e.stack);
|
||||
* }
|
||||
* ```
|
||||
* Custom exceptions should extend this class:
|
||||
* ```haxe
|
||||
* class MyException extends haxe.Exception {}
|
||||
* //...
|
||||
* throw new MyException('terrible exception');
|
||||
* ```
|
||||
* `haxe.Exception` is also a wildcard type to catch any exception:
|
||||
* ```haxe
|
||||
* try {
|
||||
* throw 'Catch me!';
|
||||
* } catch(e:haxe.Exception) {
|
||||
* trace(e.message); // Output: Catch me!
|
||||
* }
|
||||
* ```
|
||||
* To rethrow an exception just throw it again.
|
||||
* Haxe will try to rethrow an original native exception whenever possible.
|
||||
* ```haxe
|
||||
* try {
|
||||
* var a:Array<Int> = null;
|
||||
* a.push(1); // generates target-specific null-pointer exception
|
||||
* } catch(e:haxe.Exception) {
|
||||
* throw e; // rethrows native exception instead of haxe.Exception
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
class Exception extends \Exception {
|
||||
/**
|
||||
* @var \Throwable
|
||||
*/
|
||||
public $__nativeException;
|
||||
/**
|
||||
* @var Exception
|
||||
*/
|
||||
public $__previousException;
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
public $__skipStack;
|
||||
|
||||
/**
|
||||
* @param mixed $value
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public static function thrown ($value) {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/haxe/Exception.hx:30: lines 30-38
|
||||
if (($value instanceof Exception)) {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/haxe/Exception.hx:31: characters 4-35
|
||||
return $value->get_native();
|
||||
} else if (($value instanceof \Throwable)) {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/haxe/Exception.hx:33: characters 4-16
|
||||
return $value;
|
||||
} else {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/haxe/Exception.hx:35: characters 4-38
|
||||
$e = new ValueException($value);
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/haxe/Exception.hx:36: characters 4-21
|
||||
$e->__skipStack = 1;
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/haxe/Exception.hx:37: characters 4-12
|
||||
return $e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new Exception instance.
|
||||
* The `previous` argument could be used for exception chaining.
|
||||
* The `native` argument is for internal usage only.
|
||||
* There is no need to provide `native` argument manually and no need to keep it
|
||||
* upon extending `haxe.Exception` unless you know what you're doing.
|
||||
*
|
||||
* @param string $message
|
||||
* @param Exception $previous
|
||||
* @param mixed $native
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct ($message, $previous = null, $native = null) {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/haxe/Exception.hx:16: characters 39-40
|
||||
$this->__skipStack = 0;
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/haxe/Exception.hx:42: characters 3-30
|
||||
parent::__construct($message, 0, $previous);
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/haxe/Exception.hx:43: characters 3-38
|
||||
$this->__previousException = $previous;
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/haxe/Exception.hx:44: lines 44-48
|
||||
if (($native !== null) && ($native instanceof \Throwable)) {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/haxe/Exception.hx:45: characters 4-30
|
||||
$this->__nativeException = $native;
|
||||
} else {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/haxe/Exception.hx:47: characters 4-33
|
||||
$this->__nativeException = $this;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
final public function get_native () {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/haxe/Exception.hx:72: characters 3-27
|
||||
return $this->__nativeException;
|
||||
}
|
||||
}
|
||||
|
||||
Boot::registerClass(Exception::class, 'haxe.Exception');
|
||||
Boot::registerGetters('haxe\\Exception', [
|
||||
'native' => true
|
||||
]);
|
|
@ -0,0 +1,88 @@
|
|||
<?php
|
||||
/**
|
||||
*/
|
||||
|
||||
namespace haxe;
|
||||
|
||||
use \php\Boot;
|
||||
|
||||
/**
|
||||
* Log primarily provides the `trace()` method, which is invoked upon a call to
|
||||
* `trace()` in Haxe code.
|
||||
*/
|
||||
class Log {
|
||||
/**
|
||||
* @var \Closure
|
||||
* Outputs `v` in a platform-dependent way.
|
||||
* The second parameter `infos` is injected by the compiler and contains
|
||||
* information about the position where the `trace()` call was made.
|
||||
* This method can be rebound to a custom function:
|
||||
* var oldTrace = haxe.Log.trace; // store old function
|
||||
* haxe.Log.trace = function(v, ?infos) {
|
||||
* // handle trace
|
||||
* }
|
||||
* ...
|
||||
* haxe.Log.trace = oldTrace;
|
||||
* If it is bound to null, subsequent calls to `trace()` will cause an
|
||||
* exception.
|
||||
*/
|
||||
static public $trace;
|
||||
|
||||
/**
|
||||
* Format the output of `trace` before printing it.
|
||||
*
|
||||
* @param mixed $v
|
||||
* @param object $infos
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function formatOutput ($v, $infos) {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/haxe/Log.hx:34: characters 3-27
|
||||
$str = \Std::string($v);
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/haxe/Log.hx:35: lines 35-36
|
||||
if ($infos === null) {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/haxe/Log.hx:36: characters 4-14
|
||||
return $str;
|
||||
}
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/haxe/Log.hx:37: characters 3-54
|
||||
$pstr = ($infos->fileName??'null') . ":" . ($infos->lineNumber??'null');
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/haxe/Log.hx:38: lines 38-40
|
||||
if ($infos->customParams !== null) {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/haxe/Log.hx:39: lines 39-40
|
||||
$_g = 0;
|
||||
$_g1 = $infos->customParams;
|
||||
while ($_g < $_g1->length) {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/haxe/Log.hx:39: characters 9-10
|
||||
$v = ($_g1->arr[$_g] ?? null);
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/haxe/Log.hx:39: lines 39-40
|
||||
++$_g;
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/haxe/Log.hx:40: characters 5-32
|
||||
$str = ($str??'null') . ", " . \Std::string($v);
|
||||
}
|
||||
}
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/haxe/Log.hx:41: characters 3-27
|
||||
return ($pstr??'null') . ": " . ($str??'null');
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
* @access private
|
||||
*/
|
||||
static public function __hx__init ()
|
||||
{
|
||||
static $called = false;
|
||||
if ($called) return;
|
||||
$called = true;
|
||||
|
||||
|
||||
self::$trace = function ($v, $infos = null) {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/haxe/Log.hx:63: characters 3-36
|
||||
$str = Log::formatOutput($v, $infos);
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/haxe/Log.hx:70: characters 3-19
|
||||
echo(\Std::string($str) . \PHP_EOL);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Boot::registerClass(Log::class, 'haxe.Log');
|
||||
Log::__hx__init();
|
|
@ -0,0 +1,44 @@
|
|||
<?php
|
||||
/**
|
||||
*/
|
||||
|
||||
namespace haxe;
|
||||
|
||||
use \php\Boot;
|
||||
|
||||
/**
|
||||
* An exception containing arbitrary value.
|
||||
* This class is automatically used for throwing values, which don't extend `haxe.Exception`
|
||||
* or native exception type.
|
||||
* For example:
|
||||
* ```haxe
|
||||
* throw "Terrible error";
|
||||
* ```
|
||||
* will be compiled to
|
||||
* ```haxe
|
||||
* throw new ValueException("Terrible error");
|
||||
* ```
|
||||
*/
|
||||
class ValueException extends Exception {
|
||||
/**
|
||||
* @var mixed
|
||||
* Thrown value.
|
||||
*/
|
||||
public $value;
|
||||
|
||||
/**
|
||||
* @param mixed $value
|
||||
* @param Exception $previous
|
||||
* @param mixed $native
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct ($value, $previous = null, $native = null) {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/haxe/ValueException.hx:24: characters 3-100
|
||||
parent::__construct(\Std::string($value), $previous, $native);
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/haxe/ValueException.hx:25: characters 3-21
|
||||
$this->value = $value;
|
||||
}
|
||||
}
|
||||
|
||||
Boot::registerClass(ValueException::class, 'haxe.ValueException');
|
|
@ -0,0 +1,57 @@
|
|||
<?php
|
||||
/**
|
||||
*/
|
||||
|
||||
namespace haxe\iterators;
|
||||
|
||||
use \php\Boot;
|
||||
|
||||
/**
|
||||
* This iterator is used only when `Array<T>` is passed to `Iterable<T>`
|
||||
*/
|
||||
class ArrayIterator {
|
||||
/**
|
||||
* @var mixed[]|\Array_hx
|
||||
*/
|
||||
public $array;
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
public $current;
|
||||
|
||||
/**
|
||||
* Create a new `ArrayIterator`.
|
||||
*
|
||||
* @param mixed[]|\Array_hx $array
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct ($array) {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/haxe/iterators/ArrayIterator.hx:30: characters 20-21
|
||||
$this->current = 0;
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/haxe/iterators/ArrayIterator.hx:37: characters 3-21
|
||||
$this->array = $array;
|
||||
}
|
||||
|
||||
/**
|
||||
* See `Iterator.hasNext`
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function hasNext () {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/haxe/iterators/ArrayIterator.hx:45: characters 3-32
|
||||
return $this->current < $this->array->length;
|
||||
}
|
||||
|
||||
/**
|
||||
* See `Iterator.next`
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function next () {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/haxe/iterators/ArrayIterator.hx:53: characters 3-26
|
||||
return ($this->array->arr[$this->current++] ?? null);
|
||||
}
|
||||
}
|
||||
|
||||
Boot::registerClass(ArrayIterator::class, 'haxe.iterators.ArrayIterator');
|
|
@ -0,0 +1,26 @@
|
|||
<?php
|
||||
/**
|
||||
*/
|
||||
|
||||
namespace haxe\iterators;
|
||||
|
||||
use \php\Boot;
|
||||
|
||||
class ArrayKeyValueIterator {
|
||||
/**
|
||||
* @var mixed[]|\Array_hx
|
||||
*/
|
||||
public $array;
|
||||
|
||||
/**
|
||||
* @param mixed[]|\Array_hx $array
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct ($array) {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/haxe/iterators/ArrayKeyValueIterator.hx:32: characters 3-21
|
||||
$this->array = $array;
|
||||
}
|
||||
}
|
||||
|
||||
Boot::registerClass(ArrayKeyValueIterator::class, 'haxe.iterators.ArrayKeyValueIterator');
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,43 @@
|
|||
<?php
|
||||
/**
|
||||
*/
|
||||
|
||||
namespace php\_Boot;
|
||||
|
||||
use \php\Boot;
|
||||
|
||||
/**
|
||||
* Anonymous objects implementation
|
||||
*/
|
||||
class HxAnon extends \StdClass {
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function __construct () {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:950: lines 950-960
|
||||
;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
* @param array $args
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function __call ($name, $args) {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:958: characters 3-57
|
||||
return ($this->$name)(...$args);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function __get ($name) {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:953: characters 3-14
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
Boot::registerClass(HxAnon::class, 'php._Boot.HxAnon');
|
|
@ -0,0 +1,95 @@
|
|||
<?php
|
||||
/**
|
||||
*/
|
||||
|
||||
namespace php\_Boot;
|
||||
|
||||
use \php\Boot;
|
||||
|
||||
/**
|
||||
* Class<T> implementation for Haxe->PHP internals.
|
||||
*/
|
||||
class HxClass {
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $phpClassName;
|
||||
|
||||
/**
|
||||
* @param string $phpClassName
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct ($phpClassName) {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:667: characters 3-35
|
||||
$this->phpClassName = $phpClassName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Magic method to call static methods of this class, when `HxClass` instance is in a `Dynamic` variable.
|
||||
*
|
||||
* @param string $method
|
||||
* @param array $args
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function __call ($method, $args) {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:675: characters 3-111
|
||||
$callback = ((($this->phpClassName === "String" ? HxString::class : $this->phpClassName))??'null') . "::" . ($method??'null');
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:676: characters 3-53
|
||||
return \call_user_func_array($callback, $args);
|
||||
}
|
||||
|
||||
/**
|
||||
* Magic method to get static vars of this class, when `HxClass` instance is in a `Dynamic` variable.
|
||||
*
|
||||
* @param string $property
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function __get ($property) {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:684: lines 684-692
|
||||
if (\defined("" . ($this->phpClassName??'null') . "::" . ($property??'null'))) {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:685: characters 4-54
|
||||
return \constant("" . ($this->phpClassName??'null') . "::" . ($property??'null'));
|
||||
} else if (Boot::hasGetter($this->phpClassName, $property)) {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:687: characters 29-41
|
||||
$tmp = $this->phpClassName;
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:687: characters 4-59
|
||||
return $tmp::{"get_" . ($property??'null')}();
|
||||
} else if (\method_exists($this->phpClassName, $property)) {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:689: characters 4-56
|
||||
return Boot::getStaticClosure($this->phpClassName, $property);
|
||||
} else {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:691: characters 33-45
|
||||
$tmp = $this->phpClassName;
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:691: characters 4-56
|
||||
return $tmp::${$property};
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Magic method to set static vars of this class, when `HxClass` instance is in a `Dynamic` variable.
|
||||
*
|
||||
* @param string $property
|
||||
* @param mixed $value
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __set ($property, $value) {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:700: lines 700-704
|
||||
if (Boot::hasSetter($this->phpClassName, $property)) {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:701: characters 22-34
|
||||
$tmp = $this->phpClassName;
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:701: characters 4-59
|
||||
$tmp::{"set_" . ($property??'null')}($value);
|
||||
} else {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:703: characters 26-38
|
||||
$tmp = $this->phpClassName;
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:703: characters 4-56
|
||||
$tmp::${$property} = $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Boot::registerClass(HxClass::class, 'php._Boot.HxClass');
|
|
@ -0,0 +1,114 @@
|
|||
<?php
|
||||
/**
|
||||
*/
|
||||
|
||||
namespace php\_Boot;
|
||||
|
||||
use \php\Boot;
|
||||
use \haxe\Exception;
|
||||
|
||||
/**
|
||||
* Closures implementation
|
||||
*/
|
||||
class HxClosure {
|
||||
/**
|
||||
* @var mixed
|
||||
* A callable value, which can be invoked by PHP
|
||||
*/
|
||||
public $callable;
|
||||
/**
|
||||
* @var string
|
||||
* Method name for methods
|
||||
*/
|
||||
public $func;
|
||||
/**
|
||||
* @var mixed
|
||||
* `this` for instance methods; php class name for static methods
|
||||
*/
|
||||
public $target;
|
||||
|
||||
/**
|
||||
* @param mixed $target
|
||||
* @param string $func
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct ($target, $func) {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:978: characters 3-23
|
||||
$this->target = $target;
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:979: characters 3-19
|
||||
$this->func = $func;
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:981: lines 981-983
|
||||
if (\is_null($target)) {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:982: characters 4-9
|
||||
throw Exception::thrown("Unable to create closure on `null`");
|
||||
}
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:984: characters 3-104
|
||||
$this->callable = (($target instanceof HxAnon) ? $target->{$func} : [$target, $func]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see http://php.net/manual/en/language.oop5.magic.php#object.invoke
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function __invoke () {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:992: characters 3-71
|
||||
return \call_user_func_array($this->callable, \func_get_args());
|
||||
}
|
||||
|
||||
/**
|
||||
* Invoke this closure with `newThis` instead of `this`
|
||||
*
|
||||
* @param mixed $newThis
|
||||
* @param array $args
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function callWith ($newThis, $args) {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:1019: characters 3-65
|
||||
return \call_user_func_array($this->getCallback($newThis), $args);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if this is the same closure
|
||||
*
|
||||
* @param HxClosure $closure
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function equals ($closure) {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:1012: characters 10-60
|
||||
if (Boot::equal($this->target, $closure->target)) {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:1012: characters 39-59
|
||||
return $this->func === $closure->func;
|
||||
} else {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:1012: characters 10-60
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates callable value for PHP
|
||||
*
|
||||
* @param mixed $eThis
|
||||
*
|
||||
* @return mixed[]
|
||||
*/
|
||||
public function getCallback ($eThis = null) {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:999: lines 999-1001
|
||||
if ($eThis === null) {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:1000: characters 4-18
|
||||
$eThis = $this->target;
|
||||
}
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:1002: lines 1002-1004
|
||||
if (($eThis instanceof HxAnon)) {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:1003: characters 4-36
|
||||
return $eThis->{$this->func};
|
||||
}
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:1005: characters 3-39
|
||||
return [$eThis, $this->func];
|
||||
}
|
||||
}
|
||||
|
||||
Boot::registerClass(HxClosure::class, 'php._Boot.HxClosure');
|
|
@ -0,0 +1,160 @@
|
|||
<?php
|
||||
/**
|
||||
*/
|
||||
|
||||
namespace php\_Boot;
|
||||
|
||||
use \php\Boot;
|
||||
|
||||
/**
|
||||
* For Dynamic access which looks like String.
|
||||
* Instances of this class should not be saved anywhere.
|
||||
* Instead it should be used to immediately invoke a String field right after instance creation one time only.
|
||||
*/
|
||||
class HxDynamicStr extends HxClosure {
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
static public $hxString;
|
||||
|
||||
/**
|
||||
* @param string $str
|
||||
* @param string $method
|
||||
* @param array $args
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public static function invoke ($str, $method, $args) {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:892: characters 3-34
|
||||
\array_unshift($args, $str);
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:893: characters 3-69
|
||||
return \call_user_func_array((HxDynamicStr::$hxString??'null') . "::" . ($method??'null'), $args);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns HxDynamicStr instance if `value` is a string.
|
||||
* Otherwise returns `value` as-is.
|
||||
*
|
||||
* @param mixed $value
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public static function wrap ($value) {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:884: lines 884-888
|
||||
if (\is_string($value)) {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:885: characters 4-34
|
||||
return new HxDynamicStr($value);
|
||||
} else {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:887: characters 4-16
|
||||
return $value;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $str
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct ($str) {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:897: characters 3-19
|
||||
parent::__construct($str, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $method
|
||||
* @param array $args
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function __call ($method, $args) {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:913: characters 10-38
|
||||
\array_unshift($args, $this->target);
|
||||
return \call_user_func_array((HxDynamicStr::$hxString??'null') . "::" . ($method??'null'), $args);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $field
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function __get ($field) {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:902: lines 902-908
|
||||
if ($field === "length") {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:904: characters 5-36
|
||||
return mb_strlen($this->target);
|
||||
} else {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:906: characters 5-17
|
||||
$this->func = $field;
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:907: characters 5-16
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @see http://php.net/manual/en/language.oop5.magic.php#object.invoke
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function __invoke () {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:921: characters 10-54
|
||||
$str = $this->target;
|
||||
$method = $this->func;
|
||||
$args = \func_get_args();
|
||||
\array_unshift($args, $str);
|
||||
return \call_user_func_array((HxDynamicStr::$hxString??'null') . "::" . ($method??'null'), $args);
|
||||
}
|
||||
|
||||
/**
|
||||
* Invoke this closure with `newThis` instead of `this`
|
||||
*
|
||||
* @param mixed $newThis
|
||||
* @param array $args
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function callWith ($newThis, $args) {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:938: lines 938-940
|
||||
if ($newThis === null) {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:939: characters 4-20
|
||||
$newThis = $this->target;
|
||||
}
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:941: characters 10-37
|
||||
$method = $this->func;
|
||||
\array_unshift($args, $newThis);
|
||||
return \call_user_func_array((HxDynamicStr::$hxString??'null') . "::" . ($method??'null'), $args);
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates callable value for PHP
|
||||
*
|
||||
* @param mixed $eThis
|
||||
*
|
||||
* @return mixed[]
|
||||
*/
|
||||
public function getCallback ($eThis = null) {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:928: lines 928-930
|
||||
if ($eThis === null) {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:929: characters 4-51
|
||||
return [$this, $this->func];
|
||||
}
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:931: characters 3-69
|
||||
return [new HxDynamicStr($eThis), $this->func];
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
* @access private
|
||||
*/
|
||||
static public function __hx__init ()
|
||||
{
|
||||
static $called = false;
|
||||
if ($called) return;
|
||||
$called = true;
|
||||
|
||||
|
||||
self::$hxString = Boot::getClass(HxString::class)->phpClassName;
|
||||
}
|
||||
}
|
||||
|
||||
Boot::registerClass(HxDynamicStr::class, 'php._Boot.HxDynamicStr');
|
||||
HxDynamicStr::__hx__init();
|
|
@ -0,0 +1,73 @@
|
|||
<?php
|
||||
/**
|
||||
*/
|
||||
|
||||
namespace php\_Boot;
|
||||
|
||||
use \php\Boot;
|
||||
|
||||
/**
|
||||
* Base class for enum types
|
||||
*/
|
||||
class HxEnum {
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
public $index;
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
public $params;
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $tag;
|
||||
|
||||
/**
|
||||
* @param string $tag
|
||||
* @param int $index
|
||||
* @param array $arguments
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct ($tag, $index, $arguments = null) {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:721: characters 3-17
|
||||
$this->tag = $tag;
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:722: characters 3-21
|
||||
$this->index = $index;
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:723: characters 12-63
|
||||
$tmp = null;
|
||||
if ($arguments === null) {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:723: characters 33-50
|
||||
$this1 = [];
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:723: characters 12-63
|
||||
$tmp = $this1;
|
||||
} else {
|
||||
$tmp = $arguments;
|
||||
}
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:723: characters 3-63
|
||||
$this->params = $tmp;
|
||||
}
|
||||
|
||||
/**
|
||||
* PHP magic method to get string representation of this `Class`
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString () {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:738: characters 3-30
|
||||
return Boot::stringify($this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get string representation of this `Class`
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function toString () {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:730: characters 3-22
|
||||
return $this->__toString();
|
||||
}
|
||||
}
|
||||
|
||||
Boot::registerClass(HxEnum::class, 'php._Boot.HxEnum');
|
|
@ -0,0 +1,294 @@
|
|||
<?php
|
||||
/**
|
||||
*/
|
||||
|
||||
namespace php\_Boot;
|
||||
|
||||
use \php\Boot;
|
||||
|
||||
/**
|
||||
* `String` implementation
|
||||
*/
|
||||
class HxString {
|
||||
/**
|
||||
* @param string $str
|
||||
* @param int $index
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function charAt ($str, $index) {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:759: characters 10-58
|
||||
if ($index < 0) {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:759: characters 22-24
|
||||
return "";
|
||||
} else {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:759: characters 27-58
|
||||
return \mb_substr($str, $index, 1);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $str
|
||||
* @param int $index
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public static function charCodeAt ($str, $index) {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:763: lines 763-765
|
||||
if (($index < 0) || ($str === "")) {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:764: characters 4-15
|
||||
return null;
|
||||
}
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:766: lines 766-768
|
||||
if ($index === 0) {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:767: characters 11-30
|
||||
$code = \ord($str[0]);
|
||||
if ($code < 192) {
|
||||
return $code;
|
||||
} else if ($code < 224) {
|
||||
return (($code - 192) << 6) + \ord($str[1]) - 128;
|
||||
} else if ($code < 240) {
|
||||
return (($code - 224) << 12) + ((\ord($str[1]) - 128) << 6) + \ord($str[2]) - 128;
|
||||
} else {
|
||||
return (($code - 240) << 18) + ((\ord($str[1]) - 128) << 12) + ((\ord($str[2]) - 128) << 6) + \ord($str[3]) - 128;
|
||||
}
|
||||
}
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:769: characters 3-46
|
||||
$char = \mb_substr($str, $index, 1);
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:770: characters 10-50
|
||||
if ($char === "") {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:770: characters 23-27
|
||||
return null;
|
||||
} else {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:770: characters 30-50
|
||||
$code = \ord($char[0]);
|
||||
if ($code < 192) {
|
||||
return $code;
|
||||
} else if ($code < 224) {
|
||||
return (($code - 192) << 6) + \ord($char[1]) - 128;
|
||||
} else if ($code < 240) {
|
||||
return (($code - 224) << 12) + ((\ord($char[1]) - 128) << 6) + \ord($char[2]) - 128;
|
||||
} else {
|
||||
return (($code - 240) << 18) + ((\ord($char[1]) - 128) << 12) + ((\ord($char[2]) - 128) << 6) + \ord($char[3]) - 128;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $code
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function fromCharCode ($code) {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:865: characters 3-29
|
||||
return \mb_chr($code);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $str
|
||||
* @param string $search
|
||||
* @param int $startIndex
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public static function indexOf ($str, $search, $startIndex = null) {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:774: lines 774-787
|
||||
if ($startIndex === null) {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:775: characters 4-18
|
||||
$startIndex = 0;
|
||||
} else {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:777: characters 4-28
|
||||
$length = mb_strlen($str);
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:778: lines 778-783
|
||||
if ($startIndex < 0) {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:779: characters 5-25
|
||||
$startIndex += $length;
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:780: lines 780-782
|
||||
if ($startIndex < 0) {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:781: characters 6-20
|
||||
$startIndex = 0;
|
||||
}
|
||||
}
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:784: lines 784-786
|
||||
if (($startIndex >= $length) && ($search !== "")) {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:785: characters 5-14
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:788: lines 788-793
|
||||
$index = null;
|
||||
if ($search === "") {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:789: characters 4-28
|
||||
$length = mb_strlen($str);
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:788: lines 788-793
|
||||
$index = ($startIndex > $length ? $length : $startIndex);
|
||||
} else {
|
||||
$index = \mb_strpos($str, $search, $startIndex);
|
||||
}
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:794: characters 10-39
|
||||
if ($index === false) {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:794: characters 28-30
|
||||
return -1;
|
||||
} else {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:794: characters 33-38
|
||||
return $index;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $str
|
||||
* @param string $search
|
||||
* @param int $startIndex
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public static function lastIndexOf ($str, $search, $startIndex = null) {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:798: characters 3-26
|
||||
$start = $startIndex;
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:799: lines 799-811
|
||||
if ($start === null) {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:800: characters 4-13
|
||||
$start = 0;
|
||||
} else {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:802: characters 4-28
|
||||
$length = mb_strlen($str);
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:803: lines 803-810
|
||||
if ($start >= 0) {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:804: characters 5-27
|
||||
$start -= $length;
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:805: lines 805-807
|
||||
if ($start > 0) {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:806: characters 6-15
|
||||
$start = 0;
|
||||
}
|
||||
} else if ($start < -$length) {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:809: characters 5-20
|
||||
$start = -$length;
|
||||
}
|
||||
}
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:812: lines 812-817
|
||||
$index = null;
|
||||
if ($search === "") {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:813: characters 4-28
|
||||
$length = mb_strlen($str);
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:812: lines 812-817
|
||||
$index = (($startIndex === null) || ($startIndex > $length) ? $length : $startIndex);
|
||||
} else {
|
||||
$index = \mb_strrpos($str, $search, $start);
|
||||
}
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:818: lines 818-822
|
||||
if ($index === false) {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:819: characters 4-13
|
||||
return -1;
|
||||
} else {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:821: characters 4-16
|
||||
return $index;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $str
|
||||
* @param string $delimiter
|
||||
*
|
||||
* @return string[]|\Array_hx
|
||||
*/
|
||||
public static function split ($str, $delimiter) {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:826: lines 826-831
|
||||
$arr = null;
|
||||
if ($delimiter === "") {
|
||||
$arr = \preg_split("//u", $str, -1, \PREG_SPLIT_NO_EMPTY);
|
||||
} else {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:829: characters 4-49
|
||||
$delimiter = \preg_quote($delimiter, "/");
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:826: lines 826-831
|
||||
$arr = \preg_split("/" . ($delimiter??'null') . "/", $str);
|
||||
}
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:832: characters 3-41
|
||||
return \Array_hx::wrap($arr);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $str
|
||||
* @param int $pos
|
||||
* @param int $len
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function substr ($str, $pos, $len = null) {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:836: characters 3-41
|
||||
return \mb_substr($str, $pos, $len);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $str
|
||||
* @param int $startIndex
|
||||
* @param int $endIndex
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function substring ($str, $startIndex, $endIndex = null) {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:840: lines 840-845
|
||||
if ($endIndex === null) {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:841: lines 841-843
|
||||
if ($startIndex < 0) {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:842: characters 5-19
|
||||
$startIndex = 0;
|
||||
}
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:844: characters 4-44
|
||||
return \mb_substr($str, $startIndex);
|
||||
}
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:846: lines 846-848
|
||||
if ($endIndex < 0) {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:847: characters 4-16
|
||||
$endIndex = 0;
|
||||
}
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:849: lines 849-851
|
||||
if ($startIndex < 0) {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:850: characters 4-18
|
||||
$startIndex = 0;
|
||||
}
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:852: lines 852-856
|
||||
if ($startIndex > $endIndex) {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:853: characters 4-23
|
||||
$tmp = $endIndex;
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:854: characters 4-25
|
||||
$endIndex = $startIndex;
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:855: characters 4-20
|
||||
$startIndex = $tmp;
|
||||
}
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:857: characters 3-66
|
||||
return \mb_substr($str, $startIndex, $endIndex - $startIndex);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $str
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function toLowerCase ($str) {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:755: characters 3-35
|
||||
return \mb_strtolower($str);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $str
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function toString ($str) {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:861: characters 3-13
|
||||
return $str;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $str
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function toUpperCase ($str) {
|
||||
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:751: characters 3-35
|
||||
return \mb_strtoupper($str);
|
||||
}
|
||||
}
|
||||
|
||||
Boot::registerClass(HxString::class, 'php._Boot.HxString');
|
|
@ -0,0 +1,63 @@
|
|||
<?php
|
||||
/**
|
||||
* Polyfills for some functions, which are required by Haxe-generated code, but not available in PHP 7.0.
|
||||
* No Haxe-generated code is available at this point.
|
||||
* No code should be executed from this file.
|
||||
* Symbols declarations are the only code allowed here.
|
||||
*/
|
||||
namespace { //Namespace declaration is required because this file is included under non-root namespace.
|
||||
|
||||
/**
|
||||
* @see http://php.net/manual/en/function.mb-chr.php
|
||||
*/
|
||||
if(!function_exists('mb_chr')) {
|
||||
function mb_chr($code, $encoding = null) {
|
||||
if($encoding && $encoding !== 'UTF-8') {
|
||||
throw new Exception("$encoding is not supported in mb_chr() polyfill.");
|
||||
}
|
||||
if (0x80 > $code %= 0x200000) {
|
||||
$s = chr($code);
|
||||
} elseif (0x800 > $code) {
|
||||
$s = chr(0xC0 | $code >> 6) . chr(0x80 | $code & 0x3F);
|
||||
} elseif (0x10000 > $code) {
|
||||
$s = chr(0xE0 | $code >> 12) . chr(0x80 | $code >> 6 & 0x3F) . chr(0x80 | $code & 0x3F);
|
||||
} else {
|
||||
$s = chr(0xF0 | $code >> 18) . chr(0x80 | $code >> 12 & 0x3F) . chr(0x80 | $code >> 6 & 0x3F) . chr(0x80 | $code & 0x3F);
|
||||
}
|
||||
return $s;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @see http://php.net/manual/en/function.mb-ord.php
|
||||
*/
|
||||
if(!function_exists('mb_ord')) {
|
||||
function mb_ord($s, $encoding = null) {
|
||||
if($encoding && $encoding !== 'UTF-8') {
|
||||
throw new Exception("$encoding is not supported in mb_ord() polyfill.");
|
||||
}
|
||||
$code = ($s = unpack('C*', substr($s, 0, 4))) ? $s[1] : 0;
|
||||
if (0xF0 <= $code) {
|
||||
return (($code - 0xF0) << 18) + (($s[2] - 0x80) << 12) + (($s[3] - 0x80) << 6) + $s[4] - 0x80;
|
||||
}
|
||||
if (0xE0 <= $code) {
|
||||
return (($code - 0xE0) << 12) + (($s[2] - 0x80) << 6) + $s[3] - 0x80;
|
||||
}
|
||||
if (0xC0 <= $code) {
|
||||
return (($code - 0xC0) << 6) + $s[2] - 0x80;
|
||||
}
|
||||
return $code;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @see http://php.net/manual/en/function.mb-scrub.php
|
||||
*/
|
||||
if(!function_exists('mb_scrub')) {
|
||||
function mb_scrub($s, $encoding = null) {
|
||||
$encoding = null === $encoding ? mb_internal_encoding() : $encoding;
|
||||
return mb_convert_encoding($s, $encoding, $encoding);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,139 @@
|
|||
<?php
|
||||
/**
|
||||
*/
|
||||
|
||||
namespace xrfragment;
|
||||
|
||||
use \php\_Boot\HxAnon;
|
||||
use \php\Boot;
|
||||
use \haxe\Log;
|
||||
use \php\_Boot\HxString;
|
||||
|
||||
class Parser {
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
static public $debug = false;
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
static public $error = "";
|
||||
|
||||
/**
|
||||
* @param string $key
|
||||
* @param string $value
|
||||
* @param mixed $store
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function parse ($key, $value, $store) {
|
||||
#src/xrfragment/Parser.hx:17: characters 35-57
|
||||
$this1 = [];
|
||||
$Frag_data = $this1;
|
||||
#src/xrfragment/Parser.hx:20: characters 7-68
|
||||
$Frag_data["prio"] = XRF::$ASSET | XRF::$T_INT;
|
||||
#src/xrfragment/Parser.hx:21: characters 7-68
|
||||
$Frag_data["#"] = XRF::$ASSET | XRF::$T_PREDEFINED_VIEW;
|
||||
#src/xrfragment/Parser.hx:22: characters 7-68
|
||||
$Frag_data["class"] = XRF::$ASSET | XRF::$T_STRING;
|
||||
#src/xrfragment/Parser.hx:23: characters 7-68
|
||||
$Frag_data["src"] = XRF::$ASSET | XRF::$T_URL;
|
||||
#src/xrfragment/Parser.hx:26: characters 7-133
|
||||
$Frag_data["pos"] = XRF::$PV_OVERRIDE | XRF::$ROUNDROBIN | XRF::$T_VECTOR3 | XRF::$T_STRING_OBJ | XRF::$EMBEDDED | XRF::$NAVIGATOR;
|
||||
#src/xrfragment/Parser.hx:27: characters 7-97
|
||||
$Frag_data["href"] = XRF::$ASSET | XRF::$T_URL | XRF::$T_PREDEFINED_VIEW;
|
||||
#src/xrfragment/Parser.hx:30: characters 7-98
|
||||
$Frag_data["q"] = XRF::$PV_OVERRIDE | XRF::$T_STRING | XRF::$EMBEDDED;
|
||||
#src/xrfragment/Parser.hx:31: characters 7-119
|
||||
$Frag_data["scale"] = XRF::$QUERY_OPERATOR | XRF::$PV_OVERRIDE | XRF::$ROUNDROBIN | XRF::$T_VECTOR3 | XRF::$EMBEDDED;
|
||||
#src/xrfragment/Parser.hx:32: characters 7-135
|
||||
$Frag_data["rot"] = XRF::$QUERY_OPERATOR | XRF::$PV_OVERRIDE | XRF::$ROUNDROBIN | XRF::$T_VECTOR3 | XRF::$EMBEDDED | XRF::$NAVIGATOR;
|
||||
#src/xrfragment/Parser.hx:33: characters 7-119
|
||||
$Frag_data["translate"] = XRF::$QUERY_OPERATOR | XRF::$PV_OVERRIDE | XRF::$ROUNDROBIN | XRF::$T_VECTOR3 | XRF::$EMBEDDED;
|
||||
#src/xrfragment/Parser.hx:34: characters 7-119
|
||||
$Frag_data["visible"] = XRF::$QUERY_OPERATOR | XRF::$PV_OVERRIDE | XRF::$ROUNDROBIN | XRF::$T_INT | XRF::$EMBEDDED;
|
||||
#src/xrfragment/Parser.hx:35: characters 7-92
|
||||
$Frag_data["env"] = XRF::$ASSET | XRF::$PV_OVERRIDE | XRF::$T_STRING | XRF::$EMBEDDED;
|
||||
#src/xrfragment/Parser.hx:38: characters 7-125
|
||||
$Frag_data["t"] = XRF::$ASSET | XRF::$PV_OVERRIDE | XRF::$ROUNDROBIN | XRF::$T_VECTOR2 | XRF::$NAVIGATOR | XRF::$EMBEDDED;
|
||||
#src/xrfragment/Parser.hx:39: characters 7-93
|
||||
$Frag_data["gravity"] = XRF::$ASSET | XRF::$PV_OVERRIDE | XRF::$T_VECTOR3 | XRF::$EMBEDDED;
|
||||
#src/xrfragment/Parser.hx:40: characters 7-93
|
||||
$Frag_data["physics"] = XRF::$ASSET | XRF::$PV_OVERRIDE | XRF::$T_VECTOR3 | XRF::$EMBEDDED;
|
||||
#src/xrfragment/Parser.hx:43: characters 7-109
|
||||
$Frag_data["fov"] = XRF::$ASSET | XRF::$PV_OVERRIDE | XRF::$T_INT | XRF::$NAVIGATOR | XRF::$EMBEDDED;
|
||||
#src/xrfragment/Parser.hx:44: characters 7-109
|
||||
$Frag_data["clip"] = XRF::$ASSET | XRF::$PV_OVERRIDE | XRF::$T_VECTOR2 | XRF::$NAVIGATOR | XRF::$EMBEDDED;
|
||||
#src/xrfragment/Parser.hx:45: characters 7-109
|
||||
$Frag_data["fog"] = XRF::$ASSET | XRF::$PV_OVERRIDE | XRF::$T_STRING | XRF::$NAVIGATOR | XRF::$EMBEDDED;
|
||||
#src/xrfragment/Parser.hx:48: characters 7-92
|
||||
$Frag_data["namespace"] = XRF::$ASSET | XRF::$T_STRING;
|
||||
#src/xrfragment/Parser.hx:49: characters 7-92
|
||||
$Frag_data["SPDX"] = XRF::$ASSET | XRF::$T_STRING;
|
||||
#src/xrfragment/Parser.hx:50: characters 7-92
|
||||
$Frag_data["unit"] = XRF::$ASSET | XRF::$T_STRING;
|
||||
#src/xrfragment/Parser.hx:51: characters 7-92
|
||||
$Frag_data["description"] = XRF::$ASSET | XRF::$T_STRING;
|
||||
#src/xrfragment/Parser.hx:54: characters 7-114
|
||||
$Frag_data["session"] = XRF::$ASSET | XRF::$T_URL | XRF::$PV_OVERRIDE | XRF::$NAVIGATOR | XRF::$EMBEDDED | XRF::$PROMPT;
|
||||
#src/xrfragment/Parser.hx:67: lines 67-72
|
||||
if ((mb_strlen($value) === 0) && (mb_strlen($key) > 0) && !\array_key_exists($key, $Frag_data)) {
|
||||
#src/xrfragment/Parser.hx:68: characters 5-64
|
||||
$v = new XRF($key, XRF::$PV_EXECUTE | XRF::$NAVIGATOR);
|
||||
#src/xrfragment/Parser.hx:69: characters 9-24
|
||||
$v->validate($key);
|
||||
#src/xrfragment/Parser.hx:70: characters 5-23
|
||||
\Reflect::setField($store, $key, $v);
|
||||
#src/xrfragment/Parser.hx:71: characters 5-16
|
||||
return true;
|
||||
}
|
||||
#src/xrfragment/Parser.hx:73: lines 73-76
|
||||
if ((HxString::split($key, ".")->length > 1) && (HxString::split($value, ".")->length > 1)) {
|
||||
#src/xrfragment/Parser.hx:74: characters 5-95
|
||||
$value1 = new XRF($key, XRF::$ASSET | XRF::$PV_OVERRIDE | XRF::$T_STRING | XRF::$PROP_BIND);
|
||||
\Reflect::setField($store, $key, $value1);
|
||||
#src/xrfragment/Parser.hx:75: characters 5-16
|
||||
return true;
|
||||
}
|
||||
#src/xrfragment/Parser.hx:79: characters 7-47
|
||||
$v = new XRF($key, ($Frag_data[$key] ?? null));
|
||||
#src/xrfragment/Parser.hx:80: lines 80-90
|
||||
if (\array_key_exists($key, $Frag_data)) {
|
||||
#src/xrfragment/Parser.hx:81: lines 81-84
|
||||
if (!$v->validate($value)) {
|
||||
#src/xrfragment/Parser.hx:82: characters 11-16
|
||||
(Log::$trace)("⚠ fragment '" . ($key??'null') . "' has incompatible value (" . ($value??'null') . ")", new _HxAnon_Parser0("src/xrfragment/Parser.hx", 82, "xrfragment.Parser", "parse"));
|
||||
#src/xrfragment/Parser.hx:83: characters 11-23
|
||||
return false;
|
||||
}
|
||||
#src/xrfragment/Parser.hx:85: characters 9-27
|
||||
\Reflect::setField($store, $key, $v);
|
||||
#src/xrfragment/Parser.hx:86: characters 9-50
|
||||
if (Parser::$debug) {
|
||||
#src/xrfragment/Parser.hx:86: characters 21-26
|
||||
(Log::$trace)("✔ " . ($key??'null') . ": " . ($v->string??'null'), new _HxAnon_Parser0("src/xrfragment/Parser.hx", 86, "xrfragment.Parser", "parse"));
|
||||
}
|
||||
} else {
|
||||
#src/xrfragment/Parser.hx:88: characters 9-63
|
||||
if (is_string($value)) {
|
||||
#src/xrfragment/Parser.hx:88: characters 43-63
|
||||
$v->guessType($v, $value);
|
||||
}
|
||||
#src/xrfragment/Parser.hx:89: characters 9-29
|
||||
\Reflect::setField($store, "_" . ($key??'null'), $v);
|
||||
}
|
||||
#src/xrfragment/Parser.hx:92: characters 7-18
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
class _HxAnon_Parser0 extends HxAnon {
|
||||
function __construct($fileName, $lineNumber, $className, $methodName) {
|
||||
$this->fileName = $fileName;
|
||||
$this->lineNumber = $lineNumber;
|
||||
$this->className = $className;
|
||||
$this->methodName = $methodName;
|
||||
}
|
||||
}
|
||||
|
||||
Boot::registerClass(Parser::class, 'xrfragment.Parser');
|
|
@ -0,0 +1,393 @@
|
|||
<?php
|
||||
/**
|
||||
*/
|
||||
|
||||
namespace xrfragment;
|
||||
|
||||
use \php\_Boot\HxAnon;
|
||||
use \php\Boot;
|
||||
use \php\_Boot\HxString;
|
||||
|
||||
class Query {
|
||||
/**
|
||||
* @var \EReg
|
||||
*/
|
||||
public $isClass;
|
||||
/**
|
||||
* @var \EReg
|
||||
*/
|
||||
public $isExclude;
|
||||
/**
|
||||
* @var \EReg
|
||||
*/
|
||||
public $isNumber;
|
||||
/**
|
||||
* @var \EReg
|
||||
*/
|
||||
public $isProp;
|
||||
/**
|
||||
* @var \EReg
|
||||
*/
|
||||
public $isRoot;
|
||||
/**
|
||||
* @var mixed
|
||||
*/
|
||||
public $q;
|
||||
/**
|
||||
* @var string
|
||||
* # Spec
|
||||
*
|
||||
* > version 1.0.0 [![Actions Status](https://github.com/coderofsalvation/xrfragment/workflows/test/badge.svg)](https://github.com/coderofsalvation/xrfragment/actions) generated by `make doc` @ $(date +"%Y-%m-%dT%H:%M:%S%z")
|
||||
*
|
||||
* In case your programming language has no parser ([check here](https://github.com/coderofsalvation/xrfragment/tree/main/dist)) you can [crosscompile it](https://github.com/coderofsalvation/xrfragment/blob/main/build.hxml), or roll your own `Query.parse(str)` using the spec:
|
||||
*/
|
||||
public $str;
|
||||
|
||||
/**
|
||||
* @param string $str
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct ($str) {
|
||||
#src/xrfragment/Query.hx:59: characters 36-49
|
||||
$this->isNumber = new \EReg("^[0-9\\.]+\$", "");
|
||||
#src/xrfragment/Query.hx:58: characters 36-50
|
||||
$this->isClass = new \EReg("^[-]?class\$", "");
|
||||
#src/xrfragment/Query.hx:57: characters 36-46
|
||||
$this->isRoot = new \EReg("^[-]?/", "");
|
||||
#src/xrfragment/Query.hx:56: characters 36-41
|
||||
$this->isExclude = new \EReg("^-", "");
|
||||
#src/xrfragment/Query.hx:55: characters 36-50
|
||||
$this->isProp = new \EReg("^.*:[><=!]?", "");
|
||||
#src/xrfragment/Query.hx:54: characters 47-49
|
||||
$this->q = new HxAnon();
|
||||
#src/xrfragment/Query.hx:53: characters 28-30
|
||||
$this->str = "";
|
||||
#src/xrfragment/Query.hx:62: characters 5-39
|
||||
if ($str !== null) {
|
||||
#src/xrfragment/Query.hx:62: characters 24-39
|
||||
$this->parse($str);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $token
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function expandAliases ($token) {
|
||||
#src/xrfragment/Query.hx:71: characters 5-33
|
||||
$classAlias = new \EReg("^(-)?\\.", "");
|
||||
#src/xrfragment/Query.hx:72: characters 12-85
|
||||
if ($classAlias->match($token)) {
|
||||
#src/xrfragment/Query.hx:72: characters 38-77
|
||||
return \StringTools::replace($token, ".", "class:");
|
||||
} else {
|
||||
#src/xrfragment/Query.hx:72: characters 80-85
|
||||
return $token;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function get () {
|
||||
#src/xrfragment/Query.hx:76: characters 5-18
|
||||
return $this->q;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $str
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function parse ($str) {
|
||||
#src/xrfragment/Query.hx:79: lines 79-126
|
||||
$_gthis = $this;
|
||||
#src/xrfragment/Query.hx:81: characters 5-32
|
||||
$token = HxString::split($str, " ");
|
||||
#src/xrfragment/Query.hx:82: characters 5-44
|
||||
$q = new HxAnon();
|
||||
#src/xrfragment/Query.hx:84: lines 84-123
|
||||
$process = function ($str, $prefix = "") use (&$_gthis, &$q) {
|
||||
if ($prefix === null) {
|
||||
$prefix = "";
|
||||
}
|
||||
#src/xrfragment/Query.hx:85: characters 7-34
|
||||
$str = \trim($str);
|
||||
#src/xrfragment/Query.hx:86: characters 7-40
|
||||
$k = (HxString::split($str, ":")->arr[0] ?? null);
|
||||
#src/xrfragment/Query.hx:87: characters 7-40
|
||||
$v = (HxString::split($str, ":")->arr[1] ?? null);
|
||||
#src/xrfragment/Query.hx:89: characters 7-51
|
||||
$filter = new HxAnon();
|
||||
#src/xrfragment/Query.hx:90: characters 7-53
|
||||
if (\Reflect::field($q, ($prefix??'null') . ($k??'null'))) {
|
||||
#src/xrfragment/Query.hx:90: characters 29-53
|
||||
$filter = \Reflect::field($q, ($prefix??'null') . ($k??'null'));
|
||||
}
|
||||
#src/xrfragment/Query.hx:91: characters 7-89
|
||||
$value = (\Reflect::field($filter, "rules") !== null ? \Reflect::field($filter, "rules") : new \Array_hx());
|
||||
\Reflect::setField($filter, "rules", $value);
|
||||
#src/xrfragment/Query.hx:93: lines 93-122
|
||||
if ($_gthis->isProp->match($str)) {
|
||||
#src/xrfragment/Query.hx:94: characters 9-30
|
||||
$oper = "";
|
||||
#src/xrfragment/Query.hx:95: characters 9-49
|
||||
if (HxString::indexOf($str, "*") !== -1) {
|
||||
#src/xrfragment/Query.hx:95: characters 39-49
|
||||
$oper = "*";
|
||||
}
|
||||
#src/xrfragment/Query.hx:96: characters 9-49
|
||||
if (HxString::indexOf($str, ">") !== -1) {
|
||||
#src/xrfragment/Query.hx:96: characters 39-49
|
||||
$oper = ">";
|
||||
}
|
||||
#src/xrfragment/Query.hx:97: characters 9-49
|
||||
if (HxString::indexOf($str, "<") !== -1) {
|
||||
#src/xrfragment/Query.hx:97: characters 39-49
|
||||
$oper = "<";
|
||||
}
|
||||
#src/xrfragment/Query.hx:98: characters 9-50
|
||||
if (HxString::indexOf($str, ">=") !== -1) {
|
||||
#src/xrfragment/Query.hx:98: characters 39-50
|
||||
$oper = ">=";
|
||||
}
|
||||
#src/xrfragment/Query.hx:99: characters 9-50
|
||||
if (HxString::indexOf($str, "<=") !== -1) {
|
||||
#src/xrfragment/Query.hx:99: characters 39-50
|
||||
$oper = "<=";
|
||||
}
|
||||
#src/xrfragment/Query.hx:100: lines 100-103
|
||||
if ($_gthis->isExclude->match($k)) {
|
||||
#src/xrfragment/Query.hx:101: characters 11-22
|
||||
$oper = "!=";
|
||||
#src/xrfragment/Query.hx:102: characters 15-26
|
||||
$k = \mb_substr($k, 1, null);
|
||||
} else {
|
||||
#src/xrfragment/Query.hx:103: characters 19-40
|
||||
$v = \mb_substr($v, mb_strlen($oper), null);
|
||||
}
|
||||
#src/xrfragment/Query.hx:104: characters 9-42
|
||||
if (mb_strlen($oper) === 0) {
|
||||
#src/xrfragment/Query.hx:104: characters 32-42
|
||||
$oper = "=";
|
||||
}
|
||||
#src/xrfragment/Query.hx:105: lines 105-114
|
||||
if ($_gthis->isClass->match($k)) {
|
||||
#src/xrfragment/Query.hx:106: characters 11-45
|
||||
$value = $oper !== "!=";
|
||||
\Reflect::setField($filter, ($prefix??'null') . ($k??'null'), $value);
|
||||
#src/xrfragment/Query.hx:107: characters 11-26
|
||||
\Reflect::setField($q, $v, $filter);
|
||||
} else {
|
||||
#src/xrfragment/Query.hx:109: characters 11-53
|
||||
$rule = new HxAnon();
|
||||
#src/xrfragment/Query.hx:110: lines 110-111
|
||||
if ($_gthis->isNumber->match($v)) {
|
||||
#src/xrfragment/Query.hx:110: characters 35-67
|
||||
$value = \Std::parseFloat($v);
|
||||
\Reflect::setField($rule, $oper, $value);
|
||||
} else {
|
||||
#src/xrfragment/Query.hx:111: characters 16-30
|
||||
\Reflect::setField($rule, $oper, $v);
|
||||
}
|
||||
#src/xrfragment/Query.hx:112: characters 11-39
|
||||
\Reflect::field($filter, "rules")->push($rule);
|
||||
#src/xrfragment/Query.hx:113: characters 11-29
|
||||
\Reflect::setField($q, $k, $filter);
|
||||
}
|
||||
#src/xrfragment/Query.hx:115: characters 9-15
|
||||
return;
|
||||
} else {
|
||||
#src/xrfragment/Query.hx:117: characters 9-62
|
||||
$value = ($_gthis->isExclude->match($str) ? false : true);
|
||||
\Reflect::setField($filter, "id", $value);
|
||||
#src/xrfragment/Query.hx:118: characters 9-63
|
||||
$value = $_gthis->isRoot->match($str);
|
||||
\Reflect::setField($filter, "root", $value);
|
||||
#src/xrfragment/Query.hx:119: characters 9-55
|
||||
if ($_gthis->isExclude->match($str)) {
|
||||
#src/xrfragment/Query.hx:119: characters 42-55
|
||||
$str = \mb_substr($str, 1, null);
|
||||
}
|
||||
#src/xrfragment/Query.hx:120: characters 9-55
|
||||
if ($_gthis->isRoot->match($str)) {
|
||||
#src/xrfragment/Query.hx:120: characters 42-55
|
||||
$str = \mb_substr($str, 1, null);
|
||||
}
|
||||
#src/xrfragment/Query.hx:121: characters 9-29
|
||||
\Reflect::setField($q, $str, $filter);
|
||||
}
|
||||
};
|
||||
#src/xrfragment/Query.hx:124: characters 15-19
|
||||
$_g = 0;
|
||||
#src/xrfragment/Query.hx:124: characters 19-31
|
||||
$_g1 = $token->length;
|
||||
#src/xrfragment/Query.hx:124: characters 5-68
|
||||
while ($_g < $_g1) {
|
||||
#src/xrfragment/Query.hx:124: characters 15-31
|
||||
$i = $_g++;
|
||||
#src/xrfragment/Query.hx:124: characters 34-68
|
||||
$process($this->expandAliases(($token->arr[$i] ?? null)));
|
||||
}
|
||||
#src/xrfragment/Query.hx:125: characters 5-22
|
||||
return $this->q = $q;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $obj
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function test ($obj = null) {
|
||||
#src/xrfragment/Query.hx:130: characters 5-30
|
||||
$qualify = false;
|
||||
#src/xrfragment/Query.hx:132: lines 132-135
|
||||
$_g = 0;
|
||||
$_g1 = \Reflect::fields($obj);
|
||||
while ($_g < $_g1->length) {
|
||||
#src/xrfragment/Query.hx:132: characters 11-12
|
||||
$k = ($_g1->arr[$_g] ?? null);
|
||||
#src/xrfragment/Query.hx:132: lines 132-135
|
||||
++$_g;
|
||||
#src/xrfragment/Query.hx:133: characters 7-57
|
||||
$v = \Std::string(\Reflect::field($obj, $k));
|
||||
#src/xrfragment/Query.hx:134: characters 7-47
|
||||
if ($this->testProperty($k, $v)) {
|
||||
#src/xrfragment/Query.hx:134: characters 33-47
|
||||
$qualify = true;
|
||||
}
|
||||
}
|
||||
#src/xrfragment/Query.hx:136: lines 136-139
|
||||
$_g = 0;
|
||||
$_g1 = \Reflect::fields($obj);
|
||||
while ($_g < $_g1->length) {
|
||||
#src/xrfragment/Query.hx:136: characters 11-12
|
||||
$k = ($_g1->arr[$_g] ?? null);
|
||||
#src/xrfragment/Query.hx:136: lines 136-139
|
||||
++$_g;
|
||||
#src/xrfragment/Query.hx:137: characters 7-57
|
||||
$v = \Std::string(\Reflect::field($obj, $k));
|
||||
#src/xrfragment/Query.hx:138: characters 7-54
|
||||
if ($this->testProperty($k, $v, true)) {
|
||||
#src/xrfragment/Query.hx:138: characters 39-54
|
||||
$qualify = false;
|
||||
}
|
||||
}
|
||||
#src/xrfragment/Query.hx:140: characters 5-19
|
||||
return $qualify;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $property
|
||||
* @param string $value
|
||||
* @param bool $exclude
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function testProperty ($property, $value, $exclude = null) {
|
||||
#src/xrfragment/Query.hx:145: characters 5-23
|
||||
$conds = 0;
|
||||
#src/xrfragment/Query.hx:146: characters 5-23
|
||||
$fails = 0;
|
||||
#src/xrfragment/Query.hx:147: characters 5-26
|
||||
$qualify = 0;
|
||||
#src/xrfragment/Query.hx:149: lines 149-153
|
||||
$testprop = function ($expr) use (&$conds, &$fails) {
|
||||
#src/xrfragment/Query.hx:150: characters 7-15
|
||||
$conds += 1;
|
||||
#src/xrfragment/Query.hx:151: characters 7-27
|
||||
$fails += ($expr ? 0 : 1);
|
||||
#src/xrfragment/Query.hx:152: characters 7-18
|
||||
return $expr;
|
||||
};
|
||||
#src/xrfragment/Query.hx:156: lines 156-159
|
||||
if (\Reflect::field($this->q, $value) !== null) {
|
||||
#src/xrfragment/Query.hx:157: characters 7-52
|
||||
$v = \Reflect::field($this->q, $value);
|
||||
#src/xrfragment/Query.hx:158: characters 7-59
|
||||
if (\Reflect::field($v, $property) !== null) {
|
||||
#src/xrfragment/Query.hx:158: characters 37-59
|
||||
return \Reflect::field($v, $property);
|
||||
}
|
||||
}
|
||||
#src/xrfragment/Query.hx:162: lines 162-183
|
||||
$_g = 0;
|
||||
$_g1 = \Reflect::fields($this->q);
|
||||
while ($_g < $_g1->length) {
|
||||
#src/xrfragment/Query.hx:162: characters 11-12
|
||||
$k = ($_g1->arr[$_g] ?? null);
|
||||
#src/xrfragment/Query.hx:162: lines 162-183
|
||||
++$_g;
|
||||
#src/xrfragment/Query.hx:163: characters 7-47
|
||||
$filter = \Reflect::field($this->q, $k);
|
||||
#src/xrfragment/Query.hx:164: characters 7-43
|
||||
if (Boot::dynamicField($filter, 'rules') === null) {
|
||||
#src/xrfragment/Query.hx:164: characters 35-43
|
||||
continue;
|
||||
}
|
||||
#src/xrfragment/Query.hx:165: characters 7-47
|
||||
$rules = Boot::dynamicField($filter, 'rules');
|
||||
#src/xrfragment/Query.hx:167: lines 167-182
|
||||
$_g2 = 0;
|
||||
while ($_g2 < $rules->length) {
|
||||
#src/xrfragment/Query.hx:167: characters 12-16
|
||||
$rule = ($rules->arr[$_g2] ?? null);
|
||||
#src/xrfragment/Query.hx:167: lines 167-182
|
||||
++$_g2;
|
||||
#src/xrfragment/Query.hx:169: lines 169-181
|
||||
if ($exclude) {
|
||||
#src/xrfragment/Query.hx:170: characters 11-145
|
||||
if ((\Reflect::field($rule, "!=") !== null) && $testprop(\Std::string($value) === \Std::string(\Reflect::field($rule, "!="))) && $exclude) {
|
||||
#src/xrfragment/Query.hx:170: characters 133-145
|
||||
++$qualify;
|
||||
}
|
||||
} else {
|
||||
#src/xrfragment/Query.hx:172: characters 11-141
|
||||
if ((\Reflect::field($rule, "*") !== null) && $testprop(\Std::parseFloat($value) !== null)) {
|
||||
#src/xrfragment/Query.hx:172: characters 129-141
|
||||
++$qualify;
|
||||
}
|
||||
#src/xrfragment/Query.hx:173: characters 11-143
|
||||
if ((\Reflect::field($rule, ">") !== null) && $testprop(\Std::parseFloat($value) > \Std::parseFloat(\Reflect::field($rule, ">")))) {
|
||||
#src/xrfragment/Query.hx:173: characters 131-143
|
||||
++$qualify;
|
||||
}
|
||||
#src/xrfragment/Query.hx:174: characters 11-143
|
||||
if ((\Reflect::field($rule, "<") !== null) && $testprop(\Std::parseFloat($value) < \Std::parseFloat(\Reflect::field($rule, "<")))) {
|
||||
#src/xrfragment/Query.hx:174: characters 131-143
|
||||
++$qualify;
|
||||
}
|
||||
#src/xrfragment/Query.hx:175: characters 11-143
|
||||
if ((\Reflect::field($rule, ">=") !== null) && $testprop(\Std::parseFloat($value) >= \Std::parseFloat(\Reflect::field($rule, ">=")))) {
|
||||
#src/xrfragment/Query.hx:175: characters 131-143
|
||||
++$qualify;
|
||||
}
|
||||
#src/xrfragment/Query.hx:176: characters 11-143
|
||||
if ((\Reflect::field($rule, "<=") !== null) && $testprop(\Std::parseFloat($value) <= \Std::parseFloat(\Reflect::field($rule, "<=")))) {
|
||||
#src/xrfragment/Query.hx:176: characters 131-143
|
||||
++$qualify;
|
||||
}
|
||||
#src/xrfragment/Query.hx:177: lines 177-180
|
||||
if ((\Reflect::field($rule, "=") !== null) && ($testprop($value === \Reflect::field($rule, "=")) || $testprop(Boot::equal(\Std::parseFloat($value), \Std::parseFloat(\Reflect::field($rule, "=")))))) {
|
||||
#src/xrfragment/Query.hx:180: characters 14-26
|
||||
++$qualify;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#src/xrfragment/Query.hx:184: characters 5-23
|
||||
return $qualify > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function toObject () {
|
||||
#src/xrfragment/Query.hx:66: characters 5-18
|
||||
return $this->q;
|
||||
}
|
||||
}
|
||||
|
||||
Boot::registerClass(Query::class, 'xrfragment.Query');
|
|
@ -0,0 +1,101 @@
|
|||
<?php
|
||||
/**
|
||||
*/
|
||||
|
||||
namespace xrfragment;
|
||||
|
||||
use \php\_Boot\HxAnon;
|
||||
use \php\Boot;
|
||||
use \php\_Boot\HxString;
|
||||
|
||||
/**
|
||||
* # Spec
|
||||
*
|
||||
* > version 1.0.0 [![Actions Status](https://github.com/coderofsalvation/xrfragment/workflows/test/badge.svg)](https://github.com/coderofsalvation/xrfragment/actions) generated by `make doc` @ $(date +"%Y-%m-%dT%H:%M:%S%z")
|
||||
*
|
||||
* ### XR Fragment URI Grammar
|
||||
*
|
||||
* ```
|
||||
* reserved = gen-delims / sub-delims
|
||||
* gen-delims = "#" / "&"
|
||||
* sub-delims = "," / "="
|
||||
* ```
|
||||
*
|
||||
* > Example: `://foo.com/my3d.asset#pos=1,0,0&prio=-5&t=0,100|100,200`
|
||||
*
|
||||
* | Explanation | |
|
||||
* |-|-|
|
||||
* | `pos=1,2,3` | vector/coordinate argument e.g. |
|
||||
* | `pos=1,2,3&rot=0,90,0&q=.foo` | combinators |
|
||||
*
|
||||
* In case your programming language has no parser ([check here](https://github.com/coderofsalvation/xrfragment/tree/main/dist)) you can [crosscompile it](https://github.com/coderofsalvation/xrfragment/blob/main/build.hxml), or roll your own `Parser.parse(k,v,store)` using the spec:
|
||||
*
|
||||
*/
|
||||
class URI {
|
||||
/**
|
||||
* @param string $url
|
||||
* @param int $filter
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public static function parse ($url, $filter) {
|
||||
#src/xrfragment/URI.hx:37: characters 7-50
|
||||
$store = new HxAnon();
|
||||
#src/xrfragment/URI.hx:38: characters 7-63
|
||||
if (($url === null) || (HxString::indexOf($url, "#") === -1)) {
|
||||
#src/xrfragment/URI.hx:38: characters 51-63
|
||||
return $store;
|
||||
}
|
||||
#src/xrfragment/URI.hx:39: characters 7-54
|
||||
$fragment = HxString::split($url, "#");
|
||||
#src/xrfragment/URI.hx:40: characters 7-62
|
||||
$splitArray = HxString::split(($fragment->arr[1] ?? null), "&");
|
||||
#src/xrfragment/URI.hx:41: characters 19-23
|
||||
$_g = 0;
|
||||
#src/xrfragment/URI.hx:41: characters 23-40
|
||||
$_g1 = $splitArray->length;
|
||||
#src/xrfragment/URI.hx:41: lines 41-51
|
||||
while ($_g < $_g1) {
|
||||
#src/xrfragment/URI.hx:41: characters 19-40
|
||||
$i = $_g++;
|
||||
#src/xrfragment/URI.hx:43: characters 9-53
|
||||
$splitByEqual = HxString::split(($splitArray->arr[$i] ?? null), "=");
|
||||
#src/xrfragment/URI.hx:44: characters 9-33
|
||||
$regexPlus = new \EReg("\\+", "g");
|
||||
#src/xrfragment/URI.hx:45: characters 9-42
|
||||
$key = ($splitByEqual->arr[0] ?? null);
|
||||
#src/xrfragment/URI.hx:46: characters 5-27
|
||||
$value = "";
|
||||
#src/xrfragment/URI.hx:47: lines 47-49
|
||||
if ($splitByEqual->length > 1) {
|
||||
#src/xrfragment/URI.hx:48: characters 19-84
|
||||
$value = \urldecode($regexPlus->split(($splitByEqual->arr[1] ?? null))->join(" "));
|
||||
}
|
||||
#src/xrfragment/URI.hx:50: characters 5-49
|
||||
$ok = Parser::parse($key, $value, $store);
|
||||
}
|
||||
#src/xrfragment/URI.hx:52: lines 52-59
|
||||
if (($filter !== null) && ($filter !== 0)) {
|
||||
#src/xrfragment/URI.hx:53: lines 53-58
|
||||
$_g = 0;
|
||||
$_g1 = \Reflect::fields($store);
|
||||
while ($_g < $_g1->length) {
|
||||
#src/xrfragment/URI.hx:53: characters 14-17
|
||||
$key = ($_g1->arr[$_g] ?? null);
|
||||
#src/xrfragment/URI.hx:53: lines 53-58
|
||||
++$_g;
|
||||
#src/xrfragment/URI.hx:54: characters 13-42
|
||||
$xrf = \Reflect::field($store, $key);
|
||||
#src/xrfragment/URI.hx:55: lines 55-57
|
||||
if (!$xrf->is($filter)) {
|
||||
#src/xrfragment/URI.hx:56: characters 8-25
|
||||
\Reflect::deleteField($store, $key);
|
||||
}
|
||||
}
|
||||
}
|
||||
#src/xrfragment/URI.hx:60: characters 7-19
|
||||
return $store;
|
||||
}
|
||||
}
|
||||
|
||||
Boot::registerClass(URI::class, 'xrfragment.URI');
|
|
@ -0,0 +1,334 @@
|
|||
<?php
|
||||
/**
|
||||
*/
|
||||
|
||||
namespace xrfragment;
|
||||
|
||||
use \php\Boot;
|
||||
use \php\_Boot\HxString;
|
||||
|
||||
class XRF {
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
static public $ASSET = 1;
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
static public $EMBEDDED = 64;
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
static public $NAVIGATOR = 32;
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
static public $PROMPT = 8;
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
static public $PROP_BIND = 2;
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
static public $PV_EXECUTE = 256;
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
static public $PV_OVERRIDE = 128;
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
static public $QUERY_OPERATOR = 4;
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
static public $ROUNDROBIN = 16;
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
static public $T_COLOR = 8192;
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
static public $T_FLOAT = 32768;
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
static public $T_INT = 16384;
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
static public $T_PREDEFINED_VIEW = 524288;
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
static public $T_STRING = 1048576;
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
static public $T_STRING_OBJ = 2097152;
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
static public $T_STRING_OBJ_PROP = 4194304;
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
static public $T_URL = 262144;
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
static public $T_VECTOR2 = 65536;
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
static public $T_VECTOR3 = 131072;
|
||||
/**
|
||||
* @var \EReg
|
||||
*/
|
||||
static public $isColor;
|
||||
/**
|
||||
* @var \EReg
|
||||
*/
|
||||
static public $isFloat;
|
||||
/**
|
||||
* @var \EReg
|
||||
*/
|
||||
static public $isInt;
|
||||
/**
|
||||
* @var \EReg
|
||||
*/
|
||||
static public $isString;
|
||||
/**
|
||||
* @var \EReg
|
||||
*/
|
||||
static public $isUrl;
|
||||
/**
|
||||
* @var \EReg
|
||||
*/
|
||||
static public $isUrlOrPretypedView;
|
||||
/**
|
||||
* @var \EReg
|
||||
*/
|
||||
static public $isVector;
|
||||
|
||||
/**
|
||||
* @var XRF[]|\Array_hx
|
||||
*/
|
||||
public $args;
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $color;
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
public $flags;
|
||||
/**
|
||||
* @var float
|
||||
*/
|
||||
public $float;
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $fragment;
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
public $int;
|
||||
/**
|
||||
* @var Query
|
||||
*/
|
||||
public $query;
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $string;
|
||||
/**
|
||||
* @var float
|
||||
*/
|
||||
public $x;
|
||||
/**
|
||||
* @var float
|
||||
*/
|
||||
public $y;
|
||||
/**
|
||||
* @var float
|
||||
*/
|
||||
public $z;
|
||||
|
||||
/**
|
||||
* @param int $flag
|
||||
* @param int $flags
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public static function set ($flag, $flags) {
|
||||
#src/xrfragment/XRF.hx:70: characters 5-24
|
||||
return $flags | $flag;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $flag
|
||||
* @param int $flags
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public static function unset ($flag, $flags) {
|
||||
#src/xrfragment/XRF.hx:74: characters 5-25
|
||||
return $flags & ~$flag;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $_fragment
|
||||
* @param int $_flags
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct ($_fragment, $_flags) {
|
||||
#src/xrfragment/XRF.hx:61: characters 5-25
|
||||
$this->fragment = $_fragment;
|
||||
#src/xrfragment/XRF.hx:62: characters 5-22
|
||||
$this->flags = $_flags;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param XRF $v
|
||||
* @param string $str
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function guessType ($v, $str) {
|
||||
#src/xrfragment/XRF.hx:103: characters 5-19
|
||||
$v->string = $str;
|
||||
#src/xrfragment/XRF.hx:104: lines 104-109
|
||||
if (HxString::split($str, ",")->length > 1) {
|
||||
#src/xrfragment/XRF.hx:105: characters 7-46
|
||||
$xyz = HxString::split($str, ",");
|
||||
#src/xrfragment/XRF.hx:106: characters 7-56
|
||||
if ($xyz->length > 0) {
|
||||
#src/xrfragment/XRF.hx:106: characters 28-56
|
||||
$v->x = \Std::parseFloat(($xyz->arr[0] ?? null));
|
||||
}
|
||||
#src/xrfragment/XRF.hx:107: characters 7-56
|
||||
if ($xyz->length > 1) {
|
||||
#src/xrfragment/XRF.hx:107: characters 28-56
|
||||
$v->y = \Std::parseFloat(($xyz->arr[1] ?? null));
|
||||
}
|
||||
#src/xrfragment/XRF.hx:108: characters 7-56
|
||||
if ($xyz->length > 2) {
|
||||
#src/xrfragment/XRF.hx:108: characters 28-56
|
||||
$v->z = \Std::parseFloat(($xyz->arr[2] ?? null));
|
||||
}
|
||||
}
|
||||
#src/xrfragment/XRF.hx:111: characters 5-43
|
||||
if (XRF::$isColor->match($str)) {
|
||||
#src/xrfragment/XRF.hx:111: characters 30-43
|
||||
$v->color = $str;
|
||||
}
|
||||
#src/xrfragment/XRF.hx:112: characters 5-59
|
||||
if (XRF::$isFloat->match($str)) {
|
||||
#src/xrfragment/XRF.hx:112: characters 30-59
|
||||
$v->float = \Std::parseFloat($str);
|
||||
}
|
||||
#src/xrfragment/XRF.hx:113: characters 5-57
|
||||
if (XRF::$isInt->match($str)) {
|
||||
#src/xrfragment/XRF.hx:113: characters 30-57
|
||||
$v->int = \Std::parseInt($str);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $flag
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function is ($flag) {
|
||||
#src/xrfragment/XRF.hx:66: characters 5-31
|
||||
return ($this->flags & $flag) !== 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $value
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function validate ($value) {
|
||||
#src/xrfragment/XRF.hx:78: characters 5-27
|
||||
$this->guessType($this, $value);
|
||||
#src/xrfragment/XRF.hx:80: lines 80-88
|
||||
if (HxString::split($value, "|")->length > 1) {
|
||||
#src/xrfragment/XRF.hx:81: characters 7-35
|
||||
$this->args = new \Array_hx();
|
||||
#src/xrfragment/XRF.hx:82: characters 7-49
|
||||
$args = HxString::split($value, "|");
|
||||
#src/xrfragment/XRF.hx:83: characters 17-21
|
||||
$_g = 0;
|
||||
#src/xrfragment/XRF.hx:83: characters 21-32
|
||||
$_g1 = $args->length;
|
||||
#src/xrfragment/XRF.hx:83: lines 83-87
|
||||
while ($_g < $_g1) {
|
||||
#src/xrfragment/XRF.hx:83: characters 17-32
|
||||
$i = $_g++;
|
||||
#src/xrfragment/XRF.hx:84: characters 9-45
|
||||
$x = new XRF($this->fragment, $this->flags);
|
||||
#src/xrfragment/XRF.hx:85: characters 9-30
|
||||
$this->guessType($x, ($args->arr[$i] ?? null));
|
||||
#src/xrfragment/XRF.hx:86: characters 9-28
|
||||
$_this = $this->args;
|
||||
$_this->arr[$_this->length++] = $x;
|
||||
}
|
||||
}
|
||||
#src/xrfragment/XRF.hx:90: characters 5-59
|
||||
if ($this->fragment === "q") {
|
||||
#src/xrfragment/XRF.hx:90: characters 27-59
|
||||
$this->query = (new Query($value))->get();
|
||||
}
|
||||
#src/xrfragment/XRF.hx:92: characters 5-24
|
||||
$ok = true;
|
||||
#src/xrfragment/XRF.hx:93: lines 93-97
|
||||
if (!($this->args instanceof \Array_hx)) {
|
||||
#src/xrfragment/XRF.hx:94: characters 7-115
|
||||
if ($this->is(XRF::$T_VECTOR3) && !((is_float($this->x) || is_int($this->x)) && (is_float($this->y) || is_int($this->y)) && (is_float($this->z) || is_int($this->z)))) {
|
||||
#src/xrfragment/XRF.hx:94: characters 105-115
|
||||
$ok = false;
|
||||
}
|
||||
#src/xrfragment/XRF.hx:95: characters 7-115
|
||||
if ($this->is(XRF::$T_VECTOR2) && !((is_float($this->x) || is_int($this->x)) && (is_float($this->y) || is_int($this->y)))) {
|
||||
#src/xrfragment/XRF.hx:95: characters 105-115
|
||||
$ok = false;
|
||||
}
|
||||
#src/xrfragment/XRF.hx:96: characters 7-63
|
||||
if ($this->is(XRF::$T_INT) && !Boot::isOfType($this->int, Boot::getClass('Int'))) {
|
||||
#src/xrfragment/XRF.hx:96: characters 53-63
|
||||
$ok = false;
|
||||
}
|
||||
}
|
||||
#src/xrfragment/XRF.hx:98: characters 5-14
|
||||
return $ok;
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
* @access private
|
||||
*/
|
||||
static public function __hx__init ()
|
||||
{
|
||||
static $called = false;
|
||||
if ($called) return;
|
||||
$called = true;
|
||||
|
||||
|
||||
self::$isColor = new \EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})\$", "");
|
||||
self::$isInt = new \EReg("^[0-9]+\$", "");
|
||||
self::$isFloat = new \EReg("^[0-9]+\\.[0-9]+\$", "");
|
||||
self::$isVector = new \EReg("([,]+|\\w)", "");
|
||||
self::$isUrl = new \EReg("(://)?\\..*", "");
|
||||
self::$isUrlOrPretypedView = new \EReg("(^#|://)?\\..*", "");
|
||||
self::$isString = new \EReg(".*", "");
|
||||
}
|
||||
}
|
||||
|
||||
Boot::registerClass(XRF::class, 'xrfragment.XRF');
|
||||
XRF::__hx__init();
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
18
index.html
18
index.html
File diff suppressed because one or more lines are too long
9
make
9
make
|
@ -20,6 +20,8 @@ install(){
|
|||
haxelib install hxjava
|
||||
haxelib install hxcs
|
||||
haxelib install hscript
|
||||
which javac && haxelib install hxjava 4.2.0
|
||||
which mono && haxelib install hxcs 4.2.0
|
||||
}
|
||||
|
||||
tests(){
|
||||
|
@ -41,8 +43,11 @@ doc(){
|
|||
}
|
||||
|
||||
server(){
|
||||
test -f cert.pem || openssl req -newkey rsa:2048 -new -nodes -x509 -days 3650 -keyout key.pem -out cert.pem
|
||||
http-server -c-1 -S -C cert.pem .
|
||||
dir=$(pwd)
|
||||
cd /tmp
|
||||
test -f redbean.com || wget https://redbean.dev/redbean-2.2.com -O redbean.com && chmod 755 redbean.com
|
||||
test -f cert.pem || openssl req -newkey rsa:2048 -new -nodes -x509 -days 3650 -keyout key.pem -out cert.pem
|
||||
./redbean.com -C cert.pem -K key.pem -D $dir
|
||||
}
|
||||
|
||||
build(){
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
{ pkgs ? import <nixpkgs> {} }:
|
||||
|
||||
pkgs.mkShell {
|
||||
# nativeBuildInputs is usually what you want -- tools you need to run
|
||||
nativeBuildInputs = with pkgs.buildPackages; [
|
||||
|
||||
haxe
|
||||
python3
|
||||
nodejs-slim_20
|
||||
|
||||
# extra
|
||||
php82
|
||||
mono
|
||||
jdk
|
||||
|
||||
];
|
||||
}
|
|
@ -1,10 +1,9 @@
|
|||
// *TODO* use webgl instancing
|
||||
|
||||
xrf.frag.src = function(v, opts){
|
||||
|
||||
opts.embedded = v // indicate embedded XR fragment
|
||||
let { mesh, model, camera, scene, renderer, THREE} = opts
|
||||
console.log("SRCCC")
|
||||
console.dir(mesh)
|
||||
|
||||
console.log(" └ instancing src")
|
||||
let src = new THREE.Group()
|
||||
|
@ -46,11 +45,6 @@ xrf.frag.src = function(v, opts){
|
|||
.finally( () => {
|
||||
})
|
||||
.catch( console.error )
|
||||
|
||||
//// scale URI XR Fragments inside src-value
|
||||
//for( var i in frag ){
|
||||
// xrf.eval.fragment(i, Object.assign(opts,{frag, model,scene}))
|
||||
//}
|
||||
}
|
||||
|
||||
if( v.string[0] == "#" ) localSRC() // current file
|
||||
|
@ -69,27 +63,31 @@ xrf.frag.src.scale = function(scene, opts, url){
|
|||
for( var i in frag ){
|
||||
xrf.eval.fragment(i, Object.assign(opts,{frag, model:{scene},scene}))
|
||||
}
|
||||
// if( frag.q ) scene = frag.q.scene
|
||||
//if( frag.q ) scene = frag.q.scene
|
||||
console.dir(frag)
|
||||
//xrf.add( model.scene )
|
||||
xrf.eval( '#', {scene} ) // execute the default projection '#' (if exist)
|
||||
xrf.eval( url, {scene} ) // and eval URI XR fragments
|
||||
//if( !hash.match(/pos=/) )
|
||||
// xrf.eval( '#pos=0,0,0' ) // set default position if not specified
|
||||
//if( !hash.match(/pos=/) ) // xrf.eval( '#pos=0,0,0' ) // set default position if not specified
|
||||
}
|
||||
scene.isXRF = model.scene.isSRC = true
|
||||
if( restrictToBoundingBox ){
|
||||
if( restrictToBoundingBox ){
|
||||
// spec 3 of https://xrfragment.org/#src
|
||||
// spec 1 of https://xrfragment.org/#scaling%20of%20instanced%20objects
|
||||
// normalize instanced objectsize to boundingbox
|
||||
let bboxMesh = new THREE.Box3().setFromObject(mesh);
|
||||
let bboxScene = new THREE.Box3().setFromObject(scene);
|
||||
let maxScene = bboxScene.max.y > bboxScene.max.x ? bboxScene.max.y : bboxScene.max.x
|
||||
let maxMesh = bboxMesh.max.y > bboxMesh.max.x ? bboxMesh.max.y : bboxMesh.max.x
|
||||
let factor = maxMesh > maxScene ? maxScene / maxMesh : maxMesh / maxScene
|
||||
console.log("maxMesh="+maxMesh+" maxScene="+maxScene)
|
||||
console.log("factor="+factor+" 1/factor="+1/factor)
|
||||
scene.scale.multiplyScalar( factor )
|
||||
}else{
|
||||
// spec 4 of https://xrfragment.org/#src
|
||||
// spec 2 of https://xrfragment.org/#scaling%20of%20instanced%20objects
|
||||
scene.scale.multiply( mesh.scale )
|
||||
}
|
||||
//scene.position.copy( mesh.position )
|
||||
//scene.rotation.copy( mesh.rotation )
|
||||
//scene.scale.copy( mesh.scale )
|
||||
scene.scale.multiply( mesh.scale )
|
||||
scene.isXRF = model.scene.isSRC = true
|
||||
mesh.add( scene )
|
||||
if( !opts.recursive && mesh.material ) mesh.material.visible = false // lets hide the preview object because deleting disables animations+nested objs
|
||||
}
|
||||
|
@ -156,7 +154,7 @@ xrf.frag.src.type['image/png'] = function(url,opts){
|
|||
opacity:1
|
||||
});
|
||||
|
||||
// stretch image by forcing uv-coordinages
|
||||
// stretch image by pinning uv-coordinates to corners
|
||||
if( mesh.geometry ){
|
||||
if( mesh.geometry.attributes.uv ){ // buffergeometries
|
||||
let uv = mesh.geometry.attributes.uv;
|
||||
|
|
Loading…
Reference in New Issue