* Released under the MIT license
* http://opensource.org/licenses/MIT
*
- * @version 0.1.0
* @source https://github.com/santhoshtr/CLDRPluralRuleParser
* @author Santhosh Thottingal <santhosh.thottingal@gmail.com>
* @author Timo Tijhof
// AMD. Register as an anonymous module.
define(factory);
} else if (typeof exports === 'object') {
+ /* global module */
// Node. Does not work with strict CommonJS, but
// only CommonJS-like environments that support module.exports,
// like Node.
return null;
}
- debug(' -- passed ' + parseInt(result[0], 10) + ' ' + result[2] + ' ' + parseInt(result[4], 10));
+ debug(' -- passed ', parseInt(result[0], 10), result[2], parseInt(result[4], 10));
- return parseInt(result[0], 10) % parseInt(result[4], 10);
+ return parseFloat(result[0]) % parseInt(result[4], 10);
}
function not() {
var result = sequence([expression, whitespace, choice([_is_]), whitespace, value]);
if (result !== null) {
- debug(' -- passed is : ' + result[0] + ' == ' + parseInt(result[4], 10));
+ debug(' -- passed is :', result[0], ' == ', parseInt(result[4], 10));
return result[0] === parseInt(result[4], 10);
}
);
if (result !== null) {
- debug(' -- passed isnot: ' + result[0] + ' != ' + parseInt(result[4], 10));
+ debug(' -- passed isnot: ', result[0], ' != ', parseInt(result[4], 10));
return result[0] !== parseInt(result[4], 10);
}
result = sequence([expression, whitespace, _isnot_sign_, whitespace, rangeList]);
if (result !== null) {
- debug(' -- passed not_in: ' + result[0] + ' != ' + result[4]);
+ debug(' -- passed not_in: ', result[0], ' != ', result[4]);
range_list = result[4];
for (i = 0; i < range_list.length; i++) {
);
if (result !== null) {
- debug(' -- passed _in:' + result);
+ debug(' -- passed _in:', result);
range_list = result[5];
for (i = 0; i < range_list.length; i++) {
- if (parseInt(range_list[i], 10) === parseInt(result[0], 10)) {
+ if (parseInt(range_list[i], 10) === parseFloat(result[0])) {
return (result[1][0] !== 'not');
}
}
var result = sequence([whitespace, _and_, whitespace, relation]);
if (result !== null) {
- debug(' -- passed andTail' + result);
+ debug(' -- passed andTail', result);
return result[3];
}
var result = sequence([whitespace, _or_, whitespace, and]);
if (result !== null) {
- debug(' -- passed orTail: ' + result[3]);
+ debug(' -- passed orTail: ', result[3]);
return result[3];
}
}
if (pos !== rule.length) {
- debug('Warning: Rule not parsed completely. Parser stopped at ' + rule.substr(0, pos) + ' for rule: ' + rule);
+ debug('Warning: Rule not parsed completely. Parser stopped at ', rule.substr(0, pos), ' for rule: ', rule);
}
return result;