+ Predicate predicate = Default;
+ boolean looping = false;
+ boolean interruptible = false;
+ for(int i=0; i<tt.child(0).size(); i++) {
+ Tree ttt = tt.child(0).child(i);
+ if ("[a]".equals(ttt.head())) predicate = FlagA;
+ if ("[b]".equals(ttt.head())) predicate = FlagB;
+ if ("[c]".equals(ttt.head())) predicate = FlagC;
+ if ("[!a]".equals(ttt.head())) predicate = NotFlagA;
+ if ("[!b]".equals(ttt.head())) predicate = NotFlagB;
+ if ("[!c]".equals(ttt.head())) predicate = NotFlagC;
+ if ("[*]".equals(ttt.head())) predicate = IgnoreOLC;
+ if ("[olc=0]".equals(ttt.head())) predicate = OLCZero;
+ if ("[Rq]".equals(ttt.head())) looping = true;
+ }
+ tt = tt.child(1);
+ if ("tail".equals(tt.head())) {
+ cb.add(new Tail(dock));
+ continue;
+ } else if ("flags".equals(tt.head())) {
+ cb.add(new Set(dock, looping, predicate, parseFlags(tt.child(0)), parseFlags(tt.child(1))));
+ continue;
+ } else if ("olc=word".equals(tt.head())) {
+ cb.add(new Set(dock, looping, predicate, SetDest.OuterLoopCounter, SetSource.DataLatch));
+ continue;
+ } else if ("ilc=word".equals(tt.head())) {
+ cb.add(new Set(dock, looping, predicate, SetDest.InnerLoopCounter, SetSource.DataLatch));
+ continue;
+ } else if ("*".equals(tt.head())) {
+ cb.add(new Set(dock, looping, predicate, SetDest.InnerLoopCounter, SetSource.Infinity));
+ continue;
+ } else if ("olc=int".equals(tt.head())) {
+ cb.add(new Set(dock, looping, predicate, SetDest.OuterLoopCounter, (number(tt.child(0)))));
+ continue;
+ } else if ("ilc=int".equals(tt.head())) {
+ cb.add(new Set(dock, looping, predicate, SetDest.InnerLoopCounter, (number(tt.child(0)))));
+ continue;
+ } else if ("--".equals(tt.head())) {
+ cb.add(new Set(dock, looping, predicate, SetDest.OuterLoopCounter, SetSource.Decrement));
+ continue;
+ } else if ("nop".equals(tt.head())) {
+ if (tt.size() > 0 && "[T]".equals(tt.child(0).head())) interruptible = true;
+ cb.add(new Move(dock, looping, predicate, interruptible, null, false, false, false, false, false, false));
+ } else if ("shift".equals(tt.head())) {
+ cb.add(new Shift(dock, looping, predicate,
+ new BitVector(dock.getShip().getFleet().getShiftWidth()).set(number(tt.child(0)))));
+ continue;
+ } else if ("flush".equals(tt.head())) {
+ cb.add(new Flush(dock, looping, predicate));
+ continue;
+ } else if ("word".equals(tt.head())) {
+ long literal = 0;
+ if (tt.child(0).head().equals("CodeBagBody")) {
+ Tree<String> tq = tt;
+ CodeBag cb2 = getCodeBag("anon"+(anoncount++));
+ for(Tree<String> statement : tq.child(0))
+ fillCodeBag(statement, cb2);
+ cb.add(new Set(dock, looping, predicate, SetDest.DataLatch, (cb2.getFakeAddress())), true);
+ continue OUTER;
+ } else if (tt.child(0).head().equals("Name")) {
+ String refname = name(tt.child(0));
+ CodeBag cb2 = getCodeBag(refname);
+ cb.add(new Set(dock, looping, predicate, SetDest.DataLatch, (cb2.getFakeAddress())), true);
+ continue OUTER;
+ } else if (tt.child(0).head().equals("[")) {
+ literal = parseSSL(tt.child(0));
+ } else {
+ literal = number(tt.child(0));
+ }
+ count = 1;
+ /*
+ if ("int".equals(tt.child(1).head())) {
+ count = (int)number(tt.child(1));
+ } else if ("forever".equals(tt.child(1).head())) {
+ count = 0;