/** * @param ParserState $state * @return ParseResult */ public function parse(ParserState $state) { $parsingKey = $state->isParsingKey(); if ($state->getHeadCharacter() === Tokens::NEW_LINE) { $parsingKey = true; } return new ParseResult(new ParserState(array_slice($state->getCharacters(), 1), $state->getBraceCount(), $state->isParsingString(), $parsingKey), null); }
/** * @param ParserState $state * @return ParseResult */ public function parse(ParserState $state) { $characters = $state->getCharacters(); $keyName = ''; while ($this->canParseKey($characters)) { $keyName .= array_shift($characters); } $this->checkForBadlyFormedKey($keyName); return new ParseResult(new ParserState($characters, $state->getBraceCount(), false, true), new Key($keyName)); }
/** * @param ParserState $state * @return ParseResult */ public function parse(ParserState $state) { $characters = $state->getCharacters(); $value = ''; if (true === ($this->isQuotedString = $this->isQuotedString($state->getHeadCharacter()))) { $this->quoteCharacter = array_shift($characters); } while ($this->canStillParseValue($characters)) { $value .= array_shift($characters); } if (count($characters) && $characters[0] === $this->quoteCharacter) { array_shift($characters); } return new ParseResult(new ParserState($characters, $state->getBraceCount()), $this->getObjectForValue($value)); }
/** * @param ParserState $state * @return ParseResult */ public function parse(ParserState $state) { return new ParseResult(new ParserState(array_slice($state->getCharacters(), 1), $state->getBraceCount()), null); }