4 * @author Niklas Laxström, Tim Starling
6 * @copyright Copyright © 2010-2012, Niklas Laxström
7 * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later
14 * Helper for CLDRPluralRuleConverter.
15 * The base class for operators and expressions, describing a region of the input string.
17 class CLDRPluralRuleConverterFragment
{
18 public $parser, $pos, $length, $end;
20 function __construct( $parser, $pos, $length ) {
21 $this->parser
= $parser;
23 $this->length
= $length;
24 $this->end
= $pos +
$length;
27 public function error( $message ) {
28 $text = $this->getText();
29 throw new CLDRPluralRuleError( "$message at position " . ( $this->pos +
1 ) . ": \"$text\"" );
32 public function getText() {
33 return substr( $this->parser
->rule
, $this->pos
, $this->length
);