Remove messages.inc, rebuildLanguage.php, writeMessagesArray.inc
[mediawiki.git] / languages / utils / CLDRPluralRuleConverterFragment.php
blobdf299cbdf4e0e99a4de9520ff4bf1b9eeceec5e1
1 <?php
2 /**
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
8 * @file
9 * @since 1.20
12 /**
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;
21 $this->pos = $pos;
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 );