JEmptyStatement.java |
1 // Copyright 2013 Bill Campbell, Swami Iyer and Bahar Akbal-Delibas 2 3 package jminusminus; 4 5 /** 6 * The (dummy) AST node for representing the empty statement. Nothing needs to 7 * be done during analysis or code generation. It simply represents empty 8 * statements that are denoted by the ";" in j--. 9 */ 10 11 class JEmptyStatement extends JStatement { 12 13 /** 14 * Construct an AST node for an empty statement. 15 * 16 * @param line 17 * line in which the empty statement occurs in the source file. 18 */ 19 20 protected JEmptyStatement(int line) { 21 super(line); 22 } 23 24 /** 25 * @inheritDoc 26 */ 27 28 public JAST analyze(Context context) { 29 // Nothing to do. 30 return this; 31 } 32 33 /** 34 * @inheritDoc 35 */ 36 37 public void codegen(CLEmitter output) { 38 // Nothing to do. 39 } 40 41 /** 42 * @inheritDoc 43 */ 44 45 public void writeToStdOut(PrettyPrinter p) { 46 p.printf("<JEmptyStatement line=\"%d\"/>\n", line()); 47 } 48 49 } 50