mirror of
https://github.com/cerbero90/json-parser.git
synced 2025-01-17 04:58:15 +01:00
Move logic to traverse a key to the string token
This commit is contained in:
parent
72c61d55cb
commit
690fb2c0bc
@ -37,6 +37,10 @@ class ScalarString extends Token
|
||||
{
|
||||
parent::mutateState($state);
|
||||
|
||||
if ($state->expectsKey() && $state->shouldTrackTree()) {
|
||||
$state->traverseKey($this);
|
||||
}
|
||||
|
||||
if ($this->isKey = $state->expectsKey()) {
|
||||
$state->doNotExpectKey();
|
||||
}
|
||||
|
@ -82,11 +82,7 @@ abstract class Token implements Stringable
|
||||
$state->traverseArray();
|
||||
}
|
||||
|
||||
if ($this->isString() && $state->expectsKey() && $state->shouldTrackTree()) {
|
||||
$state->traverseKey($this);
|
||||
}
|
||||
|
||||
if ($state->inRoot() && $state->shouldBufferToken($this)) {
|
||||
if ($state->shouldBufferToken($this)) {
|
||||
$state->bufferToken($this);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user