2 namespace Masterminds\HTML5\Parser;
5 * Interface for stream readers.
7 * The parser only reads from streams. Various input sources can write
8 * an adapater to this InputStream.
10 * Currently provided InputStream implementations include
11 * FileInputStream and StringInputStream.
13 interface InputStream extends \Iterator
17 * Returns the current line that is being consumed.
19 * TODO: Move this to the scanner.
21 public function currentLine();
24 * Returns the current column of the current line that the tokenizer is at.
26 * Newlines are column 0. The first char after a newline is column 1.
28 * @TODO Move this to the scanner.
30 * @return int The column number.
32 public function columnOffset();
35 * Get all characters until EOF.
37 * This consumes characters until the EOF.
39 public function remainingChars();
42 * Read to a particular match (or until $max bytes are consumed).
44 * This operates on byte sequences, not characters.
46 * Matches as far as possible until we reach a certain set of bytes
47 * and returns the matched substring.
50 * @param string $bytes
53 * Maximum number of bytes to scan.
54 * @return mixed Index or false if no match is found. You should use strong
55 * equality when checking the result, since index could be 0.
57 public function charsUntil($bytes, $max = null);
60 * Returns the string so long as $bytes matches.
62 * Matches as far as possible with a certain set of bytes
63 * and returns the matched substring.
66 * @param string $bytes
67 * A mask of bytes to match. If ANY byte in this mask matches the
68 * current char, the pointer advances and the char is part of the
71 * The max number of chars to read.
73 public function charsWhile($bytes, $max = null);
76 * Unconsume one character.
79 * The number of characters to move the pointer back.
81 public function unconsume($howMany = 1);
84 * Retrieve the next character without advancing the pointer.
86 public function peek();