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