annotate vendor/masterminds/html5/src/HTML5/Parser/InputStream.php @ 19:fa3358dc1485 tip

Add ndrum files
author Chris Cannam
date Wed, 28 Aug 2019 13:14:47 +0100
parents 129ea1e6d783
children
rev   line source
Chris@0 1 <?php
Chris@17 2
Chris@0 3 namespace Masterminds\HTML5\Parser;
Chris@0 4
Chris@0 5 /**
Chris@0 6 * Interface for stream readers.
Chris@0 7 *
Chris@0 8 * The parser only reads from streams. Various input sources can write
Chris@0 9 * an adapater to this InputStream.
Chris@0 10 *
Chris@0 11 * Currently provided InputStream implementations include
Chris@0 12 * FileInputStream and StringInputStream.
Chris@17 13 *
Chris@17 14 * @deprecated since 2.4, to remove in 3.0. Use a string in the scanner instead.
Chris@0 15 */
Chris@0 16 interface InputStream extends \Iterator
Chris@0 17 {
Chris@0 18 /**
Chris@0 19 * Returns the current line that is being consumed.
Chris@0 20 *
Chris@0 21 * TODO: Move this to the scanner.
Chris@0 22 */
Chris@0 23 public function currentLine();
Chris@0 24
Chris@0 25 /**
Chris@0 26 * Returns the current column of the current line that the tokenizer is at.
Chris@0 27 *
Chris@0 28 * Newlines are column 0. The first char after a newline is column 1.
Chris@0 29 *
Chris@0 30 * @TODO Move this to the scanner.
Chris@0 31 *
Chris@0 32 * @return int The column number.
Chris@0 33 */
Chris@0 34 public function columnOffset();
Chris@0 35
Chris@0 36 /**
Chris@0 37 * Get all characters until EOF.
Chris@0 38 *
Chris@0 39 * This consumes characters until the EOF.
Chris@0 40 */
Chris@0 41 public function remainingChars();
Chris@0 42
Chris@0 43 /**
Chris@0 44 * Read to a particular match (or until $max bytes are consumed).
Chris@0 45 *
Chris@0 46 * This operates on byte sequences, not characters.
Chris@0 47 *
Chris@0 48 * Matches as far as possible until we reach a certain set of bytes
Chris@0 49 * and returns the matched substring.
Chris@0 50 *
Chris@0 51 * @see strcspn
Chris@17 52 *
Chris@17 53 * @param string $bytes Bytes to match.
Chris@17 54 * @param int $max Maximum number of bytes to scan.
Chris@17 55 *
Chris@0 56 * @return mixed Index or false if no match is found. You should use strong
Chris@17 57 * equality when checking the result, since index could be 0.
Chris@0 58 */
Chris@0 59 public function charsUntil($bytes, $max = null);
Chris@0 60
Chris@0 61 /**
Chris@0 62 * Returns the string so long as $bytes matches.
Chris@0 63 *
Chris@0 64 * Matches as far as possible with a certain set of bytes
Chris@0 65 * and returns the matched substring.
Chris@0 66 *
Chris@0 67 * @see strspn
Chris@17 68 *
Chris@17 69 * @param string $bytes A mask of bytes to match. If ANY byte in this mask matches the
Chris@17 70 * current char, the pointer advances and the char is part of the
Chris@17 71 * substring.
Chris@17 72 * @param int $max The max number of chars to read.
Chris@0 73 */
Chris@0 74 public function charsWhile($bytes, $max = null);
Chris@0 75
Chris@0 76 /**
Chris@0 77 * Unconsume one character.
Chris@0 78 *
Chris@17 79 * @param int $howMany The number of characters to move the pointer back.
Chris@0 80 */
Chris@0 81 public function unconsume($howMany = 1);
Chris@0 82
Chris@0 83 /**
Chris@0 84 * Retrieve the next character without advancing the pointer.
Chris@0 85 */
Chris@0 86 public function peek();
Chris@0 87 }