Merge "jshint: Enable 'es3' option"
[lhc/web/wiklou.git] / languages / utils / CLDRPluralRuleConverter_Expression.php
1 <?php
2
3 /**
4 * @author Niklas Laxström, Tim Starling
5 *
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
8 *
9 * @file
10 * @since 1.20
11 */
12
13 /**
14 * Helper for CLDRPluralRuleConverter.
15 * An expression object, representing a region of the input string (for error
16 * messages), the RPN notation used to evaluate it, and the result type for
17 * validation.
18 */
19 class CLDRPluralRuleConverter_Expression extends CLDRPluralRuleConverter_Fragment {
20 /** @var string */
21 public $type;
22
23 /** @var string */
24 public $rpn;
25
26 function __construct( $parser, $type, $rpn, $pos, $length ) {
27 parent::__construct( $parser, $pos, $length );
28 $this->type = $type;
29 $this->rpn = $rpn;
30 }
31
32 public function isType( $type ) {
33 if ( $type === 'range' && ( $this->type === 'range' || $this->type === 'number' ) ) {
34 return true;
35 }
36 if ( $type === $this->type ) {
37 return true;
38 }
39 return false;
40 }
41 }