3 * Template Lite compile IS exprenssion in IF tag - template internal module
6 * Name: compile_parse_is_expr
9 function compile_parse_is_expr($is_arg, $_args, &$object)
14 if (($first_arg = array_shift($_args)) == 'not') {
16 $expr_type = array_shift($_args);
20 $expr_type = $first_arg;
25 if (isset($_args[$expr_end]) && $_args[$expr_end] == 'by')
28 $expr_arg = $_args[$expr_end++
];
29 $expr = "!(1 & ($is_arg / " . $object->_parse_variable($expr_arg) . "))";
33 $expr = "!(1 & $is_arg)";
38 if (isset($_args[$expr_end]) && $_args[$expr_end] == 'by')
41 $expr_arg = $_args[$expr_end++
];
42 $expr = "(1 & ($is_arg / " . $object->_parse_variable($expr_arg) . "))";
46 $expr = "(1 & $is_arg)";
51 if (@$_args[$expr_end] == 'by')
54 $expr_arg = $_args[$expr_end++
];
55 $expr = "!($is_arg % " . $object->_parse_variable($expr_arg) . ")";
59 throw new Template_Exception("expecting 'by' after 'div'", $object);
64 throw new Template_Exception("unknown 'is' expression - '$expr_type'", $object);
72 array_splice($_args, 0, $expr_end, $expr);