Mercurial > hg > isophonics-drupal-site
comparison vendor/masterminds/html5/src/HTML5/Parser/InputStream.php @ 0:4c8ae668cc8c
Initial import (non-working)
author | Chris Cannam |
---|---|
date | Wed, 29 Nov 2017 16:09:58 +0000 |
parents | |
children | 129ea1e6d783 |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:4c8ae668cc8c |
---|---|
1 <?php | |
2 namespace Masterminds\HTML5\Parser; | |
3 | |
4 /** | |
5 * Interface for stream readers. | |
6 * | |
7 * The parser only reads from streams. Various input sources can write | |
8 * an adapater to this InputStream. | |
9 * | |
10 * Currently provided InputStream implementations include | |
11 * FileInputStream and StringInputStream. | |
12 */ | |
13 interface InputStream extends \Iterator | |
14 { | |
15 | |
16 /** | |
17 * Returns the current line that is being consumed. | |
18 * | |
19 * TODO: Move this to the scanner. | |
20 */ | |
21 public function currentLine(); | |
22 | |
23 /** | |
24 * Returns the current column of the current line that the tokenizer is at. | |
25 * | |
26 * Newlines are column 0. The first char after a newline is column 1. | |
27 * | |
28 * @TODO Move this to the scanner. | |
29 * | |
30 * @return int The column number. | |
31 */ | |
32 public function columnOffset(); | |
33 | |
34 /** | |
35 * Get all characters until EOF. | |
36 * | |
37 * This consumes characters until the EOF. | |
38 */ | |
39 public function remainingChars(); | |
40 | |
41 /** | |
42 * Read to a particular match (or until $max bytes are consumed). | |
43 * | |
44 * This operates on byte sequences, not characters. | |
45 * | |
46 * Matches as far as possible until we reach a certain set of bytes | |
47 * and returns the matched substring. | |
48 * | |
49 * @see strcspn | |
50 * @param string $bytes | |
51 * Bytes to match. | |
52 * @param int $max | |
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. | |
56 */ | |
57 public function charsUntil($bytes, $max = null); | |
58 | |
59 /** | |
60 * Returns the string so long as $bytes matches. | |
61 * | |
62 * Matches as far as possible with a certain set of bytes | |
63 * and returns the matched substring. | |
64 * | |
65 * @see strspn | |
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 | |
69 * substring. | |
70 * @param int $max | |
71 * The max number of chars to read. | |
72 */ | |
73 public function charsWhile($bytes, $max = null); | |
74 | |
75 /** | |
76 * Unconsume one character. | |
77 * | |
78 * @param int $howMany | |
79 * The number of characters to move the pointer back. | |
80 */ | |
81 public function unconsume($howMany = 1); | |
82 | |
83 /** | |
84 * Retrieve the next character without advancing the pointer. | |
85 */ | |
86 public function peek(); | |
87 } |