Lines Matching refs:cursor

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->currentLine, $cursor))) {
775 throw new ParseException(sprintf('Unexpected characters near "%s".', substr($this->currentLine, $cursor)));
1150 private function lexInlineQuotedString(int &$cursor = 0): string
1152 $quotation = $this->currentLine[$cursor];
1154 ++$cursor;
1162 $cursor += strspn($this->currentLine, ' ', $cursor);
1171 for (; \strlen($this->currentLine) > $cursor; ++$cursor) {
1172 switch ($this->currentLine[$cursor]) {
1176 } elseif (isset($this->currentLine[++$cursor])) {
1177 $value .= '\\'.$this->currentLine[$cursor];
1182 ++$cursor;
1184 if ("'" === $quotation && isset($this->currentLine[$cursor]) && "'" === $this->currentLine[$cursor]) {
1191 $value .= $this->currentLine[$cursor];
1207 $cursor = 0;
1214 private function lexUnquotedString(int &$cursor): string
1216 $offset = $cursor;
1217 $cursor += strcspn($this->currentLine, '[]{},: ', $cursor);
1219 if ($cursor === $offset) {
1223 return substr($this->currentLine, $offset, $cursor - $offset);
1226 private function lexInlineMapping(int &$cursor = 0): string
1228 return $this->lexInlineStructure($cursor, '}');
1231 private function lexInlineSequence(int &$cursor = 0): string
1233 return $this->lexInlineStructure($cursor, ']');
1236 private function lexInlineStructure(int &$cursor, string $closingTag): string
1238 $value = $this->currentLine[$cursor];
1239 ++$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];
1253 ++$cursor;
1256 $value .= $this->lexInlineMapping($cursor);
1259 $value .= $this->lexInlineSequence($cursor);
1262 $value .= $this->currentLine[$cursor];
1263 ++$cursor;
1269 $value .= $this->lexUnquotedString($cursor);
1272 if ($this->consumeWhitespaces($cursor)) {
1278 $cursor = 0;
1285 private function consumeWhitespaces(int &$cursor): bool
1290 $whitespaceOnlyTokenLength = strspn($this->currentLine, ' ', $cursor);
1292 $cursor += $whitespaceOnlyTokenLength;
1294 if (isset($this->currentLine[$cursor])) {
1299 $cursor = 0;