Esempio n. 1
0
 /**
  * @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);
 }
Esempio n. 2
0
 /**
  * @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));
 }
Esempio n. 3
0
 /**
  * @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));
 }
Esempio n. 4
0
 /**
  * @param ParserState $state
  * @return ParseResult
  */
 public function parse(ParserState $state)
 {
     return new ParseResult(new ParserState(array_slice($state->getCharacters(), 1), $state->getBraceCount()), null);
 }