incubator-adffaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mat...@apache.org
Subject svn commit: r425117 [11/14] - in /incubator/adffaces/branches/matzew-repackaging-trinidad/plugins/maven-javascript-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/javascript: ./ javascript20parser/ javascriptcompiler/ obfuscator/ obfuscato...
Date Mon, 24 Jul 2006 16:58:51 GMT
Added: incubator/adffaces/branches/matzew-repackaging-trinidad/plugins/maven-javascript-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/javascript/javascript20parser/js2.0.jjt
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/matzew-repackaging-trinidad/plugins/maven-javascript-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/javascript/javascript20parser/js2.0.jjt?rev=425117&view=auto
==============================================================================
--- incubator/adffaces/branches/matzew-repackaging-trinidad/plugins/maven-javascript-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/javascript/javascript20parser/js2.0.jjt (added)
+++ incubator/adffaces/branches/matzew-repackaging-trinidad/plugins/maven-javascript-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/javascript/javascript20parser/js2.0.jjt Mon Jul 24 09:58:43 2006
@@ -0,0 +1,1501 @@
+options {
+    STATIC=false;
+    MULTI=true;
+    VISITOR=true;
+    NODE_USES_PARSER=true;
+    DEBUG_TOKEN_MANAGER=false;
+    DEBUG_PARSER=false;
+}
+
+PARSER_BEGIN(JSParser20)
+package org.apache.myfaces.trinidadbuild.plugin.javascript.javascript20parser;
+import java.io.IOException;
+public class JSParser20 
+{
+    //
+    // This is the root node for the parse tree (root DOM node, tree of SimpleNode(s))
+    //
+    protected ASTProgram _jjtRoot;
+    
+    public ASTProgram getRootNode()
+    {
+    	return _jjtRoot;
+    }
+    
+}
+
+PARSER_END(JSParser20)
+
+
+
+/////////////////////////////////////////////////////
+// LEXICAL RULES Section
+/////////////////////////////////////////////////////
+TOKEN_MGR_DECLS :
+{
+    private boolean isRegValid = true;
+    public void setRegInvalid()
+    {
+        isRegValid = false;
+    }
+    public void setRegValid()
+    {
+        isRegValid = true;
+    }
+}
+
+/////////////////////////////////////////////////////
+// WHITE SPACE 
+/////////////////////////////////////////////////////
+SPECIAL_TOKEN :
+{
+        <EOL:   (["\n","\r"])+ >
+    |   <WS:    ([" ","\t"])+ >
+}
+/////////////////////////////////////////////////////
+// COMMENTS 
+/////////////////////////////////////////////////////
+MORE :
+{
+        "//" : IN_SINGLE_LINE_COMMENT
+    |   "/*" : IN_MULTI_LINE_COMMENT
+}
+
+<IN_SINGLE_LINE_COMMENT>
+SPECIAL_TOKEN :
+{
+        < SINGLE_LINE_COMMENT: (~["\n","\r"])* ("\n"|"\r"|"\r\n")? >  : DEFAULT
+}
+
+<IN_MULTI_LINE_COMMENT>
+SPECIAL_TOKEN :
+{
+        <MULTI_LINE_COMMENT: "*/" > : DEFAULT
+}
+
+<IN_SINGLE_LINE_COMMENT, IN_MULTI_LINE_COMMENT>
+MORE :
+{
+        < ~[] >
+}
+/////////////////////////////////////////////////////
+// RESERVED WORDS AND LITERALS
+/////////////////////////////////////////////////////
+TOKEN :
+{
+        < AS:           "as"         >
+    |   < BREAK:        "break"      >
+    |   < CASE:         "case"       >
+    |   < CATCH:        "catch"      >
+    |   < CLASS:        "class"      >
+    |   < CONST:        "const"      >
+    |   < CONTINUE:     "continue"   >
+    |   < _DEFAULT:     "default"    >
+    |   < DELETE:       "delete"     >
+    |   < DO:           "do"         >
+    |   < ELSE:         "else"       >
+    |   < EXTENDS:      "extends"    >
+    |   < FALSE:        "false"      >   
+    |   < FINALLY:      "finally"    >
+    |   < FOR:          "for"        >
+    |   < FUNCTION:     "function"   >
+    |   < FUNCTION_:    "Function"   >
+    |   < GET:          "get"        >
+    |   < IF:           "if"         >
+    |   < IN:           "in"         >
+    |   < INCLUDE:      "include"    >
+    |   < INSTANCEOF:   "instanceof" >
+    |   < IS:           "is"         >
+    |   < NAMESPACE:    "namespace"  >
+    |   < NEW:          "new"        >
+    |   < NULL:         "null"       >    
+    |   < PACKAGE:      "package"    > 
+    |   < PRIVATE:      "private"    >
+    |   < PUBLIC:       "public"     >
+    |   < RETURN:       "return"     >
+    |   < SET:          "set"        >
+    |   < SUPER:        "super"      >
+    |   < SWITCH:       "switch"     >
+    |   < THIS:         "this"       >
+    |   < THROW:        "throw"      >
+    |   < TRUE:         "true"       > 
+    |   < TRY:          "try"        >
+    |   < TYPEOF:       "typeof"     >
+    |   < USE:          "use"        >
+    |   < VAR:          "var"        >
+    |   < VOID:         "void"       >
+    |   < WHILE:        "while"      >
+    |   < WITH:         "with"       >
+}
+/////////////////////////////////////////////////////
+// FUTURE RESERVED WORDS
+/////////////////////////////////////////////////////
+TOKEN :
+{
+        < ABSTRACT:     "abstract"     >
+    |   < DEBUGGER:     "debugger"     >
+    |   < ENUM:         "enum"         >
+    |   < EXPORT:       "export"       >
+    |   < GOTO:         "goto"         >
+    |   < IMPLEMENTS:   "implements"   >
+    |   < INTERFACE:    "interface"    >
+    |   < NATIVE:       "native"       >
+    |   < PROTECTED:    "protected"    >
+    |   < SYNCHRONIZED: "synchronized" >
+    |   < THROWS:       "throws"       >
+    |   < TRANSIENT:    "transient"    >
+    |   < VOLATILE:     "volatile"     >
+    |   < IMPORT:       "import"       >
+}
+/////////////////////////////////////////////////////
+// LITERALS 
+/////////////////////////////////////////////////////
+TOKEN :
+{
+        < DECIMAL_LITERAL: ["1"-"9"] (["0"-"9"])* >
+    |   < HEX_LITERAL: "0" ["x","X"] (["0"-"9","a"-"f","A"-"F"])+ >
+    |   < OCTAL_LITERAL: "0" (["0"-"7"])* >
+    |   < FLOATING_POINT_LITERAL: (["0"-"9"])+ "." (["0"-"9"])* (<EXPONENT>)? 
+                                |   "." (["0"-"9"])+ (<EXPONENT>)? 
+                                |   (["0"-"9"])+ (<EXPONENT>)? 
+        >
+    |   < #EXPONENT: ["e","E"] (["+","-"])? (["0"-"9"])+ >
+    |   < STRING_LITERAL:   "\""  
+                            ( (~["\"","\\","\n","\r"]) | <ESCAPE_SEQUENCE> )* 
+                            "\""
+                        |   "\"" 
+                            ( (~["\"","\\"]) | "\\" ("\n" | "\r" | "\r\n") | <ESCAPE_SEQUENCE> )* 
+                            "\""  
+                        |   "'"
+                            ( (~["'","\\","\n","\r"]) | <ESCAPE_SEQUENCE> )*
+                            "'"
+        >
+    |   < #ESCAPE_SEQUENCE: 
+            "\\"
+            (       ["n","t","b","r","f","\\","'","\"","[","]"]
+                |   ["0"-"7"] ( ["0"-"7"] )?
+                |   ["0"-"3"] ["0"-"7"] ["0"-"7"]
+                |   ["x"] ["0"-"9","a"-"f","A"-"F"] ["0"-"9","a"-"f","A"-"F"]
+                |   ["u"] ["0"-"9","a"-"f","A"-"F"] ["0"-"9","a"-"f","A"-"F"] 
+                          ["0"-"9","a"-"f","A"-"F"] ["0"-"9","a"-"f","A"-"F"]
+            )
+        >
+    |   < UNTERMINATED_STRING_LITERAL:
+                "\"" ( (~["\"","\\","\n","\r"]) | <ESCAPE_SEQUENCE> )* ( ["\n","\r"] )?
+            |   "'"  ( (~["'","\\","\n","\r"])  | <ESCAPE_SEQUENCE> )* ( ["\n","\r"] )?
+        >
+}
+/////////////////////////////////////////////////////
+// REGULAR EXPRESSIONS 
+/////////////////////////////////////////////////////
+TOKEN :
+{ 
+        < #REGX_START_CHAR : ~["\r","\n","/","=","*"] | "\\/">
+    |   < #REGX_BODY_CHAR_EXCLUSION : ~["\r","\n","/"] >  
+    |   < #REGX_BODY_CHAR : ( <REGX_BODY_CHAR_EXCLUSION> | "\\/" ) >
+    |   < #REGEX_END_CHAR :     "i" 
+                            |   "g" 
+                            |   "m" 
+                            |   "ig" 
+                            |   "im" 
+                            |   "gi" 
+                            |   "gm" 
+                            |   "mi" 
+                            |   "mg" 
+                            |   "igm" 
+                            |   "img" 
+                            |   "gmi" 
+                            |   "gim" 
+                            |   "mig" 
+                            |   "mgi" 
+                            
+        >
+}
+
+TOKEN :
+{
+        <REGULAR_EXPRESSION : "/" <REGX_START_CHAR> (<REGX_BODY_CHAR>)* "/"  (<REGEX_END_CHAR>)? >
+        {
+           try {
+                // Peek at the next character.
+                char nextCh = input_stream.readChar();
+                input_stream.backup(1);
+                if (isRegValid == false || nextCh == '/' || nextCh == '*') {
+                    //
+                    // Lexecal analyser thinks it is a RE
+                    // operator such as /...../
+                    // Put the everything to the first "/" back on the input stream
+                    //
+                    input_stream.backup(lengthOfMatch-1);
+                    //
+                    // And remove it from the token
+                    //
+                    matchedToken.image = matchedToken.image.substring(0, 1);
+                    image.delete(0, image.length() - 1);
+                    image.append('/');
+                    matchedToken.kind=SLASH;
+                }
+               } catch (IOException e) {
+                    throw new Error(e.toString());
+               }
+       }        
+        
+}
+/////////////////////////////////////////////////////
+// IDENTIFIERS 
+/////////////////////////////////////////////////////
+TOKEN :
+{
+        < IDENTIFIER: <LETTER> (<LETTER>|<DIGIT>)* >
+    |   < #LETTER: ["a"-"z","A"-"Z","$","_"] >
+    |   < #DIGIT: ["0"-"9"]>
+}
+/////////////////////////////////////////////////////
+// SEPARATORS 
+/////////////////////////////////////////////////////
+TOKEN :
+{
+        < LPAREN:    "("   >
+    |   < RPAREN:    ")"   >
+    |   < LBRACE:    "{"   >
+    |   < RBRACE:    "}"   >
+    |   < LBRACKET:  "["   >
+    |   < RBRACKET:  "]"   >
+    |   < SEMICOLON: ";"   >
+    |   < COMMA:     ","   >
+    |   < DOT:       "."   >
+    |   < QUALIFIER: "::"  >
+    |   < ELIPSE:    "..." >
+}
+
+/////////////////////////////////////////////////////
+// OPERATORS 
+/////////////////////////////////////////////////////
+TOKEN :
+{
+        < ASSIGN:               "="    >
+    |   < GT:                   ">"    >
+    |   < LT:                   "<"    >
+    |   < BANG:                 "!"    >
+    |   < TILDE:                "~"    >
+    |   < HOOK:                 "?"    >
+    |   < COLON:                ":"    >
+    |   < EQ:                   "=="   >
+    |   < LE:                   "<="   >
+    |   < GE:                   ">="   >
+    |   < NE:                   "!="   >
+    |   < SC_OR:                "||"   >
+    |   < SC_AND:               "&&"   >
+    |   < SC_XOR:               "^^"   >
+    |   < INCR:                 "++"   >
+    |   < DECR:                 "--"   >
+    |   < PLUS:                 "+"    >
+    |   < MINUS:                "-"    >
+    |   < STAR:                 "*"    >
+    |   < SLASH:                "/"    >
+    |   < BIT_AND:              "&"    >
+    |   < BIT_OR:               "|"    >
+    |   < XOR:                  "^"    >
+    |   < REM:                  "%"    >
+    |   < LSHIFT:               "<<"   >
+    |   < RSIGNEDSHIFT:         ">>"   >
+    |   < RUNSIGNEDSHIFT:       ">>>"  >
+    |   < PLUSASSIGN:           "+="   >
+    |   < MINUSASSIGN:          "-="   >
+    |   < STARASSIGN:           "*="   >
+    |   < SLASHASSIGN:          "/="   >
+    |   < ANDASSIGN:            "&="   >
+    |   < ORASSIGN:             "|="   >
+    |   < XORASSIGN:            "^="   >
+    |   < REMASSIGN:            "%="   >
+    |   < LSHIFTASSIGN:         "<<="  >
+    |   < RSIGNEDSHIFTASSIGN:   ">>="  >
+    |   < RUNSIGNEDSHIFTASSIGN: ">>>=" >
+    |   < SC_ORASSIGN:          "||="  >
+    |   < SC_ANDASSIGN:         "&&="  >
+    |   < SC_XORASSIGN:         "^^="  >
+    |   < IDENTITYOPER:         "==="  >
+    |   < NOTIDENTITYOPER:      "!=="  >
+}
+///////////////////////////////////////////////////////////////////
+// GRAMMAR Section
+///////////////////////////////////////////////////////////////////
+
+Token Program():
+{
+        Token retval = getToken(1);
+}
+{
+        (PackageDefinition())* [Directives()] <EOF>
+        {
+            _jjtRoot = jjtThis;
+            return retval;
+        }
+}
+
+/////////////////////////////////////////////////////
+// Expressions 
+/////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////
+// Identifier 
+/////////////////////////////////////////////////////
+void Identifier():
+{}
+{
+        <IDENTIFIER>
+    |   <GET>
+    |   <SET>
+    |   <INCLUDE>
+//    |   <NAMESPACE>
+}
+
+/////////////////////////////////////////////////////
+// Qualified Identifier 
+/////////////////////////////////////////////////////
+void SimpleQualifiedIdentifier():
+{}
+{
+       Identifier() [<QUALIFIER> Identifier()]
+    |  ReservedNamespace() [<QUALIFIER> Identifier()] 
+}
+
+void ExpressionQualifiedIdentifier():
+{}
+{
+       <LPAREN> AssignmentExpression() <RPAREN> <QUALIFIER> Identifier()
+}
+
+void QualifiedIdentifier():
+{}
+{
+       SimpleQualifiedIdentifier()
+    |  ExpressionQualifiedIdentifier()
+}
+
+/////////////////////////////////////////////////////
+// Primary Expressions
+/////////////////////////////////////////////////////
+void PrimaryExpression ():
+{}
+{
+    (
+        <NULL>
+    |   <TRUE>
+    |   <FALSE>
+    |   <DECIMAL_LITERAL> 
+    |   <OCTAL_LITERAL>
+    |   <HEX_LITERAL>
+    |   <FLOATING_POINT_LITERAL> 
+    |   <STRING_LITERAL> 
+    |   <THIS>
+    |   <REGULAR_EXPRESSION>
+    |   <LPAREN> ListExpression() <RPAREN>
+    |   ArrayLiteral()
+    |   ObjectLiteral()
+    |   FunctionExpression()
+    )
+    {
+        token_source.setRegValid();
+    }
+}
+
+void ReservedNamespace ():
+{}
+{
+       <PUBLIC>
+    |  <PROTECTED>
+    |  <PRIVATE>
+}
+
+/////////////////////////////////////////////////////
+// Function Expression
+/////////////////////////////////////////////////////
+void  FunctionExpression ():
+{}
+{
+        LOOKAHEAD(2) <FUNCTION> FunctionCommon()
+    |                <FUNCTION> Identifier() FunctionCommon()
+}
+
+/////////////////////////////////////////////////////
+// Object Literals
+/////////////////////////////////////////////////////
+void ObjectLiteral ():
+{}
+{
+        <LBRACE> [FieldList()] <RBRACE>  
+}        
+
+void FieldList():
+{}
+{
+        LiteralField() (<COMMA> LiteralField())*
+}
+
+void LiteralField ():
+{}
+{
+        FieldName() <COLON> AssignmentExpression()
+}
+
+void FieldName ():
+{}
+{
+        <STRING_LITERAL>
+    |   <DECIMAL_LITERAL>
+    |   SimpleQualifiedIdentifier()
+    |   <LPAREN> AssignmentExpression() <RPAREN> [<QUALIFIER> Identifier()]
+}	
+
+/////////////////////////////////////////////////////
+// Array Literal
+/////////////////////////////////////////////////////
+void ArrayLiteral():
+{}
+{
+        <LBRACKET> [ElementList()] <RBRACKET>
+}
+
+void ElementList():
+{}
+{
+        LiteralElement() (<COMMA> LiteralElement())*
+}
+
+void LiteralElement():
+{}
+{
+        AssignmentExpression()
+}
+
+/////////////////////////////////////////////////////
+// Super Expression
+/////////////////////////////////////////////////////
+void SuperExpression ():
+{}
+{
+        <SUPER> [LOOKAHEAD(2) <LPAREN> AssignmentExpression() <RPAREN>]
+}
+
+/////////////////////////////////////////////////////
+// Postfix Expression
+/////////////////////////////////////////////////////
+void PostfixExpression ():
+{}
+{
+        AttributeExpression ()                            [PostfixOp()]
+    |   {token_source.setRegInvalid();} 
+        FullPostfixExpression () (PropertyOrArguments())* [PostfixOp()]
+    |   SuperExpression()         PropertyOperator()
+}    
+
+void AttributeExpression ():
+{}
+{
+        SimpleQualifiedIdentifier()  (PropertyOrArguments())*
+}
+
+void FullPostfixExpression ():
+{}
+{
+       LOOKAHEAD(<LPAREN> AssignmentExpression() <RPAREN> <QUALIFIER>) 
+       ExpressionQualifiedIdentifier()
+    |  PrimaryExpression() 
+    |  FullNewExpression()             
+}
+
+void FullNewExpression ():
+{}
+{
+        <NEW> FullNewSubexpression()  (LOOKAHEAD(2) PropertyOperator())* [LOOKAHEAD(2) Arguments()]
+}
+
+void FunctionConstructor():
+{}
+{    
+        <FUNCTION_> Arguments()
+}
+
+void FullNewSubexpression ():
+{}
+{
+        LOOKAHEAD(<LPAREN> AssignmentExpression() <RPAREN> <QUALIFIER>) 
+        ExpressionQualifiedIdentifier()        
+    |   PrimaryExpression() 
+    |   SimpleQualifiedIdentifier()
+    |   SuperExpression() 
+    |   FullNewExpression()
+    |   FunctionConstructor()
+}
+
+
+void PostfixOp():
+{}
+{
+        <INCR>
+    |   <DECR>
+}
+
+void PropertyOrArguments ():
+{}
+{
+        Arguments()        
+    |   PropertyOperator()
+}
+
+/////////////////////////////////////////////////////
+// Property Operators
+/////////////////////////////////////////////////////
+void PropertyOperator ():
+{}
+{          
+        <DOT>      QualifiedIdentifier()
+    |   LOOKAHEAD(2) <LBRACKET> <RBRACKET>
+    |   LOOKAHEAD(2) <LBRACKET> <ELIPSE> AssignmentExpression() <RBRACKET>
+    |                <LBRACKET> ListExpression() [<ELIPSE> AssignmentExpression()] <RBRACKET>
+}
+
+void Arguments ():
+{{token_source.setRegValid();}}
+{
+        LOOKAHEAD(2) <LPAREN> <RPAREN>
+    |   LOOKAHEAD(2) <LPAREN> <ELIPSE> AssignmentExpression() <RPAREN>
+    |                <LPAREN> ListExpression() [<ELIPSE> AssignmentExpression()] <RPAREN>
+}
+
+/////////////////////////////////////////////////////
+// Unary Operators 
+/////////////////////////////////////////////////////
+void UnaryExpression ():
+{}
+{
+                 PostfixExpression()
+    |   <DELETE> PostfixExpression()
+    |   <VOID>   UnaryExpression()
+    |   <TYPEOF> UnaryExpression()
+    |   <INCR>   PostfixExpression()
+    |   <DECR>   PostfixExpression()
+    |   <PLUS>   UnaryExpression()
+    |   <MINUS>  UnaryExpression()
+    |   <TILDE>  UnaryExpression()
+    |   <BANG>   UnaryExpression()
+}
+
+/////////////////////////////////////////////////////
+// Multiplicative Operators 
+/////////////////////////////////////////////////////
+void MulOp():
+{}
+{
+        <STAR>
+    |   <SLASH>
+    |   <REM> 
+}
+
+void MultiplicativeExpression():
+{}
+{
+        UnaryExpression() (MulOp() UnaryExpression())*
+
+}
+
+/////////////////////////////////////////////////////
+// Additive Operators 
+/////////////////////////////////////////////////////
+void AddOp():
+{}
+{
+        <PLUS>
+    |   <MINUS>
+}
+
+void AdditiveExpression():
+{}
+{
+        MultiplicativeExpression() (AddOp() MultiplicativeExpression())*
+} 
+
+/////////////////////////////////////////////////////
+// Bitwise Shift Operators 
+/////////////////////////////////////////////////////
+void ShiftOp():
+{}
+{
+        <LSHIFT>
+    |   <RSIGNEDSHIFT>
+    |   <RUNSIGNEDSHIFT>
+}
+
+void ShiftExpression():
+{}
+{
+        AdditiveExpression() (ShiftOp() AdditiveExpression())*
+}
+
+/////////////////////////////////////////////////////
+// Relational Operators 
+/////////////////////////////////////////////////////
+void RelOp():
+{}
+{
+        <LT>
+    |   <GT> 
+    |   <LE> 
+    |   <GE>
+    |   <IS>
+    |   <AS>
+}
+
+void RelationalExpression():
+{}
+{
+        ShiftExpression() 
+            (LOOKAHEAD(3)(RelOp() | <IN> | <INSTANCEOF> ) ShiftExpression())*
+}
+
+void RelationalExpressionNoIN():
+{}
+{
+        ShiftExpression() 
+            ((RelOp() | <INSTANCEOF>)  ShiftExpression())*
+}
+
+/////////////////////////////////////////////////////
+// Equality Operators 
+/////////////////////////////////////////////////////
+void EqualOp():
+{}
+{
+        <EQ> 
+    |   <NE> 
+    |   <IDENTITYOPER> 
+    |   <NOTIDENTITYOPER>
+}
+
+void EqualityExpression():
+{}
+{
+        RelationalExpression() (EqualOp() RelationalExpression())*
+}
+
+void EqualityExpressionNoIN():
+{}
+{
+        RelationalExpressionNoIN() (EqualOp() RelationalExpressionNoIN())*
+}
+
+/////////////////////////////////////////////////////
+// Binary Bitwise Operators 
+/////////////////////////////////////////////////////
+void BitwiseANDOp():
+{}
+{
+        <BIT_AND>
+}
+
+void BitwiseANDExpression():
+{}
+{
+        EqualityExpression() (BitwiseANDOp() EqualityExpression())*
+}
+
+void BitwiseANDExpressionNoIN():
+{}
+{
+        EqualityExpressionNoIN() (BitwiseANDOp() EqualityExpressionNoIN())*
+}
+
+
+void BitwiseXOROp():
+{}
+{
+        <XOR>
+}
+
+void BitwiseXORExpression():
+{}
+{
+        BitwiseANDExpression() (BitwiseXOROp() BitwiseANDExpression())*
+}
+
+void BitwiseXORExpressionNoIN():
+{}
+{
+        BitwiseANDExpressionNoIN() (BitwiseXOROp() BitwiseANDExpressionNoIN())*
+}
+
+void BitwiseOROp():
+{}
+{
+        <BIT_OR>
+}
+
+void BitwiseORExpression():
+{}
+{
+        BitwiseXORExpression() (BitwiseOROp() BitwiseXORExpression())*
+}
+
+void BitwiseORExpressionNoIN():
+{}
+{
+        BitwiseXORExpressionNoIN() (BitwiseOROp() BitwiseXORExpressionNoIN())*
+}
+
+/////////////////////////////////////////////////////
+// Binary Logical Operators 
+/////////////////////////////////////////////////////
+void LogicalANDExpression():
+{}
+{
+        BitwiseORExpression() (<SC_AND> BitwiseORExpression())*
+}
+
+void LogicalANDExpressionNoIN():
+{}
+{
+        BitwiseORExpressionNoIN() (<SC_AND> BitwiseORExpressionNoIN())*
+}
+
+void LogicalORExpression():
+{}
+{
+        LogicalANDExpression() (<SC_OR> LogicalANDExpression())*
+}
+
+void LogicalORExpressionNoIN():
+{}
+{
+        LogicalANDExpressionNoIN() (<SC_OR> LogicalANDExpressionNoIN())*
+}
+
+/////////////////////////////////////////////////////
+// Conditional Operators 
+/////////////////////////////////////////////////////
+void ConditionalExpression():
+{}
+{
+        LogicalORExpression() [<HOOK>  AssignmentExpression() 
+                               <COLON> AssignmentExpression()]
+}
+
+void ConditionalExpressionNoIN():
+{}
+{
+        LogicalORExpressionNoIN()  [<HOOK>  AssignmentExpressionNoIN() 
+                                    <COLON> AssignmentExpressionNoIN()]
+}
+
+void NonAssignmentExpression():
+{}
+{
+        LogicalORExpression() [<HOOK>  NonAssignmentExpression() 
+                               <COLON> NonAssignmentExpression()]
+}
+
+void NonAssignmentExpressionNoIN():
+{}
+{
+        LogicalORExpressionNoIN() [<HOOK>  NonAssignmentExpressionNoIN() 
+                                   <COLON> NonAssignmentExpressionNoIN()]
+}
+
+/////////////////////////////////////////////////////
+// Assignment Operators 
+/////////////////////////////////////////////////////
+void AssignementOperator():
+{}
+{
+        <ASSIGN>
+    |   <STARASSIGN>
+    |   <SLASHASSIGN> 
+    |   <REMASSIGN> 
+    |   <PLUSASSIGN>
+    |   <MINUSASSIGN> 
+    |   <LSHIFTASSIGN> 
+    |   <RSIGNEDSHIFTASSIGN>
+    |   <RUNSIGNEDSHIFTASSIGN>
+    |   <ANDASSIGN> 
+    |   <XORASSIGN> 
+    |   <ORASSIGN>
+    |   <SC_ANDASSIGN>
+    |   <SC_XORASSIGN>
+    |   <SC_ORASSIGN>
+ 
+}
+
+void AssignmentExpression():
+{}
+{
+        ConditionalExpression() [LOOKAHEAD(2) AssignementOperator() AssignmentExpression()]
+}
+
+void AssignmentExpressionNoIN():
+{}
+{
+        ConditionalExpressionNoIN() [LOOKAHEAD(2) AssignementOperator() AssignmentExpressionNoIN()]
+}
+
+/////////////////////////////////////////////////////
+// Comma Expressions
+/////////////////////////////////////////////////////
+void ListExpression ():
+{}
+{
+        AssignmentExpression() (<COMMA> AssignmentExpression())*
+}   
+
+void ListExpressionNoIN ():
+{}
+{
+        AssignmentExpressionNoIN() (<COMMA> AssignmentExpressionNoIN())*
+}   
+
+/////////////////////////////////////////////////////
+// Type Expressions
+/////////////////////////////////////////////////////
+void TypeExpression ():
+{}
+{
+        NonAssignmentExpression()
+}
+
+void TypeExpressionNoIN ():
+{}
+{
+        NonAssignmentExpressionNoIN()
+}
+
+void TypeExpressionList ():
+{}
+{
+        NonAssignmentExpression() (<COMMA> NonAssignmentExpression())*
+}
+/////////////////////////////////////////////////////
+// Staements (abbrev, noShortIf, full) 
+/////////////////////////////////////////////////////
+void Statement ():
+{}
+{
+        LOOKAHEAD(3) ExpressionStatement() Sc()
+    |                SuperStatement() Sc()
+    |                Block()
+    |                LabeledStatement()
+    |                IfStatement()
+    |                SwitchStatement()
+    |                DoStatement() Sc()
+    |                WhileStatement()
+    |                ForStatement()
+    |                WithStatement()
+    |                ContinueStatement() Sc()
+    |                BreakStatement() Sc()
+    |                ReturnStatement() Sc()
+    |                ThrowStatement() Sc()
+    |                TryStatement()
+}
+
+void Substatement ():
+{}
+{
+                     EmptyStatement()
+    |   LOOKAHEAD(2) Statement()
+    |                SimpleVariableDefinition() Sc()
+    |                Attributes()               <LBRACE> Substatements() <RBRACE>
+}
+
+void Substatements ():
+{}
+{
+        (Substatement())+
+}
+
+JAVACODE
+  void Sc() {
+    Token tok = getToken(1);
+    if (tok.kind == SEMICOLON) {
+       tok = getNextToken();
+    } else if (tok.specialToken != null) {
+       if (!EolCommentSkipWs(tok.specialToken) && (tok.kind != EOF)) {
+          throw generateParseException();
+       }
+    } else if ((tok.kind != EOF) && (tok.kind!=RBRACE)) {
+         throw generateParseException();
+    }
+  }
+ 
+JAVACODE
+  boolean EolCommentSkipWs(Token t) {
+    boolean retVal = false;
+    Token specialToken = t;
+    while(specialToken != null) {
+      if(specialToken.kind == WS) {
+        specialToken = specialToken.specialToken;
+        continue;
+      }
+      else if(specialToken.kind == EOL  ||
+              specialToken.kind == SINGLE_LINE_COMMENT) {
+        retVal = true;
+        break;
+      }
+      else {
+        break;
+      }
+    }
+    return retVal;
+  }
+ 
+/////////////////////////////////////////////////////
+// Empty Statement 
+/////////////////////////////////////////////////////
+void EmptyStatement():
+{}
+{
+        <SEMICOLON>
+}
+
+/////////////////////////////////////////////////////
+// Expresion Statement 
+/////////////////////////////////////////////////////
+void ExpressionStatement():
+{}
+{
+        ListExpression() 
+}
+
+/////////////////////////////////////////////////////
+// Super Statement 
+/////////////////////////////////////////////////////
+void SuperStatement ():
+{}
+{
+        <SUPER> Arguments()
+}
+
+/////////////////////////////////////////////////////
+// Block Statement 
+/////////////////////////////////////////////////////
+void Block ():
+{}
+{   
+        <LBRACE> [Directives()] <RBRACE>
+}
+
+/////////////////////////////////////////////////////
+// Labeled Statement (maps to literal field)
+/////////////////////////////////////////////////////
+void LabeledStatement ():
+{}
+{
+        Identifier() <COLON> Substatement()
+}
+
+/////////////////////////////////////////////////////
+// If Statement 
+/////////////////////////////////////////////////////
+void IfStatement():
+{}
+{
+        <IF> <LPAREN> ListExpression() <RPAREN> 
+            Substatement() 
+            [LOOKAHEAD(1) <ELSE> Substatement()]
+}
+
+/////////////////////////////////////////////////////
+// Switch Statement 
+/////////////////////////////////////////////////////
+void SwitchStatement ():
+{}
+{
+        <SWITCH> <LPAREN> ListExpression() <RPAREN>
+                 <LBRACE> [CaseElements()] <RBRACE>
+}
+
+void CaseElements ():
+{}
+{
+        CaseLabel() (CaseElement())*
+}
+
+void CaseElement ():
+{}
+{
+        Directive()
+    |   CaseLabel()
+}
+
+void CaseLabel ():
+{}
+{
+        <CASE> ListExpression() <COLON>
+    |   <_DEFAULT> <COLON>
+}
+
+/////////////////////////////////////////////////////
+// Do-While Statement 
+/////////////////////////////////////////////////////
+void DoStatement(): 
+{}
+{
+        <DO> Substatement() <WHILE> <LPAREN> ListExpression() <RPAREN>
+}
+
+/////////////////////////////////////////////////////
+// While Statement
+/////////////////////////////////////////////////////
+void WhileStatement ():
+{}
+{
+        <WHILE> <LPAREN> ListExpression() <RPAREN>
+           Substatement()
+}
+
+/////////////////////////////////////////////////////
+// For Statements 
+/////////////////////////////////////////////////////
+void ForStatement ():
+{}
+{
+         LOOKAHEAD(<FOR> <LPAREN> ForInBinding() <IN>)
+                   <FOR> <LPAREN> ForInBinding() <IN> ListExpression() <RPAREN>
+                      Substatement()
+    |              <FOR> <LPAREN> [ForInitializer()] <SEMICOLON> 
+                       [ListExpression()] <SEMICOLON> 
+                       [ListExpression()] <RPAREN> 
+                      Substatement()
+}
+
+void ForInitializer ():
+{}
+{
+        LOOKAHEAD(3) ListExpressionNoIN()
+    |                VariableDefinitionNoIN()
+    |                Attributes()             VariableDefinitionNoIN()
+}
+
+void ForInBinding ():
+{}
+{
+        LOOKAHEAD(3) PostfixExpression()
+    |                VariableDefinitionKind() VariableBindingNoIN()
+    |                Attributes()             VariableDefinitionKind() VariableBindingNoIN()
+}
+
+/////////////////////////////////////////////////////
+// With Statement 
+/////////////////////////////////////////////////////
+void WithStatement():
+{}
+{
+        <WITH> <LPAREN> ExpressionStatement() <RPAREN>
+            Substatement()
+}
+
+/////////////////////////////////////////////////////
+// Continue and Break Statement
+/////////////////////////////////////////////////////
+void ContinueStatement():
+{}
+{
+        <CONTINUE> [Identifier()]
+}
+
+void BreakStatement():
+{}
+{
+        <BREAK> [Identifier()]
+}
+ 
+
+/////////////////////////////////////////////////////
+// Return Statement
+/////////////////////////////////////////////////////
+void ReturnStatement():
+{}
+{
+        <RETURN> [ListExpression()]
+}
+
+/////////////////////////////////////////////////////
+// Throw Statement
+/////////////////////////////////////////////////////
+void ThrowStatement():
+{}
+{
+        <THROW> ListExpression()
+}
+
+/////////////////////////////////////////////////////
+// Try Statement
+/////////////////////////////////////////////////////
+void TryStatement():
+{}
+{
+        <TRY> Block()
+        (<CATCH> <LPAREN> Identifier() <RPAREN> Block())*
+        [<FINALLY> Block()]
+} 
+ 
+/////////////////////////////////////////////////////
+// Directives 
+/////////////////////////////////////////////////////
+void Directives ():
+{}
+{
+        (Directive())+
+}
+
+void Directive ():
+{}
+{
+                      EmptyStatement()
+     |   LOOKAHEAD(3) Statement()
+     |   LOOKAHEAD(2) AnnotatableDirective()
+     |   LOOKAHEAD(2) Attributes()            <LBRACE> Directives() <RBRACE>
+     |   LOOKAHEAD(2) Attributes()            AnnotatableDirective() 
+     |                IncludeDirective()      Sc()
+     |                Pragma()                Sc()
+}
+
+void AnnotatableDirective ():
+{}
+{
+         VariableDefinition() Sc()
+     |   FunctionDefinition()
+     |   ClassDefinition()
+     |   InterfaceDefinition()
+     |   NamespaceDefinition() Sc()
+     |   ImportDirective() Sc()
+     |   ExportDefinition() Sc()
+     |   UseDirective() Sc()
+}
+/////////////////////////////////////////////////////
+// Attributes
+/////////////////////////////////////////////////////
+void Attributes ():
+{}
+{
+        (Attribute ())+
+}
+
+void Attribute ():
+{}
+{
+                     AttributeExpression()
+    |                <TRUE>
+    |                <FALSE>
+}
+
+/////////////////////////////////////////////////////
+// Use Directive
+/////////////////////////////////////////////////////
+void UseDirective ():
+{}
+{ 
+        <USE> <NAMESPACE> <LPAREN> ListExpression() <RPAREN>
+}
+
+/////////////////////////////////////////////////////
+// Import Directive
+/////////////////////////////////////////////////////
+void ImportDirective ():
+{}
+{
+        LOOKAHEAD(3) <IMPORT> PackageName()
+    |                <IMPORT> Identifier() <ASSIGN> PackageName()
+}
+
+/////////////////////////////////////////////////////
+// Include Directive
+/////////////////////////////////////////////////////
+void IncludeDirective (): 
+{}
+{
+        <INCLUDE> <STRING_LITERAL>
+}
+
+/////////////////////////////////////////////////////
+// Pragma
+/////////////////////////////////////////////////////
+void Pragma ():
+{}
+{
+        <USE> PragmaItems()
+}
+
+void PragmaItems ():
+{}
+{
+        PragmaItem() (<COMMA> PragmaItem())
+}
+
+void PragmaItem ():
+{}
+{
+        PragmaExpr() [<HOOK>]
+}
+
+
+void PragmaExpr ():
+{}
+{
+        Identifier() [<LPAREN> PragmaArgument() <RPAREN>]
+}
+
+void PragmaArgument ():
+{}
+{
+        <TRUE>
+    |   <FALSE>
+    |   <DECIMAL_LITERAL> 
+    |   <OCTAL_LITERAL>
+    |   <HEX_LITERAL>
+    |   <FLOATING_POINT_LITERAL> 
+    |   <STRING_LITERAL> 
+}
+
+/////////////////////////////////////////////////////
+// Definitions 
+/////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////
+// Export Definition 
+/////////////////////////////////////////////////////
+void ExportDefinition ():
+{}
+{
+        <EXPORT> ExportBindingList ()
+}
+
+void ExportBindingList ():
+{}
+{
+        ExportBinding() (<COMMA> ExportBinding())*
+}
+
+void ExportBinding ():
+{}
+{
+        LOOKAHEAD(2) FunctionName ()
+    |                FunctionName () <ASSIGN> FunctionName ()
+}
+
+/////////////////////////////////////////////////////
+// Variable Definition (in, NoIN)
+/////////////////////////////////////////////////////
+void VariableDefinition ():
+{}
+{
+        VariableDefinitionKind() VariableBindingList()
+}
+
+void VariableDefinitionNoIN ():
+{}
+{
+        VariableDefinitionKind() VariableBindingListNoIN()
+}
+
+
+void VariableDefinitionKind ():
+{}
+{
+        <VAR>
+    |   <CONST>
+}
+
+void VariableBindingList ():
+{}
+{
+   VariableBinding() (<COMMA> VariableBinding ())*
+}
+
+void VariableBindingListNoIN ():
+{}
+{
+   VariableBindingNoIN() (<COMMA> VariableBindingNoIN())*
+}
+
+void VariableBinding ():
+{}
+{
+        TypedIdentifier() [VariableInitialisation()]
+}
+
+void VariableBindingNoIN ():
+{}
+{
+        TypedIdentifierNoIN() [VariableInitialisationNoIN()]
+}
+
+
+void VariableInitialisation ():
+{}
+{
+       <ASSIGN>  VariableInitializer ()
+}
+
+void VariableInitialisationNoIN ():
+{}
+{
+       <ASSIGN>  VariableInitializerNoIN ()
+}
+
+void VariableInitializer ():
+{}
+{
+        LOOKAHEAD(3) AssignmentExpression ()
+    |                Attributes ()
+}
+
+void VariableInitializerNoIN ():
+{}
+{
+        LOOKAHEAD(3) AssignmentExpressionNoIN ()
+    |                Attributes ()
+}
+
+
+void TypedIdentifier ():
+{}
+{
+        Identifier () [<COLON> TypeExpression()]
+}
+
+void TypedIdentifierNoIN ():
+{}
+{
+        Identifier () [<COLON> TypeExpressionNoIN()]
+}
+
+/////////////////////////////////////////////////////
+// Simple Variable Definition 
+/////////////////////////////////////////////////////
+void SimpleVariableDefinition ():
+{}
+{
+        <VAR> UntypedVariableBindingList()
+}
+
+void UntypedVariableBindingList ():
+{}
+{
+        UntypedVariableBinding() (<COMMA> UntypedVariableBinding())*
+}
+
+void UntypedVariableBinding ():
+{}
+{
+        Identifier() VariableInitialisation()
+}
+
+/////////////////////////////////////////////////////
+// Function Definition
+/////////////////////////////////////////////////////
+void FunctionDefinition ():
+{}
+{
+        <FUNCTION> FunctionName() FunctionCommon()
+}
+
+void FunctionName ():
+{}
+{
+        // no line break after get
+        LOOKAHEAD(2) <GET> Identifier()
+        // no line break after get
+    |   LOOKAHEAD(2) <SET> Identifier()
+    |                 Identifier()
+}
+
+void FunctionCommon ():
+{}
+{
+        <LPAREN> [Parameters()] <RPAREN> [Result()] Block()
+}
+
+void Parameters ():
+{}
+{
+        RestParameters()
+    |   ParameterInit() (<COMMA> ParameterInit())* [RestParameters()]
+}
+
+void Parameter ():
+{}
+{
+        [<CONST>] TypedIdentifier()
+}
+
+void ParameterInit ():
+{}
+{
+        Parameter() [<ASSIGN> AssignmentExpression()]
+}
+
+void RestParameters ():
+{}
+{
+        <ELIPSE> [<CONST> Identifier()]
+}
+
+void Result ():
+{}
+{
+        <COLON> TypeExpression()
+}
+
+/////////////////////////////////////////////////////
+// Class Definition
+/////////////////////////////////////////////////////
+void ClassDefinition ():
+{}
+{
+        <CLASS> Identifier() [Inheritance()] Block()
+}
+
+void InterfaceDefinition ():
+{}
+{
+        LOOKAHEAD(3) <INTERFACE> Identifier() Sc()
+    |                <INTERFACE> Identifier() 
+                                 [<EXTENDS> TypeExpressionList()] Block()
+}
+
+
+void Inheritance ():
+{}
+{ 
+        <EXTENDS> TypeExpression() [<IMPLEMENTS> TypeExpressionList()]
+    |   <IMPLEMENTS> TypeExpressionList()
+}
+
+/////////////////////////////////////////////////////
+// Namespace Definition 
+/////////////////////////////////////////////////////
+void NamespaceDefinition ():
+{}
+{
+        <NAMESPACE> Identifier()
+}
+
+/////////////////////////////////////////////////////
+// Package Definition 
+/////////////////////////////////////////////////////
+void PackageDefinition ():
+{}
+{
+        <PACKAGE> [PackageName()] Block()
+}
+
+void PackageName ():
+{}
+{
+        <STRING_LITERAL>
+    |   PackageIdentifiers()
+}
+
+void PackageIdentifiers ():
+{}
+{
+        Identifier() (<DOT> Identifier())*
+}

Added: incubator/adffaces/branches/matzew-repackaging-trinidad/plugins/maven-javascript-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/javascript/javascriptcompiler/DepthFirstTraversal.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/matzew-repackaging-trinidad/plugins/maven-javascript-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/javascript/javascriptcompiler/DepthFirstTraversal.java?rev=425117&view=auto
==============================================================================
--- incubator/adffaces/branches/matzew-repackaging-trinidad/plugins/maven-javascript-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/javascript/javascriptcompiler/DepthFirstTraversal.java (added)
+++ incubator/adffaces/branches/matzew-repackaging-trinidad/plugins/maven-javascript-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/javascript/javascriptcompiler/DepthFirstTraversal.java Mon Jul 24 09:58:43 2006
@@ -0,0 +1,1350 @@
+/*
+* Copyright 2006 The Apache Software Foundation.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package org.apache.myfaces.trinidadbuild.plugin.javascript.javascriptcompiler;
+
+import java.io.PrintStream;
+
+import java.util.HashMap;
+
+import java.util.StringTokenizer;
+
+import org.apache.myfaces.trinidadbuild.plugin.javascript.javascript20parser.ASTAddOp;
+import org.apache.myfaces.trinidadbuild.plugin.javascript.javascript20parser.ASTAdditiveExpression;
+import org.apache.myfaces.trinidadbuild.plugin.javascript.javascript20parser.ASTAnnotatableDirective;
+import org.apache.myfaces.trinidadbuild.plugin.javascript.javascript20parser.ASTArguments;
+import org.apache.myfaces.trinidadbuild.plugin.javascript.javascript20parser.ASTArrayLiteral;
+import org.apache.myfaces.trinidadbuild.plugin.javascript.javascript20parser.ASTAssignementOperator;
+import org.apache.myfaces.trinidadbuild.plugin.javascript.javascript20parser.ASTAssignmentExpression;
+import org.apache.myfaces.trinidadbuild.plugin.javascript.javascript20parser.ASTAssignmentExpressionNoIN;
+import org.apache.myfaces.trinidadbuild.plugin.javascript.javascript20parser.ASTAttribute;
+import org.apache.myfaces.trinidadbuild.plugin.javascript.javascript20parser.ASTAttributeExpression;
+import org.apache.myfaces.trinidadbuild.plugin.javascript.javascript20parser.ASTAttributes;
+import org.apache.myfaces.trinidadbuild.plugin.javascript.javascript20parser.ASTBitwiseANDExpression;
+import org.apache.myfaces.trinidadbuild.plugin.javascript.javascript20parser.ASTBitwiseANDExpressionNoIN;
+import org.apache.myfaces.trinidadbuild.plugin.javascript.javascript20parser.ASTBitwiseANDOp;
+import org.apache.myfaces.trinidadbuild.plugin.javascript.javascript20parser.ASTBitwiseORExpression;
+import org.apache.myfaces.trinidadbuild.plugin.javascript.javascript20parser.ASTBitwiseORExpressionNoIN;
+import org.apache.myfaces.trinidadbuild.plugin.javascript.javascript20parser.ASTBitwiseOROp;
+import org.apache.myfaces.trinidadbuild.plugin.javascript.javascript20parser.ASTBitwiseXORExpression;
+import org.apache.myfaces.trinidadbuild.plugin.javascript.javascript20parser.ASTBitwiseXORExpressionNoIN;
+import org.apache.myfaces.trinidadbuild.plugin.javascript.javascript20parser.ASTBitwiseXOROp;
+import org.apache.myfaces.trinidadbuild.plugin.javascript.javascript20parser.ASTBlock;
+import org.apache.myfaces.trinidadbuild.plugin.javascript.javascript20parser.ASTBreakStatement;
+import org.apache.myfaces.trinidadbuild.plugin.javascript.javascript20parser.ASTCaseElement;
+import org.apache.myfaces.trinidadbuild.plugin.javascript.javascript20parser.ASTCaseElements;
+import org.apache.myfaces.trinidadbuild.plugin.javascript.javascript20parser.ASTCaseLabel;
+import org.apache.myfaces.trinidadbuild.plugin.javascript.javascript20parser.ASTClassDefinition;
+import org.apache.myfaces.trinidadbuild.plugin.javascript.javascript20parser.ASTConditionalExpression;
+import org.apache.myfaces.trinidadbuild.plugin.javascript.javascript20parser.ASTConditionalExpressionNoIN;
+import org.apache.myfaces.trinidadbuild.plugin.javascript.javascript20parser.ASTContinueStatement;
+import org.apache.myfaces.trinidadbuild.plugin.javascript.javascript20parser.ASTDirective;
+import org.apache.myfaces.trinidadbuild.plugin.javascript.javascript20parser.ASTDirectives;
+import org.apache.myfaces.trinidadbuild.plugin.javascript.javascript20parser.ASTDoStatement;
+import org.apache.myfaces.trinidadbuild.plugin.javascript.javascript20parser.ASTElementList;
+import org.apache.myfaces.trinidadbuild.plugin.javascript.javascript20parser.ASTEmptyStatement;
+import org.apache.myfaces.trinidadbuild.plugin.javascript.javascript20parser.ASTEolCommentSkipWs;
+import org.apache.myfaces.trinidadbuild.plugin.javascript.javascript20parser.ASTEqualOp;
+import org.apache.myfaces.trinidadbuild.plugin.javascript.javascript20parser.ASTEqualityExpression;
+import org.apache.myfaces.trinidadbuild.plugin.javascript.javascript20parser.ASTEqualityExpressionNoIN;
+import org.apache.myfaces.trinidadbuild.plugin.javascript.javascript20parser.ASTExportBinding;
+import org.apache.myfaces.trinidadbuild.plugin.javascript.javascript20parser.ASTExportBindingList;
+import org.apache.myfaces.trinidadbuild.plugin.javascript.javascript20parser.ASTExportDefinition;
+import org.apache.myfaces.trinidadbuild.plugin.javascript.javascript20parser.ASTExpressionQualifiedIdentifier;
+import org.apache.myfaces.trinidadbuild.plugin.javascript.javascript20parser.ASTExpressionStatement;
+import org.apache.myfaces.trinidadbuild.plugin.javascript.javascript20parser.ASTFieldList;
+import org.apache.myfaces.trinidadbuild.plugin.javascript.javascript20parser.ASTFieldName;
+import org.apache.myfaces.trinidadbuild.plugin.javascript.javascript20parser.ASTForInBinding;
+import org.apache.myfaces.trinidadbuild.plugin.javascript.javascript20parser.ASTForInitializer;
+import org.apache.myfaces.trinidadbuild.plugin.javascript.javascript20parser.ASTForStatement;
+import org.apache.myfaces.trinidadbuild.plugin.javascript.javascript20parser.ASTFullNewExpression;
+import org.apache.myfaces.trinidadbuild.plugin.javascript.javascript20parser.ASTFullNewSubexpression;
+import org.apache.myfaces.trinidadbuild.plugin.javascript.javascript20parser.ASTFullPostfixExpression;
+import org.apache.myfaces.trinidadbuild.plugin.javascript.javascript20parser.ASTFunctionCommon;
+import org.apache.myfaces.trinidadbuild.plugin.javascript.javascript20parser.ASTFunctionConstructor;
+import org.apache.myfaces.trinidadbuild.plugin.javascript.javascript20parser.ASTFunctionDefinition;
+import org.apache.myfaces.trinidadbuild.plugin.javascript.javascript20parser.ASTFunctionExpression;
+import org.apache.myfaces.trinidadbuild.plugin.javascript.javascript20parser.ASTFunctionName;
+import org.apache.myfaces.trinidadbuild.plugin.javascript.javascript20parser.ASTIdentifier;
+import org.apache.myfaces.trinidadbuild.plugin.javascript.javascript20parser.ASTIfStatement;
+import org.apache.myfaces.trinidadbuild.plugin.javascript.javascript20parser.ASTImportDirective;
+import org.apache.myfaces.trinidadbuild.plugin.javascript.javascript20parser.ASTIncludeDirective;
+import org.apache.myfaces.trinidadbuild.plugin.javascript.javascript20parser.ASTInheritance;
+import org.apache.myfaces.trinidadbuild.plugin.javascript.javascript20parser.ASTInterfaceDefinition;
+import org.apache.myfaces.trinidadbuild.plugin.javascript.javascript20parser.ASTLabeledStatement;
+import org.apache.myfaces.trinidadbuild.plugin.javascript.javascript20parser.ASTListExpression;
+import org.apache.myfaces.trinidadbuild.plugin.javascript.javascript20parser.ASTListExpressionNoIN;
+import org.apache.myfaces.trinidadbuild.plugin.javascript.javascript20parser.ASTLiteralElement;
+import org.apache.myfaces.trinidadbuild.plugin.javascript.javascript20parser.ASTLiteralField;
+import org.apache.myfaces.trinidadbuild.plugin.javascript.javascript20parser.ASTLogicalANDExpression;
+import org.apache.myfaces.trinidadbuild.plugin.javascript.javascript20parser.ASTLogicalANDExpressionNoIN;
+import org.apache.myfaces.trinidadbuild.plugin.javascript.javascript20parser.ASTLogicalORExpression;
+import org.apache.myfaces.trinidadbuild.plugin.javascript.javascript20parser.ASTLogicalORExpressionNoIN;
+import org.apache.myfaces.trinidadbuild.plugin.javascript.javascript20parser.ASTMulOp;
+import org.apache.myfaces.trinidadbuild.plugin.javascript.javascript20parser.ASTMultiplicativeExpression;
+import org.apache.myfaces.trinidadbuild.plugin.javascript.javascript20parser.ASTNamespaceDefinition;
+import org.apache.myfaces.trinidadbuild.plugin.javascript.javascript20parser.ASTNonAssignmentExpression;
+import org.apache.myfaces.trinidadbuild.plugin.javascript.javascript20parser.ASTNonAssignmentExpressionNoIN;
+import org.apache.myfaces.trinidadbuild.plugin.javascript.javascript20parser.ASTObjectLiteral;
+import org.apache.myfaces.trinidadbuild.plugin.javascript.javascript20parser.ASTPackageDefinition;
+import org.apache.myfaces.trinidadbuild.plugin.javascript.javascript20parser.ASTPackageIdentifiers;
+import org.apache.myfaces.trinidadbuild.plugin.javascript.javascript20parser.ASTPackageName;
+import org.apache.myfaces.trinidadbuild.plugin.javascript.javascript20parser.ASTParameter;
+import org.apache.myfaces.trinidadbuild.plugin.javascript.javascript20parser.ASTParameterInit;
+import org.apache.myfaces.trinidadbuild.plugin.javascript.javascript20parser.ASTParameters;
+import org.apache.myfaces.trinidadbuild.plugin.javascript.javascript20parser.ASTPostfixExpression;
+import org.apache.myfaces.trinidadbuild.plugin.javascript.javascript20parser.ASTPostfixOp;
+import org.apache.myfaces.trinidadbuild.plugin.javascript.javascript20parser.ASTPragma;
+import org.apache.myfaces.trinidadbuild.plugin.javascript.javascript20parser.ASTPragmaArgument;
+import org.apache.myfaces.trinidadbuild.plugin.javascript.javascript20parser.ASTPragmaExpr;
+import org.apache.myfaces.trinidadbuild.plugin.javascript.javascript20parser.ASTPragmaItem;
+import org.apache.myfaces.trinidadbuild.plugin.javascript.javascript20parser.ASTPragmaItems;
+import org.apache.myfaces.trinidadbuild.plugin.javascript.javascript20parser.ASTPrimaryExpression;
+import org.apache.myfaces.trinidadbuild.plugin.javascript.javascript20parser.ASTProgram;
+import org.apache.myfaces.trinidadbuild.plugin.javascript.javascript20parser.ASTPropertyOperator;
+import org.apache.myfaces.trinidadbuild.plugin.javascript.javascript20parser.ASTPropertyOrArguments;
+import org.apache.myfaces.trinidadbuild.plugin.javascript.javascript20parser.ASTQualifiedIdentifier;
+import org.apache.myfaces.trinidadbuild.plugin.javascript.javascript20parser.ASTRelOp;
+import org.apache.myfaces.trinidadbuild.plugin.javascript.javascript20parser.ASTRelationalExpression;
+import org.apache.myfaces.trinidadbuild.plugin.javascript.javascript20parser.ASTRelationalExpressionNoIN;
+import org.apache.myfaces.trinidadbuild.plugin.javascript.javascript20parser.ASTReservedNamespace;
+import org.apache.myfaces.trinidadbuild.plugin.javascript.javascript20parser.ASTRestParameters;
+import org.apache.myfaces.trinidadbuild.plugin.javascript.javascript20parser.ASTResult;
+import org.apache.myfaces.trinidadbuild.plugin.javascript.javascript20parser.ASTReturnStatement;
+import org.apache.myfaces.trinidadbuild.plugin.javascript.javascript20parser.ASTSc;
+import org.apache.myfaces.trinidadbuild.plugin.javascript.javascript20parser.ASTShiftExpression;
+import org.apache.myfaces.trinidadbuild.plugin.javascript.javascript20parser.ASTShiftOp;
+import org.apache.myfaces.trinidadbuild.plugin.javascript.javascript20parser.ASTSimpleQualifiedIdentifier;
+import org.apache.myfaces.trinidadbuild.plugin.javascript.javascript20parser.ASTSimpleVariableDefinition;
+import org.apache.myfaces.trinidadbuild.plugin.javascript.javascript20parser.ASTStatement;
+import org.apache.myfaces.trinidadbuild.plugin.javascript.javascript20parser.ASTSubstatement;
+import org.apache.myfaces.trinidadbuild.plugin.javascript.javascript20parser.ASTSubstatements;
+import org.apache.myfaces.trinidadbuild.plugin.javascript.javascript20parser.ASTSuperExpression;
+import org.apache.myfaces.trinidadbuild.plugin.javascript.javascript20parser.ASTSuperStatement;
+import org.apache.myfaces.trinidadbuild.plugin.javascript.javascript20parser.ASTSwitchStatement;
+import org.apache.myfaces.trinidadbuild.plugin.javascript.javascript20parser.ASTThrowStatement;
+import org.apache.myfaces.trinidadbuild.plugin.javascript.javascript20parser.ASTTryStatement;
+import org.apache.myfaces.trinidadbuild.plugin.javascript.javascript20parser.ASTTypeExpression;
+import org.apache.myfaces.trinidadbuild.plugin.javascript.javascript20parser.ASTTypeExpressionList;
+import org.apache.myfaces.trinidadbuild.plugin.javascript.javascript20parser.ASTTypeExpressionNoIN;
+import org.apache.myfaces.trinidadbuild.plugin.javascript.javascript20parser.ASTTypedIdentifier;
+import org.apache.myfaces.trinidadbuild.plugin.javascript.javascript20parser.ASTTypedIdentifierNoIN;
+import org.apache.myfaces.trinidadbuild.plugin.javascript.javascript20parser.ASTUnaryExpression;
+import org.apache.myfaces.trinidadbuild.plugin.javascript.javascript20parser.ASTUntypedVariableBinding;
+import org.apache.myfaces.trinidadbuild.plugin.javascript.javascript20parser.ASTUntypedVariableBindingList;
+import org.apache.myfaces.trinidadbuild.plugin.javascript.javascript20parser.ASTUseDirective;
+import org.apache.myfaces.trinidadbuild.plugin.javascript.javascript20parser.ASTVariableBinding;
+import org.apache.myfaces.trinidadbuild.plugin.javascript.javascript20parser.ASTVariableBindingList;
+import org.apache.myfaces.trinidadbuild.plugin.javascript.javascript20parser.ASTVariableBindingListNoIN;
+import org.apache.myfaces.trinidadbuild.plugin.javascript.javascript20parser.ASTVariableBindingNoIN;
+import org.apache.myfaces.trinidadbuild.plugin.javascript.javascript20parser.ASTVariableDefinition;
+import org.apache.myfaces.trinidadbuild.plugin.javascript.javascript20parser.ASTVariableDefinitionKind;
+import org.apache.myfaces.trinidadbuild.plugin.javascript.javascript20parser.ASTVariableDefinitionNoIN;
+import org.apache.myfaces.trinidadbuild.plugin.javascript.javascript20parser.ASTVariableInitialisation;
+import org.apache.myfaces.trinidadbuild.plugin.javascript.javascript20parser.ASTVariableInitialisationNoIN;
+import org.apache.myfaces.trinidadbuild.plugin.javascript.javascript20parser.ASTVariableInitializer;
+import org.apache.myfaces.trinidadbuild.plugin.javascript.javascript20parser.ASTVariableInitializerNoIN;
+import org.apache.myfaces.trinidadbuild.plugin.javascript.javascript20parser.ASTWhileStatement;
+import org.apache.myfaces.trinidadbuild.plugin.javascript.javascript20parser.ASTWithStatement;
+import org.apache.myfaces.trinidadbuild.plugin.javascript.javascript20parser.JSParser20Visitor;
+import org.apache.myfaces.trinidadbuild.plugin.javascript.javascript20parser.SimpleNode;
+import org.apache.myfaces.trinidadbuild.plugin.javascript.javascript20parser.Token;
+
+public class DepthFirstTraversal implements JSParser20Visitor
+{
+  protected PrintStream out;
+  private boolean _debug;
+  private int depth;
+  private HashMap<String, String> nameTable;
+
+  public DepthFirstTraversal()
+  {
+    out = System.out;
+    _debug = true;
+    depth = 0;
+  }
+
+
+  public DepthFirstTraversal(PrintStream o)
+  {
+    out = o;
+    _debug = true;
+    depth = 0;
+  }
+
+  public DepthFirstTraversal(PrintStream o, HashMap<String, String> tMap)
+  {
+    out = o;
+    _debug = true;
+    depth = 0;
+    nameTable = tMap;
+  }
+
+
+  public Object depthFirstTraversal(SimpleNode node, Object data)
+  {
+    depth++;
+
+    Token t1 = node.getFirstToken();
+    Token t = new Token();
+    t.next = t1;
+
+    SimpleNode n;
+
+    for (int ord = 0; ord < node.jjtGetNumChildren(); ord++)
+    {
+      //
+      //  Get the next chid node in sequence.
+      //
+      n = (SimpleNode) node.jjtGetChild(ord);
+
+      //
+      // Loop through all the Tokens that are attached to this node.
+      //
+      if (_debug == true)
+      {
+        while (true)
+        {
+          t = t.next;
+
+          if (t == n.getFirstToken()) break;
+
+          print(t);
+        }
+      }
+
+      //
+      // Depth Fist search so visit this nodes children before siblings
+      //
+      n.jjtAccept(this, data);
+
+      t = n.getLastToken();
+    }
+
+    if (_debug == true)
+    {
+      while (t != node.getLastToken())
+      {
+        if (t.next == null) {
+            break;
+        }
+        t = t.next;
+        print(t);
+      }
+    }
+
+    depth--;
+
+    return data;
+  }
+
+  protected void printNode(SimpleNode node)
+  {
+    Token t = node.getFirstToken();
+
+    while (t != node.getLastToken())
+    {
+      print(t);
+      t = t.next;
+    }
+
+    print(node.getLastToken());
+  }
+
+  protected void print(Token t)
+  {
+    //
+    //  Hack Alert: Due to an error with the leaf node ASTEolWithComments
+    //  Wich only matches special and no regular tokens thus we get the next
+    //  valid leafs token stuck in here. Thus we get duplicate info in each file.
+    //  Fixed this with simple flag to recognizes if the token has already been 
+    //  written out.Need to refactor that terminal.
+    //
+    if (t.hasPrinted == true) return;
+    
+    Token tt = t.specialToken;
+
+    if (tt != null)
+    {
+      while (tt.specialToken != null)
+        tt = tt.specialToken;
+
+      while (tt != null)
+      {
+        out.print(addUnicodeEscapes(tt.image));
+        tt = tt.next;
+      }
+    }
+    //
+    //  Check to see if the Token is an identifier kind.
+    //
+    if (t.kind == 78) 
+    {
+      //
+      //  Potential item to swap out.
+      //
+      String temp = nameTable.get(t.image);
+      if (temp != null) 
+      {
+        t.image = temp;
+      }
+    } else if (t.kind == 70 || t.kind == 72 || t.kind == 77) 
+    {
+      //
+      //   Got string that could have a potential class in it (like Eval or 
+      //   RegExp so need to scan the string.
+      //
+      StringTokenizer st;
+      if (t.image.charAt(0) == '"' && t.image.length() > 2) 
+      {
+        st = new StringTokenizer(t.image.substring(1, (t.image.length()-1)));
+                                                  
+      } else 
+      {
+        st = new StringTokenizer(t.image);
+      }
+      StringBuilder replacementString = new StringBuilder(t.image);
+      boolean update = false;
+      while (st.hasMoreTokens()) {
+          String temp1 = st.nextToken();
+          String temp = nameTable.get(temp1);
+          if (temp != null) 
+          {
+            int start = replacementString.indexOf(temp1);
+            int end = start + temp1.length();
+            update = true;
+            replacementString.delete(start, end);
+            replacementString.insert(start, temp);
+          } 
+      }
+      if (update == true) 
+      {
+          System.out.println("Old String is:" + t.image);
+          t.image = replacementString.toString();
+          System.out.println("New String is:" + t.image);
+      }
+    }
+    out.print(addUnicodeEscapes(t.image));
+    t.hasPrinted = true;
+  }
+
+  private String addUnicodeEscapes(String str)
+  {
+    String retval = "";
+    char ch;
+
+    for (int i = 0; i < str.length(); i++)
+    {
+      ch = str.charAt(i);
+
+      if (((ch < 0x20) || (ch > 0x7e)) && (ch != '\t') && (ch != '\n') &&
+          (ch != '\r') && (ch != '\f'))
+      {
+        String s = "0000" + Integer.toString(ch, 16);
+        retval += ("\\u" + s.substring(s.length() - 4, s.length()));
+      }
+      else
+      {
+        retval += ch;
+      }
+    }
+
+    return retval;
+  }
+
+  private String buildPaddedString(String s)
+  {
+    StringBuffer sb = new StringBuffer();
+
+    for (int count = 0; count <= depth; count++)
+    {
+      sb = sb.append(" ");
+    }
+
+    sb = sb.append(s);
+
+    return sb.toString();
+  }
+
+  public Object visit(SimpleNode node, Object data)
+  {
+    depthFirstTraversal(node, data);
+
+    return data;
+  }
+
+  public Object visit(ASTProgram node, Object data)
+  {
+    depthFirstTraversal(node, data);
+
+    return data;
+  }
+
+  public Object visit(ASTIdentifier node, Object data)
+  {
+    depthFirstTraversal(node, data);
+
+    return data;
+  }
+
+  public Object visit(ASTSimpleQualifiedIdentifier node, Object data)
+  {
+    depthFirstTraversal(node, data);
+
+    return data;
+  }
+
+  public Object visit(ASTExpressionQualifiedIdentifier node, Object data)
+  {
+    depthFirstTraversal(node, data);
+
+    return data;
+  }
+
+  public Object visit(ASTQualifiedIdentifier node, Object data)
+  {
+    depthFirstTraversal(node, data);
+
+    return data;
+  }
+
+  public Object visit(ASTPrimaryExpression node, Object data)
+  {
+    depthFirstTraversal(node, data);
+
+    return data;
+  }
+
+  public Object visit(ASTReservedNamespace node, Object data)
+  {
+    depthFirstTraversal(node, data);
+
+    return data;
+  }
+
+  public Object visit(ASTFunctionExpression node, Object data)
+  {
+    depthFirstTraversal(node, data);
+
+    return data;
+  }
+
+  public Object visit(ASTObjectLiteral node, Object data)
+  {
+    depthFirstTraversal(node, data);
+
+    return data;
+  }
+
+  public Object visit(ASTFieldList node, Object data)
+  {
+    depthFirstTraversal(node, data);
+
+    return data;
+  }
+
+  public Object visit(ASTLiteralField node, Object data)
+  {
+    depthFirstTraversal(node, data);
+
+    return data;
+ }
+
+  public Object visit(ASTFieldName node, Object data)
+  {
+    depthFirstTraversal(node, data);
+
+    return data;
+  }
+
+  public Object visit(ASTArrayLiteral node, Object data)
+  {
+    depthFirstTraversal(node, data);
+
+    return data;
+  }
+
+  public Object visit(ASTElementList node, Object data)
+  {
+    depthFirstTraversal(node, data);
+
+    return data;
+  }
+
+  public Object visit(ASTLiteralElement node, Object data)
+  {
+    depthFirstTraversal(node, data);
+
+    return data;
+  }
+
+  public Object visit(ASTSuperExpression node, Object data)
+  {
+    depthFirstTraversal(node, data);
+
+    return data;
+  }
+
+  public Object visit(ASTPostfixExpression node, Object data)
+  {
+    depthFirstTraversal(node, data);
+
+    return data;
+  }
+
+  public Object visit(ASTAttributeExpression node, Object data)
+  {
+    depthFirstTraversal(node, data);
+
+    return data;
+  }
+
+  public Object visit(ASTFullPostfixExpression node, Object data)
+  {
+    depthFirstTraversal(node, data);
+
+    return data;
+  }
+
+  public Object visit(ASTFullNewExpression node, Object data)
+  {
+    depthFirstTraversal(node, data);
+
+    return data;
+  }
+
+  public Object visit(ASTFunctionConstructor node, Object data)
+  {
+    depthFirstTraversal(node, data);
+
+    return data;
+  }
+
+  public Object visit(ASTFullNewSubexpression node, Object data)
+  {
+    depthFirstTraversal(node, data);
+
+    return data;
+  }
+
+  public Object visit(ASTPostfixOp node, Object data)
+  {
+    depthFirstTraversal(node, data);
+
+    return data;
+  }
+
+  public Object visit(ASTPropertyOrArguments node, Object data)
+  {
+    depthFirstTraversal(node, data);
+
+    return data;
+  }
+
+  public Object visit(ASTPropertyOperator node, Object data)
+  {
+    depthFirstTraversal(node, data);
+
+    return data;
+  }
+
+  public Object visit(ASTArguments node, Object data)
+  {
+    depthFirstTraversal(node, data);
+
+    return data;
+  }
+
+  public Object visit(ASTUnaryExpression node, Object data)
+  {
+    depthFirstTraversal(node, data);
+
+    return data;
+  }
+
+  public Object visit(ASTMulOp node, Object data)
+  {
+    depthFirstTraversal(node, data);
+
+    return data;
+  }
+
+  public Object visit(ASTMultiplicativeExpression node, Object data)
+  {
+    depthFirstTraversal(node, data);
+
+    return data;
+  }
+
+  public Object visit(ASTAddOp node, Object data)
+  {
+    depthFirstTraversal(node, data);
+
+    return data;
+  }
+
+  public Object visit(ASTAdditiveExpression node, Object data)
+  {
+    depthFirstTraversal(node, data);
+
+    return data;
+  }
+
+  public Object visit(ASTShiftOp node, Object data)
+  {
+    depthFirstTraversal(node, data);
+
+    return data;
+  }
+
+  public Object visit(ASTShiftExpression node, Object data)
+  {
+    depthFirstTraversal(node, data);
+
+    return data;
+  }
+
+  public Object visit(ASTRelOp node, Object data)
+  {
+    depthFirstTraversal(node, data);
+
+    return data;
+  }
+
+  public Object visit(ASTRelationalExpression node, Object data)
+  {
+    depthFirstTraversal(node, data);
+
+    return data;
+  }
+
+  public Object visit(ASTRelationalExpressionNoIN node, Object data)
+  {
+    depthFirstTraversal(node, data);
+
+    return data;
+  }
+
+  public Object visit(ASTEqualOp node, Object data)
+  {
+    depthFirstTraversal(node, data);
+
+    return data;
+  }
+
+  public Object visit(ASTEqualityExpression node, Object data)
+  {
+    depthFirstTraversal(node, data);
+
+    return data;
+  }
+
+  public Object visit(ASTEqualityExpressionNoIN node, Object data)
+  {
+    depthFirstTraversal(node, data);
+
+    return data;
+  }
+
+  public Object visit(ASTBitwiseANDOp node, Object data)
+  {
+    depthFirstTraversal(node, data);
+
+    return data;
+  }
+
+  public Object visit(ASTBitwiseANDExpression node, Object data)
+  {
+    depthFirstTraversal(node, data);
+
+    return data;
+  }
+
+  public Object visit(ASTBitwiseANDExpressionNoIN node, Object data)
+  {
+    depthFirstTraversal(node, data);
+
+    return data;
+  }
+
+  public Object visit(ASTBitwiseXOROp node, Object data)
+  {
+    depthFirstTraversal(node, data);
+
+    return data;
+  }
+
+  public Object visit(ASTBitwiseXORExpression node, Object data)
+  {
+    depthFirstTraversal(node, data);
+
+    return data;
+  }
+
+  public Object visit(ASTBitwiseXORExpressionNoIN node, Object data)
+  {
+    depthFirstTraversal(node, data);
+
+    return data;
+  }
+
+  public Object visit(ASTBitwiseOROp node, Object data)
+  {
+    depthFirstTraversal(node, data);
+
+    return data;
+  }
+
+  public Object visit(ASTBitwiseORExpression node, Object data)
+  {
+    depthFirstTraversal(node, data);
+
+    return data;
+  }
+
+  public Object visit(ASTBitwiseORExpressionNoIN node, Object data)
+  {
+    depthFirstTraversal(node, data);
+
+    return data;
+  }
+
+  public Object visit(ASTLogicalANDExpression node, Object data)
+  {
+    depthFirstTraversal(node, data);
+
+    return data;
+  }
+
+  public Object visit(ASTLogicalANDExpressionNoIN node, Object data)
+  {
+    depthFirstTraversal(node, data);
+
+    return data;
+  }
+
+  public Object visit(ASTLogicalORExpression node, Object data)
+  {
+    depthFirstTraversal(node, data);
+
+    return data;
+  }
+
+  public Object visit(ASTLogicalORExpressionNoIN node, Object data)
+  {
+    depthFirstTraversal(node, data);
+
+    return data;
+  }
+
+  public Object visit(ASTConditionalExpression node, Object data)
+  {
+    depthFirstTraversal(node, data);
+
+    return data;
+  }
+
+  public Object visit(ASTConditionalExpressionNoIN node, Object data)
+  {
+    depthFirstTraversal(node, data);
+
+    return data;
+  }
+
+  public Object visit(ASTNonAssignmentExpression node, Object data)
+  {
+    depthFirstTraversal(node, data);
+
+    return data;
+  }
+
+  public Object visit(ASTNonAssignmentExpressionNoIN node, Object data)
+  {
+    depthFirstTraversal(node, data);
+
+    return data;
+  }
+
+  public Object visit(ASTAssignementOperator node, Object data)
+  {
+    depthFirstTraversal(node, data);
+
+    return data;
+  }
+
+  public Object visit(ASTAssignmentExpression node, Object data)
+  {
+    depthFirstTraversal(node, data);
+
+    return data;
+  }
+
+  public Object visit(ASTAssignmentExpressionNoIN node, Object data)
+  {
+    depthFirstTraversal(node, data);
+
+    return data;
+  }
+
+  public Object visit(ASTListExpression node, Object data)
+  {
+    depthFirstTraversal(node, data);
+
+    return data;
+  }
+
+  public Object visit(ASTListExpressionNoIN node, Object data)
+  {
+    depthFirstTraversal(node, data);
+
+    return data;
+  }
+
+  public Object visit(ASTTypeExpression node, Object data)
+  {
+    depthFirstTraversal(node, data);
+
+    return data;
+  }
+
+  public Object visit(ASTTypeExpressionNoIN node, Object data)
+  {
+    depthFirstTraversal(node, data);
+
+    return data;
+
+  }
+
+  public Object visit(ASTTypeExpressionList node, Object data)
+  {
+    depthFirstTraversal(node, data);
+
+    return data;
+
+  }
+
+  public Object visit(ASTStatement node, Object data)
+  {
+    depthFirstTraversal(node, data);
+
+    return data;
+
+  }
+
+  public Object visit(ASTSubstatement node, Object data)
+  {
+    depthFirstTraversal(node, data);
+
+    return data;
+  }
+
+  public Object visit(ASTSubstatements node, Object data)
+  {
+    depthFirstTraversal(node, data);
+
+    return data;
+  }
+
+  public Object visit(ASTSc node, Object data)
+  {
+    depthFirstTraversal(node, data);
+
+    return data;
+  }
+
+  public Object visit(ASTEolCommentSkipWs node, Object data)
+  {
+    depthFirstTraversal(node, data);
+
+    return data;
+  }
+
+  public Object visit(ASTEmptyStatement node, Object data)
+  {
+    depthFirstTraversal(node, data);
+
+    return data;
+  }
+
+  public Object visit(ASTExpressionStatement node, Object data)
+  {
+    depthFirstTraversal(node, data);
+
+    return data;
+  }
+
+  public Object visit(ASTSuperStatement node, Object data)
+  {
+    depthFirstTraversal(node, data);
+
+    return data;
+  }
+
+  public Object visit(ASTBlock node, Object data)
+  {
+    depthFirstTraversal(node, data);
+
+    return data;
+  }
+
+  public Object visit(ASTLabeledStatement node, Object data)
+  {
+    depthFirstTraversal(node, data);
+
+    return data;
+  }
+
+  public Object visit(ASTIfStatement node, Object data)
+  {
+    depthFirstTraversal(node, data);
+
+    return data;
+  }
+
+  public Object visit(ASTSwitchStatement node, Object data)
+  {
+    depthFirstTraversal(node, data);
+
+    return data;
+  }
+
+  public Object visit(ASTCaseElements node, Object data)
+  {
+    depthFirstTraversal(node, data);
+
+    return data;
+  }
+
+  public Object visit(ASTCaseElement node, Object data)
+  {
+    depthFirstTraversal(node, data);
+
+    return data;
+  }
+
+  public Object visit(ASTCaseLabel node, Object data)
+  {
+    depthFirstTraversal(node, data);
+
+    return data;
+  }
+
+  public Object visit(ASTDoStatement node, Object data)
+  {
+    depthFirstTraversal(node, data);
+
+    return data;
+  }
+
+  public Object visit(ASTWhileStatement node, Object data)
+  {
+    depthFirstTraversal(node, data);
+
+    return data;
+  }
+
+  public Object visit(ASTForStatement node, Object data)
+  {
+    depthFirstTraversal(node, data);
+
+    return data;
+  }
+
+  public Object visit(ASTForInitializer node, Object data)
+  {
+    depthFirstTraversal(node, data);
+
+    return data;
+  }
+
+  public Object visit(ASTForInBinding node, Object data)
+  {
+    depthFirstTraversal(node, data);
+
+    return data;
+  }
+
+  public Object visit(ASTWithStatement node, Object data)
+  {
+    depthFirstTraversal(node, data);
+
+    return data;
+  }
+
+  public Object visit(ASTContinueStatement node, Object data)
+  {
+    depthFirstTraversal(node, data);
+
+    return data;
+  }
+
+  public Object visit(ASTBreakStatement node, Object data)
+  {
+    depthFirstTraversal(node, data);
+
+    return data;
+  }
+
+  public Object visit(ASTReturnStatement node, Object data)
+  {
+    depthFirstTraversal(node, data);
+
+    return data;
+  }
+
+  public Object visit(ASTThrowStatement node, Object data)
+  {
+    depthFirstTraversal(node, data);
+
+    return data;
+  }
+
+  public Object visit(ASTTryStatement node, Object data)
+  {
+    depthFirstTraversal(node, data);
+
+    return data;
+  }
+
+  public Object visit(ASTDirectives node, Object data)
+  {
+    depthFirstTraversal(node, data);
+
+    return data;
+  }
+
+  public Object visit(ASTDirective node, Object data)
+  {
+    depthFirstTraversal(node, data);
+
+    return data;
+  }
+
+  public Object visit(ASTAnnotatableDirective node, Object data)
+  {
+    depthFirstTraversal(node, data);
+
+    return data;
+  }
+
+  public Object visit(ASTAttributes node, Object data)
+  {
+    depthFirstTraversal(node, data);
+
+    return data;
+  }
+
+  public Object visit(ASTAttribute node, Object data)
+  {
+    depthFirstTraversal(node, data);
+
+    return data;
+  }
+
+  public Object visit(ASTUseDirective node, Object data)
+  {
+    depthFirstTraversal(node, data);
+
+    return data;
+  }
+
+  public Object visit(ASTImportDirective node, Object data)
+  {
+    depthFirstTraversal(node, data);
+
+    return data;
+  }
+
+  public Object visit(ASTIncludeDirective node, Object data)
+  {
+    depthFirstTraversal(node, data);
+
+    return data;
+  }
+
+  public Object visit(ASTPragma node, Object data)
+  {
+    depthFirstTraversal(node, data);
+
+    return data;
+  }
+
+  public Object visit(ASTPragmaItems node, Object data)
+  {
+    depthFirstTraversal(node, data);
+
+    return data;
+  }
+
+  public Object visit(ASTPragmaItem node, Object data)
+  {
+    depthFirstTraversal(node, data);
+
+    return data;
+  }
+
+  public Object visit(ASTPragmaExpr node, Object data)
+  {
+    depthFirstTraversal(node, data);
+
+    return data;
+  }
+
+  public Object visit(ASTPragmaArgument node, Object data)
+  {
+    depthFirstTraversal(node, data);
+
+    return data;
+  }
+
+  public Object visit(ASTExportDefinition node, Object data)
+  {
+    depthFirstTraversal(node, data);
+
+    return data;
+  }
+
+  public Object visit(ASTExportBindingList node, Object data)
+  {
+    depthFirstTraversal(node, data);
+
+    return data;
+  }
+
+  public Object visit(ASTExportBinding node, Object data)
+  {
+    depthFirstTraversal(node, data);
+
+    return data;
+  }
+
+  public Object visit(ASTVariableDefinition node, Object data)
+  {
+    depthFirstTraversal(node, data);
+
+    return data;
+  }
+
+  public Object visit(ASTVariableDefinitionNoIN node, Object data)
+  {
+    depthFirstTraversal(node, data);
+
+    return data;
+  }
+
+  public Object visit(ASTVariableDefinitionKind node, Object data)
+  {
+    depthFirstTraversal(node, data);
+
+    return data;
+  }
+
+  public Object visit(ASTVariableBindingList node, Object data)
+  {
+    depthFirstTraversal(node, data);
+
+    return data;
+  }
+
+  public Object visit(ASTVariableBindingListNoIN node, Object data)
+  {
+    depthFirstTraversal(node, data);
+
+    return data;
+  }
+
+  public Object visit(ASTVariableBinding node, Object data)
+  {
+    depthFirstTraversal(node, data);
+
+    return data;
+  }
+
+  public Object visit(ASTVariableBindingNoIN node, Object data)
+  {
+    depthFirstTraversal(node, data);
+
+    return data;
+  }
+
+  public Object visit(ASTVariableInitialisation node, Object data)
+  {
+    depthFirstTraversal(node, data);
+
+    return data;
+  }
+
+  public Object visit(ASTVariableInitialisationNoIN node, Object data)
+  {
+    depthFirstTraversal(node, data);
+
+    return data;
+  }
+
+  public Object visit(ASTVariableInitializer node, Object data)
+  {
+    depthFirstTraversal(node, data);
+
+    return data;
+  }
+
+  public Object visit(ASTVariableInitializerNoIN node, Object data)
+  {
+    depthFirstTraversal(node, data);
+
+    return data;
+  }
+
+  public Object visit(ASTTypedIdentifier node, Object data)
+  {
+    depthFirstTraversal(node, data);
+
+    return data;
+  }
+
+  public Object visit(ASTTypedIdentifierNoIN node, Object data)
+  {
+    depthFirstTraversal(node, data);
+
+    return data;
+  }
+
+  public Object visit(ASTSimpleVariableDefinition node, Object data)
+  {
+    depthFirstTraversal(node, data);
+
+    return data;
+  }
+
+  public Object visit(ASTUntypedVariableBindingList node, Object data)
+  {
+    depthFirstTraversal(node, data);
+
+    return data;
+  }
+
+  public Object visit(ASTUntypedVariableBinding node, Object data)
+  {
+    depthFirstTraversal(node, data);
+
+    return data;
+  }
+
+  public Object visit(ASTFunctionDefinition node, Object data)
+  {
+    depthFirstTraversal(node, data);
+
+    return data;
+  }
+
+  public Object visit(ASTFunctionName node, Object data)
+  {
+    depthFirstTraversal(node, data);
+
+    return data;
+  }
+
+  public Object visit(ASTFunctionCommon node, Object data)
+  {
+    depthFirstTraversal(node, data);
+
+    return data;
+  }
+
+  public Object visit(ASTParameters node, Object data)
+  {
+    depthFirstTraversal(node, data);
+
+    return data;
+  }
+
+  public Object visit(ASTParameter node, Object data)
+  {
+    depthFirstTraversal(node, data);
+
+    return data;
+  }
+
+  public Object visit(ASTParameterInit node, Object data)
+  {
+    depthFirstTraversal(node, data);
+
+    return data;
+  }
+
+  public Object visit(ASTRestParameters node, Object data)
+  {
+    depthFirstTraversal(node, data);
+
+    return data;
+  }
+
+  public Object visit(ASTResult node, Object data)
+  {
+    depthFirstTraversal(node, data);
+
+    return data;
+  }
+
+  public Object visit(ASTClassDefinition node, Object data)
+  {
+    depthFirstTraversal(node, data);
+
+    return data;
+  }
+
+  public Object visit(ASTInterfaceDefinition node, Object data)
+  {
+    depthFirstTraversal(node, data);
+
+    return data;
+  }
+
+  public Object visit(ASTInheritance node, Object data)
+  {
+    depthFirstTraversal(node, data);
+
+    return data;
+  }
+
+  public Object visit(ASTNamespaceDefinition node, Object data)
+  {
+    depthFirstTraversal(node, data);
+
+    return data;
+  }
+
+  public Object visit(ASTPackageDefinition node, Object data)
+  {
+    depthFirstTraversal(node, data);
+
+    return data;
+  }
+
+  public Object visit(ASTPackageName node, Object data)
+  {
+    depthFirstTraversal(node, data);
+
+    return data;
+  }
+
+  public Object visit(ASTPackageIdentifiers node, Object data)
+  {
+    depthFirstTraversal(node, data);
+
+    return data;
+  }
+}
+

Propchange: incubator/adffaces/branches/matzew-repackaging-trinidad/plugins/maven-javascript-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/javascript/javascriptcompiler/DepthFirstTraversal.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/adffaces/branches/matzew-repackaging-trinidad/plugins/maven-javascript-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/javascript/javascriptcompiler/DepthFirstTraversal.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: incubator/adffaces/branches/matzew-repackaging-trinidad/plugins/maven-javascript-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/javascript/javascriptcompiler/JavascriptCompiler.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/matzew-repackaging-trinidad/plugins/maven-javascript-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/javascript/javascriptcompiler/JavascriptCompiler.java?rev=425117&view=auto
==============================================================================
--- incubator/adffaces/branches/matzew-repackaging-trinidad/plugins/maven-javascript-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/javascript/javascriptcompiler/JavascriptCompiler.java (added)
+++ incubator/adffaces/branches/matzew-repackaging-trinidad/plugins/maven-javascript-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/javascript/javascriptcompiler/JavascriptCompiler.java Mon Jul 24 09:58:43 2006
@@ -0,0 +1,108 @@
+/*
+* Copyright 2006 The Apache Software Foundation.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package org.apache.myfaces.trinidadbuild.plugin.javascript.javascriptcompiler;
+
+import java.io.BufferedOutputStream;
+
+import org.apache.myfaces.trinidadbuild.plugin.javascript.uixtools.FileProcessor;
+import org.apache.myfaces.trinidadbuild.plugin.javascript.javascript20parser.JSParser20;
+import org.apache.myfaces.trinidadbuild.plugin.javascript.javascript20parser.Token;
+import org.apache.myfaces.trinidadbuild.plugin.javascript.javascript20parser.ParseException;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.InputStreamReader;
+import java.io.InputStream;
+import java.io.PrintStream;
+
+import java.util.HashMap;
+
+public class JavascriptCompiler extends FileProcessor
+{
+  private JSParser20        _jsParser;
+  public  HashMap<String, String>         fileTable;
+
+  public JavascriptCompiler()
+  {
+    super("js", false);
+    fileTable = new HashMap<String,String>();
+  }
+
+  private void init(InputStream in)
+  {
+    // apply overrides
+  }
+
+  protected void processFile(File in, File out)
+    throws Exception
+  {
+    String className, newClassName;
+    FileInputStream inStream = new FileInputStream(in);
+    //
+    //  Get the name of the file
+    //
+    className = in.getName();
+    className = className.substring(0, className.indexOf('.'));
+    //
+    //  Check to see if the name exists as we do not want to over write the four
+    //  special names we are using.
+    //
+    newClassName = fileTable.get(className);
+    if ( newClassName == null) 
+    {
+//       newClassName = "Adf" + className;
+//      fileTable.put(className, newClassName);
+      newClassName = className;
+    }
+    out = new File(out.getParentFile(), newClassName + ".js");
+    PrintStream outStream = new PrintStream(new BufferedOutputStream(new FileOutputStream(out)));
+    process(inStream, outStream);
+    inStream.close();
+    outStream.flush();
+    outStream.close();
+  }
+  private void initParser(InputStream in)
+  {
+
+    if (_jsParser == null)
+    {
+      _jsParser = new JSParser20(in);
+    }
+    else
+    {
+      _jsParser.ReInit(new InputStreamReader(in));
+    }
+  }
+  public void process(InputStream in, PrintStream o) throws ParseException
+  {
+    Token token = null;
+    DepthFirstTraversal vstr;
+    init(in);
+    token = tokenize(in);
+    //
+    //   Create an instance of DepthFirstTraversal
+    //
+    vstr = new DepthFirstTraversal(o, fileTable); 
+    _jsParser.getRootNode().jjtAccept(vstr, null);
+  }
+  private Token tokenize(InputStream in) throws ParseException
+  {
+    initParser(in);
+    return (Token) _jsParser.Program();
+  }
+
+}

Propchange: incubator/adffaces/branches/matzew-repackaging-trinidad/plugins/maven-javascript-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/javascript/javascriptcompiler/JavascriptCompiler.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: incubator/adffaces/branches/matzew-repackaging-trinidad/plugins/maven-javascript-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/javascript/javascriptcompiler/JavascriptCompilerMain.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/matzew-repackaging-trinidad/plugins/maven-javascript-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/javascript/javascriptcompiler/JavascriptCompilerMain.java?rev=425117&view=auto
==============================================================================
--- incubator/adffaces/branches/matzew-repackaging-trinidad/plugins/maven-javascript-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/javascript/javascriptcompiler/JavascriptCompilerMain.java (added)
+++ incubator/adffaces/branches/matzew-repackaging-trinidad/plugins/maven-javascript-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/javascript/javascriptcompiler/JavascriptCompilerMain.java Mon Jul 24 09:58:43 2006
@@ -0,0 +1,120 @@
+/*
+* Copyright 2006 The Apache Software Foundation.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package org.apache.myfaces.trinidadbuild.plugin.javascript.javascriptcompiler;
+
+import org.apache.myfaces.trinidadbuild.plugin.javascript.javascriptcompiler.JavascriptCompiler;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.ObjectOutputStream;
+import java.io.ObjectInputStream;
+
+import java.util.HashMap;
+
+
+public class JavascriptCompilerMain
+{
+  private JavascriptCompiler _javascriptCompiler;
+
+  public JavascriptCompilerMain()
+  {
+  }
+
+  public static void main(String[] args)
+  {
+    JavascriptCompilerMain _main = new JavascriptCompilerMain();
+    _main._javascriptCompiler = new JavascriptCompiler();
+    try
+    {
+      FileInputStream fis = new FileInputStream("D:\\Foo\\data1.txt");
+      ObjectInputStream ois = new ObjectInputStream(fis);
+      _main._javascriptCompiler.fileTable =  (HashMap<String, String>)ois.readObject(); // Read the object back in here
+      //
+      // 
+      _main._javascriptCompiler.fileTable.put("RichObject", "AdfObject");
+      _main._javascriptCompiler.fileTable.put("RichPage", "AdfPage");
+      _main._javascriptCompiler.fileTable.put("RichConverter", "AdfConverter");
+      _main._javascriptCompiler.fileTable.put("RichValidator", "AdfValidator");
+      _main._javascriptCompiler.fileTable.put("Bootstrap", "AdfBootstrap");
+      _main._javascriptCompiler.fileTable.put("BootstrapFaces", "AdfBootstrapFaces");
+      _main._javascriptCompiler.fileTable.put("XMLRequest", "AdfXMLRequest");
+      _main._javascriptCompiler.fileTable.put("MarshalingService", "AdfMarshalingService");
+      _main._javascriptCompiler.fileTable.put("MessagingService", "AdfMessagingService");
+      ois.close();
+      fis.close();
+    }
+    catch (FileNotFoundException e)
+    {
+      // TODO
+    }
+    catch (IOException e)
+    {
+      // TODO
+    }
+    catch (ClassNotFoundException e) 
+    {
+      // TODO
+    }
+    File in = 
+      new File("D:\\jdevrt\\adf-faces\\trunk\\adf-richclient-demo\\src\\main\\webapp\\jsLibs");
+    File out = new File("D:\\Foo\\Demo\\jsLibs");
+    _main._javascriptCompiler.process(in, out);
+    in = 
+      new File("D:\\jdevrt\\adf-faces\\trunk\\adf-richclient-demo-crm\\src\\main\\webapp\\jsLibs");
+    out = new File("D:\\Foo\\crm\\jsLibs");
+    _main._javascriptCompiler.process(in, out);
+
+    //
+    //  Transform the Api JavaScript files
+    //
+//    File in = 
+//      new File("D:\\jdevrt\\adf-faces\\trunk\\adf-richclient-api\\src\\main\\javascript\\oracle\\adf\\view");
+//    File out = new File("D:\\Foo\\api");
+//    _main._javascriptCompiler.process(in, out);
+    //
+    //  Transform the Impl JavaScript files
+    //
+//    in = 
+//       new File("D:\\jdevrt\\adf-faces\\trunk\\adf-richclient-impl\\src\\main\\javascript\\oracle\\adfinternal\\view\\");
+//    out = new File("D:\\Foo\\impl");
+//    _main._javascriptCompiler.process(in, out);
+    //
+    //  Uodate the serialized version of the HashMap
+    //
+    FileOutputStream fos;
+    ObjectOutputStream oos;
+    try
+    {
+
+      fos = new FileOutputStream("D:\\Foo\\data1.txt");
+      oos = new ObjectOutputStream(fos);
+      oos.writeObject(_main._javascriptCompiler.fileTable);
+      oos.flush();
+      oos.close();
+    }
+    catch (FileNotFoundException e)
+    {
+      // TODO
+    }
+    catch (IOException e)
+    {
+      // TODO
+    }
+  }
+}
\ No newline at end of file

Propchange: incubator/adffaces/branches/matzew-repackaging-trinidad/plugins/maven-javascript-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/javascript/javascriptcompiler/JavascriptCompilerMain.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL



Mime
View raw message