Lines Matching defs:line

362     foreach ($exploded as $line) {

363 $newValue .= "\n" . $spaces . ($line);
415 $line = $Source[$i];
417 $this->indent = strlen($line) - strlen(ltrim($line));
419 $line = self::stripIndent($line, $this->indent);
420 if (self::isComment($line)) continue;
421 if (self::isEmpty($line)) continue;
424 $literalBlockStyle = self::startsLiteralBlock($line);
426 $line = rtrim ($line, $literalBlockStyle . " \n");
428 $line .= $this->LiteralPlaceHolder;
436 while (++$i < $cnt && self::greedilyNeedNextLine($line)) {
437 $line = rtrim ($line, " \n\t\r") . ' ' . ltrim ($Source[$i], " \t");
443 if (strpos ($line, '#')) {
444 if (strpos ($line, '"') === false && strpos ($line, "'") === false)
445 $line = preg_replace('/\s+#(.+)$/','',$line);
448 $lineArray = $this->_parseLine($line);
483 * @param string $line A line from the YAML file
485 private function _parseLine($line) {
486 if (!$line) return array();
487 $line = trim($line);
488 if (!$line) return array();
492 $group = $this->nodeContainsGroup($line);
494 $this->addGroup($line, $group);
495 $line = $this->stripGroup ($line, $group);
498 if ($this->startsMappedSequence($line))
499 return $this->returnMappedSequence($line);
501 if ($this->startsMappedValue($line))
502 return $this->returnMappedValue($line);
504 if ($this->isArrayElement($line))
505 return $this->returnArrayElement($line);
507 if ($this->isPlainArray($line))
508 return $this->returnPlainArray($line);
511 return $this->returnKeyValuePair($line);
720 private function literalBlockContinues ($line, $lineIndent) {
721 if (!trim($line)) return true;
722 if (strlen($line) - strlen(ltrim($line)) > $lineIndent) return true;
824 private static function startsLiteralBlock ($line) {
825 $lastChar = substr (trim($line), -1);
829 if (preg_match ('#<.*?>$#', $line)) return false;
833 private static function greedilyNeedNextLine($line) {
834 $line = trim ($line);
835 if (!strlen($line)) return false;
836 if (substr ($line, -1, 1) == ']') return false;
837 if ($line[0] == '[') return true;
838 if (preg_match ('#^[^:]+?:\s*\[#', $line)) return true;
842 private function addLiteralLine ($literalBlock, $line, $literalBlockStyle, $indent = -1) {
843 $line = self::stripIndent($line, $indent);
845 $line = self::stripIndent($line);
847 $line = rtrim ($line, "\r\n\t ") . "\n";
849 return $literalBlock . $line;
851 if (strlen($line) == 0)
853 if ($line == "\n" && $literalBlockStyle == '>') {
856 if ($line != "\n")
857 $line = trim ($line, "\r\n ") . " ";
858 return $literalBlock . $line;
871 private static function stripIndent ($line, $indent = -1) {
872 if ($indent == -1) $indent = strlen($line) - strlen(ltrim($line));
873 return substr ($line, $indent);
901 private static function isComment ($line) {
902 if (!$line) return false;
903 if ($line[0] == '#') return true;
904 if (trim($line, " \r\n\t") == '---') return true;
908 private static function isEmpty ($line) {
909 return (trim ($line) === '');
913 private function isArrayElement ($line) {
914 if (!$line) return false;
915 if ($line[0] != '-') return false;
916 if (strlen ($line) > 3)
917 if (substr($line,0,3) == '---') return false;
922 private function isHashElement ($line) {
923 return strpos($line, ':');
926 private function isLiteral ($line) {
927 if ($this->isArrayElement($line)) return false;
928 if ($this->isHashElement($line)) return false;
941 private function startsMappedSequence ($line) {
942 return ($line[0] == '-' && substr ($line, -1, 1) == ':');
945 private function returnMappedSequence ($line) {
947 $key = self::unquote(trim(substr($line,1,-1)));
949 $this->delayedPath = array(strpos ($line, $key) + $this->indent => $key);
953 private function returnMappedValue ($line) {
955 $key = self::unquote (trim(substr($line,0,-1)));
960 private function startsMappedValue ($line) {
961 return (substr ($line, -1, 1) == ':');
964 private function isPlainArray ($line) {
965 return ($line[0] == '[' && substr ($line, -1, 1) == ']');
968 private function returnPlainArray ($line) {
969 return $this->_toType($line);
972 private function returnKeyValuePair ($line) {
975 if (strpos ($line, ':')) {
978 if (($line[0] == '"' || $line[0] == "'") && preg_match('/^(["\'](.*)["\'](\s)*:)/',$line,$matches)) {
979 $value = trim(str_replace($matches[1],'',$line));
983 $explode = explode(':',$line);
993 $array = array ($line);
1000 private function returnArrayElement ($line) {
1001 if (strlen($line) <= 1) return array(array()); // Weird %)
1003 $value = trim(substr($line,1));
1010 private function nodeContainsGroup ($line) {
1012 if (strpos($line, '&') === false && strpos($line, '*') === false) return false; // Please die fast ;-)
1013 if ($line[0] == '&' && preg_match('/^(&['.$symbolsForReference.']+)/', $line, $matches)) return $matches[1];
1014 if ($line[0] == '*' && preg_match('/^(\*['.$symbolsForReference.']+)/', $line, $matches)) return $matches[1];
1015 if (preg_match('/(&['.$symbolsForReference.']+)$/', $line, $matches)) return $matches[1];
1016 if (preg_match('/(\*['.$symbolsForReference.']+$)/', $line, $matches)) return $matches[1];
1017 if (preg_match ('#^\s*<<\s*:\s*(\*[^\s]+).*$#', $line, $matches)) return $matches[1];
1022 private function addGroup ($line, $group) {
1028 private function stripGroup ($line, $group) {
1029 $line = trim(str_replace($group, '', $line));
1030 return $line;
1034 // Enable use of Spyc from command line