1: <?php
2: // Parco
3: // Copyright (c) 2015 Niels Sonnich Poulsen (http://nielssp.dk)
4: // Licensed under the MIT license.
5: // See the LICENSE file or http://opensource.org/licenses/MIT for more information.
6: namespace Parco;
7:
8: /**
9: * Interface for classes with stored positional information. Used in conjunction
10: * with {@see Position}.
11: *
12: * A position is an array of the form `array($line, $column)`, where `$line`
13: * and `$column` are integers. `array(1, 1)` is always the first character of the
14: * first line of an input stream.
15: * There are two special cases: `array(0, 0)` represents an unknown or
16: * undefined position and `array(-1, -1)` represents the end of the input.
17: */
18: interface Positional
19: {
20:
21: /**
22: * Get the stored position.
23: *
24: * @return int[]
25: * Position as a 2-element array consisting of a line number and
26: * a column number.
27: */
28: public function getPosition();
29:
30: /**
31: * Set the stored position.
32: *
33: * @param int[] $pos
34: * Position as a 2-element array consisting of a line number and
35: * a column number.
36: */
37: public function setPosition(array $pos);
38: }
39: