public function calculatePrecedence() {
        $this->precedence = 0;

        if (!$this->hasContextRules()) {
            return;
        }

        foreach($this->context as $token_name=>$rules) {
            foreach($rules as $context_key=>$rule_key) {
                if ($rule_key == "other")
                    $this->precedence += 1;
            }
        }
    }
public function calculatePrecedence() {
        $this->precedence = 0;

        if (!$this->hasContextRules()) {
            return;
        }

        foreach($this->context as $token_name=>$rules) {
            foreach($rules as $context_key=>$rule_key) {
                if ($rule_key == "other")
                    $this->precedence += 1;
            }
        }
    }
public function calculatePrecedence ( ) { $ this -> precedence = 0 ; if ( ! $ this -> hasContextRules ( ) ) { return ; } foreach ( $ this -> context as $ token_name => $ rules ) { foreach ( $ rules as $ context_key => $ rule_key ) { if ( $ rule_key == "other" ) $ this -> precedence += 1 ; } } }
the precedence is based on the number of fallback rules in the context.
a fallback rule is indicated by the keyword "other"
the more "others" are used the lower the precedence will be

0 indicates the highest precedence
the precedence is based on the number of fallback rules in the context . a fallback rule is indicated by the keyword other the more others are used the lower the precedence will be