Lines Matching refs:scalar

266 …public static function parseScalar(string $scalar, int $flags = 0, array $delimiters = null, int &…  argument
268 if (\in_array($scalar[$i], ['"', "'"])) {
270 $output = self::parseQuotedScalar($scalar, $i);
273 $tmp = ltrim(substr($scalar, $i), ' ');
275 … one of "%s".', implode('', $delimiters)), self::$parsedLineNumber + 1, $scalar, self::$parsedFile…
278 …ion(sprintf('Unexpected characters (%s).', substr($scalar, $i)), self::$parsedLineNumber + 1, $sca…
284 $output = substr($scalar, $i);
291 …} elseif (Parser::preg_match('/^(.*?)('.implode('|', $delimiters).')/', substr($scalar, $i), $matc…
296 …throw new ParseException(sprintf('Malformed inline YAML string: %s.', $scalar), self::$parsedLineN…
317 private static function parseQuotedScalar(string $scalar, int &$i): string argument
319 if (!Parser::preg_match('/'.self::REGEX_QUOTED_STRING.'/Au', substr($scalar, $i), $match)) {
320 …rintf('Malformed inline YAML string: %s.', substr($scalar, $i)), self::$parsedLineNumber + 1, $sca…
326 if ('"' == $scalar[$i]) {
541 private static function evaluateScalar(string $scalar, int $flags, array $references = []) argument
543 $scalar = trim($scalar);
544 $scalarLower = strtolower($scalar);
546 if (0 === strpos($scalar, '*')) {
547 if (false !== $pos = strpos($scalar, '#')) {
548 $value = substr($scalar, 1, $pos - 2);
550 $value = substr($scalar, 1);
567 case '' === $scalar:
568 case '~' === $scalar:
574 case '!' === $scalar[0]:
576 case 0 === strpos($scalar, '!!str '):
577 return (string) substr($scalar, 6);
578 case 0 === strpos($scalar, '! '):
579 return substr($scalar, 2);
580 case 0 === strpos($scalar, '!php/object'):
582 return unserialize(self::parseScalar(substr($scalar, 12)));
586 …n parsing a YAML file has been disabled.', self::$parsedLineNumber + 1, $scalar, self::$parsedFile…
590 case 0 === strpos($scalar, '!php/const'):
593 … if (\defined($const = self::parseScalar(substr($scalar, 11), 0, null, $i, false))) {
597 …e constant "%s" is not defined.', $const), self::$parsedLineNumber + 1, $scalar, self::$parsedFile…
600 …ass the "Yaml::PARSE_CONSTANT" flag to the parser?', $scalar), self::$parsedLineNumber + 1, $scala…
604 case 0 === strpos($scalar, '!!float '):
605 return (float) substr($scalar, 8);
606 case 0 === strpos($scalar, '!!binary '):
607 return self::evaluateBinaryScalar(substr($scalar, 9));
609 …ot be parsed as it uses an unsupported built-in tag.', $scalar), self::$parsedLineNumber, $scalar,…
614 … case '+' === $scalar[0] || '-' === $scalar[0] || '.' === $scalar[0] || is_numeric($scalar[0]):
616 case Parser::preg_match('{^[+-]?[0-9][0-9_]*$}', $scalar):
617 $scalar = str_replace('_', '', (string) $scalar);
620 case ctype_digit($scalar):
621 $raw = $scalar;
622 $cast = (int) $scalar;
624 … return '0' == $scalar[0] ? octdec($scalar) : (((string) $raw == (string) $cast) ? $cast : $raw);
625 case '-' === $scalar[0] && ctype_digit(substr($scalar, 1)):
626 $raw = $scalar;
627 $cast = (int) $scalar;
629 … return '0' == $scalar[1] ? octdec($scalar) : (((string) $raw === (string) $cast) ? $cast : $raw);
630 case is_numeric($scalar):
631 case Parser::preg_match(self::getHexRegex(), $scalar):
632 $scalar = str_replace('_', '', $scalar);
634 return '0x' === $scalar[0].$scalar[1] ? hexdec($scalar) : (float) $scalar;
640 case Parser::preg_match('/^(-|\+)?[0-9][0-9_]*(\.[0-9_]+)?$/', $scalar):
641 return (float) str_replace('_', '', $scalar);
642 case Parser::preg_match(self::getTimestampRegex(), $scalar):
645 return new \DateTime($scalar, new \DateTimeZone('UTC'));
650 $time = strtotime($scalar);
657 return (string) $scalar;
692 public static function evaluateBinaryScalar(string $scalar): string argument
694 $parsedBinaryData = self::parseScalar(preg_replace('/\s/', '', $scalar));
697 …tes given).', \strlen($parsedBinaryData)), self::$parsedLineNumber + 1, $scalar, self::$parsedFile…
701 … invalid characters.', $parsedBinaryData), self::$parsedLineNumber + 1, $scalar, self::$parsedFile…