pj
Class PJ.Parser

java.lang.Object
  extended by java.util.AbstractCollection
      extended by java.util.AbstractList
          extended by java.util.ArrayList
              extended by pj.PJ.Parser
All Implemented Interfaces:
Serializable, Cloneable, Iterable, Collection, List, RandomAccess, Dump.Helper
Enclosing class:
PJ

protected class PJ.Parser
extends ArrayList
implements Dump.Helper

represents the top level.

See Also:
Serialized Form

Field Summary
protected  String className
          parser's class name, if any.
protected  String packagePath
          parser's package path, if any.
 
Fields inherited from class java.util.AbstractList
modCount
 
Constructor Summary
protected PJ.Parser(List optPackage, String optId, ArrayList decls, ArrayList lexs, String sep, ArrayList rules, ArrayList epilogs)
           
 
Method Summary
 String className()
           
 void dump(Dump sender, Class c, Object o)
           
 void epilog(PrintWriter out, boolean main, boolean scannerStatic, boolean trace, String animate)
          copy/create epilog section of jay file, if any.
 boolean factory(PrintWriter out, boolean inline, boolean staticClass, boolean flatten)
          implement tree factory if PJ.typed: delegate to PJ.Rule.
 void lex(PrintWriter out, boolean main)
          implement JLex-based scanner.
 String packagePath()
           
 void prolog(PrintWriter out)
          copy/create prolog section of jay file.
 void rules(PrintWriter out, boolean recover)
          create grammar section of jay file.
 void setup()
          initialize terminal and nonterminal descriptions, check macros.
 
Methods inherited from class java.util.ArrayList
add, add, addAll, addAll, clear, clone, contains, ensureCapacity, get, indexOf, isEmpty, lastIndexOf, remove, remove, removeRange, set, size, toArray, toArray, trimToSize
 
Methods inherited from class java.util.AbstractList
equals, hashCode, iterator, listIterator, listIterator, subList
 
Methods inherited from class java.util.AbstractCollection
containsAll, removeAll, retainAll, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.List
containsAll, equals, hashCode, iterator, listIterator, listIterator, removeAll, retainAll, subList
 

Field Detail

packagePath

protected final String packagePath
parser's package path, if any.


className

protected final String className
parser's class name, if any.

Constructor Detail

PJ.Parser

protected PJ.Parser(List optPackage,
                    String optId,
                    ArrayList decls,
                    ArrayList lexs,
                    String sep,
                    ArrayList rules,
                    ArrayList epilogs)
Method Detail

packagePath

public String packagePath()

className

public String className()

setup

public void setup()
initialize terminal and nonterminal descriptions, check macros. Must be called before the tree is used.


lex

public void lex(PrintWriter out,
                boolean main)
implement JLex-based scanner.


factory

public boolean factory(PrintWriter out,
                       boolean inline,
                       boolean staticClass,
                       boolean flatten)
implement tree factory if PJ.typed: delegate to PJ.Rule.

Parameters:
inline - if true, generate factory class header.
staticClass - if true and inline, make factory class static.
flatten - if true, flatten single java.util.ArrayList parameter.
Returns:
true if PJ.typed and all methods generated.

prolog

public void prolog(PrintWriter out)
copy/create prolog section of jay file. Omit action stuff if not PJ.typed.


rules

public void rules(PrintWriter out,
                  boolean recover)
create grammar section of jay file.


epilog

public void epilog(PrintWriter out,
                   boolean main,
                   boolean scannerStatic,
                   boolean trace,
                   String animate)
copy/create epilog section of jay file, if any.

Parameters:
main - if true, create main program.
trace - true to add yyDebug in main program.
animate - null to add yyDebugAdapter, "0".."3" to add yyAnim and simulate nothing, input, and/or output.

dump

public void dump(Dump sender,
                 Class c,
                 Object o)
Specified by:
dump in interface Dump.Helper