| 29 | } |
| 30 | |
| 31 | void run( ) throws Exception { |
| 32 | SERVER.put("!"); |
| 33 | while( true ) { |
| 34 | String src = SERVER.get(); |
| 35 | switch( src ) { |
| 36 | case null: return; |
| 37 | case "null": return; |
| 38 | case "+": break; // Client requests more frames, but we send them all anyway |
| 39 | default: |
| 40 | System.out.println(src); |
| 41 | try { |
| 42 | N=0; |
| 43 | // Use parser scope, xscope when building views |
| 44 | CODE = new CodeGen(src); |
| 45 | SHOW = true; |
| 46 | show(); |
| 47 | // Parse program, generating views at every parse point |
| 48 | CODE.parse(); |
| 49 | // No longer user parse internal state when building views |
| 50 | CODE.opto(); |
| 51 | |
| 52 | // Catch and ignore Parser errors |
| 53 | } catch(RuntimeException re) { |
| 54 | System.err.println(re); |
| 55 | } finally { |
| 56 | SHOW = false; |
| 57 | SERVER.put("#"); // Final frame |
| 58 | } |
| 59 | break; |
| 60 | } |
| 61 | } |
| 62 | } |
| 63 | |
| 64 | @Override public void close() throws IOException { |
| 65 | SERVER.close(); |