GJDepthFirst.java
- //
- // Generated by JTB 1.3.2
- //
- package net.metanotion.simpletemplate.parser.visitor;
- import net.metanotion.simpletemplate.parser.syntaxtree.*;
- import java.util.*;
- /**
- * Provides default methods which visit each node in the tree in depth-first
- * order. Your visitors may extend this class.
- */
- public class GJDepthFirst<R,A> implements GJVisitor<R,A> {
- //
- // Auto class visitors--probably don't need to be overridden.
- //
- public R visit(NodeList n, A argu) {
- R _ret=null;
- int _count=0;
- for ( Enumeration<Node> e = n.elements(); e.hasMoreElements(); ) {
- e.nextElement().accept(this,argu);
- _count++;
- }
- return _ret;
- }
- public R visit(NodeListOptional n, A argu) {
- if ( n.present() ) {
- R _ret=null;
- int _count=0;
- for ( Enumeration<Node> e = n.elements(); e.hasMoreElements(); ) {
- e.nextElement().accept(this,argu);
- _count++;
- }
- return _ret;
- }
- else
- return null;
- }
- public R visit(NodeOptional n, A argu) {
- if ( n.present() )
- return n.node.accept(this,argu);
- else
- return null;
- }
- public R visit(NodeSequence n, A argu) {
- R _ret=null;
- int _count=0;
- for ( Enumeration<Node> e = n.elements(); e.hasMoreElements(); ) {
- e.nextElement().accept(this,argu);
- _count++;
- }
- return _ret;
- }
- public R visit(NodeToken n, A argu) { return null; }
- //
- // User-generated visitor methods below
- //
- /**
- * <PRE>
- * f0 -> ( HtmlBlock() )*
- * f1 -> <EOF>
- * </PRE>
- */
- public R visit(Template n, A argu) {
- R _ret=null;
- n.f0.accept(this, argu);
- n.f1.accept(this, argu);
- return _ret;
- }
- /**
- * <PRE>
- * f0 -> <HTML>
- * | <HTML_OTHER>
- * | ES()
- * | <BEGIN_SSI> SSD() <END_SSI>
- * </PRE>
- */
- public R visit(HtmlBlock n, A argu) {
- R _ret=null;
- n.f0.accept(this, argu);
- return _ret;
- }
- /**
- * <PRE>
- * f0 -> <BEGIN_CALL>
- * f1 -> [ ExprSeq() ]
- * f2 -> <END_CALL>
- * </PRE>
- */
- public R visit(ES n, A argu) {
- R _ret=null;
- n.f0.accept(this, argu);
- n.f1.accept(this, argu);
- n.f2.accept(this, argu);
- return _ret;
- }
- /**
- * <PRE>
- * f0 -> Expression()
- * f1 -> ( <OP_SEMI> Expression() )*
- * </PRE>
- */
- public R visit(ExprSeq n, A argu) {
- R _ret=null;
- n.f0.accept(this, argu);
- n.f1.accept(this, argu);
- return _ret;
- }
- /**
- * <PRE>
- * f0 -> Apply()
- * | JSObj()
- * | JSArr()
- * | Tuple()
- * | Lambda()
- * | Let()
- * | Literal()
- * | Lift()
- * </PRE>
- */
- public R visit(Expression n, A argu) {
- R _ret=null;
- n.f0.accept(this, argu);
- return _ret;
- }
- /**
- * <PRE>
- * f0 -> <ID>
- * f1 -> ( <OP_DOT> <ID> )*
- * f2 -> [ Expression() ]
- * </PRE>
- */
- public R visit(Apply n, A argu) {
- R _ret=null;
- n.f0.accept(this, argu);
- n.f1.accept(this, argu);
- n.f2.accept(this, argu);
- return _ret;
- }
- /**
- * <PRE>
- * f0 -> <L_CURLY>
- * f1 -> [ WithParams() ]
- * f2 -> <R_CURLY>
- * </PRE>
- */
- public R visit(JSObj n, A argu) {
- R _ret=null;
- n.f0.accept(this, argu);
- n.f1.accept(this, argu);
- n.f2.accept(this, argu);
- return _ret;
- }
- /**
- * <PRE>
- * f0 -> <L_BRACE>
- * f1 -> [ Params() ]
- * f2 -> <R_BRACE>
- * </PRE>
- */
- public R visit(JSArr n, A argu) {
- R _ret=null;
- n.f0.accept(this, argu);
- n.f1.accept(this, argu);
- n.f2.accept(this, argu);
- return _ret;
- }
- /**
- * <PRE>
- * f0 -> <L_PAREN>
- * f1 -> [ Params() ]
- * f2 -> <R_PAREN>
- * f3 -> [ Expression() ]
- * </PRE>
- */
- public R visit(Tuple n, A argu) {
- R _ret=null;
- n.f0.accept(this, argu);
- n.f1.accept(this, argu);
- n.f2.accept(this, argu);
- n.f3.accept(this, argu);
- return _ret;
- }
- /**
- * <PRE>
- * f0 -> <OP_LAMBDA>
- * f1 -> <L_PAREN>
- * f2 -> ExprSeq()
- * f3 -> <R_PAREN>
- * f4 -> [ Expression() ]
- * </PRE>
- */
- public R visit(Lambda n, A argu) {
- R _ret=null;
- n.f0.accept(this, argu);
- n.f1.accept(this, argu);
- n.f2.accept(this, argu);
- n.f3.accept(this, argu);
- n.f4.accept(this, argu);
- return _ret;
- }
- /**
- * <PRE>
- * f0 -> <KW_LET>
- * f1 -> JSObj()
- * f2 -> <L_PAREN>
- * f3 -> ExprSeq()
- * f4 -> <R_PAREN>
- * f5 -> [ Expression() ]
- * </PRE>
- */
- public R visit(Let n, A argu) {
- R _ret=null;
- n.f0.accept(this, argu);
- n.f1.accept(this, argu);
- n.f2.accept(this, argu);
- n.f3.accept(this, argu);
- n.f4.accept(this, argu);
- n.f5.accept(this, argu);
- return _ret;
- }
- /**
- * <PRE>
- * f0 -> <OP_LIFT>
- * f1 -> [ Expression() ]
- * </PRE>
- */
- public R visit(Lift n, A argu) {
- R _ret=null;
- n.f0.accept(this, argu);
- n.f1.accept(this, argu);
- return _ret;
- }
- /**
- * <PRE>
- * f0 -> <DECIMAL_LITERAL>
- * | <HEX_LITERAL>
- * | <FLOAT_LITERAL>
- * | <STRING_LITERAL>
- * | <SQSTRING_LITERAL>
- * | <BOOLEAN_LITERAL>
- * </PRE>
- */
- public R visit(Literal n, A argu) {
- R _ret=null;
- n.f0.accept(this, argu);
- return _ret;
- }
- /**
- * <PRE>
- * f0 -> Expression()
- * f1 -> ( <OP_COMMA> Expression() )*
- * </PRE>
- */
- public R visit(Params n, A argu) {
- R _ret=null;
- n.f0.accept(this, argu);
- n.f1.accept(this, argu);
- return _ret;
- }
- /**
- * <PRE>
- * f0 -> WithParam()
- * f1 -> ( <OP_COMMA> WithParam() )*
- * </PRE>
- */
- public R visit(WithParams n, A argu) {
- R _ret=null;
- n.f0.accept(this, argu);
- n.f1.accept(this, argu);
- return _ret;
- }
- /**
- * <PRE>
- * f0 -> <ID>
- * | <STRING_LITERAL>
- * | <SQSTRING_LITERAL>
- * </PRE>
- */
- public R visit(Key n, A argu) {
- R _ret=null;
- n.f0.accept(this, argu);
- return _ret;
- }
- /**
- * <PRE>
- * f0 -> Key()
- * f1 -> <OP_WITH>
- * f2 -> Expression()
- * </PRE>
- */
- public R visit(WithParam n, A argu) {
- R _ret=null;
- n.f0.accept(this, argu);
- n.f1.accept(this, argu);
- n.f2.accept(this, argu);
- return _ret;
- }
- /**
- * <PRE>
- * f0 -> Directive()
- * f1 -> <SSIID>
- * f2 -> <SOP_EQ>
- * f3 -> <SSI_STRING_LITERAL>
- * </PRE>
- */
- public R visit(SSD n, A argu) {
- R _ret=null;
- n.f0.accept(this, argu);
- n.f1.accept(this, argu);
- n.f2.accept(this, argu);
- n.f3.accept(this, argu);
- return _ret;
- }
- /**
- * <PRE>
- * f0 -> <KW_INC>
- * | <KW_ECHO>
- * | <KW_CONFIG>
- * | <KW_EXEC>
- * | <KW_SET>
- * | <KW_IF>
- * | <KW_ELIF>
- * | <KW_ELSE>
- * | <KW_ENDIF>
- * </PRE>
- */
- public R visit(Directive n, A argu) {
- R _ret=null;
- n.f0.accept(this, argu);
- return _ret;
- }
- }