3v4l.org

run code in 500+ PHP versions simultaneously
<?php declare(strict_types=1); # THE RESULT HERE IS KINDA KOOL BUT I'M NOT SURE IF I MADE IT WORSE OR BETTER BY STUFFING AROUND WITHOUT A PLAN ! function most_frequent(array $list_to_search) { // print_r($list_to_search);#DEBUG if (count($list_to_search) === 0) return ['', 0]; $it = new ArrayIterator($list_to_search); $counter = 0; $num = $list_to_search[0]; foreach ($it as $i) { $curr_frequency = 0; foreach (new ArrayIterator($list_to_search) as $j) { if ($j === $i) { $curr_frequency++; } } if ($curr_frequency > $counter) { $counter = $curr_frequency; $num = $i; } } return [$num, $counter]; } interface ReToken extends Countable { public function is_empty(): bool; public function get_head(): string; public function has_head(): bool; public function get_tail(): string; public function has_tail(): bool; public function create_without_head(): ReToken; public function create_without_tail(): ReToken; } /** * A string split by [A-Z]+[] */ class ReSingleToken implements ReToken { private iterable $vals; public function __construct(string $val) { // echo 'ReSingleToken('.$val.')'.PHP_EOL;#DEBUG $regexV1 = '/([A-Z]*[a-z_0-9]*)(?=[A-Z]+)/'; $regexV2 = '~([A-Z]?[^A-Z]+|[A-Z]+(?=[A-Z][^A-Z]|$))~'; $words = preg_split($regexV2,$val,-1, PREG_SPLIT_NO_EMPTY|PREG_SPLIT_DELIM_CAPTURE); // print_r($words);#DEBUG $this->vals = $words; // print_r(['"'.$val.'"', $words]);#DEBUG } public function __toString(): string { return implode('', $this->vals); } public function count(): int { return count($this->vals); } public function is_empty(): bool { return count($this) === 0; } public function get_head(): string { return count($this) > 0 ? $this->vals[0] : ''; } public function has_head(): bool { return true; } public function get_tail(): string { return count($this) > 0 ? $this->vals[array_key_last($this->vals)] : ''; } public function has_tail(): bool { return true; } public function create_without_head(): ReSingleToken { $vals = $this->vals; if ($this->has_head()) { array_shift($vals); } return new ReSingleToken(implode('', $vals)); } public function create_without_tail(): ReSingleToken { $vals = $this->vals; if ($this->has_tail()) { array_pop($vals); } return new ReSingleToken(implode('', $vals)); } } class ReGroup implements ReToken, RecursiveIterator { public function __construct( private iterable $tokens, private $commonBeginning, private $commonEnding, private bool $optional = false ) { // echo 'ReGroup(['.implode(',', $tokens).'], commonBeginning='.$commonBeginning.', commonEnding='.$commonEnding.', optional='.(string)$optional.')'.PHP_EOL;#DEBUG foreach ($tokens as $key => $value) { if ($value->is_empty()) { unset($this->tokens[$key]); $this->optional = true; } } } /** * Sets the tokens that are not empty string and makes the object optional * if any are empty. * * @param iterable $tokens The tokens that represent the alternation group. */ public function setTokens(iterable $tokens) { $this->tokens = []; $this->optional = false; foreach ($tokens as $token) { if ((string)$token === '') $this->optional = true; else $this->tokens[] = $token; } } public function tryToOptimize() { while (true) { // get all token heads $tokenHeads = []; foreach ($this->tokens as $token) { if ($token->has_head()) { $tokenHeads[] = $token->get_head(); } } list($head_most_popular, $head_count) = most_frequent($tokenHeads); // get all token tails $tokenTails = []; foreach ($this->tokens as $token) { if ($token->has_tail()) { $tokenTails[] = $token->get_tail(); } } list($tail_most_popular, $tail_count) = most_frequent($tokenTails); // all tokens have same head if ($head_count > 1 and $head_count === count($this->tokens)) { $tokenGroup = []; // $optional = false; foreach ($this->tokens as $token) { $token = $token->create_without_head(); $tokenGroup[] = $token; // if ((string)$token === '') // $optional = true; } // $this->tokens = [new ReGroup($tokenGroup, $head_most_popular, '', $optional)]; $this->setTokens($tokenGroup); $this->commonBeginning = $head_most_popular; $this->commonEnding = ''; // echo 'grouped by popular head: '.__LINE__.PHP_EOL;#DEBUG continue; } // all tokens have same tail if ($tail_count > 1 and $tail_count === count($this->tokens)) { $tokenGroup = []; // $optional = false; foreach ($this->tokens as $token) { $token = $token->create_without_tail(); $tokenGroup[] = $token; // if ((string)$token === '') // $optional = true; } // $this->tokens = [new ReGroup($tokenGroup, '', $tail_most_popular, $optional)]; $this->setTokens($tokenGroup); $this->commonBeginning = ''; $this->commonEnding = $tail_most_popular; // echo 'grouped by popular tail: '.__LINE__.PHP_EOL;#DEBUG continue; } if ($head_count >= $tail_count) { if ($head_count < 2) { // echo '//############################################################################//';#DEBUG // print_r(get_defined_vars());#DEBUG // echo 'no common groups: '.__LINE__.PHP_EOL;#DEBUG break; } $tokensNoHead = []; $tokensOther = []; $optional = false; foreach ($this->tokens as $token) { if ($token->get_head() === $head_most_popular) { $token = $token->create_without_head(); $tokensNoHead[] = $token; if ((string)$token === '') $optional = true; } else $tokensOther[] = $token; } $newGroup = new ReGroup($tokensNoHead, $head_most_popular, '', $optional); $this->tokens = [$newGroup, ...$tokensOther]; } else { if ($tail_count < 2) { // echo 'no common groups: '.__LINE__.PHP_EOL;#DEBUG break; } $tokensNoTail = []; $tokensOther = []; $optional = false; foreach ($this->tokens as $token) { if ($token->get_tail() === $tail_most_popular) { $token = $token->create_without_tail(); $tokensNoTail[] = $token; if ((string)$token === '') $optional = true; } else $tokensOther[] = $token; } $newGroup = new ReGroup($tokensNoTail, '', $tail_most_popular, $optional); $this->tokens = [$newGroup, ...$tokensOther]; } } // $tokens = []; // foreach ($this->tokens as $token) { // if ($token instanceof ReSingleToken and $token->get_head() === '') { // $tokens[] = $token; // } // } // if (count($tokens) > 0) { // #check if group has '' -> make optional // $this->optional = true; // $tokens = []; // foreach ($this->tokens as $token) { // if (!$token instanceof ReSingleToken or $token->get_head() !== '') { // $tokens[] = $token; // } // } // } foreach ($this->tokens as $group) { if ($group instanceof ReGroup) { $group->tryToOptimize(); } } } public function __toString(): string { $tokens = []; foreach ($this->tokens as $token) { $tokens[] = $token->__toString(); } $ret = $this->commonBeginning.'('.implode('|', $tokens).')'.($this->optional ? '?' : '').$this->commonEnding; // echo $ret.PHP_EOL;#DEBUG return $ret; } public function count(): int { return count($this->tokens); } public function is_empty(): bool { return count($this) === 0; } public function get_head(): string { return (string)$this->commonBeginning; } public function has_head(): bool { return (string)$this->commonBeginning != ''; } public function get_tail(): string { return (string)$this->commonEnding; } public function has_tail(): bool { return (string)$this->commonEnding != ''; } public function create_without_head(): ReGroup { return new ReGroup($this->tokens, '', $this->commonEnding, $this->optional); } public function create_without_tail(): ReGroup { return new ReGroup($this->tokens, $this->commonBeginning, '', $this->optional); } // ~~~>>> Iterator <<<~~~ //\ private int $position = 0; public function current(): mixed { return $this->tokens[$this->position]; } public function key(): mixed { return $this->position; } public function next(): void { $this->position++; } public function rewind(): void { $this->position = 0; } public function valid(): bool { return count($this) > $this->position; } // ~~~>>> RecursiveIterator <<<~~~ // public function getChildren(): ?RecursiveIterator { return $this->tokens; } public function hasChildren(): bool { return (bool)count($this); } } $for_test = [ '(A|B|C|D)', '(A|B|C|DA)', '(A|B|C|AD)', '(Example|ArrayIterator|RecursiveArrayIterator|DirectoryIterator|RecursiveDirectoryIterator)', '(Example|DOMNode|DOMText|DOMElement)' ]; $for_test[] = '('.implode( '|', array_filter( get_declared_classes(), function ($value) { return !(bool)strpos($value, '\\'); } ) ).')'; foreach ($for_test as $init) { // print_r(preg_split('/([A-Z]*[a-z_0-9]*)(?=[A-Z]+)/',substr($init, 1, -1),-1, PREG_SPLIT_NO_EMPTY|PREG_SPLIT_DELIM_CAPTURE)); // continue; echo PHP_EOL.PHP_EOL.'----'.PHP_EOL.PHP_EOL; $inita = substr($init, 1, -1); $tokens = []; $strings = explode('|', $inita); foreach ($strings as $token) { $tokens[] = new ReSingleToken($token); } $r = new ReGroup($tokens, '', '', false); $r->tryToOptimize(); // print_r($r); echo $init.' => '.$r; foreach ($r as $token) { if ($token instanceof ReGroup) $token->tryToOptimize(); } echo PHP_EOL.PHP_EOL.$r.PHP_EOL.PHP_EOL; $tree = new RecursiveTreeIterator($r); foreach ($tree as $key => $value) { echo $value.PHP_EOL; } } /** RANDOM NOTES JUST KEEPING CAUSE I'M TOO TIRED TO GO THROUGH IT NOW * (Sngle|Sngle) * Group = Sngle(Sngle|Sngle)Sngle * * Token can have head/tail * * Sngle split into words: * - starting with upper case character * - all uppercase before a word ^ * head/tail = first/last word * * Group split into Sngle * head/tail = common head/tail * * for a group, * get all heads * if any match * group them with heads removed * rebuild tokens with group and remaining tokens * * Abcdef(Ghijk|Lmnop)?Vwxyz * ^pre ^attrib opt^^post * * prefixToken(tokens)suffixToken * * @todo 🟡 what if the common head and tail counts are equal? */
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 17, Position 2 = 73
Branch analysis from position: 17
2 jumps found. (Code = 78) Position 1 = 18, Position 2 = 73
Branch analysis from position: 18
2 jumps found. (Code = 77) Position 1 = 29, Position 2 = 36
Branch analysis from position: 29
2 jumps found. (Code = 78) Position 1 = 30, Position 2 = 36
Branch analysis from position: 30
1 jumps found. (Code = 42) Position 1 = 29
Branch analysis from position: 29
Branch analysis from position: 36
2 jumps found. (Code = 77) Position 1 = 50, Position 2 = 56
Branch analysis from position: 50
2 jumps found. (Code = 78) Position 1 = 51, Position 2 = 56
Branch analysis from position: 51
2 jumps found. (Code = 43) Position 1 = 53, Position 2 = 55
Branch analysis from position: 53
1 jumps found. (Code = 42) Position 1 = 50
Branch analysis from position: 50
Branch analysis from position: 55
Branch analysis from position: 56
2 jumps found. (Code = 77) Position 1 = 66, Position 2 = 71
Branch analysis from position: 66
2 jumps found. (Code = 78) Position 1 = 67, Position 2 = 71
Branch analysis from position: 67
1 jumps found. (Code = 42) Position 1 = 66
Branch analysis from position: 66
Branch analysis from position: 71
1 jumps found. (Code = 42) Position 1 = 17
Branch analysis from position: 17
Branch analysis from position: 71
Branch analysis from position: 56
Branch analysis from position: 36
Branch analysis from position: 73
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 73
filename:       /in/TbnPu
function name:  (null)
number of ops:  75
compiled vars:  !0 = $for_test, !1 = $init, !2 = $inita, !3 = $tokens, !4 = $strings, !5 = $token, !6 = $r, !7 = $tree, !8 = $value, !9 = $key
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   28     0  E >   DECLARE_CLASS                                                'retoken'
   41     1        DECLARE_CLASS                                                'resingletoken'
  101     2        DECLARE_CLASS                                                'regroup'
  329     3        ASSIGN                                                       !0, <array>
  339     4        INIT_FCALL                                                   'array_filter'
  340     5        INIT_FCALL                                                   'get_declared_classes'
          6        DO_ICALL                                             $12     
          7        SEND_VAR                                                     $12
  341     8        DECLARE_LAMBDA_FUNCTION                              ~13     [0]
          9        SEND_VAL                                                     ~13
  339    10        DO_ICALL                                             $14     
  337    11        FRAMELESS_ICALL_2                implode             ~15     '%7C', $14
  341    12        CONCAT                                               ~16     '%28', ~15
  343    13        CONCAT                                               ~17     ~16, '%29'
  337    14        ASSIGN_DIM                                                   !0
  343    15        OP_DATA                                                      ~17
  345    16      > FE_RESET_R                                           $18     !0, ->73
         17    > > FE_FETCH_R                                                   $18, !1, ->73
  348    18    >   ECHO                                                         '%0A%0A----%0A%0A'
  349    19        FRAMELESS_ICALL_3                substr              ~19     !1, 1
         20        OP_DATA                                                      -1
         21        ASSIGN                                                       !2, ~19
  350    22        ASSIGN                                                       !3, <array>
  351    23        INIT_FCALL                                                   'explode'
         24        SEND_VAL                                                     '%7C'
         25        SEND_VAR                                                     !2
         26        DO_ICALL                                             $22     
         27        ASSIGN                                                       !4, $22
  352    28      > FE_RESET_R                                           $24     !4, ->36
         29    > > FE_FETCH_R                                                   $24, !5, ->36
  353    30    >   NEW                                                  $26     'ReSingleToken'
         31        SEND_VAR_EX                                                  !5
         32        DO_FCALL                                          0          
         33        ASSIGN_DIM                                                   !3
         34        OP_DATA                                                      $26
  352    35      > JMP                                                          ->29
         36    >   FE_FREE                                                      $24
  355    37        NEW                                                  $28     'ReGroup'
         38        SEND_VAR_EX                                                  !3
         39        SEND_VAL_EX                                                  ''
         40        SEND_VAL_EX                                                  ''
         41        SEND_VAL_EX                                                  <false>
         42        DO_FCALL                                          0          
         43        ASSIGN                                                       !6, $28
  356    44        INIT_METHOD_CALL                                             !6, 'tryToOptimize'
         45        DO_FCALL                                          0          
  358    46        CONCAT                                               ~32     !1, '+%3D%3E+'
         47        CONCAT                                               ~33     ~32, !6
         48        ECHO                                                         ~33
  359    49      > FE_RESET_R                                           $34     !6, ->56
         50    > > FE_FETCH_R                                                   $34, !5, ->56
  360    51    >   INSTANCEOF                                                   !5, 'ReGroup'
         52      > JMPZ                                                         ~35, ->55
  361    53    >   INIT_METHOD_CALL                                             !5, 'tryToOptimize'
         54        DO_FCALL                                          0          
  359    55    > > JMP                                                          ->50
         56    >   FE_FREE                                                      $34
  363    57        CONCAT                                               ~37     '%0A%0A', !6
         58        CONCAT                                               ~38     ~37, '%0A'
         59        CONCAT                                               ~39     ~38, '%0A'
         60        ECHO                                                         ~39
  364    61        NEW                                                  $40     'RecursiveTreeIterator'
         62        SEND_VAR_EX                                                  !6
         63        DO_FCALL                                          0          
         64        ASSIGN                                                       !7, $40
  365    65      > FE_RESET_R                                           $43     !7, ->71
         66    > > FE_FETCH_R                                           ~44     $43, !8, ->71
         67    >   ASSIGN                                                       !9, ~44
  366    68        CONCAT                                               ~46     !8, '%0A'
         69        ECHO                                                         ~46
  365    70      > JMP                                                          ->66
         71    >   FE_FREE                                                      $43
  345    72      > JMP                                                          ->17
         73    >   FE_FREE                                                      $18
  397    74      > RETURN                                                       1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/TbnPu
function name:  {closure:/in/TbnPu:341}
number of ops:  6
compiled vars:  !0 = $value
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
  341     0  E >   RECV                                                 !0      
          1        FRAMELESS_ICALL_2                strpos              ~1      !0, '%5C'
          2        BOOL                                                 ~2      ~1
          3        BOOL_NOT                                             ~3      ~2
          4      > RETURN                                                       ~3
          5*     > RETURN                                                       null

End of Dynamic Function 0

Function most_frequent:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 5
Branch analysis from position: 4
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 5
2 jumps found. (Code = 77) Position 1 = 13, Position 2 = 30
Branch analysis from position: 13
2 jumps found. (Code = 78) Position 1 = 14, Position 2 = 30
Branch analysis from position: 14
2 jumps found. (Code = 77) Position 1 = 19, Position 2 = 24
Branch analysis from position: 19
2 jumps found. (Code = 78) Position 1 = 20, Position 2 = 24
Branch analysis from position: 20
2 jumps found. (Code = 43) Position 1 = 22, Position 2 = 23
Branch analysis from position: 22
1 jumps found. (Code = 42) Position 1 = 19
Branch analysis from position: 19
Branch analysis from position: 23
Branch analysis from position: 24
2 jumps found. (Code = 43) Position 1 = 27, Position 2 = 29
Branch analysis from position: 27
1 jumps found. (Code = 42) Position 1 = 13
Branch analysis from position: 13
Branch analysis from position: 29
Branch analysis from position: 24
Branch analysis from position: 30
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 30
filename:       /in/TbnPu
function name:  most_frequent
number of ops:  35
compiled vars:  !0 = $list_to_search, !1 = $it, !2 = $counter, !3 = $num, !4 = $i, !5 = $curr_frequency, !6 = $j
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    6     0  E >   RECV                                                 !0      
    8     1        COUNT                                                ~7      !0
          2        IS_IDENTICAL                                                 ~7, 0
          3      > JMPZ                                                         ~8, ->5
    9     4    > > RETURN                                                       <array>
   10     5    >   NEW                                                  $9      'ArrayIterator'
          6        SEND_VAR_EX                                                  !0
          7        DO_FCALL                                          0          
          8        ASSIGN                                                       !1, $9
   11     9        ASSIGN                                                       !2, 0
   12    10        FETCH_DIM_R                                          ~13     !0, 0
         11        ASSIGN                                                       !3, ~13
   13    12      > FE_RESET_R                                           $15     !1, ->30
         13    > > FE_FETCH_R                                                   $15, !4, ->30
   14    14    >   ASSIGN                                                       !5, 0
   15    15        NEW                                                  $17     'ArrayIterator'
         16        SEND_VAR_EX                                                  !0
         17        DO_FCALL                                          0          
         18      > FE_RESET_R                                           $19     $17, ->24
         19    > > FE_FETCH_R                                                   $19, !6, ->24
   16    20    >   IS_IDENTICAL                                                 !6, !4
         21      > JMPZ                                                         ~20, ->23
   17    22    >   PRE_INC                                                      !5
   15    23    > > JMP                                                          ->19
         24    >   FE_FREE                                                      $19
   20    25        IS_SMALLER                                                   !2, !5
         26      > JMPZ                                                         ~22, ->29
   21    27    >   ASSIGN                                                       !2, !5
   22    28        ASSIGN                                                       !3, !4
   13    29    > > JMP                                                          ->13
         30    >   FE_FREE                                                      $15
   25    31        INIT_ARRAY                                           ~25     !3
         32        ADD_ARRAY_ELEMENT                                    ~25     !2
         33      > RETURN                                                       ~25
   26    34*     > RETURN                                                       null

End of function most_frequent

Class ReToken:
Function is_empty:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/TbnPu
function name:  is_empty
number of ops:  2
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   29     0  E >   VERIFY_RETURN_TYPE                                           
          1      > RETURN                                                       null

End of function is_empty

Function get_head:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/TbnPu
function name:  get_head
number of ops:  2
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   30     0  E >   VERIFY_RETURN_TYPE                                           
          1      > RETURN                                                       null

End of function get_head

Function has_head:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/TbnPu
function name:  has_head
number of ops:  2
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   31     0  E >   VERIFY_RETURN_TYPE                                           
          1      > RETURN                                                       null

End of function has_head

Function get_tail:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/TbnPu
function name:  get_tail
number of ops:  2
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   32     0  E >   VERIFY_RETURN_TYPE                                           
          1      > RETURN                                                       null

End of function get_tail

Function has_tail:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/TbnPu
function name:  has_tail
number of ops:  2
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   33     0  E >   VERIFY_RETURN_TYPE                                           
          1      > RETURN                                                       null

End of function has_tail

Function create_without_head:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/TbnPu
function name:  create_without_head
number of ops:  2
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   34     0  E >   VERIFY_RETURN_TYPE                                           
          1      > RETURN                                                       null

End of function create_without_head

Function create_without_tail:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/TbnPu
function name:  create_without_tail
number of ops:  2
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   35     0  E >   VERIFY_RETURN_TYPE                                           
          1      > RETURN                                                       null

End of function create_without_tail

End of class ReToken.

Class ReSingleToken:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/TbnPu
function name:  __construct
number of ops:  13
compiled vars:  !0 = $val, !1 = $regexV1, !2 = $regexV2, !3 = $words
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   44     0  E >   RECV                                                 !0      
   46     1        ASSIGN                                                       !1, '%2F%28%5BA-Z%5D%2A%5Ba-z_0-9%5D%2A%29%28%3F%3D%5BA-Z%5D%2B%29%2F'
   47     2        ASSIGN                                                       !2, '%7E%28%5BA-Z%5D%3F%5B%5EA-Z%5D%2B%7C%5BA-Z%5D%2B%28%3F%3D%5BA-Z%5D%5B%5EA-Z%5D%7C%24%29%29%7E'
   48     3        INIT_FCALL                                                   'preg_split'
          4        SEND_VAR                                                     !2
          5        SEND_VAR                                                     !0
          6        SEND_VAL                                                     -1
          7        SEND_VAL                                                     3
          8        DO_ICALL                                             $6      
          9        ASSIGN                                                       !3, $6
   50    10        ASSIGN_OBJ                                                   'vals'
         11        OP_DATA                                                      !3
   52    12      > RETURN                                                       null

End of function __construct

Function __tostring:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/TbnPu
function name:  __toString
number of ops:  6
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   55     0  E >   FETCH_OBJ_R                                          ~0      'vals'
          1        FRAMELESS_ICALL_2                implode             ~1      '', ~0
          2        VERIFY_RETURN_TYPE                                           ~1
          3      > RETURN                                                       ~1
   56     4*       VERIFY_RETURN_TYPE                                           
          5*     > RETURN                                                       null

End of function __tostring

Function count:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/TbnPu
function name:  count
number of ops:  6
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   59     0  E >   FETCH_OBJ_R                                          ~0      'vals'
          1        COUNT                                                ~1      ~0
          2        VERIFY_RETURN_TYPE                                           ~1
          3      > RETURN                                                       ~1
   60     4*       VERIFY_RETURN_TYPE                                           
          5*     > RETURN                                                       null

End of function count

Function is_empty:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/TbnPu
function name:  is_empty
number of ops:  7
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   63     0  E >   FETCH_THIS                                           ~0      
          1        COUNT                                                ~1      ~0
          2        IS_IDENTICAL                                         ~2      ~1, 0
          3        VERIFY_RETURN_TYPE                                           ~2
          4      > RETURN                                                       ~2
   64     5*       VERIFY_RETURN_TYPE                                           
          6*     > RETURN                                                       null

End of function is_empty

Function get_head:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 8
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 9
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/TbnPu
function name:  get_head
number of ops:  13
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   67     0  E >   FETCH_THIS                                           ~0      
          1        COUNT                                                ~1      ~0
          2        IS_SMALLER                                                   0, ~1
          3      > JMPZ                                                         ~2, ->8
          4    >   FETCH_OBJ_R                                          ~3      'vals'
          5        FETCH_DIM_R                                          ~4      ~3, 0
          6        QM_ASSIGN                                            ~5      ~4
          7      > JMP                                                          ->9
          8    >   QM_ASSIGN                                            ~5      ''
          9    >   VERIFY_RETURN_TYPE                                           ~5
         10      > RETURN                                                       ~5
   68    11*       VERIFY_RETURN_TYPE                                           
         12*     > RETURN                                                       null

End of function get_head

Function has_head:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/TbnPu
function name:  has_head
number of ops:  3
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   71     0  E > > RETURN                                                       <true>
   72     1*       VERIFY_RETURN_TYPE                                           
          2*     > RETURN                                                       null

End of function has_head

Function get_tail:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 12
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 13
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 12
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/TbnPu
function name:  get_tail
number of ops:  17
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   75     0  E >   FETCH_THIS                                           ~0      
          1        COUNT                                                ~1      ~0
          2        IS_SMALLER                                                   0, ~1
          3      > JMPZ                                                         ~2, ->12
          4    >   INIT_FCALL                                                   'array_key_last'
          5        FETCH_OBJ_R                                          ~4      'vals'
          6        SEND_VAL                                                     ~4
          7        DO_ICALL                                             $5      
          8        FETCH_OBJ_R                                          ~3      'vals'
          9        FETCH_DIM_R                                          ~6      ~3, $5
         10        QM_ASSIGN                                            ~7      ~6
         11      > JMP                                                          ->13
         12    >   QM_ASSIGN                                            ~7      ''
         13    >   VERIFY_RETURN_TYPE                                           ~7
         14      > RETURN                                                       ~7
   76    15*       VERIFY_RETURN_TYPE                                           
         16*     > RETURN                                                       null

End of function get_tail

Function has_tail:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/TbnPu
function name:  has_tail
number of ops:  3
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   79     0  E > > RETURN                                                       <true>
   80     1*       VERIFY_RETURN_TYPE                                           
          2*     > RETURN                                                       null

End of function has_tail

Function create_without_head:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 5, Position 2 = 8
Branch analysis from position: 5
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
filename:       /in/TbnPu
function name:  create_without_head
number of ops:  16
compiled vars:  !0 = $vals
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   83     0  E >   FETCH_OBJ_R                                          ~1      'vals'
          1        ASSIGN                                                       !0, ~1
   84     2        INIT_METHOD_CALL                                             'has_head'
          3        DO_FCALL                                          0  $3      
          4      > JMPZ                                                         $3, ->8
   86     5    >   INIT_FCALL                                                   'array_shift'
          6        SEND_REF                                                     !0
          7        DO_ICALL                                                     
   88     8    >   NEW                                                  $5      'ReSingleToken'
          9        FRAMELESS_ICALL_2                implode             ~6      '', !0
         10        SEND_VAL_EX                                                  ~6
         11        DO_FCALL                                          0          
         12        VERIFY_RETURN_TYPE                                           $5
         13      > RETURN                                                       $5
   89    14*       VERIFY_RETURN_TYPE                                           
         15*     > RETURN                                                       null

End of function create_without_head

Function create_without_tail:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 5, Position 2 = 8
Branch analysis from position: 5
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
filename:       /in/TbnPu
function name:  create_without_tail
number of ops:  16
compiled vars:  !0 = $vals
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   92     0  E >   FETCH_OBJ_R                                          ~1      'vals'
          1        ASSIGN                                                       !0, ~1
   93     2        INIT_METHOD_CALL                                             'has_tail'
          3        DO_FCALL                                          0  $3      
          4      > JMPZ                                                         $3, ->8
   95     5    >   INIT_FCALL                                                   'array_pop'
          6        SEND_REF                                                     !0
          7        DO_ICALL                                                     
   97     8    >   NEW                                                  $5      'ReSingleToken'
          9        FRAMELESS_ICALL_2                implode             ~6      '', !0
         10        SEND_VAL_EX                                                  ~6
         11        DO_FCALL                                          0          
         12        VERIFY_RETURN_TYPE                                           $5
         13      > RETURN                                                       $5
   98    14*       VERIFY_RETURN_TYPE                                           
         15*     > RETURN                                                       null

End of function create_without_tail

End of class ReSingleToken.

Class ReGroup:
Function __construct:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 13, Position 2 = 23
Branch analysis from position: 13
2 jumps found. (Code = 78) Position 1 = 14, Position 2 = 23
Branch analysis from position: 14
2 jumps found. (Code = 43) Position 1 = 18, Position 2 = 22
Branch analysis from position: 18
1 jumps found. (Code = 42) Position 1 = 13
Branch analysis from position: 13
Branch analysis from position: 22
Branch analysis from position: 23
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 23
filename:       /in/TbnPu
function name:  __construct
number of ops:  25
compiled vars:  !0 = $tokens, !1 = $commonBeginning, !2 = $commonEnding, !3 = $optional, !4 = $value, !5 = $key
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
  103     0  E >   RECV                                                 !0      
  104     1        RECV                                                 !1      
  105     2        RECV                                                 !2      
  106     3        RECV_INIT                                            !3      <false>
  103     4        ASSIGN_OBJ                                                   'tokens'
          5        OP_DATA                                                      !0
  104     6        ASSIGN_OBJ                                                   'commonBeginning'
          7        OP_DATA                                                      !1
  105     8        ASSIGN_OBJ                                                   'commonEnding'
          9        OP_DATA                                                      !2
  106    10        ASSIGN_OBJ                                                   'optional'
         11        OP_DATA                                                      !3
  110    12      > FE_RESET_R                                           $6      !0, ->23
         13    > > FE_FETCH_R                                           ~7      $6, !4, ->23
         14    >   ASSIGN                                                       !5, ~7
  112    15        INIT_METHOD_CALL                                             !4, 'is_empty'
         16        DO_FCALL                                          0  $9      
         17      > JMPZ                                                         $9, ->22
  113    18    >   FETCH_OBJ_UNSET                                      $10     'tokens'
         19        UNSET_DIM                                                    $10, !5
  114    20        ASSIGN_OBJ                                                   'optional'
         21        OP_DATA                                                      <true>
  110    22    > > JMP                                                          ->13
         23    >   FE_FREE                                                      $6
  117    24      > RETURN                                                       null

End of function __construct

Function settokens:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 6, Position 2 = 17
Branch analysis from position: 6
2 jumps found. (Code = 78) Position 1 = 7, Position 2 = 17
Branch analysis from position: 7
2 jumps found. (Code = 43) Position 1 = 10, Position 2 = 13
Branch analysis from position: 10
1 jumps found. (Code = 42) Position 1 = 16
Branch analysis from position: 16
1 jumps found. (Code = 42) Position 1 = 6
Branch analysis from position: 6
Branch analysis from position: 13
1 jumps found. (Code = 42) Position 1 = 6
Branch analysis from position: 6
Branch analysis from position: 17
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 17
filename:       /in/TbnPu
function name:  setTokens
number of ops:  19
compiled vars:  !0 = $tokens, !1 = $token
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
  124     0  E >   RECV                                                 !0      
  125     1        ASSIGN_OBJ                                                   'tokens'
          2        OP_DATA                                                      <array>
  126     3        ASSIGN_OBJ                                                   'optional'
          4        OP_DATA                                                      <false>
  127     5      > FE_RESET_R                                           $4      !0, ->17
          6    > > FE_FETCH_R                                                   $4, !1, ->17
  128     7    >   CAST                                              6  ~5      !1
          8        IS_IDENTICAL                                                 ~5, ''
          9      > JMPZ                                                         ~6, ->13
  129    10    >   ASSIGN_OBJ                                                   'optional'
         11        OP_DATA                                                      <true>
  128    12      > JMP                                                          ->16
  130    13    >   FETCH_OBJ_W                                          $8      'tokens'
         14        ASSIGN_DIM                                                   $8
         15        OP_DATA                                                      !1
  127    16    > > JMP                                                          ->6
         17    >   FE_FREE                                                      $4
  132    18      > RETURN                                                       null

End of function settokens

Function trytooptimize:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 174
Branch analysis from position: 174
2 jumps found. (Code = 44) Position 1 = 175, Position 2 = 1
Branch analysis from position: 175
2 jumps found. (Code = 77) Position 1 = 177, Position 2 = 183
Branch analysis from position: 177
2 jumps found. (Code = 78) Position 1 = 178, Position 2 = 183
Branch analysis from position: 178
2 jumps found. (Code = 43) Position 1 = 180, Position 2 = 182
Branch analysis from position: 180
1 jumps found. (Code = 42) Position 1 = 177
Branch analysis from position: 177
Branch analysis from position: 182
Branch analysis from position: 183
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 183
Branch analysis from position: 1
2 jumps found. (Code = 77) Position 1 = 4, Position 2 = 13
Branch analysis from position: 4
2 jumps found. (Code = 78) Position 1 = 5, Position 2 = 13
Branch analysis from position: 5
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 12
Branch analysis from position: 8
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 12
Branch analysis from position: 13
2 jumps found. (Code = 77) Position 1 = 25, Position 2 = 34
Branch analysis from position: 25
2 jumps found. (Code = 78) Position 1 = 26, Position 2 = 34
Branch analysis from position: 26
2 jumps found. (Code = 43) Position 1 = 29, Position 2 = 33
Branch analysis from position: 29
1 jumps found. (Code = 42) Position 1 = 25
Branch analysis from position: 25
Branch analysis from position: 33
Branch analysis from position: 34
2 jumps found. (Code = 46) Position 1 = 45, Position 2 = 49
Branch analysis from position: 45
2 jumps found. (Code = 43) Position 1 = 50, Position 2 = 69
Branch analysis from position: 50
2 jumps found. (Code = 77) Position 1 = 53, Position 2 = 60
Branch analysis from position: 53
2 jumps found. (Code = 78) Position 1 = 54, Position 2 = 60
Branch analysis from position: 54
1 jumps found. (Code = 42) Position 1 = 53
Branch analysis from position: 53
Branch analysis from position: 60
1 jumps found. (Code = 42) Position 1 = 174
Branch analysis from position: 174
Branch analysis from position: 60
Branch analysis from position: 69
2 jumps found. (Code = 46) Position 1 = 71, Position 2 = 75
Branch analysis from position: 71
2 jumps found. (Code = 43) Position 1 = 76, Position 2 = 95
Branch analysis from position: 76
2 jumps found. (Code = 77) Position 1 = 79, Position 2 = 86
Branch analysis from position: 79
2 jumps found. (Code = 78) Position 1 = 80, Position 2 = 86
Branch analysis from position: 80
1 jumps found. (Code = 42) Position 1 = 79
Branch analysis from position: 79
Branch analysis from position: 86
1 jumps found. (Code = 42) Position 1 = 174
Branch analysis from position: 174
Branch analysis from position: 86
Branch analysis from position: 95
2 jumps found. (Code = 43) Position 1 = 97, Position 2 = 136
Branch analysis from position: 97
2 jumps found. (Code = 43) Position 1 = 99, Position 2 = 100
Branch analysis from position: 99
1 jumps found. (Code = 42) Position 1 = 175
Branch analysis from position: 175
Branch analysis from position: 100
2 jumps found. (Code = 77) Position 1 = 105, Position 2 = 123
Branch analysis from position: 105
2 jumps found. (Code = 78) Position 1 = 106, Position 2 = 123
Branch analysis from position: 106
2 jumps found. (Code = 43) Position 1 = 110, Position 2 = 120
Branch analysis from position: 110
2 jumps found. (Code = 43) Position 1 = 118, Position 2 = 119
Branch analysis from position: 118
1 jumps found. (Code = 42) Position 1 = 122
Branch analysis from position: 122
1 jumps found. (Code = 42) Position 1 = 105
Branch analysis from position: 105
Branch analysis from position: 119
Branch analysis from position: 120
1 jumps found. (Code = 42) Position 1 = 105
Branch analysis from position: 105
Branch analysis from position: 123
1 jumps found. (Code = 42) Position 1 = 174
Branch analysis from position: 174
Branch analysis from position: 123
Branch analysis from position: 136
2 jumps found. (Code = 43) Position 1 = 138, Position 2 = 139
Branch analysis from position: 138
1 jumps found. (Code = 42) Position 1 = 175
Branch analysis from position: 175
Branch analysis from position: 139
2 jumps found. (Code = 77) Position 1 = 144, Position 2 = 162
Branch analysis from position: 144
2 jumps found. (Code = 78) Position 1 = 145, Position 2 = 162
Branch analysis from position: 145
2 jumps found. (Code = 43) Position 1 = 149, Position 2 = 159
Branch analysis from position: 149
2 jumps found. (Code = 43) Position 1 = 157, Position 2 = 158
Branch analysis from position: 157
1 jumps found. (Code = 42) Position 1 = 161
Branch analysis from position: 161
1 jumps found. (Code = 42) Position 1 = 144
Branch analysis from position: 144
Branch analysis from position: 158
Branch analysis from position: 159
1 jumps found. (Code = 42) Position 1 = 144
Branch analysis from position: 144
Branch analysis from position: 162
2 jumps found. (Code = 44) Position 1 = 175, Position 2 = 1
Branch analysis from position: 175
Branch analysis from position: 1
Branch analysis from position: 162
Branch analysis from position: 75
Branch analysis from position: 49
Branch analysis from position: 34
Branch analysis from position: 13
filename:       /in/TbnPu
function name:  tryToOptimize
number of ops:  185
compiled vars:  !0 = $tokenHeads, !1 = $token, !2 = $head_most_popular, !3 = $head_count, !4 = $tokenTails, !5 = $tail_most_popular, !6 = $tail_count, !7 = $tokenGroup, !8 = $tokensNoHead, !9 = $tokensOther, !10 = $optional, !11 = $newGroup, !12 = $tokensNoTail, !13 = $group
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
  135     0  E > > JMP                                                          ->174
  137     1    >   ASSIGN                                                       !0, <array>
  138     2        FETCH_OBJ_R                                          ~15     'tokens'
          3      > FE_RESET_R                                           $16     ~15, ->13
          4    > > FE_FETCH_R                                                   $16, !1, ->13
  139     5    >   INIT_METHOD_CALL                                             !1, 'has_head'
          6        DO_FCALL                                          0  $17     
          7      > JMPZ                                                         $17, ->12
  140     8    >   INIT_METHOD_CALL                                             !1, 'get_head'
          9        DO_FCALL                                          0  $19     
         10        ASSIGN_DIM                                                   !0
         11        OP_DATA                                                      $19
  138    12    > > JMP                                                          ->4
         13    >   FE_FREE                                                      $16
  143    14        INIT_FCALL                                                   'most_frequent'
         15        SEND_VAR                                                     !0
         16        DO_FCALL                                          0  $20     
         17        FETCH_LIST_R                                         $21     $20, 0
         18        ASSIGN                                                       !2, $21
         19        FETCH_LIST_R                                         $23     $20, 1
         20        ASSIGN                                                       !3, $23
         21        FREE                                                         $20
  146    22        ASSIGN                                                       !4, <array>
  147    23        FETCH_OBJ_R                                          ~26     'tokens'
         24      > FE_RESET_R                                           $27     ~26, ->34
         25    > > FE_FETCH_R                                                   $27, !1, ->34
  148    26    >   INIT_METHOD_CALL                                             !1, 'has_tail'
         27        DO_FCALL                                          0  $28     
         28      > JMPZ                                                         $28, ->33
  149    29    >   INIT_METHOD_CALL                                             !1, 'get_tail'
         30        DO_FCALL                                          0  $30     
         31        ASSIGN_DIM                                                   !4
         32        OP_DATA                                                      $30
  147    33    > > JMP                                                          ->25
         34    >   FE_FREE                                                      $27
  152    35        INIT_FCALL                                                   'most_frequent'
         36        SEND_VAR                                                     !4
         37        DO_FCALL                                          0  $31     
         38        FETCH_LIST_R                                         $32     $31, 0
         39        ASSIGN                                                       !5, $32
         40        FETCH_LIST_R                                         $34     $31, 1
         41        ASSIGN                                                       !6, $34
         42        FREE                                                         $31
  155    43        IS_SMALLER                                           ~36     1, !3
         44      > JMPZ_EX                                              ~36     ~36, ->49
         45    >   FETCH_OBJ_R                                          ~37     'tokens'
         46        COUNT                                                ~38     ~37
         47        IS_IDENTICAL                                         ~39     !3, ~38
         48        BOOL                                                 ~36     ~39
         49    > > JMPZ                                                         ~36, ->69
  156    50    >   ASSIGN                                                       !7, <array>
  158    51        FETCH_OBJ_R                                          ~41     'tokens'
         52      > FE_RESET_R                                           $42     ~41, ->60
         53    > > FE_FETCH_R                                                   $42, !1, ->60
  159    54    >   INIT_METHOD_CALL                                             !1, 'create_without_head'
         55        DO_FCALL                                          0  $43     
         56        ASSIGN                                                       !1, $43
  160    57        ASSIGN_DIM                                                   !7
         58        OP_DATA                                                      !1
  158    59      > JMP                                                          ->53
         60    >   FE_FREE                                                      $42
  165    61        INIT_METHOD_CALL                                             'setTokens'
         62        SEND_VAR_EX                                                  !7
         63        DO_FCALL                                          0          
  166    64        ASSIGN_OBJ                                                   'commonBeginning'
         65        OP_DATA                                                      !2
  167    66        ASSIGN_OBJ                                                   'commonEnding'
         67        OP_DATA                                                      ''
  169    68      > JMP                                                          ->174
  173    69    >   IS_SMALLER                                           ~49     1, !6
         70      > JMPZ_EX                                              ~49     ~49, ->75
         71    >   FETCH_OBJ_R                                          ~50     'tokens'
         72        COUNT                                                ~51     ~50
         73        IS_IDENTICAL                                         ~52     !6, ~51
         74        BOOL                                                 ~49     ~52
         75    > > JMPZ                                                         ~49, ->95
  174    76    >   ASSIGN                                                       !7, <array>
  176    77        FETCH_OBJ_R                                          ~54     'tokens'
         78      > FE_RESET_R                                           $55     ~54, ->86
         79    > > FE_FETCH_R                                                   $55, !1, ->86
  177    80    >   INIT_METHOD_CALL                                             !1, 'create_without_tail'
         81        DO_FCALL                                          0  $56     
         82        ASSIGN                                                       !1, $56
  178    83        ASSIGN_DIM                                                   !7
         84        OP_DATA                                                      !1
  176    85      > JMP                                                          ->79
         86    >   FE_FREE                                                      $55
  183    87        INIT_METHOD_CALL                                             'setTokens'
         88        SEND_VAR_EX                                                  !7
         89        DO_FCALL                                          0          
  184    90        ASSIGN_OBJ                                                   'commonBeginning'
         91        OP_DATA                                                      ''
  185    92        ASSIGN_OBJ                                                   'commonEnding'
         93        OP_DATA                                                      !5
  187    94      > JMP                                                          ->174
  190    95    >   IS_SMALLER_OR_EQUAL                                          !6, !3
         96      > JMPZ                                                         ~62, ->136
  191    97    >   IS_SMALLER                                                   !3, 2
         98      > JMPZ                                                         ~63, ->100
  195    99    > > JMP                                                          ->175
  197   100    >   ASSIGN                                                       !8, <array>
  198   101        ASSIGN                                                       !9, <array>
  199   102        ASSIGN                                                       !10, <false>
  200   103        FETCH_OBJ_R                                          ~67     'tokens'
        104      > FE_RESET_R                                           $68     ~67, ->123
        105    > > FE_FETCH_R                                                   $68, !1, ->123
  201   106    >   INIT_METHOD_CALL                                             !1, 'get_head'
        107        DO_FCALL                                          0  $69     
        108        IS_IDENTICAL                                                 !2, $69
        109      > JMPZ                                                         ~70, ->120
  203   110    >   INIT_METHOD_CALL                                             !1, 'create_without_head'
        111        DO_FCALL                                          0  $71     
        112        ASSIGN                                                       !1, $71
  204   113        ASSIGN_DIM                                                   !8
        114        OP_DATA                                                      !1
  205   115        CAST                                              6  ~74     !1
        116        IS_IDENTICAL                                                 ~74, ''
        117      > JMPZ                                                         ~75, ->119
  206   118    >   ASSIGN                                                       !10, <true>
  201   119    > > JMP                                                          ->122
  209   120    >   ASSIGN_DIM                                                   !9
        121        OP_DATA                                                      !1
  200   122    > > JMP                                                          ->105
        123    >   FE_FREE                                                      $68
  211   124        NEW                                                  $78     'ReGroup'
        125        SEND_VAR_EX                                                  !8
        126        SEND_VAR_EX                                                  !2
        127        SEND_VAL_EX                                                  ''
        128        SEND_VAR_EX                                                  !10
        129        DO_FCALL                                          0          
        130        ASSIGN                                                       !11, $78
  212   131        INIT_ARRAY                                           ~82     !11
        132        ADD_ARRAY_UNPACK                                     ~82     !9
        133        ASSIGN_OBJ                                                   'tokens'
        134        OP_DATA                                                      ~82
  190   135      > JMP                                                          ->174
  215   136    >   IS_SMALLER                                                   !6, 2
        137      > JMPZ                                                         ~83, ->139
  217   138    > > JMP                                                          ->175
  219   139    >   ASSIGN                                                       !12, <array>
  220   140        ASSIGN                                                       !9, <array>
  221   141        ASSIGN                                                       !10, <false>
  222   142        FETCH_OBJ_R                                          ~87     'tokens'
        143      > FE_RESET_R                                           $88     ~87, ->162
        144    > > FE_FETCH_R                                                   $88, !1, ->162
  223   145    >   INIT_METHOD_CALL                                             !1, 'get_tail'
        146        DO_FCALL                                          0  $89     
        147        IS_IDENTICAL                                                 !5, $89
        148      > JMPZ                                                         ~90, ->159
  225   149    >   INIT_METHOD_CALL                                             !1, 'create_without_tail'
        150        DO_FCALL                                          0  $91     
        151        ASSIGN                                                       !1, $91
  226   152        ASSIGN_DIM                                                   !12
        153        OP_DATA                                                      !1
  227   154        CAST                                              6  ~94     !1
        155        IS_IDENTICAL                                                 ~94, ''
        156      > JMPZ                                                         ~95, ->158
  228   157    >   ASSIGN                                                       !10, <true>
  223   158    > > JMP                                                          ->161
  231   159    >   ASSIGN_DIM                                                   !9
        160        OP_DATA                                                      !1
  222   161    > > JMP                                                          ->144
        162    >   FE_FREE                                                      $88
  233   163        NEW                                                  $98     'ReGroup'
        164        SEND_VAR_EX                                                  !12
        165        SEND_VAL_EX                                                  ''
        166        SEND_VAR_EX                                                  !5
        167        SEND_VAR_EX                                                  !10
        168        DO_FCALL                                          0          
        169        ASSIGN                                                       !11, $98
  234   170        INIT_ARRAY                                           ~102    !11
        171        ADD_ARRAY_UNPACK                                     ~102    !9
        172        ASSIGN_OBJ                                                   'tokens'
        173        OP_DATA                                                      ~102
  135   174    > > JMPNZ                                                        <true>, ->1
  253   175    >   FETCH_OBJ_R                                          ~103    'tokens'
        176      > FE_RESET_R                                           $104    ~103, ->183
        177    > > FE_FETCH_R                                                   $104, !13, ->183
  254   178    >   INSTANCEOF                                                   !13, 'ReGroup'
        179      > JMPZ                                                         ~105, ->182
  255   180    >   INIT_METHOD_CALL                                             !13, 'tryToOptimize'
        181        DO_FCALL                                          0          
  253   182    > > JMP                                                          ->177
        183    >   FE_FREE                                                      $104
  258   184      > RETURN                                                       null

End of function trytooptimize

Function __tostring:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 9
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 9
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 9
2 jumps found. (Code = 43) Position 1 = 17, Position 2 = 19
Branch analysis from position: 17
1 jumps found. (Code = 42) Position 1 = 20
Branch analysis from position: 20
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 19
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 9
filename:       /in/TbnPu
function name:  __toString
number of ops:  28
compiled vars:  !0 = $tokens, !1 = $token, !2 = $ret
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
  261     0  E >   ASSIGN                                                       !0, <array>
  262     1        FETCH_OBJ_R                                          ~4      'tokens'
          2      > FE_RESET_R                                           $5      ~4, ->9
          3    > > FE_FETCH_R                                                   $5, !1, ->9
  263     4    >   INIT_METHOD_CALL                                             !1, '__toString'
          5        DO_FCALL                                          0  $7      
          6        ASSIGN_DIM                                                   !0
          7        OP_DATA                                                      $7
  262     8      > JMP                                                          ->3
          9    >   FE_FREE                                                      $5
  265    10        FETCH_OBJ_R                                          ~8      'commonBeginning'
         11        CONCAT                                               ~9      ~8, '%28'
         12        FRAMELESS_ICALL_2                implode             ~10     '%7C', !0
         13        CONCAT                                               ~11     ~9, ~10
         14        CONCAT                                               ~12     ~11, '%29'
         15        FETCH_OBJ_R                                          ~13     'optional'
         16      > JMPZ                                                         ~13, ->19
         17    >   QM_ASSIGN                                            ~14     '%3F'
         18      > JMP                                                          ->20
         19    >   QM_ASSIGN                                            ~14     ''
         20    >   CONCAT                                               ~15     ~12, ~14
         21        FETCH_OBJ_R                                          ~16     'commonEnding'
         22        CONCAT                                               ~17     ~15, ~16
         23        ASSIGN                                                       !2, ~17
  267    24        VERIFY_RETURN_TYPE                                           !2
         25      > RETURN                                                       !2
  268    26*       VERIFY_RETURN_TYPE                                           
         27*     > RETURN                                                       null

End of function __tostring

Function count:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/TbnPu
function name:  count
number of ops:  6
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
  271     0  E >   FETCH_OBJ_R                                          ~0      'tokens'
          1        COUNT                                                ~1      ~0
          2        VERIFY_RETURN_TYPE                                           ~1
          3      > RETURN                                                       ~1
  272     4*       VERIFY_RETURN_TYPE                                           
          5*     > RETURN                                                       null

End of function count

Function is_empty:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/TbnPu
function name:  is_empty
number of ops:  7
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
  275     0  E >   FETCH_THIS                                           ~0      
          1        COUNT                                                ~1      ~0
          2        IS_IDENTICAL                                         ~2      ~1, 0
          3        VERIFY_RETURN_TYPE                                           ~2
          4      > RETURN                                                       ~2
  276     5*       VERIFY_RETURN_TYPE                                           
          6*     > RETURN                                                       null

End of function is_empty

Function get_head:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/TbnPu
function name:  get_head
number of ops:  6
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
  279     0  E >   FETCH_OBJ_R                                          ~0      'commonBeginning'
          1        CAST                                              6  ~1      ~0
          2        VERIFY_RETURN_TYPE                                           ~1
          3      > RETURN                                                       ~1
  280     4*       VERIFY_RETURN_TYPE                                           
          5*     > RETURN                                                       null

End of function get_head

Function has_head:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/TbnPu
function name:  has_head
number of ops:  7
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
  283     0  E >   FETCH_OBJ_R                                          ~0      'commonBeginning'
          1        CAST                                              6  ~1      ~0
          2        IS_NOT_EQUAL                                         ~2      ~1, ''
          3        VERIFY_RETURN_TYPE                                           ~2
          4      > RETURN                                                       ~2
  284     5*       VERIFY_RETURN_TYPE                                           
          6*     > RETURN                                                       null

End of function has_head

Function get_tail:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/TbnPu
function name:  get_tail
number of ops:  6
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
  287     0  E >   FETCH_OBJ_R                                          ~0      'commonEnding'
          1        CAST                                              6  ~1      ~0
          2        VERIFY_RETURN_TYPE                                           ~1
          3      > RETURN                                                       ~1
  288     4*       VERIFY_RETURN_TYPE                                           
          5*     > RETURN                                                       null

End of function get_tail

Function has_tail:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/TbnPu
function name:  has_tail
number of ops:  7
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
  291     0  E >   FETCH_OBJ_R                                          ~0      'commonEnding'
          1        CAST                                              6  ~1      ~0
          2        IS_NOT_EQUAL                                         ~2      ~1, ''
          3        VERIFY_RETURN_TYPE                                           ~2
          4      > RETURN                                                       ~2
  292     5*       VERIFY_RETURN_TYPE                                           
          6*     > RETURN                                                       null

End of function has_tail

Function create_without_head:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/TbnPu
function name:  create_without_head
number of ops:  16
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
  295     0  E >   NEW                                                  $0      'ReGroup'
          1        CHECK_FUNC_ARG                                               
          2        FETCH_OBJ_FUNC_ARG                                   $1      'tokens'
          3        SEND_FUNC_ARG                                                $1
          4        SEND_VAL_EX                                                  ''
          5        CHECK_FUNC_ARG                                               
          6        FETCH_OBJ_FUNC_ARG                                   $2      'commonEnding'
          7        SEND_FUNC_ARG                                                $2
          8        CHECK_FUNC_ARG                                               
          9        FETCH_OBJ_FUNC_ARG                                   $3      'optional'
         10        SEND_FUNC_ARG                                                $3
         11        DO_FCALL                                          0          
         12        VERIFY_RETURN_TYPE                                           $0
         13      > RETURN                                                       $0
  296    14*       VERIFY_RETURN_TYPE                                           
         15*     > RETURN                                                       null

End of function create_without_head

Function create_without_tail:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/TbnPu
function name:  create_without_tail
number of ops:  16
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
  299     0  E >   NEW                                                  $0      'ReGroup'
          1        CHECK_FUNC_ARG                                               
          2        FETCH_OBJ_FUNC_ARG                                   $1      'tokens'
          3        SEND_FUNC_ARG                                                $1
          4        CHECK_FUNC_ARG                                               
          5        FETCH_OBJ_FUNC_ARG                                   $2      'commonBeginning'
          6        SEND_FUNC_ARG                                                $2
          7        SEND_VAL_EX                                                  ''
          8        CHECK_FUNC_ARG                                               
          9        FETCH_OBJ_FUNC_ARG                                   $3      'optional'
         10        SEND_FUNC_ARG                                                $3
         11        DO_FCALL                                          0          
         12        VERIFY_RETURN_TYPE                                           $0
         13      > RETURN                                                       $0
  300    14*       VERIFY_RETURN_TYPE                                           
         15*     > RETURN                                                       null

End of function create_without_tail

Function current:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/TbnPu
function name:  current
number of ops:  6
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
  304     0  E >   FETCH_OBJ_R                                          ~1      'position'
          1        FETCH_OBJ_R                                          ~0      'tokens'
          2        FETCH_DIM_R                                          ~2      ~0, ~1
          3      > RETURN                                                       ~2
  305     4*       VERIFY_RETURN_TYPE                                           
          5*     > RETURN                                                       null

End of function current

Function key:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/TbnPu
function name:  key
number of ops:  4
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
  307     0  E >   FETCH_OBJ_R                                          ~0      'position'
          1      > RETURN                                                       ~0
  308     2*       VERIFY_RETURN_TYPE                                           
          3*     > RETURN                                                       null

End of function key

Function next:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/TbnPu
function name:  next
number of ops:  2
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
  310     0  E >   PRE_INC_OBJ                                                  'position'
  311     1      > RETURN                                                       null

End of function next

Function rewind:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/TbnPu
function name:  rewind
number of ops:  3
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
  313     0  E >   ASSIGN_OBJ                                                   'position'
          1        OP_DATA                                                      0
  314     2      > RETURN                                                       null

End of function rewind

Function valid:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/TbnPu
function name:  valid
number of ops:  8
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
  316     0  E >   FETCH_THIS                                           ~0      
          1        COUNT                                                ~1      ~0
          2        FETCH_OBJ_R                                          ~2      'position'
          3        IS_SMALLER                                           ~3      ~2, ~1
          4        VERIFY_RETURN_TYPE                                           ~3
          5      > RETURN                                                       ~3
  317     6*       VERIFY_RETURN_TYPE                                           
          7*     > RETURN                                                       null

End of function valid

Function getchildren:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/TbnPu
function name:  getChildren
number of ops:  5
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
  321     0  E >   FETCH_OBJ_R                                          ~0      'tokens'
          1        VERIFY_RETURN_TYPE                                           ~0
          2      > RETURN                                                       ~0
  322     3*       VERIFY_RETURN_TYPE                                           
          4*     > RETURN                                                       null

End of function getchildren

Function haschildren:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/TbnPu
function name:  hasChildren
number of ops:  7
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
  324     0  E >   FETCH_THIS                                           ~0      
          1        COUNT                                                ~1      ~0
          2        BOOL                                                 ~2      ~1
          3        VERIFY_RETURN_TYPE                                           ~2
          4      > RETURN                                                       ~2
  325     5*       VERIFY_RETURN_TYPE                                           
          6*     > RETURN                                                       null

End of function haschildren

End of class ReGroup.

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
191.31 ms | 1542 KiB | 17 Q