3v4l.org

run code in 300+ PHP versions simultaneously
<?php namespace LLSDN\Token; enum Type: string { // structural tokens case LeftMapDelimiter = '{'; case RightMapDelimiter = '}'; case LeftArrayDelimiter = '['; case RightArrayDelimiter = ']'; case ItemSeparator = ','; case PairSeparator = ':'; // key case Name = '#'; // <-- symbole bidon // type tokens case Undef = '!'; case BooleanTrue = 'true'; case BooleanFalse = 'false'; case Integer = 'i'; case Real = 'r'; case UUID = 'u'; case String = 's'; case RawBinary = 'b'; case Binary16 = 'b16'; case Binary64 = 'b64'; case URI = 'l'; case Date = 'd'; public function endsValue(): bool { return match($this) { Type::RightMapDelimiter, Type::RightArrayDelimiter, Type::ItemSeparator => true, default => false }; } public function isStructural(): bool { return match($this) { Type::LeftMapDelimiter, Type::RightMapDelimiter, Type::LeftArrayDelimiter, Type::RightArrayDelimiter, Type::PairSeparator, Type::ItemSeparator => true, default => false }; } }; abstract class AbstractToken { public ?Type $type; public ?string $value; } class Token extends AbstractToken { } class Tokenizer { protected \Iterator $chunk; protected AbstractToken $token; protected ?string $onHold = null; public function __construct(\Iterator | Array $chunks, AbstractToken $token = new Token()) { $this->chunk = is_array($chunks) ? new \ArrayIterator($chunks) : $chunks; $this->token = $token; } public function tokenize() { while($this->chunk->valid()) { $chunk = $this->chunk->current(); if (in_array($chunk, ["'", '"', 's'], true)) { $this->onHold = $this->stringContent(); } else { yield from match($chunk) { '{', '}', '[', ']', ',', ':', '!' => $this->noValue(), '0', 'f', 'false', 'F', 'FALSE' => $this->boolean(false), '1', 't', 'true', 'T', 'TRUE' => $this->boolean(true), 'b16', 'b64', 'd', 'l' => $this->quoted(), 'b' => $this->rawBinary(), 'i', 'r', 'u' => $this->simple(), }; } $this->skipWS(); } } protected function noValue() { $type = Type::from($this->chunk->current()); if ($this->onHold !== null) { if ($type->endsValue()) { yield $this->buildToken(Type::String, $this->onHold); } elseif ($type === Type::PairSeparator) { yield $this->buildToken(Type::Name, $this->onHold); } $this->onHold = null; } yield $this->buildToken($type); } protected function simple() { $type = Type::from($this->chunk->current()); $this->chunk->next(); yield $this->buildToken($type, $this->chunk->current()); } protected function quoted(): \Generator { $type = Type::from($this->chunk->current()); $this->chunk->next(); $value = $this->escapedContent(); yield $this->buildToken($type, $value); } protected function boolean($value): \Generator { yield $value ? $this->buildToken(Type::BooleanTrue, 'true') : $this->buildToken(Type::BooleanFalse, 'false'); } protected function RawBinary(): \Generator { $this->chunk->next(); yield $this->buildToken(Type::RawBinary, $this->sizedContent()); } protected function stringContent(): string { if (in_array($this->chunk->current(), ["'", '"'], true)) { return $this->escapedContent(); } else { $this->chunk->next(); // parenthèse ouvrante return $this->sizedContent(); } } protected function escapedContent(): string { $delimiter = $this->chunk->current(); $content = ''; do { $escaped = false; $this->chunk->next(); if ($this->chunk->current() === '\\') { $escaped = true; $this->chunk->next(); if ($this->chunk->current() !== $delimiter) { $content .= '\\'; } $content .= $this->chunk->current(); } elseif ($this->chunk->current() !== $delimiter) { $content .= $this->chunk->current(); } } while($this->chunk->current() !== $delimiter || $escaped === true); return $content; } protected function sizedContent(): string { $this->chunk->next(); // taille $size = (int)$this->chunk->current(); $this->chunk->next(); // parenthèse fermante $this->chunk->next(); // délimiteur de début $content = ''; while(strlen($content) < $size) { $this->chunk->next(); $content .= $this->chunk->current(); } $this->chunk->next(); // délimiteur de fin return $content; } protected function skipWS() { $this->chunk->next(); if ($this->chunk->valid() && preg_match('~\A \s+ \z~ux', $this->chunk->current())) { $this->chunk->next(); } } protected function buildToken(Type $tokenType, ?string $value = null): AbstractToken { $token = clone $this->token; $token->type = $tokenType; $token->value = $value; return $token; } } function toJSON(\Iterator $tokens): string { $result = ''; foreach ($tokens as $token) { if ($token->type->isStructural()) { $result .= $token->type->value; } elseif ($token->type === Type::Name) { $result .= '"' . $token->value . '"'; } elseif ($token->type === Type::Undef) { $result .= 'null'; } elseif (str_starts_with(needle: 'Boolean', haystack: $token->type->name)) { $result .= '{"value":"' . $token->value . '", "type":"Boolean"}'; } else { $result .= '{"value":' . json_encode($token->value) . ',"type":"' . $token->type->name . '"}'; } } return $result; } $test = <<<'LLSDN' [ { 'creation-date':d"2007-03-15T18:30:18Z", 'creator-id':u3c115e51-04f4-523c-9fa6-98aff1034730 }, s(10)"0123456789", "Where are the beef & the <pig>?", 'Over here.', b(158)"default { state_entry() { llSay(0, "Hello, Avatar!"); } touch_start(integer total_number) { llSay(0, "Touched."); } }", b64"AABAAAAAAAAAAAIAAAA//wAAP/8AAADgAAAA5wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AABkAAAAZAAAAAAAAAAAAAAAZAAAAAAAAAABAAAAAAAAAAAAAAAAAAAABQAAAAEAAAAQAAAAAAAA AAUAAAAFAAAAABAAAAAAAAAAPgAAAAQAAAAFAGNbXgAAAABgSGVsbG8sIEF2YXRhciEAZgAAAABc XgAAAAhwEQjRABeVAAAABQBjW14AAAAAYFRvdWNoZWQuAGYAAAAAXF4AAAAIcBEI0QAXAZUAAEAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", !, 0, f, t, T, TRUE, FALSE, F ] LLSDN; $pattern = <<<'REGEX' ~(?xx) (?<chunk> [ ] [ ) ( } { : , ! ' " \\ ] | [[:<:]] ( ( # boolean (?<! [ - + . ] ) [ 0 1 ] (?= [ ] \s , } ]) | f (alse)? | t (rue)? | F (ALSE)? | T (RUE)? | # binary b ( 16 | 64 )? | # string, date, URI [ s d l ] ) [[:>:]] | # integer, real, UUID [ i r u ] ) | \s+ ) ~un REGEX; $chunks = preg_split( pattern: $pattern, subject: $test, flags: PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY ); $myTKZ = new Tokenizer($chunks); $tokenGen = $myTKZ->tokenize(); print_r(json_decode(toJSON($tokenGen), true));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/RMVIg
function name:  (null)
number of ops:  31
compiled vars:  !0 = $test, !1 = $pattern, !2 = $chunks, !3 = $myTKZ, !4 = $tokenGen
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   DECLARE_CLASS                                            'llsdn%5Ctoken%5Ctype'
  249     1        ASSIGN                                                   !0, '%5B%0A++%7B%0A++++%27creation-date%27%3Ad%222007-03-15T18%3A30%3A18Z%22%2C+%0A++++%27creator-id%27%3Au3c115e51-04f4-523c-9fa6-98aff1034730%0A++%7D%2C%0A++s%2810%29%220123456789%22%2C%0A++%22Where+are+the+beef+%26+the+%3Cpig%3E%3F%22%2C%0A++%27Over+here.%27%2C++%0A++b%28158%29%22default%0A%7B%0A++++state_entry%28%29%0A++++%7B%0A++++++++llSay%280%2C+%22Hello%2C+Avatar%21%22%29%3B%0A++++%7D%0A%0A++++touch_start%28integer+total_number%29%0A++++%7B%0A++++++++llSay%280%2C+%22Touched.%22%29%3B%0A++++%7D%0A%7D%22%2C%0A++b64%22AABAAAAAAAAAAAIAAAA%2F%2FwAAP%2F8AAADgAAAA5wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA%0AAABkAAAAZAAAAAAAAAAAAAAAZAAAAAAAAAABAAAAAAAAAAAAAAAAAAAABQAAAAEAAAAQAAAAAAAA%0AAAUAAAAFAAAAABAAAAAAAAAAPgAAAAQAAAAFAGNbXgAAAABgSGVsbG8sIEF2YXRhciEAZgAAAABc%0AXgAAAAhwEQjRABeVAAAABQBjW14AAAAAYFRvdWNoZWQuAGYAAAAAXF4AAAAIcBEI0QAXAZUAAEAA%0AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA%22%2C%0A%21%2C+0%2C+f%2C+t%2C+T%2C+TRUE%2C+FALSE%2C+F%0A%5D'
  279     2        ASSIGN                                                   !1, '%7E%28%3Fxx%29%0A%28%3F%3Cchunk%3E%0A++++%5B++++%5D+%5B+%29+%28+%7D+%7B+%3A+%2C+%21+%27+%22+%5C%5C++++%5D%0A++%7C+++++++%0A++++%5B%5B%3A%3C%3A%5D%5D%0A++++%28+%0A++++++++%28+++%23+boolean%0A++++++++++++%28%3F%3C%21+%5B+-+%2B+.+%5D+%29++%5B+0+1+%5D++%28%3F%3D+%5B++%5D+%5Cs+%2C+%7D++%5D%29%0A++++++++++%7C%0A++++++++++++f+%28alse%29%3F+%7C+t+%28rue%29%3F+%7C+F+%28ALSE%29%3F+%7C+T+%28RUE%29%3F++%0A++++++++++%7C+%23+binary%0A++++++++++++b+%28+16+%7C+64+%29%3F%0A++++++++++%7C+%23+string%2C+date%2C+URI%0A++++++++++++%5B+s+d+l+%5D%0A++++++++%29%0A++++++++%5B%5B%3A%3E%3A%5D%5D%0A++++++%7C+%23+integer%2C+real%2C+UUID%0A++++++++%5B+i+r+u+%5D%0A++++%29%0A++%7C%0A++++%5Cs%2B++%0A%29%0A%7Eun'
  305     3        INIT_NS_FCALL_BY_NAME                                    'LLSDN%5CToken%5Cpreg_split'
  306     4        SEND_VAR_EX                                              !1, 'pattern'
          5        SEND_VAR_EX                                              !0, 'subject'
  308     6        FETCH_CONSTANT                                   ~7      'LLSDN%5CToken%5CPREG_SPLIT_DELIM_CAPTURE'
          7        FETCH_CONSTANT                                   ~8      'LLSDN%5CToken%5CPREG_SPLIT_NO_EMPTY'
          8        BW_OR                                            ~9      ~7, ~8
          9        SEND_VAL_EX                                              ~9, 'flags'
         10        CHECK_UNDEF_ARGS                                         
  305    11        DO_FCALL                                      1  $10     
         12        ASSIGN                                                   !2, $10
  311    13        NEW                                              $12     'LLSDN%5CToken%5CTokenizer'
         14        SEND_VAR_EX                                              !2
         15        DO_FCALL                                      0          
         16        ASSIGN                                                   !3, $12
  312    17        INIT_METHOD_CALL                                         !3, 'tokenize'
         18        DO_FCALL                                      0  $15     
         19        ASSIGN                                                   !4, $15
  314    20        INIT_NS_FCALL_BY_NAME                                    'LLSDN%5CToken%5Cprint_r'
         21        INIT_NS_FCALL_BY_NAME                                    'LLSDN%5CToken%5Cjson_decode'
         22        INIT_NS_FCALL_BY_NAME                                    'LLSDN%5CToken%5CtoJSON'
         23        SEND_VAR_EX                                              !4
         24        DO_FCALL                                      0  $17     
         25        SEND_VAR_NO_REF_EX                                       $17
         26        SEND_VAL_EX                                              <true>
         27        DO_FCALL                                      0  $18     
         28        SEND_VAR_NO_REF_EX                                       $18
         29        DO_FCALL                                      0          
         30      > RETURN                                                   1

Function llsdn%5Ctoken%5Ctojson:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 54
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 54
Branch analysis from position: 4
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 12
Branch analysis from position: 8
1 jumps found. (Code = 42) Position 1 = 53
Branch analysis from position: 53
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 12
2 jumps found. (Code = 43) Position 1 = 16, Position 2 = 21
Branch analysis from position: 16
1 jumps found. (Code = 42) Position 1 = 53
Branch analysis from position: 53
Branch analysis from position: 21
2 jumps found. (Code = 43) Position 1 = 25, Position 2 = 27
Branch analysis from position: 25
1 jumps found. (Code = 42) Position 1 = 53
Branch analysis from position: 53
Branch analysis from position: 27
2 jumps found. (Code = 43) Position 1 = 36, Position 2 = 41
Branch analysis from position: 36
1 jumps found. (Code = 42) Position 1 = 53
Branch analysis from position: 53
Branch analysis from position: 41
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 54
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 54
filename:       /in/RMVIg
function name:  LLSDN\Token\toJSON
number of ops:  59
compiled vars:  !0 = $tokens, !1 = $result, !2 = $token
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  221     0  E >   RECV                                             !0      
  222     1        ASSIGN                                                   !1, ''
  224     2      > FE_RESET_R                                       $4      !0, ->54
          3    > > FE_FETCH_R                                               $4, !2, ->54
  226     4    >   FETCH_OBJ_R                                      ~5      !2, 'type'
          5        INIT_METHOD_CALL                                         ~5, 'isStructural'
          6        DO_FCALL                                      0  $6      
          7      > JMPZ                                                     $6, ->12
  227     8    >   FETCH_OBJ_R                                      ~7      !2, 'type'
          9        FETCH_OBJ_R                                      ~8      ~7, 'value'
         10        ASSIGN_OP                                     8          !1, ~8
  226    11      > JMP                                                      ->53
  229    12    >   FETCH_OBJ_R                                      ~10     !2, 'type'
         13        FETCH_CLASS_CONSTANT                             ~11     'LLSDN%5CToken%5CType', 'Name'
         14        IS_IDENTICAL                                             ~10, ~11
         15      > JMPZ                                                     ~12, ->21
  230    16    >   FETCH_OBJ_R                                      ~13     !2, 'value'
         17        CONCAT                                           ~14     '%22', ~13
         18        CONCAT                                           ~15     ~14, '%22'
         19        ASSIGN_OP                                     8          !1, ~15
  229    20      > JMP                                                      ->53
  232    21    >   FETCH_OBJ_R                                      ~17     !2, 'type'
         22        FETCH_CLASS_CONSTANT                             ~18     'LLSDN%5CToken%5CType', 'Undef'
         23        IS_IDENTICAL                                             ~17, ~18
         24      > JMPZ                                                     ~19, ->27
  233    25    >   ASSIGN_OP                                     8          !1, 'null'
  232    26      > JMP                                                      ->53
  235    27    >   INIT_NS_FCALL_BY_NAME                                    'LLSDN%5CToken%5Cstr_starts_with'
         28        SEND_VAL_EX                                              'Boolean', 'needle'
         29        CHECK_FUNC_ARG                                           'haystack'
         30        FETCH_OBJ_FUNC_ARG                               $21     !2, 'type'
         31        FETCH_OBJ_FUNC_ARG                               $22     $21, 'name'
         32        SEND_FUNC_ARG                                            $22, 'haystack'
         33        CHECK_UNDEF_ARGS                                         
         34        DO_FCALL                                      1  $23     
         35      > JMPZ                                                     $23, ->41
  236    36    >   FETCH_OBJ_R                                      ~24     !2, 'value'
         37        CONCAT                                           ~25     '%7B%22value%22%3A%22', ~24
         38        CONCAT                                           ~26     ~25, '%22%2C+%22type%22%3A%22Boolean%22%7D'
         39        ASSIGN_OP                                     8          !1, ~26
  235    40      > JMP                                                      ->53
  240    41    >   INIT_NS_FCALL_BY_NAME                                    'LLSDN%5CToken%5Cjson_encode'
         42        CHECK_FUNC_ARG                                           
         43        FETCH_OBJ_FUNC_ARG                               $28     !2, 'value'
         44        SEND_FUNC_ARG                                            $28
         45        DO_FCALL                                      0  $29     
         46        CONCAT                                           ~30     '%7B%22value%22%3A', $29
  241    47        CONCAT                                           ~31     ~30, '%2C%22type%22%3A%22'
  242    48        FETCH_OBJ_R                                      ~32     !2, 'type'
         49        FETCH_OBJ_R                                      ~33     ~32, 'name'
         50        CONCAT                                           ~34     ~31, ~33
         51        CONCAT                                           ~35     ~34, '%22%7D'
         52        ASSIGN_OP                                     8          !1, ~35
  224    53    > > JMP                                                      ->3
         54    >   FE_FREE                                                  $4
  245    55        VERIFY_RETURN_TYPE                                       !1
         56      > RETURN                                                   !1
  246    57*       VERIFY_RETURN_TYPE                                       
         58*     > RETURN                                                   null

End of function llsdn%5Ctoken%5Ctojson

Class LLSDN\Token\Type:
Function endsvalue:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 44) Position 1 = 4, Position 2 = 11
Branch analysis from position: 4
2 jumps found. (Code = 44) Position 1 = 7, Position 2 = 11
Branch analysis from position: 7
2 jumps found. (Code = 44) Position 1 = 10, Position 2 = 11
Branch analysis from position: 10
1 jumps found. (Code = 42) Position 1 = 13
Branch analysis from position: 13
1 jumps found. (Code = 42) Position 1 = 15
Branch analysis from position: 15
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 15
Branch analysis from position: 15
Branch analysis from position: 11
Branch analysis from position: 11
filename:       /in/RMVIg
function name:  endsValue
number of ops:  20
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   35     0  E >   FETCH_THIS                                       ~0      
   36     1        FETCH_CLASS_CONSTANT                             ~2      'LLSDN%5CToken%5CType', 'RightMapDelimiter'
          2        CASE_STRICT                                              ~0, ~2
          3      > JMPNZ                                                    ~1, ->11
          4    >   FETCH_CLASS_CONSTANT                             ~3      'LLSDN%5CToken%5CType', 'RightArrayDelimiter'
          5        CASE_STRICT                                              ~0, ~3
          6      > JMPNZ                                                    ~1, ->11
          7    >   FETCH_CLASS_CONSTANT                             ~4      'LLSDN%5CToken%5CType', 'ItemSeparator'
          8        CASE_STRICT                                              ~0, ~4
          9      > JMPNZ                                                    ~1, ->11
         10    > > JMP                                                      ->13
         11    >   QM_ASSIGN                                        ~5      <true>
         12      > JMP                                                      ->15
   37    13    >   QM_ASSIGN                                        ~5      <false>
         14      > JMP                                                      ->15
         15    >   FREE                                                     ~0
         16        VERIFY_RETURN_TYPE                                       ~5
         17      > RETURN                                                   ~5
   39    18*       VERIFY_RETURN_TYPE                                       
         19*     > RETURN                                                   null

End of function endsvalue

Function isstructural:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 44) Position 1 = 4, Position 2 = 20
Branch analysis from position: 4
2 jumps found. (Code = 44) Position 1 = 7, Position 2 = 20
Branch analysis from position: 7
2 jumps found. (Code = 44) Position 1 = 10, Position 2 = 20
Branch analysis from position: 10
2 jumps found. (Code = 44) Position 1 = 13, Position 2 = 20
Branch analysis from position: 13
2 jumps found. (Code = 44) Position 1 = 16, Position 2 = 20
Branch analysis from position: 16
2 jumps found. (Code = 44) Position 1 = 19, Position 2 = 20
Branch analysis from position: 19
1 jumps found. (Code = 42) Position 1 = 22
Branch analysis from position: 22
1 jumps found. (Code = 42) Position 1 = 24
Branch analysis from position: 24
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 20
1 jumps found. (Code = 42) Position 1 = 24
Branch analysis from position: 24
Branch analysis from position: 20
Branch analysis from position: 20
Branch analysis from position: 20
Branch analysis from position: 20
Branch analysis from position: 20
filename:       /in/RMVIg
function name:  isStructural
number of ops:  29
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   42     0  E >   FETCH_THIS                                       ~0      
   43     1        FETCH_CLASS_CONSTANT                             ~2      'LLSDN%5CToken%5CType', 'LeftMapDelimiter'
          2        CASE_STRICT                                              ~0, ~2
          3      > JMPNZ                                                    ~1, ->20
          4    >   FETCH_CLASS_CONSTANT                             ~3      'LLSDN%5CToken%5CType', 'RightMapDelimiter'
          5        CASE_STRICT                                              ~0, ~3
          6      > JMPNZ                                                    ~1, ->20
   44     7    >   FETCH_CLASS_CONSTANT                             ~4      'LLSDN%5CToken%5CType', 'LeftArrayDelimiter'
          8        CASE_STRICT                                              ~0, ~4
          9      > JMPNZ                                                    ~1, ->20
         10    >   FETCH_CLASS_CONSTANT                             ~5      'LLSDN%5CToken%5CType', 'RightArrayDelimiter'
         11        CASE_STRICT                                              ~0, ~5
         12      > JMPNZ                                                    ~1, ->20
   45    13    >   FETCH_CLASS_CONSTANT                             ~6      'LLSDN%5CToken%5CType', 'PairSeparator'
         14        CASE_STRICT                                              ~0, ~6
         15      > JMPNZ                                                    ~1, ->20
         16    >   FETCH_CLASS_CONSTANT                             ~7      'LLSDN%5CToken%5CType', 'ItemSeparator'
         17        CASE_STRICT                                              ~0, ~7
         18      > JMPNZ                                                    ~1, ->20
         19    > > JMP                                                      ->22
         20    >   QM_ASSIGN                                        ~8      <true>
         21      > JMP                                                      ->24
   46    22    >   QM_ASSIGN                                        ~8      <false>
         23      > JMP                                                      ->24
         24    >   FREE                                                     ~0
         25        VERIFY_RETURN_TYPE                                       ~8
         26      > RETURN                                                   ~8
   48    27*       VERIFY_RETURN_TYPE                                       
         28*     > RETURN                                                   null

End of function isstructural

End of class LLSDN\Token\Type.

Class LLSDN\Token\AbstractToken: [no user functions]
Class LLSDN\Token\Token: [no user functions]
Class LLSDN\Token\Tokenizer:
Function __construct:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 11
Branch analysis from position: 6
1 jumps found. (Code = 42) Position 1 = 12
Branch analysis from position: 12
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 11
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/RMVIg
function name:  __construct
number of ops:  17
compiled vars:  !0 = $chunks, !1 = $token
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   70     0  E >   RECV                                             !0      
          1        RECV_INIT                                        !1      <const ast>
   72     2        INIT_NS_FCALL_BY_NAME                                    'LLSDN%5CToken%5Cis_array'
          3        SEND_VAR_EX                                              !0
          4        DO_FCALL                                      0  $3      
          5      > JMPZ                                                     $3, ->11
   73     6    >   NEW                                              $4      'ArrayIterator'
          7        SEND_VAR_EX                                              !0
          8        DO_FCALL                                      0          
          9        QM_ASSIGN                                        ~6      $4
         10      > JMP                                                      ->12
   74    11    >   QM_ASSIGN                                        ~6      !0
   72    12    >   ASSIGN_OBJ                                               'chunk'
   74    13        OP_DATA                                                  ~6
   76    14        ASSIGN_OBJ                                               'token'
         15        OP_DATA                                                  !1
   77    16      > RETURN                                                   null

End of function __construct

Function tokenize:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 49
Branch analysis from position: 49
2 jumps found. (Code = 44) Position 1 = 53, Position 2 = 2
Branch analysis from position: 53
1 jumps found. (Code = 161) Position 1 = -2
Branch analysis from position: 2
2 jumps found. (Code = 43) Position 1 = 12, Position 2 = 17
Branch analysis from position: 12
1 jumps found. (Code = 42) Position 1 = 47
Branch analysis from position: 47
2 jumps found. (Code = 44) Position 1 = 53, Position 2 = 2
Branch analysis from position: 53
Branch analysis from position: 2
Branch analysis from position: 17
26 jumps found. (Code = 195) Position 1 = 19, Position 2 = 19, Position 3 = 19, Position 4 = 19, Position 5 = 19, Position 6 = 19, Position 7 = 19, Position 8 = 23, Position 9 = 23, Position 10 = 23, Position 11 = 23, Position 12 = 23, Position 13 = 28, Position 14 = 28, Position 15 = 28, Position 16 = 28, Position 17 = 28, Position 18 = 33, Position 19 = 33, Position 20 = 33, Position 21 = 33, Position 22 = 37, Position 23 = 41, Position 24 = 41, Position 25 = 41, Position 26 = 18
Branch analysis from position: 19
1 jumps found. (Code = 42) Position 1 = 45
Branch analysis from position: 45
2 jumps found. (Code = 44) Position 1 = 53, Position 2 = 2
Branch analysis from position: 53
Branch analysis from position: 2
Branch analysis from position: 19
Branch analysis from position: 19
Branch analysis from position: 19
Branch analysis from position: 19
Branch analysis from position: 19
Branch analysis from position: 19
Branch analysis from position: 23
1 jumps found. (Code = 42) Position 1 = 45
Branch analysis from position: 45
Branch analysis from position: 23
Branch analysis from position: 23
Branch analysis from position: 23
Branch analysis from position: 23
Branch analysis from position: 28
1 jumps found. (Code = 42) Position 1 = 45
Branch analysis from position: 45
Branch analysis from position: 28
Branch analysis from position: 28
Branch analysis from position: 28
Branch analysis from position: 28
Branch analysis from position: 33
1 jumps found. (Code = 42) Position 1 = 45
Branch analysis from position: 45
Branch analysis from position: 33
Branch analysis from position: 33
Branch analysis from position: 33
Branch analysis from position: 37
1 jumps found. (Code = 42) Position 1 = 45
Branch analysis from position: 45
Branch analysis from position: 41
1 jumps found. (Code = 42) Position 1 = 45
Branch analysis from position: 45
Branch analysis from position: 41
Branch analysis from position: 41
Branch analysis from position: 18
1 jumps found. (Code = 197) Position 1 = -2
filename:       /in/RMVIg
function name:  tokenize
number of ops:  54
compiled vars:  !0 = $chunk
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   79     0  E >   GENERATOR_CREATE                                         
   81     1      > JMP                                                      ->49
   82     2    >   FETCH_OBJ_R                                      ~1      'chunk'
          3        INIT_METHOD_CALL                                         ~1, 'current'
          4        DO_FCALL                                      0  $2      
          5        ASSIGN                                                   !0, $2
   84     6        INIT_NS_FCALL_BY_NAME                                    'LLSDN%5CToken%5Cin_array'
          7        SEND_VAR_EX                                              !0
          8        SEND_VAL_EX                                              <array>
          9        SEND_VAL_EX                                              <true>
         10        DO_FCALL                                      0  $4      
         11      > JMPZ                                                     $4, ->17
   85    12    >   INIT_METHOD_CALL                                         'stringContent'
         13        DO_FCALL                                      0  $6      
         14        ASSIGN_OBJ                                               'onHold'
         15        OP_DATA                                                  $6
   84    16      > JMP                                                      ->47
   88    17    > > MATCH                                                    !0, [ '%7B':->19, '%7D':->19, '%5B':->19, '%5D':->19, '%2C':->19, '%3A':->19, '%21':->19, '0':->23, 'f':->23, 'false':->23, 'F':->23, 'FALSE':->23, '1':->28, 't':->28, 'true':->28, 'T':->28, 'TRUE':->28, 'b16':->33, 'b64':->33, 'd':->33, 'l':->33, 'b':->37, 'i':->41, 'r':->41, 'u':->41, ], ->18
         18    > > MATCH_ERROR                                              !0
   89    19    >   INIT_METHOD_CALL                                         'noValue'
         20        DO_FCALL                                      0  $8      
         21        QM_ASSIGN                                        ~9      $8
         22      > JMP                                                      ->45
   90    23    >   INIT_METHOD_CALL                                         'boolean'
         24        SEND_VAL_EX                                              <false>
         25        DO_FCALL                                      0  $10     
         26        QM_ASSIGN                                        ~9      $10
         27      > JMP                                                      ->45
   91    28    >   INIT_METHOD_CALL                                         'boolean'
         29        SEND_VAL_EX                                              <true>
         30        DO_FCALL                                      0  $11     
         31        QM_ASSIGN                                        ~9      $11
         32      > JMP                                                      ->45
   92    33    >   INIT_METHOD_CALL                                         'quoted'
         34        DO_FCALL                                      0  $12     
         35        QM_ASSIGN                                        ~9      $12
         36      > JMP                                                      ->45
   93    37    >   INIT_METHOD_CALL                                         'rawBinary'
         38        DO_FCALL                                      0  $13     
         39        QM_ASSIGN                                        ~9      $13
         40      > JMP                                                      ->45
   94    41    >   INIT_METHOD_CALL                                         'simple'
         42        DO_FCALL                                      0  $14     
         43        QM_ASSIGN                                        ~9      $14
         44      > JMP                                                      ->45
         45    >   YIELD_FROM                                       ~15     ~9
         46        FREE                                                     ~15
   98    47    >   INIT_METHOD_CALL                                         'skipWS'
         48        DO_FCALL                                      0          
   81    49    >   FETCH_OBJ_R                                      ~17     'chunk'
         50        INIT_METHOD_CALL                                         ~17, 'valid'
         51        DO_FCALL                                      0  $18     
         52      > JMPNZ                                                    $18, ->2
  100    53    > > GENERATOR_RETURN                                         

End of function tokenize

Function novalue:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 11, Position 2 = 36
Branch analysis from position: 11
2 jumps found. (Code = 43) Position 1 = 14, Position 2 = 23
Branch analysis from position: 14
1 jumps found. (Code = 42) Position 1 = 34
Branch analysis from position: 34
1 jumps found. (Code = 161) Position 1 = -2
Branch analysis from position: 23
2 jumps found. (Code = 43) Position 1 = 26, Position 2 = 34
Branch analysis from position: 26
1 jumps found. (Code = 161) Position 1 = -2
Branch analysis from position: 34
Branch analysis from position: 36
filename:       /in/RMVIg
function name:  noValue
number of ops:  41
compiled vars:  !0 = $type
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  102     0  E >   GENERATOR_CREATE                                         
  104     1        INIT_STATIC_METHOD_CALL                                  'LLSDN%5CToken%5CType', 'from'
          2        FETCH_OBJ_R                                      ~1      'chunk'
          3        INIT_METHOD_CALL                                         ~1, 'current'
          4        DO_FCALL                                      0  $2      
          5        SEND_VAR_NO_REF_EX                                       $2
          6        DO_FCALL                                      0  $3      
          7        ASSIGN                                                   !0, $3
  106     8        FETCH_OBJ_R                                      ~5      'onHold'
          9        TYPE_CHECK                                  1020          ~5
         10      > JMPZ                                                     ~6, ->36
  107    11    >   INIT_METHOD_CALL                                         !0, 'endsValue'
         12        DO_FCALL                                      0  $7      
         13      > JMPZ                                                     $7, ->23
  108    14    >   INIT_METHOD_CALL                                         'buildToken'
         15        FETCH_CLASS_CONSTANT                             ~8      'LLSDN%5CToken%5CType', 'String'
         16        SEND_VAL_EX                                              ~8
         17        CHECK_FUNC_ARG                                           
         18        FETCH_OBJ_FUNC_ARG                               $9      'onHold'
         19        SEND_FUNC_ARG                                            $9
         20        DO_FCALL                                      0  $10     
         21        YIELD                                                    $10
  107    22      > JMP                                                      ->34
  110    23    >   FETCH_CLASS_CONSTANT                             ~12     'LLSDN%5CToken%5CType', 'PairSeparator'
         24        IS_IDENTICAL                                             !0, ~12
         25      > JMPZ                                                     ~13, ->34
  111    26    >   INIT_METHOD_CALL                                         'buildToken'
         27        FETCH_CLASS_CONSTANT                             ~14     'LLSDN%5CToken%5CType', 'Name'
         28        SEND_VAL_EX                                              ~14
         29        CHECK_FUNC_ARG                                           
         30        FETCH_OBJ_FUNC_ARG                               $15     'onHold'
         31        SEND_FUNC_ARG                                            $15
         32        DO_FCALL                                      0  $16     
         33        YIELD                                                    $16
  113    34    >   ASSIGN_OBJ                                               'onHold'
         35        OP_DATA                                                  null
  116    36    >   INIT_METHOD_CALL                                         'buildToken'
         37        SEND_VAR_EX                                              !0
         38        DO_FCALL                                      0  $19     
         39        YIELD                                                    $19
  117    40      > GENERATOR_RETURN                                         

End of function novalue

Function simple:
Finding entry poin

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
145.34 ms | 1039 KiB | 21 Q