2.5.7. Classifier

TODO.

2.5.7.1. Instruction

classifier.add op1 op2 op3 [classifier::Add]
Operator 1:ref<classifier<*>>
Operator 2:any
Operator 3:any

Adds a rule to classifier op1. The first element of op2 is the rule’s fields, and the second element is the rule’s match priority. If multiple rules match with a later lookup, the rule with the highest priority will win. op3 is the value that will be associated with the rule. This instruction must not be called anymore after classifier.compile has been executed.

classifier.compile op1 [classifier::Compile]
Operator 1:ref<classifier<*>>

Freezes the classifier op1 and prepares it for subsequent lookups.

target = classifier.get op1 op2 [classifier::Get]
Target:any
Operator 1:ref<classifier<*>>
Operator 2:any

Returns the value associated with the highest-priority rule matching op2 in classifier op1. Throws an IndexError exception if no match is found. If multiple rules of the same priority match, it is undefined which one will be selected. This instruction must only be used after the classifier has been fixed with classifier.compile.

target = classifier.matches op1 op2 [classifier::Matches]
Target:bool
Operator 1:ref<classifier<*>>
Operator 2:any

Returns True if op2 matches any rule in classifier op1. This instruction must only be used after the classifier has been fixed with classifier.compile.