Lines Matching refs:this

62         $this->filename = $filename;
65 return $this->parse(file_get_contents($filename), $flags);
67 $this->filename = null;
84 …new ParseException('The YAML value does not appear to be valid UTF-8.', -1, null, $this->filename);
87 $this->refs = [];
97 $data = $this->doParse($value, $flags);
102 $this->refsBeingParsed = [];
103 $this->offset = 0;
104 $this->lines = [];
105 $this->currentLine = '';
106 $this->numberOfParsedLines = 0;
107 $this->refs = [];
108 $this->skippedLineNumbers = [];
109 $this->locallySkippedLineNumbers = [];
110 $this->totalNumberOfLines = null;
118 $this->currentLineNb = -1;
119 $this->currentLine = '';
120 $value = $this->cleanup($value);
121 $this->lines = explode("\n", $value);
122 $this->numberOfParsedLines = \count($this->lines);
123 $this->locallySkippedLineNumbers = [];
125 if (null === $this->totalNumberOfLines) {
126 $this->totalNumberOfLines = $this->numberOfParsedLines;
129 if (!$this->moveToNextLine()) {
137 while ($this->isCurrentLineEmpty()) {
138 if (!$this->moveToNextLine()) {
144 …if (null !== ($tag = $this->getLineTag($this->currentLine, $flags, false)) && !$this->moveToNextLi…
149 if ($this->isCurrentLineEmpty()) {
154 if ("\t" === $this->currentLine[0]) {
155 …ML file cannot contain tabs as indentation.', $this->getRealCurrentLineNb() + 1, $this->currentLin…
158 Inline::initialize($flags, $this->getRealCurrentLineNb(), $this->filename);
161 …if ('-' === $this->currentLine[0] && self::preg_match('#^\-((?P<leadspaces>\s+)(?P<value>.+))?$#u'…
163 …t define a sequence item when in a mapping.', $this->getRealCurrentLineNb() + 1, $this->currentLin…
169 $this->refsBeingParsed[] = $isRef;
174 …w ParseException('Complex mappings are not supported.', $this->getRealCurrentLineNb() + 1, $this->…
180 $currentLineNumber = $this->getRealCurrentLineNb();
183 $sequenceYaml = substr($this->currentLine, $sequenceIndentation);
184 $sequenceYaml .= "\n".$this->getNextEmbedBlock($sequenceIndentation, true);
186 $data[] = $this->parseBlock($currentLineNumber, rtrim($sequenceYaml), $flags);
188 …$data[] = $this->parseBlock($this->getRealCurrentLineNb() + 1, $this->getNextEmbedBlock(null, true…
189 … } elseif (null !== $subTag = $this->getLineTag(ltrim($values['value'], ' '), $flags)) {
192 … $this->parseBlock($this->getRealCurrentLineNb() + 1, $this->getNextEmbedBlock(null, true), $flags)
199 …e::REGEX_QUOTED_STRING.'|[^ \'"\{\[].*?) *\:(\s+(?P<value>.+?))?\s*$#u', $this->trimTag($values['v…
204 if ($this->isNextLineIndented()) {
205 …$block .= "\n".$this->getNextEmbedBlock($this->getCurrentLineIndentation() + \strlen($values['lead…
208 $data[] = $this->parseBlock($this->getRealCurrentLineNb(), $block, $flags);
210 $data[] = $this->parseValue($values['value'], $flags, $context);
214 $this->refs[$isRef] = end($data);
215 array_pop($this->refsBeingParsed);
218 …:!?!php/const:)?[^ \'"\[\{!].*?)) *\:(( |\t)++(?P<value>.+))?$#u', rtrim($this->currentLine), $val…
222 …annot define a mapping item when in a sequence.', $this->currentLineNb + 1, $this->currentLine, $t…
229 $e->setParsedLine($this->getRealCurrentLineNb() + 1);
230 $e->setSnippet($this->currentLine);
236 …supported. Quote your evaluable mapping keys instead.', $this->getRealCurrentLineNb() + 1, $this->…
249 if (!\array_key_exists($refName, $this->refs)) {
250 … if (false !== $pos = array_search($refName, $this->refsBeingParsed, true)) {
251 …ay_merge(\array_slice($this->refsBeingParsed, $pos), [$refName])), $refName), $this->currentLineNb…
254 …('Reference "%s" does not exist.', $refName), $this->getRealCurrentLineNb() + 1, $this->currentLin…
257 $refValue = $this->refs[$refName];
264 …ed with a scalar value instead of an array.', $this->getRealCurrentLineNb() + 1, $this->currentLin…
272 $value = $this->getNextEmbedBlock();
274 … $parsed = $this->parseBlock($this->getRealCurrentLineNb() + 1, $value, $flags);
281 …ed with a scalar value instead of an array.', $this->getRealCurrentLineNb() + 1, $this->currentLin…
294 …ew ParseException('Merge items must be arrays.', $this->getRealCurrentLineNb() + 1, $parsedItem, $
307 $this->refsBeingParsed[] = $isRef;
314 …s['value'] || 0 === strpos($values['value'], '#') || (null !== $subTag = $this->getLineTag($values…
317 if (!$this->isNextLineIndented() && !$this->isNextLineUnIndentedCollection()) {
327 …xception(sprintf('Duplicate key "%s" detected.', $key), $this->getRealCurrentLineNb() + 1, $this->…
331 $realCurrentLineNbKey = $this->getRealCurrentLineNb();
332 … $value = $this->parseBlock($this->getRealCurrentLineNb() + 1, $this->getNextEmbedBlock(), $flags);
334 $this->refs[$refMatches['ref']] = $value;
350 …tion(sprintf('Duplicate key "%s" detected.', $key), $realCurrentLineNbKey + 1, $this->currentLine);
354 $value = $this->parseValue(rtrim($values['value']), $flags, $context);
360 …xception(sprintf('Duplicate key "%s" detected.', $key), $this->getRealCurrentLineNb() + 1, $this->…
364 $this->refs[$isRef] = $data[$key];
365 array_pop($this->refsBeingParsed);
367 } elseif ('"' === $this->currentLine[0] || "'" === $this->currentLine[0]) {
369 …throw new ParseException('Unable to parse.', $this->getRealCurrentLineNb() + 1, $this->currentLine…
373 return Inline::parse($this->lexInlineQuotedString(), $flags, $this->refs);
375 $e->setParsedLine($this->getRealCurrentLineNb() + 1);
376 $e->setSnippet($this->currentLine);
380 } elseif ('{' === $this->currentLine[0]) {
382 …throw new ParseException('Unable to parse.', $this->getRealCurrentLineNb() + 1, $this->currentLine…
386 $parsedMapping = Inline::parse($this->lexInlineMapping(), $flags, $this->refs);
388 while ($this->moveToNextLine()) {
389 if (!$this->isCurrentLineEmpty()) {
390 …throw new ParseException('Unable to parse.', $this->getRealCurrentLineNb() + 1, $this->currentLine…
396 $e->setParsedLine($this->getRealCurrentLineNb() + 1);
397 $e->setSnippet($this->currentLine);
401 } elseif ('[' === $this->currentLine[0]) {
403 …throw new ParseException('Unable to parse.', $this->getRealCurrentLineNb() + 1, $this->currentLine…
407 … $parsedSequence = Inline::parse($this->lexInlineSequence(), $flags, $this->refs);
409 while ($this->moveToNextLine()) {
410 if (!$this->isCurrentLineEmpty()) {
411 …throw new ParseException('Unable to parse.', $this->getRealCurrentLineNb() + 1, $this->currentLine…
417 $e->setParsedLine($this->getRealCurrentLineNb() + 1);
418 $e->setSnippet($this->currentLine);
424 if ('---' === $this->currentLine) {
425 …xception('Multiple documents are not supported.', $this->currentLineNb + 1, $this->currentLine, $t…
428 …if ($deprecatedUsage = (isset($this->currentLine[1]) && '?' === $this->currentLine[0] && ' ' === $
429 …w ParseException('Complex mappings are not supported.', $this->getRealCurrentLineNb() + 1, $this->…
433 if (\is_string($value) && $this->lines[0] === trim($value)) {
435 $value = Inline::parse($this->lines[0], $flags, $this->refs);
437 $e->setParsedLine($this->getRealCurrentLineNb() + 1);
438 $e->setSnippet($this->currentLine);
447 if (0 === $this->currentLineNb) {
452 foreach ($this->lines as $line) {
458 … if (0 === $this->offset && !$deprecatedUsage && isset($line[0]) && ' ' === $line[0]) {
459 …throw new ParseException('Unable to parse.', $this->getRealCurrentLineNb() + 1, $this->currentLine…
463 …alues are not allowed in multi-line blocks.', $this->getRealCurrentLineNb() + 1, $this->currentLin…
497 …throw new ParseException('Unable to parse.', $this->getRealCurrentLineNb() + 1, $this->currentLine…
499 } while ($this->moveToNextLine());
520 $skippedLineNumbers = $this->skippedLineNumbers;
522 foreach ($this->locallySkippedLineNumbers as $lineNumber) {
532 $parser->totalNumberOfLines = $this->totalNumberOfLines;
534 $parser->refs = &$this->refs;
535 $parser->refsBeingParsed = $this->refsBeingParsed;
547 $realCurrentLineNumber = $this->currentLineNb + $this->offset;
549 foreach ($this->skippedLineNumbers as $skippedLineNumber) {
565 if (' ' !== ($this->currentLine[0] ?? '')) {
569 return \strlen($this->currentLine) - \strlen(ltrim($this->currentLine, ' '));
582 $oldLineIndentation = $this->getCurrentLineIndentation();
584 if (!$this->moveToNextLine()) {
596 if ($this->isCurrentLineEmpty() || $this->isCurrentLineComment()) {
597 $EOF = !$this->moveToNextLine();
603 $newIndent = $this->getCurrentLineIndentation();
608 $this->moveToPreviousLine();
611 $unindentedEmbedBlock = $this->isStringUnIndentedCollectionItem();
613 if (!$this->isCurrentLineEmpty() && 0 === $newIndent && !$unindentedEmbedBlock) {
614 …ow new ParseException('Indentation problem.', $this->getRealCurrentLineNb() + 1, $this->currentLin…
622 if ($this->getCurrentLineIndentation() >= $newIndent) {
623 $data[] = substr($this->currentLine, $newIndent ?? 0);
624 } elseif ($this->isCurrentLineEmpty() || $this->isCurrentLineComment()) {
625 $data[] = $this->currentLine;
627 $this->moveToPreviousLine();
635 $this->moveToPreviousLine();
640 $isItUnindentedCollection = $this->isStringUnIndentedCollectionItem();
641 $isItComment = $this->isCurrentLineComment();
643 while ($this->moveToNextLine()) {
645 $isItUnindentedCollection = $this->isStringUnIndentedCollectionItem();
646 $isItComment = $this->isCurrentLineComment();
649 $indent = $this->getCurrentLineIndentation();
651 …if ($isItUnindentedCollection && !$this->isCurrentLineEmpty() && !$this->isStringUnIndentedCollect…
652 $this->moveToPreviousLine();
656 if ($this->isCurrentLineBlank()) {
657 $data[] = substr($this->currentLine, $newIndent);
662 $data[] = substr($this->currentLine, $newIndent);
663 } elseif ($this->isCurrentLineComment()) {
664 $data[] = $this->currentLine;
666 $this->moveToPreviousLine();
670 …ow new ParseException('Indentation problem.', $this->getRealCurrentLineNb() + 1, $this->currentLin…
679 return (\count($this->lines) - 1) > $this->currentLineNb;
687 if ($this->currentLineNb >= $this->numberOfParsedLines - 1) {
691 $this->currentLine = $this->lines[++$this->currentLineNb];
701 if ($this->currentLineNb < 1) {
705 $this->currentLine = $this->lines[--$this->currentLineNb];
730 if (!\array_key_exists($value, $this->refs)) {
731 if (false !== $pos = array_search($value, $this->refsBeingParsed, true)) {
732 …rray_merge(\array_slice($this->refsBeingParsed, $pos), [$value])), $value), $this->currentLineNb +…
735 …printf('Reference "%s" does not exist.', $value), $this->currentLineNb + 1, $this->currentLine, $t…
738 return $this->refs[$value];
744 …$data = $this->parseBlockScalar($matches['separator'], preg_replace('#\d+#', '', $modifiers), abs(…
759 $cursor = \strlen(rtrim($this->currentLine)) - \strlen(rtrim($value));
761 return Inline::parse($this->lexInlineMapping($cursor), $flags, $this->refs);
763 $cursor = \strlen(rtrim($this->currentLine)) - \strlen(rtrim($value));
765 return Inline::parse($this->lexInlineSequence($cursor), $flags, $this->refs);
771 $cursor = \strlen(rtrim($this->currentLine)) - \strlen(rtrim($value));
772 … $parsedValue = Inline::parse($this->lexInlineQuotedString($cursor), $flags, $this->refs);
774 …if (isset($this->currentLine[$cursor]) && preg_replace('/\s*(#.*)?$/A', '', substr($this->currentL…
775 …ow new ParseException(sprintf('Unexpected characters near "%s".', substr($this->currentLine, $curs…
782 while ($this->moveToNextLine()) {
784 if (0 === $this->getCurrentLineIndentation()) {
785 $this->moveToPreviousLine();
790 $lines[] = trim($this->currentLine);
806 Inline::$parsedLineNumber = $this->getRealCurrentLineNb();
808 $parsedValue = Inline::parse($value, $flags, $this->refs);
811 …olon cannot be used in an unquoted mapping value.', $this->getRealCurrentLineNb() + 1, $value, $th…
817 $e->setParsedLine($this->getRealCurrentLineNb() + 1);
818 $e->setSnippet($this->currentLine);
833 $notEOF = $this->moveToNextLine();
838 $isCurrentLineBlank = $this->isCurrentLineBlank();
844 if ($notEOF = $this->moveToNextLine()) {
846 $isCurrentLineBlank = $this->isCurrentLineBlank();
852 $currentLineLength = \strlen($this->currentLine);
854 for ($i = 0; $i < $currentLineLength && ' ' === $this->currentLine[$i]; ++$i) {
865 self::preg_match($pattern, $this->currentLine, $matches)
868 if ($isCurrentLineBlank && \strlen($this->currentLine) > $indentation) {
869 $blockLines[] = substr($this->currentLine, $indentation);
877 if ($notEOF = $this->moveToNextLine()) {
878 $isCurrentLineBlank = $this->isCurrentLineBlank();
887 $this->moveToPreviousLine();
888 } elseif (!$notEOF && !$this->isCurrentLineLastLineInDocument()) {
940 $currentIndentation = $this->getCurrentLineIndentation();
944 $EOF = !$this->moveToNextLine();
949 } while (!$EOF && ($this->isCurrentLineEmpty() || $this->isCurrentLineComment()));
955 $ret = $this->getCurrentLineIndentation() > $currentIndentation;
958 $this->moveToPreviousLine();
969 return $this->isCurrentLineBlank() || $this->isCurrentLineComment();
977 return '' === $this->currentLine || '' === trim($this->currentLine, ' ');
986 …$ltrimmedLine = '' !== $this->currentLine && ' ' === $this->currentLine[0] ? ltrim($this->currentL…
993 return ($this->offset + $this->currentLineNb) >= ($this->totalNumberOfLines - 1);
1008 $this->offset += $count;
1014 $this->offset += substr_count($value, "\n") - substr_count($trimmedValue, "\n");
1022 $this->offset += substr_count($value, "\n") - substr_count($trimmedValue, "\n");
1037 $currentIndentation = $this->getCurrentLineIndentation();
1041 $EOF = !$this->moveToNextLine();
1046 } while (!$EOF && ($this->isCurrentLineEmpty() || $this->isCurrentLineComment()));
1052 …$ret = $this->getCurrentLineIndentation() === $currentIndentation && $this->isStringUnIndentedColl…
1055 $this->moveToPreviousLine();
1066 return '-' === rtrim($this->currentLine) || 0 === strpos($this->currentLine, '- ');
1132 if ($nextLineCheck && !$this->isNextLineIndented()) {
1140 …The built-in tag "!%s" is not implemented.', $tag), $this->getRealCurrentLineNb() + 1, $value, $th…
1147 …PARSE_CUSTOM_TAGS" to use "%s".', $matches['tag']), $this->getRealCurrentLineNb() + 1, $value, $th…
1152 $quotation = $this->currentLine[$cursor];
1162 $cursor += strspn($this->currentLine, ' ', $cursor);
1165 if ($this->isCurrentLineBlank()) {
1171 for (; \strlen($this->currentLine) > $cursor; ++$cursor) {
1172 switch ($this->currentLine[$cursor]) {
1176 } elseif (isset($this->currentLine[++$cursor])) {
1177 $value .= '\\'.$this->currentLine[$cursor];
1184 …if ("'" === $quotation && isset($this->currentLine[$cursor]) && "'" === $this->currentLine[$cursor…
1191 $value .= $this->currentLine[$cursor];
1195 if ($this->isCurrentLineBlank()) {
1198 } elseif ('\\' === $this->currentLine[-1]) {
1206 if ($this->hasMoreLines()) {
1209 } while ($this->moveToNextLine());
1217 $cursor += strcspn($this->currentLine, '[]{},: ', $cursor);
1223 return substr($this->currentLine, $offset, $cursor - $offset);
1228 return $this->lexInlineStructure($cursor, '}');
1233 return $this->lexInlineStructure($cursor, ']');
1238 $value = $this->currentLine[$cursor];
1242 $this->consumeWhitespaces($cursor);
1244 while (isset($this->currentLine[$cursor])) {
1245 switch ($this->currentLine[$cursor]) {
1248 $value .= $this->lexInlineQuotedString($cursor);
1252 $value .= $this->currentLine[$cursor];
1256 $value .= $this->lexInlineMapping($cursor);
1259 $value .= $this->lexInlineSequence($cursor);
1262 $value .= $this->currentLine[$cursor];
1269 $value .= $this->lexUnquotedString($cursor);
1272 if ($this->consumeWhitespaces($cursor)) {
1277 if ($this->hasMoreLines()) {
1280 } while ($this->moveToNextLine());
1290 $whitespaceOnlyTokenLength = strspn($this->currentLine, ' ', $cursor);
1294 if (isset($this->currentLine[$cursor])) {
1298 if ($this->hasMoreLines()) {
1301 } while ($this->moveToNextLine());