Exemplo n.º 1
0
 public static function _PRECEDENCE()
 {
     if (!self::$PRECEDENCE) {
         $a = array(array("||"), array("&&"), array("|"), array("^"), array("&"), array("==", "===", "!=", "!=="), array("<", ">", "<=", ">=", "in", "instanceof"), array(">>", "<<", ">>>"), array("+", "-"), array("*", "/", "%"));
         $ret = array();
         for ($i = 0, $n = 1, $c1 = count($a); $i < $c1; $i++, $n++) {
             $b = $a[$i];
             for ($j = 0, $c2 = count($b); $j < $c2; $j++) {
                 $ret[$b[$j]] = $n;
             }
         }
         self::$PRECEDENCE = $ret;
     }
 }
Exemplo n.º 2
0
 public function handle_dot()
 {
     $this->next();
     return ParseJS::is_digit($this->peek()) ? $this->read_num('.') : $this->token('punc', '.');
 }