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: * An unsuccessful parse result.
10: */
11: class Failure extends Result
12: {
13:
14: /**
15: * Construct parse result.
16: *
17: * @param string $message
18: * Failure message.
19: * @param int[] $pos
20: * Failure position.
21: * @param array $nextInput
22: * Remaining input.
23: * @param int[] $nextPos
24: * Next position.
25: */
26: public function __construct($message, array $pos, array $nextInput, array $nextPos)
27: {
28: $this->successful = false;
29: $this->message = $message;
30: $this->setPosition($pos);
31: $this->nextInput = $nextInput;
32: $this->nextPos = $nextPos;
33: }
34:
35: /**
36: * {@inheritdoc}
37: */
38: public function get()
39: {
40: throw new ParseException($this);
41: }
42: }
43: