In Rascal, why is it that patte matching behaves diffetly with and without label (at least in a visitor)? I wrote the following two visitors visiting the same parse tree t. The first one prints "test" three times, which is correct in my opinion as there are three occurrences of "ParseCond" in the parse tree (I checked this by rendering the tree and performing visual inspection). The second visitor, however, prints "test" many more times.
Is this behaviour I should have expected? Or might this behaviour be documented poorly? Or might it even be a bug?
First visitor:
visit(t) {
case IfCond: print("test");
}
Second visitor (note the subtle difference: there is a label "i" after "IfCond"):
visit(t) {
case IfCond i: print("test");
}
