processing.app.preproc
Class PdeEmitter

java.lang.Object
  extended by processing.app.preproc.PdeEmitter
All Implemented Interfaces:
PdeTokenTypes

public class PdeEmitter
extends java.lang.Object
implements PdeTokenTypes

PDEEmitter: A class that can take an ANTLR Java AST and produce reasonably formatted Java code from it. To use it, create a PDEEmitter object, call setOut() if you want to print to something other than System.out, and then call print(), passing the AST. Typically, the AST node that you pass would be the root of a tree - the ROOT_ID node that represents a Java file.


Field Summary
 
Fields inherited from interface processing.app.preproc.PdeTokenTypes
ABSTRACT, ARRAY_DECLARATOR, ARRAY_INIT, ASSIGN, BAND, BAND_ASSIGN, BLOCK, BNOT, BOR, BOR_ASSIGN, BSR, BSR_ASSIGN, BXOR, BXOR_ASSIGN, CASE_GROUP, CHAR_LITERAL, CLASS_DEF, COLON, COMMA, CONSTRUCTOR_CAST, CTOR_CALL, CTOR_DEF, DEC, DIV, DIV_ASSIGN, DOT, ELIST, EMPTY_FIELD, EMPTY_STAT, EOF, EQUAL, ESC, EXPONENT, EXPR, EXTENDS_CLAUSE, FINAL, FLOAT_SUFFIX, FOR_CONDITION, FOR_INIT, FOR_ITERATOR, GE, GT, HEX_DIGIT, IDENT, IMPLEMENTS_CLAUSE, IMPORT, INC, INDEX_OP, INSTANCE_INIT, INTERFACE_DEF, LABELED_STAT, LAND, LBRACK, LCURLY, LE, LITERAL_assert, LITERAL_boolean, LITERAL_break, LITERAL_byte, LITERAL_case, LITERAL_catch, LITERAL_char, LITERAL_class, LITERAL_color, LITERAL_continue, LITERAL_default, LITERAL_do, LITERAL_double, LITERAL_else, LITERAL_extends, LITERAL_false, LITERAL_finally, LITERAL_float, LITERAL_for, LITERAL_if, LITERAL_implements, LITERAL_import, LITERAL_instanceof, LITERAL_int, LITERAL_interface, LITERAL_long, LITERAL_native, LITERAL_new, LITERAL_null, LITERAL_package, LITERAL_private, LITERAL_protected, LITERAL_public, LITERAL_return, LITERAL_short, LITERAL_static, LITERAL_super, LITERAL_switch, LITERAL_synchronized, LITERAL_this, LITERAL_threadsafe, LITERAL_throw, LITERAL_throws, LITERAL_transient, LITERAL_true, LITERAL_try, LITERAL_void, LITERAL_volatile, LITERAL_while, LNOT, LOR, LPAREN, LT, METHOD_CALL, METHOD_DEF, MINUS, MINUS_ASSIGN, ML_COMMENT, MOD, MOD_ASSIGN, MODIFIERS, NOT_EQUAL, NULL_TREE_LOOKAHEAD, NUM_DOUBLE, NUM_FLOAT, NUM_INT, NUM_LONG, OBJBLOCK, PACKAGE_DEF, PARAMETER_DEF, PARAMETERS, PLUS, PLUS_ASSIGN, POST_DEC, POST_INC, QUESTION, RBRACK, RCURLY, RPAREN, SEMI, SL, SL_ASSIGN, SL_COMMENT, SLIST, SR, SR_ASSIGN, STAR, STAR_ASSIGN, STATIC_INIT, STRICTFP, STRING_LITERAL, SUPER_CTOR_CALL, TYPE, TYPECAST, UNARY_MINUS, UNARY_PLUS, VARIABLE_DEF, VOCAB, WEBCOLOR_LITERAL, WS
 
Constructor Summary
PdeEmitter()
           
 
Method Summary
 void print(antlr.collections.AST ast)
          Print the given AST.
 void setOut(java.io.PrintStream out)
          Specify a PrintStream to print to.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PdeEmitter

public PdeEmitter()
Method Detail

setOut

public void setOut(java.io.PrintStream out)
Specify a PrintStream to print to. System.out is the default.

Parameters:
out - the PrintStream to print to

print

public void print(antlr.collections.AST ast)
           throws RunnerException
Print the given AST. Call this function to print your PDE code. It works by making recursive calls to print children. So the code below is one big "switch" statement on the passed AST type.

Throws:
RunnerException