mirror of
https://github.com/cerbero90/json-parser.git
synced 2025-01-17 04:58:15 +01:00
Add being in root to conditions to buffer a token
This commit is contained in:
parent
690fb2c0bc
commit
419ced2621
@ -202,7 +202,8 @@ class State
|
||||
*/
|
||||
public function shouldBufferToken(Token $token): bool
|
||||
{
|
||||
return $this->pointerMatchesTree()
|
||||
return $this->tree->depth() >= 0
|
||||
&& $this->pointerMatchesTree()
|
||||
&& ($this->treeIsDeep() || ($token->isValue() && !$this->expectsKey()));
|
||||
}
|
||||
|
||||
@ -270,14 +271,4 @@ class State
|
||||
{
|
||||
return $this->tree->inObject();
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the tree is within the JSON root
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function inRoot(): bool
|
||||
{
|
||||
return $this->tree->depth() >= 0;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user