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