1

This is a bit of an extension to a problem I posted here Pattern matching AST nodes in Rascal

I've made a bit of a modification to how the switch statement looks for patterns but it appears that none of the patterns are matching and the default pattern isn't executing!

Code:

private str synthesise_f(Core::AST::Exp exp) {
    println("START");
    switch (exp) {
        case Exp e: str t(&T t0, &T t1) {
            println("IN CASE");
        }
        default: println("!DEFAULT!");
    }
    println("END");
    return ret;
}

With the output being:

START
END

Any ideas what might be happening here? Am I doing something wrong?

Thanks!

Community
  • 1
  • 1
josh
  • 1,544
  • 2
  • 16
  • 27

1 Answers1

1

The Rascal code looks fine so I am guessing your modification (in the code of the interpreter?) is interfering with a hidden assumption or an optimization in said interpreter. Better to post a pull request on github so we can talk about it? Most likely an internal exception is causing the interpreter to skip the default case.

Jurgen Vinju
  • 6,393
  • 1
  • 15
  • 26
  • I think I'm just going to use the previous idea. It looks like I'm able to get all the information out of the node that I need using that :). Thanks though! – josh Feb 06 '15 at 18:55