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 toXML(\Iterator $tokens): string { $result = '<?xml version="1.0" encoding="UTF-8"?>' . "\n"; $nameAttribute = null; foreach($tokens as $token) { $tagName = null; if ($token->type === Type::Name) { $nameAttribute = $token->value; } elseif (in_array($token->type, [Type::ItemSeparator, Type::PairSeparator], true)) { continue; } else { $tagName = match($token->type) { Type::LeftMapDelimiter, Type::RightMapDelimiter => 'map', Type::LeftArrayDelimiter, Type::RightArrayDelimiter => 'array', Type::BooleanFalse, Type::BooleanTrue => 'boolean', Type::UUID => 'UUID', Type::URI => 'URI', default => strtolower($token->type->name) }; $result .= '<'; if (str_starts_with(needle: 'Right', haystack: $token->type->name)) { $result .= '/' . $tagName . '>'; continue; } $result .= $tagName; if ($nameAttribute) { $result .= ' name="' . $nameAttribute . '"'; $nameAttribute = null; } if ($token->type === Type::Undef) { $result .= '/>'; continue; } $result .= '>'; if (str_starts_with(needle: 'Left', haystack: $token->type->name)) continue; $result .= $token->type === Type::RawBinary ? '<![CDATA[' . strtr($token->value, [']]>' => ']]]]><![CDATA[>']) . ']]>' : htmlspecialchars($token->value, ENT_XML1, 'UTF-8'); $result .= '</' . $tagName . '>'; } } 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(); $dom = new \DOMDocument; $dom->loadXML(toXML($tokenGen)); $dom->preserveWhiteSpace = false; $dom->formatOutput = true; echo $dom->saveXML();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ZAGS3
function name:  (null)
number of ops:  37
compiled vars:  !0 = $test, !1 = $pattern, !2 = $chunks, !3 = $myTKZ, !4 = $tokenGen, !5 = $dom
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   DECLARE_CLASS                                            'llsdn%5Ctoken%5Ctype'
  281     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'
  311     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'
  337     3        INIT_NS_FCALL_BY_NAME                                    'LLSDN%5CToken%5Cpreg_split'
  338     4        SEND_VAR_EX                                              !1, 'pattern'
          5        SEND_VAR_EX                                              !0, 'subject'
  340     6        FETCH_CONSTANT                                   ~8      'LLSDN%5CToken%5CPREG_SPLIT_DELIM_CAPTURE'
          7        FETCH_CONSTANT                                   ~9      'LLSDN%5CToken%5CPREG_SPLIT_NO_EMPTY'
          8        BW_OR                                            ~10     ~8, ~9
          9        SEND_VAL_EX                                              ~10, 'flags'
         10        CHECK_UNDEF_ARGS                                         
  337    11        DO_FCALL                                      1  $11     
         12        ASSIGN                                                   !2, $11
  343    13        NEW                                              $13     'LLSDN%5CToken%5CTokenizer'
         14        SEND_VAR_EX                                              !2
         15        DO_FCALL                                      0          
         16        ASSIGN                                                   !3, $13
  344    17        INIT_METHOD_CALL                                         !3, 'tokenize'
         18        DO_FCALL                                      0  $16     
         19        ASSIGN                                                   !4, $16
  346    20        NEW                                              $18     'DOMDocument'
         21        DO_FCALL                                      0          
         22        ASSIGN                                                   !5, $18
  347    23        INIT_METHOD_CALL                                         !5, 'loadXML'
         24        INIT_NS_FCALL_BY_NAME                                    'LLSDN%5CToken%5CtoXML'
         25        SEND_VAR_EX                                              !4
         26        DO_FCALL                                      0  $21     
         27        SEND_VAR_NO_REF_EX                                       $21
         28        DO_FCALL                                      0          
  348    29        ASSIGN_OBJ                                               !5, 'preserveWhiteSpace'
         30        OP_DATA                                                  <false>
  349    31        ASSIGN_OBJ                                               !5, 'formatOutput'
         32        OP_DATA                                                  <true>
  351    33        INIT_METHOD_CALL                                         !5, 'saveXML'
         34        DO_FCALL                                      0  $25     
         35        ECHO                                                     $25
         36      > RETURN                                                   1

Function llsdn%5Ctoken%5Ctoxml:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 4, Position 2 = 138
Branch analysis from position: 4
2 jumps found. (Code = 78) Position 1 = 5, Position 2 = 138
Branch analysis from position: 5
2 jumps found. (Code = 43) Position 1 = 10, Position 2 = 13
Branch analysis from position: 10
1 jumps found. (Code = 42) Position 1 = 137
Branch analysis from position: 137
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 13
2 jumps found. (Code = 43) Position 1 = 25, Position 2 = 27
Branch analysis from position: 25
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 27
2 jumps found. (Code = 44) Position 1 = 31, Position 2 = 53
Branch analysis from position: 31
2 jumps found. (Code = 44) Position 1 = 34, Position 2 = 53
Branch analysis from position: 34
2 jumps found. (Code = 44) Position 1 = 37, Position 2 = 55
Branch analysis from position: 37
2 jumps found. (Code = 44) Position 1 = 40, Position 2 = 55
Branch analysis from position: 40
2 jumps found. (Code = 44) Position 1 = 43, Position 2 = 57
Branch analysis from position: 43
2 jumps found. (Code = 44) Position 1 = 46, Position 2 = 57
Branch analysis from position: 46
2 jumps found. (Code = 44) Position 1 = 49, Position 2 = 59
Branch analysis from position: 49
2 jumps found. (Code = 44) Position 1 = 52, Position 2 = 61
Branch analysis from position: 52
1 jumps found. (Code = 42) Position 1 = 63
Branch analysis from position: 63
1 jumps found. (Code = 42) Position 1 = 71
Branch analysis from position: 71
2 jumps found. (Code = 43) Position 1 = 83, Position 2 = 87
Branch analysis from position: 83
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 87
2 jumps found. (Code = 43) Position 1 = 89, Position 2 = 93
Branch analysis from position: 89
2 jumps found. (Code = 43) Position 1 = 97, Position 2 = 99
Branch analysis from position: 97
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 99
2 jumps found. (Code = 43) Position 1 = 109, Position 2 = 110
Branch analysis from position: 109
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 110
2 jumps found. (Code = 43) Position 1 = 114, Position 2 = 124
Branch analysis from position: 114
1 jumps found. (Code = 42) Position 1 = 133
Branch analysis from position: 133
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 124
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 93
Branch analysis from position: 61
1 jumps found. (Code = 42) Position 1 = 71
Branch analysis from position: 71
Branch analysis from position: 59
1 jumps found. (Code = 42) Position 1 = 71
Branch analysis from position: 71
Branch analysis from position: 57
1 jumps found. (Code = 42) Position 1 = 71
Branch analysis from position: 71
Branch analysis from position: 57
Branch analysis from position: 55
1 jumps found. (Code = 42) Position 1 = 71
Branch analysis from position: 71
Branch analysis from position: 55
Branch analysis from position: 53
1 jumps found. (Code = 42) Position 1 = 71
Branch analysis from position: 71
Branch analysis from position: 53
Branch analysis from position: 138
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 138
filename:       /in/ZAGS3
function name:  LLSDN\Token\toXML
number of ops:  143
compiled vars:  !0 = $tokens, !1 = $result, !2 = $nameAttribute, !3 = $token, !4 = $tagName
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  221     0  E >   RECV                                             !0      
  223     1        ASSIGN                                                   !1, '%3C%3Fxml+version%3D%221.0%22+encoding%3D%22UTF-8%22%3F%3E%0A'
  224     2        ASSIGN                                                   !2, null
  226     3      > FE_RESET_R                                       $7      !0, ->138
          4    > > FE_FETCH_R                                               $7, !3, ->138
  227     5    >   ASSIGN                                                   !4, null
  229     6        FETCH_OBJ_R                                      ~9      !3, 'type'
          7        FETCH_CLASS_CONSTANT                             ~10     'LLSDN%5CToken%5CType', 'Name'
          8        IS_IDENTICAL                                             ~9, ~10
          9      > JMPZ                                                     ~11, ->13
  230    10    >   FETCH_OBJ_R                                      ~12     !3, 'value'
         11        ASSIGN                                                   !2, ~12
  229    12      > JMP                                                      ->137
  232    13    >   INIT_NS_FCALL_BY_NAME                                    'LLSDN%5CToken%5Cin_array'
         14        CHECK_FUNC_ARG                                           
         15        FETCH_OBJ_FUNC_ARG                               $14     !3, 'type'
         16        SEND_FUNC_ARG                                            $14
         17        FETCH_CLASS_CONSTANT                             ~15     'LLSDN%5CToken%5CType', 'ItemSeparator'
         18        INIT_ARRAY                                       ~16     ~15
         19        FETCH_CLASS_CONSTANT                             ~17     'LLSDN%5CToken%5CType', 'PairSeparator'
         20        ADD_ARRAY_ELEMENT                                ~16     ~17
         21        SEND_VAL_EX                                              ~16
         22        SEND_VAL_EX                                              <true>
         23        DO_FCALL                                      0  $18     
         24      > JMPZ                                                     $18, ->27
  233    25    > > JMP                                                      ->4
  232    26*       JMP                                                      ->137
  236    27    >   FETCH_OBJ_R                                      ~19     !3, 'type'
  237    28        FETCH_CLASS_CONSTANT                             ~21     'LLSDN%5CToken%5CType', 'LeftMapDelimiter'
         29        CASE_STRICT                                              ~19, ~21
         30      > JMPNZ                                                    ~20, ->53
         31    >   FETCH_CLASS_CONSTANT                             ~22     'LLSDN%5CToken%5CType', 'RightMapDelimiter'
         32        CASE_STRICT                                              ~19, ~22
         33      > JMPNZ                                                    ~20, ->53
  238    34    >   FETCH_CLASS_CONSTANT                             ~23     'LLSDN%5CToken%5CType', 'LeftArrayDelimiter'
         35        CASE_STRICT                                              ~19, ~23
         36      > JMPNZ                                                    ~20, ->55
         37    >   FETCH_CLASS_CONSTANT                             ~24     'LLSDN%5CToken%5CType', 'RightArrayDelimiter'
         38        CASE_STRICT                                              ~19, ~24
         39      > JMPNZ                                                    ~20, ->55
  239    40    >   FETCH_CLASS_CONSTANT                             ~25     'LLSDN%5CToken%5CType', 'BooleanFalse'
         41        CASE_STRICT                                              ~19, ~25
         42      > JMPNZ                                                    ~20, ->57
         43    >   FETCH_CLASS_CONSTANT                             ~26     'LLSDN%5CToken%5CType', 'BooleanTrue'
         44        CASE_STRICT                                              ~19, ~26
         45      > JMPNZ                                                    ~20, ->57
  240    46    >   FETCH_CLASS_CONSTANT                             ~27     'LLSDN%5CToken%5CType', 'UUID'
         47        CASE_STRICT                                              ~19, ~27
         48      > JMPNZ                                                    ~20, ->59
  241    49    >   FETCH_CLASS_CONSTANT                             ~28     'LLSDN%5CToken%5CType', 'URI'
         50        CASE_STRICT                                              ~19, ~28
         51      > JMPNZ                                                    ~20, ->61
         52    > > JMP                                                      ->63
  237    53    >   QM_ASSIGN                                        ~29     'map'
         54      > JMP                                                      ->71
  238    55    >   QM_ASSIGN                                        ~29     'array'
         56      > JMP                                                      ->71
  239    57    >   QM_ASSIGN                                        ~29     'boolean'
         58      > JMP                                                      ->71
  240    59    >   QM_ASSIGN                                        ~29     'UUID'
         60      > JMP                                                      ->71
  241    61    >   QM_ASSIGN                                        ~29     'URI'
         62      > JMP                                                      ->71
  242    63    >   INIT_NS_FCALL_BY_NAME                                    'LLSDN%5CToken%5Cstrtolower'
         64        CHECK_FUNC_ARG                                           
         65        FETCH_OBJ_FUNC_ARG                               $30     !3, 'type'
         66        FETCH_OBJ_FUNC_ARG                               $31     $30, 'name'
         67        SEND_FUNC_ARG                                            $31
         68        DO_FCALL                                      0  $32     
         69        QM_ASSIGN                                        ~29     $32
         70      > JMP                                                      ->71
         71    >   FREE                                                     ~19
  236    72        ASSIGN                                                   !4, ~29
  245    73        ASSIGN_OP                                     8          !1, '%3C'
  247    74        INIT_NS_FCALL_BY_NAME                                    'LLSDN%5CToken%5Cstr_starts_with'
         75        SEND_VAL_EX                                              'Right', 'needle'
         76        CHECK_FUNC_ARG                                           'haystack'
         77        FETCH_OBJ_FUNC_ARG                               $35     !3, 'type'
         78        FETCH_OBJ_FUNC_ARG                               $36     $35, 'name'
         79        SEND_FUNC_ARG                                            $36, 'haystack'
         80        CHECK_UNDEF_ARGS                                         
         81        DO_FCALL                                      1  $37     
         82      > JMPZ                                                     $37, ->87
  248    83    >   CONCAT                                           ~38     '%2F', !4
         84        CONCAT                                           ~39     ~38, '%3E'
         85        ASSIGN_OP                                     8          !1, ~39
  249    86      > JMP                                                      ->4
  252    87    >   ASSIGN_OP                                     8          !1, !4
  254    88      > JMPZ                                                     !2, ->93
  255    89    >   CONCAT                                           ~42     '+name%3D%22', !2
         90        CONCAT                                           ~43     ~42, '%22'
         91        ASSIGN_OP                                     8          !1, ~43
  256    92        ASSIGN                                                   !2, null
  259    93    >   FETCH_OBJ_R                                      ~46     !3, 'type'
         94        FETCH_CLASS_CONSTANT                             ~47     'LLSDN%5CToken%5CType', 'Undef'
         95        IS_IDENTICAL                                             ~46, ~47
         96      > JMPZ                                                     ~48, ->99
  260    97    >   ASSIGN_OP                                     8          !1, '%2F%3E'
  261    98      > JMP                                                      ->4
  264    99    >   ASSIGN_OP                                     8          !1, '%3E'
  266   100        INIT_NS_FCALL_BY_NAME                                    'LLSDN%5CToken%5Cstr_starts_with'
        101        SEND_VAL_EX                                              'Left', 'needle'
        102        CHECK_FUNC_ARG                                           'haystack'
        103        FETCH_OBJ_FUNC_ARG                               $51     !3, 'type'
        104        FETCH_OBJ_FUNC_ARG                               $52     $51, 'name'
        105        SEND_FUNC_ARG                                            $52, 'haystack'
        106        CHECK_UNDEF_ARGS                                         
        107        DO_FCALL                                      1  $53     
        108      > JMPZ                                                     $53, ->110
  267   109    > > JMP                                                      ->4
  269   110    >   FETCH_OBJ_R                                      ~54     !3, 'type'
        111        FETCH_CLASS_CONSTANT                             ~55     'LLSDN%5CToken%5CType', 'RawBinary'
        112        IS_IDENTICAL                                             ~54, ~55
        113      > JMPZ                                                     ~56, ->124
  270   114    >   INIT_NS_FCALL_BY_NAME                                    'LLSDN%5CToken%5Cstrtr'
        115        CHECK_FUNC_ARG                                           
        116        FETCH_OBJ_FUNC_ARG                               $57     !3, 'value'
        117        SEND_FUNC_ARG                                            $57
        118        SEND_VAL_EX                                              <array>
        119        DO_FCALL                                      0  $58     
        120        CONCAT                                           ~59     '%3C%21%5BCDATA%5B', $58
        121        CONCAT                                           ~60     ~59, '%5D%5D%3E'
        122        QM_ASSIGN                                        ~61     ~60
        123      > JMP                                                      ->133
  271   124    >   INIT_NS_FCALL_BY_NAME                                    'LLSDN%5CToken%5Chtmlspecialchars'
        125        CHECK_FUNC_ARG                                           
        126        FETCH_OBJ_FUNC_ARG                               $62     !3, 'value'
        127        SEND_FUNC_ARG                                            $62
        128        FETCH_CONSTANT                                   ~63     'LLSDN%5CToken%5CENT_XML1'
        129        SEND_VAL_EX                                              ~63
        130        SEND_VAL_EX                                              'UTF-8'
        131        DO_FCALL                                      0  $64     
        132        QM_ASSIGN                                        ~61     $64
        133    >   ASSIGN_OP                                     8          !1, ~61
  273   134        CONCAT                                           ~66     '%3C%2F', !4
        135        CONCAT                                           ~67     ~66, '%3E'
        136        ASSIGN_OP                                     8          !1, ~67
  226   137    > > JMP                                                      ->4
        138    >   FE_FREE                                                  $7
  276   139        VERIFY_RETURN_TYPE                                       !1
        140      > RETURN                                                   !1
  277   141*       VERIFY_RETURN_TYPE                                       
        142*     > RETURN                                                   null

End of function llsdn%5Ctoken%5Ctoxml

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/ZAGS3
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/ZAGS3
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/ZAGS3
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) Po

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
144.68 ms | 1039 KiB | 21 Q