incubator-adffaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mat...@apache.org
Subject svn commit: r425235 [9/11] - in /incubator/adffaces/branches/matzew-repackaging-trinidad/plugins: ./ maven-adf-archetype/ maven-adf-archetype/src/main/resources/archetype-resources/ maven-adf-archetype/src/main/resources/archetype-resources/src/main/ja...
Date Tue, 25 Jul 2006 00:24:18 GMT
Modified: incubator/adffaces/branches/matzew-repackaging-trinidad/plugins/maven-javascript-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/javascript/obfuscator/javascript15parser/js1.5.jj
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/obfuscator/javascript15parser/js1.5.jj?rev=425235&r1=425234&r2=425235&view=diff
==============================================================================
--- incubator/adffaces/branches/matzew-repackaging-trinidad/plugins/maven-javascript-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/javascript/obfuscator/javascript15parser/js1.5.jj (original)
+++ incubator/adffaces/branches/matzew-repackaging-trinidad/plugins/maven-javascript-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/javascript/obfuscator/javascript15parser/js1.5.jj Mon Jul 24 17:24:16 2006
@@ -1,1174 +1,1174 @@
-/*
- * 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.
- */
-options {
-  STATIC=false;
-  DEBUG_TOKEN_MANAGER=false;
-  DEBUG_PARSER=false;
-}
-
-PARSER_BEGIN(JSParser15)
-package org.apache.myfaces.trinidadbuild.plugin.javascript.obfuscator.javascript15parser;
-import java.util.Vector;
-import java.io.IOException;
-public class JSParser15 
-{
-    // This is a stack of symbol tables for the JS file
-    protected ProgramContextStack _contextStack = new ProgramContextStack();
-    
-}
-
-PARSER_END(JSParser15)
-
-/////////////////////////////////////////////////////
-// 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 :
-{
-        < BREAK:        "break" >
-    |   < CONTINUE:     "continue" >
-    |   < DELETE:       "delete" >
-    |   < ELSE:         "else" >
-    |   < FOR:          "for" >
-    |   < FUNCTION:     "function" >
-    |   < FUNCTION_:    "Function" >
-    |   < IF:           "if" >
-    |   < IN:           "in" >
-    |   < NEW:          "new" >
-    |   < RETURN:       "return" >
-    |   < THIS:         "this" >
-    |   < TYPEOF:       "typeof" >
-    |   < INSTANCEOF:   "instanceof" >
-    |   < VAR:          "var" >
-    |   < VOID:         "void" >
-    |   < WHILE:        "while" >
-    |   < WITH:         "with" >
-    |   < CASE:         "case" >
-    |   < CATCH:        "catch" >
-    |   < CLASS:        "class" >
-    |   < CONST:        "const" >
-    |   < DEBUGGER:     "debugger" >
-    |   < _DEFAULT:     "default" >
-    |   < DO:           "do" >
-    |   < ENUM:         "enum" >
-    |   < EXPORT:       "export" >
-    |   < EXTENDS:      "extends" >
-    |   < FINALLY:      "finally" >
-    |   < IMPORT:       "import" >
-    |   < SUPER:        "super" >
-    |   < SWITCH:       "switch" >
-    |   < THROW:        "throw" >
-    |   < TRY:          "try" >
-    |   < TRUE:         "true" >    // They are not supposed to be keywords
-    |   < FALSE:        "false" >   // They are not supposed to be keywords
-    |   < NULL:         "null" >    // They are not supposed to be keywords
-}
-/////////////////////////////////////////////////////
-// 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:
-                "\"" ( <ESCAPE_SEQUENCE> | (~["\"","\\","\n","\r"]) )* ( ["\n","\r"] )?
-            |   "'"  ( <ESCAPE_SEQUENCE> | (~["'","\\","\n","\r"])  )* ( ["\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:      "." >
-}
-
-/////////////////////////////////////////////////////
-// OPERATORS 
-/////////////////////////////////////////////////////
-TOKEN :
-{
-        < ASSIGN:               "=" >
-    |   < GT:                   ">" >
-    |   < LT:                   "<" >
-    |   < BANG:                 "!" >
-    |   < TILDE:                "~" >
-    |   < HOOK:                 "?" >
-    |   < COLON:                ":" >
-    |   < EQ:                   "==" >
-    |   < LE:                   "<=" >
-    |   < GE:                   ">=" >
-    |   < NE:                   "!=" >
-    |   < SC_OR:                "||" >
-    |   < SC_AND:               "&&" >
-    |   < 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: ">>>=" >
-    |   < IDENTITYOPER:         "===" >
-    |   < NOTIDENTITYOPER:      "!==" >
-}
-///////////////////////////////////////////////////////////////////
-// GRAMMAR Section
-///////////////////////////////////////////////////////////////////
-
-void Literal():
-{}
-{
-        <DECIMAL_LITERAL> 
-    |   <OCTAL_LITERAL>
-    |   <HEX_LITERAL>
-    |   <FLOATING_POINT_LITERAL> 
-    |   <STRING_LITERAL> 
-    |   <TRUE> 
-    |   <FALSE>
-    |   <REGULAR_EXPRESSION> 
-    |   <NULL>
-}
-
-Token Identifier():
-{
-		Token t;
-}
-{
-    	t = <IDENTIFIER> {return t;}
-}
-
-void PrimaryExpression():
-{
-		Token prefixToken = null;	
-}
-{
-    (
-        prefixToken = <THIS>            (PrimarySuffix())*
-            {
-               JSParserUtils.tagObjectIdentifier(prefixToken, getToken(1));
-            }
-    |   prefixToken=Identifier()        (PrimarySuffix())*
-            {
-               JSParserUtils.tagObjectIdentifier(prefixToken, getToken(1));
-               JSParserUtils.tagMethodInvocation(_contextStack, 
-                                                 (AnnotatedToken)prefixToken, 
-                                                 (AnnotatedToken)getToken(1));
-            }
-    |   LOOKAHEAD(2)  <STRING_LITERAL>  (PrimarySuffix())*  
-    |   LOOKAHEAD(2)  <REGULAR_EXPRESSION>  (PrimarySuffix())*    
-    |   LOOKAHEAD(2)  Literal() 
-    |   FunctionLiteral()
-    |   NestedArrayLiteral()                (PrimarySuffix())*
-    |   ObjectLiteral() 
-    |   <LPAREN> Expression() <RPAREN>      (PrimarySuffix())* 
-    |   AllocationExpression()
-    )
-    {
-        token_source.setRegValid();
-    }
-}
-
-
-void PrimarySuffix():
-{}
-{
-        Arguments() 
-    |   {token_source.setRegInvalid();} <LBRACKET> Expression() <RBRACKET> 
-    |   {token_source.setRegInvalid();} <DOT> Identifier()
-}
-
-void Arguments():
-{}
-{
-        <LPAREN> {token_source.setRegValid();} [ArgumentList()] <RPAREN>
-}
-
-void ArgumentList():
-{}
-{
-        AssignmentExpression() (<COMMA> AssignmentExpression())*
-}
-
-void LiteralArgumentList():
-{}
-{
-        <STRING_LITERAL> (<COMMA> <STRING_LITERAL>)*
-}
-
-void NewSuffix():
-{}
-{
-        <DOT> Identifier()
-}
-
-void AllocationExpression():
-{
-        Token t;
-}
-{
-        LOOKAHEAD(2)  t=<NEW> <THIS>       (NewSuffix())* [Arguments()]
-            {JSParserUtils.annotateToken(t, AnnotationConstants.UNDEFINED, null, 1);}
-    |   LOOKAHEAD(2)  t=<NEW> Identifier() (NewSuffix())* [Arguments()]
-            {JSParserUtils.annotateToken(t, AnnotationConstants.UNDEFINED, null, 1);}
-    |   LOOKAHEAD(2)  t=<NEW> FunctionConstructor() (NewSuffix())*      [Arguments()]
-            {JSParserUtils.annotateToken(t, AnnotationConstants.UNDEFINED, null, 1);}
-}
-
-
-void PostfixOp():
-{}
-{
-        <INCR>
-    |   <DECR>
-}
-
-void PostfixExpression():
-{}
-{
-        PrimaryExpression() [PostfixOp()]
-}
-
-
-void UnaryOp():
-{
-        Token t;
-}
-{
-        t=<DELETE>
-            {JSParserUtils.annotateToken(t, AnnotationConstants.UNDEFINED, null, 1);}
-    |   t=<VOID>
-            {JSParserUtils.annotateToken(t, AnnotationConstants.UNDEFINED, null, 1);}
-    |   t=<TYPEOF>
-            {JSParserUtils.annotateToken(t, AnnotationConstants.UNDEFINED, null, 1);}
-    |   <INCR>
-    |   <DECR>
-    |   <PLUS>
-    |   <MINUS>
-    |   <TILDE>
-    |   <BANG>
-}
-
-void UnaryExpression():
-{}
-{
-        PostfixExpression()
-    |   UnaryOp() UnaryExpression()
-}
-
-void MulOp():
-{}
-{
-        <STAR>
-    |   <SLASH>
-    |   <REM> 
-}
-
-void MultiplicativeExpression():
-{}
-{
-        UnaryExpression() (MulOp() UnaryExpression())*
-} 
-
-void AddOp():
-{}
-{
-        <PLUS>
-    |   <MINUS>
-}
-
-void AdditiveExpression():
-{}
-{
-        MultiplicativeExpression() (AddOp() MultiplicativeExpression())*
-} 
-
-void ShiftOp():
-{}
-{
-        <LSHIFT>
-    |   <RSIGNEDSHIFT>
-    |   <RUNSIGNEDSHIFT>
-}
-
-void ShiftExpression():
-{}
-{
-        AdditiveExpression() (ShiftOp() AdditiveExpression())*
-}
-
-void RelOp():
-{}
-{
-        <LT>
-    |   <GT> 
-    |   <LE> 
-    |   <GE>
-}
-
-void RelationalExpression():
-{
-        Token t;
-}
-{
-        ShiftExpression() 
-            (LOOKAHEAD(3) (  RelOp() 
-                           | t=<INSTANCEOF> 
-                             {JSParserUtils.annotateToken(t, 
-                                                          AnnotationConstants.UNDEFINED, 
-                                                          null, 2);}
-                           | t=<IN> 
-                             {JSParserUtils.annotateToken(t,
-                                                          AnnotationConstants.UNDEFINED,
-                                                          null, 2);})
-             ShiftExpression())*
-}
-
-void RelationalExpressionNoIN():
-{
-        Token t;
-}
-{
-        ShiftExpression() 
-            ( (  RelOp() 
-               | t=<INSTANCEOF>  
-                 {JSParserUtils.annotateToken(t, AnnotationConstants.UNDEFINED, 
-                                              null, 2);})
-              ShiftExpression())*
-}
-
-void EqualOp():
-{}
-{
-        <EQ> 
-    |   <NE> 
-    |   <IDENTITYOPER> 
-    |   <NOTIDENTITYOPER>
-}
-
-void EqualityExpression():
-{}
-{
-        RelationalExpression() (EqualOp() RelationalExpression())*
-}
-
-void EqualityExpressionNoIN():
-{}
-{
-        RelationalExpressionNoIN() (EqualOp() RelationalExpressionNoIN())*
-}
-
-
-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())*
-}
-
-void LogicalANDExpression():
-{}
-{
-        BitwiseORExpression() (<SC_AND> BitwiseORExpression())*
-}
-
-void LogicalANDExpressionNoIN():
-{}
-{
-        BitwiseORExpressionNoIN() (<SC_AND> BitwiseORExpressionNoIN())*
-}
-
-void LogicalORExpression():
-{}
-{
-        LogicalANDExpression() (<SC_OR> LogicalANDExpression())*
-}
-
-void LogicalORExpressionNoIN():
-{}
-{
-        LogicalANDExpressionNoIN() (<SC_OR> LogicalANDExpressionNoIN())*
-}
-
-void ConditionalExpression():
-{}
-{
-        LogicalORExpression() [<HOOK> Expression() <COLON> ConditionalExpression()]
-}
-
-void ConditionalExpressionNoIN():
-{}
-{
-        LogicalORExpressionNoIN() [<HOOK> ExpressionNoIN() <COLON> ConditionalExpressionNoIN()]
-}
-
-Token AssignementOperator():
-{
-        Token t;
-}
-{
-        ( t=<ASSIGN>
-    |     t=<STARASSIGN>
-    |     t=<SLASHASSIGN> 
-    |     t=<REMASSIGN> 
-    |     t=<PLUSASSIGN>
-    |     t=<MINUSASSIGN> 
-    |     t=<LSHIFTASSIGN> 
-    |     t=<RSIGNEDSHIFTASSIGN>
-    |     t=<RUNSIGNEDSHIFTASSIGN>
-    |     t=<ANDASSIGN> 
-    |     t=<XORASSIGN> 
-    |     t=<ORASSIGN> )
-        { return t; } 
-}
-
-void AssignmentExpression():
-{
-        Token tLHS      = getToken(1); 
-		Token tOperator = null; 
-		Token tRHS      = null;
-		Token tEnd      = null;
-}
-{
-        ConditionalExpression() 
-            [ (AssignementOperator() 
-               {tRHS=getToken(1);}
-               AssignmentExpression())
-               {
-                  tEnd = getToken(1);
-                  JSParserUtils.tagAssignmentExpression(_contextStack, null, 
-                                                        (AnnotatedToken)tLHS, 
-                                                        (AnnotatedToken)tOperator,
-                                                        (AnnotatedToken)tRHS, 
-                                                        (AnnotatedToken)tEnd); 
-               }
-            ]
-}
-
-void AssignmentExpressionNoIN():
-{
-        Token tLHS      = getToken(1); 
-		Token tOperator = null; 
-		Token tRHS      = null;
-		Token tEnd      = null;
-}
-{
-        ConditionalExpressionNoIN() 
-            [ (AssignementOperator() {tRHS=getToken(1);}
-               AssignmentExpressionNoIN())
-               {
-                  tEnd = getToken(1);
-                  JSParserUtils.tagAssignmentExpression(_contextStack, null, 
-                                                        (AnnotatedToken)tLHS, 
-                                                        (AnnotatedToken)tOperator,
-                                                        (AnnotatedToken)tRHS, 
-                                                        (AnnotatedToken)tEnd); 
-               }
-            ]
-}
-
-
-void Expression()                     :
-{}
-{
-  AssignmentExpression() ( "," AssignmentExpression() )*
-}   
-
-void ExpressionNoIN()                     :
-{}
-{
-  AssignmentExpressionNoIN() ( "," AssignmentExpressionNoIN() )*
-}   
-
-
-void Statement():
-{}
-{
-        LOOKAHEAD(3)    Block(null)
-    |                   VariableStatement()
-    |                   EmptyStatement()
-    |                   ExpressionStatement()
-    |                   IfStatement()
-    |                   IterationStatement()
-    |                   ContinueStatement()
-    |                   BreakStatement()
-    |                   ReturnStatement()
-    |                   WithStatement()
-    |                   TryStatement()
-    |                   ThrowStatement()
-    |                   SwitchStatement()
-}
- 
-void Block(ProgramContext context):
-{}
-{
-        LOOKAHEAD(3)    <LBRACE> <RBRACE>   
-    |                   <LBRACE> {
-                                     if (context == null) {
-                                        _contextStack.pushContext(new ProgramContext("block"));
- 	                                 }
-                                 }
-                                 [StatementList()] 
-                                 <RBRACE>
-                                 {
-                                     _contextStack.popContext();
-                                 }
-}
- 
-void VariableStatement():
-{
-        Token t;
-}
-{
-        t=<VAR> {JSParserUtils.annotateToken(t, AnnotationConstants.UNDEFINED, null, 1);}
-        VariableDeclarationList(t) Sc()
-}
- 
-void VariableDeclarationList(Token varToken):
-{}
-{
-        VariableDeclaration(varToken) ( <COMMA> VariableDeclaration(varToken) )*
-}
-
-void VariableDeclaration(Token varToken):
-{
-        Token lhs      = null;
-        Token[] tArray = null;
-}
-{
-        lhs=Identifier() [Initializer()]
-        {
-            JSParserUtils.annotateToken(lhs, AnnotationConstants.VAR_IDENTIFIER, null, -1);
-            JSParserUtils.pushToken(_contextStack, (AnnotatedToken)lhs);      
-      
-            if(tArray != null) {
-      	       Token end = getToken(1);
-               JSParserUtils.tagAssignmentExpression(_contextStack, (AnnotatedToken)varToken, 
-                                                     (AnnotatedToken)lhs, (AnnotatedToken)tArray[0], 
-                                                     (AnnotatedToken)tArray[1], (AnnotatedToken)end); 
-            }
-        }
-}
-
-Token[] Initializer():
-{
-        Token[] tArray = new Token[2];
-}
-{
-        tArray[0]=<ASSIGN> {tArray[1]=getToken(1);} 
-        AssignmentExpression()
-        {return tArray;}
-}
- 
-void EmptyStatement():
-{}
-{
-        <SEMICOLON>
-}
-
-void ExpressionStatement():
-{}
-{
-        Expression() Sc() 
-}
-
-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;
-  }
- 
-void IfStatement():
-{
-        Token t;
-}
-{
-        <IF> <LPAREN> Expression() <RPAREN> 
-            Statement() 
-            [ LOOKAHEAD(1) t=<ELSE> {JSParserUtils.annotateToken(t, AnnotationConstants.UNDEFINED,
-                                                                 null, 1);}
-              Statement()
-            ]
-}
-
-
-void IterationStatement():
-{}
-{
-                            WhileStatement()
-    |                       DoStatement()
-    |   LOOKAHEAD(<FOR> <LPAREN> Expression() <SEMICOLON>)                     
-                            ForStatement()
-    |   LOOKAHEAD(<FOR> <LPAREN> <SEMICOLON>)                                  
-                            ForStatement()
-    |   LOOKAHEAD(<FOR> <LPAREN> varToekn=<VAR> VariableDeclarationList(varToken) <SEMICOLON>)  
-                            ForVarStatement()
-    |   LOOKAHEAD(3)        ForInStatement()
-    |   LOOKAHEAD(3)        ForVarInStatement()
-}
- 
-void DoStatement():
-{}
-{
-        <DO> Statement() <WHILE> <LPAREN> Expression() <RPAREN>
-}
-
-void WhileStatement():
-{}
-{
-        <WHILE> <LPAREN> Expression() <RPAREN> 
-            Statement()
-}
- 
-void ForStatement():
-{}
-{
-        <FOR> <LPAREN>  [Expression()] <SEMICOLON> 
-                        [Expression()] <SEMICOLON> 
-                        [Expression()] <RPAREN> 
-            Statement()
-}
-
-void ForVarStatement():
-{
-        Token t;
-}
-{
-        <FOR> <LPAREN>  t=<VAR> {JSParserUtils.annotateToken(t, AnnotationConstants.UNDEFINED, 
-                                                             null, 1);}
-                        VariableDeclarationList(t) <SEMICOLON> 
-                        [Expression()]  <SEMICOLON> 
-                        [Expression()]  <RPAREN> 
-            Statement()
-}
-
-void ForInStatement():
-{
-        Token t;
-}
-{
-        <FOR> <LPAREN>  ExpressionNoIN() 
-                        t=<IN> {JSParserUtils.annotateToken(t, AnnotationConstants.UNDEFINED, 
-                                                            null, 2);}
-                        ExpressionNoIN() <RPAREN> 
-            Statement()
-}
- 
-void ForVarInStatement():
-{
-        Token t;
-}
-{
-        <FOR> <LPAREN>  
-                t=<VAR> {JSParserUtils.annotateToken(t, AnnotationConstants.UNDEFINED, null, 1);}
-                t=Identifier() 
-                  {
-   	                  JSParserUtils.annotateToken(t, AnnotationConstants.VAR_IDENTIFIER, null, 1);
-   	                  JSParserUtils.pushToken(_contextStack, (AnnotatedToken)t);
-                  }
-                [Initializer()] 
-                t=<IN> {JSParserUtils.annotateToken(t, AnnotationConstants.UNDEFINED, null, 2);}
-                ExpressionNoIN() 
-              <RPAREN> 
-            Statement()
-}
-
-void ContinueStatement():
-{}
-{
-        <CONTINUE> Sc()
-}
-
-void BreakStatement():
-{}
-{
-        <BREAK> Sc()
-}
- 
-void ReturnStatement():
-{
-        Token t;
-}
-{
-        t=<RETURN> {JSParserUtils.annotateToken(t, AnnotationConstants.UNDEFINED, null, 1);}
-        [Expression()] Sc()
-}
-
-void WithStatement():
-{}
-{
-        <WITH> <LPAREN> Expression() <RPAREN>
-            Statement()
-}
-
-void TryStatement():
-{}
-{
-        <TRY> Block(null)
-        (<CATCH> <LPAREN> Identifier() <RPAREN> Block(null))*
-        [<FINALLY> Block(null)]
-} 
-
-void ThrowStatement():
-{
-        Token t;
-}
-{
-        t=<THROW> {JSParserUtils.annotateToken(t, AnnotationConstants.UNDEFINED, null, 1);}
-        [Expression()] Sc()
-}
-
-void CaseGuard():
-{
-        Token t;
-}
-{
-        t=<CASE> {JSParserUtils.annotateToken(t, AnnotationConstants.UNDEFINED, null, 1);}
-        Expression() <COLON>
-    |   <_DEFAULT> <COLON>
-}
-
-void CaseGroup():
-{}
-{
-        CaseGuard() (Statement())*  
-}
-
-void SwitchStatement():
-{}
-{
-        <SWITCH>    <LPAREN> Expression() <RPAREN> 
-                    <LBRACE> (CaseGroup())* <RBRACE>
-}
-
-void NamedFunction():
-{
-        Token  tIdentifier = null;
-        Token  tFunction   = null;
-        Token  blockStart  = null;
-        Token  blockEnd    = null;
-        Vector params      = new Vector();
-}
-{
-        tFunction=<FUNCTION> 
-        tIdentifier=Identifier() 
-           { 
-              JSParserUtils.annotateToken(tIdentifier, AnnotationConstants.FUNCTION_NAME_IDENTIFIER, 
-                                          null, -1); 
-              ProgramContext context = new ProgramContext(tIdentifier.image);
-              _contextStack.pushContext(context);
-           }
-        <LPAREN> 
-           [params=FormalParameterList()] 
-              { 
-                  JSParserUtils.annotateTokens(params,
-                                               AnnotationConstants.FUNCTION_PARAM_IDENTIFIER,
-                                               null, -1); 
-                  JSParserUtils.annotateToken(tFunction, AnnotationConstants.NAMED_FUNCTION,
-                                              params, 1); 
-                  JSParserUtils.pushTokens(_contextStack, params);
-              } 
-
-        <RPAREN>
-        {blockStart = getToken(1);} 
-        Block(context)
-        {
-           blockEnd = getToken(1);
-           JSParserUtils.tagEvalCalls(tFunction, blockStart, blockEnd);
-        }
-}
-
-void AnonymousFunction():
-{
-        Token  tFunction  = null;
-        Token  blockStart = null;
-        Token  blockEnd   = null;
-        Vector params     = new Vector();
-}
-{
-        tFunction=<FUNCTION>
-           { 
-              ProgramContext context = new ProgramContext("anonymous");
-              _contextStack.pushContext(context);
-           } 
-        <LPAREN> 
-           [params=FormalParameterList()] 
-              { 
-                  JSParserUtils.annotateTokens(params,
-                                               AnnotationConstants.FUNCTION_PARAM_IDENTIFIER,
-                                               null, -1); 
-                  JSParserUtils.annotateToken(tFunction,
-                                              AnnotationConstants.ANONYMOUS_FUNCTION,
-                                              params, -1); 
-                  JSParserUtils.pushTokens(_contextStack, params);
-              } 
-        <RPAREN> 
-        {blockStart = getToken(1);}
-        Block(context)
-        {
-           blockEnd = getToken(1);
-           JSParserUtils.tagEvalCalls(tFunction, blockStart, blockEnd);
-        }
-}
-
-void FunctionConstructor():
-{}
-{    
-        <FUNCTION_> <LPAREN> ArgumentList() <RPAREN> 
-}
-
-void FunctionDeclaration():
-{}
-{
-        LOOKAHEAD(2) NamedFunction() 
-    |   LOOKAHEAD(2) AnonymousFunction()
-}           
-
-void FunctionLiteral():
-{}
-{
-        AnonymousFunction()
-}
-                          
-Vector FormalParameterList():
-{
-        Token  t = null;
-        Vector v = new Vector();
-}
-{
-        t=Identifier() {v.add(t);} 
-        (<COMMA> t=Identifier() {v.add(t);})*
-        {return v;}
-}
-
-void LiteralElement() :
-{}
-{
-        AssignmentExpression()
-}
-
-void ElementList():
-{}
-{
-        LiteralElement() (<COMMA> LiteralElement())*
-}
-
-void ArrayLiteral():
-{}
-{
-        LOOKAHEAD(2) <LBRACKET> <RBRACKET>
-    |   LOOKAHEAD(2) <LBRACKET> ElementList() <RBRACKET>
-}
-
-void NestedArrayLiteral():
-{}
-{
-        LOOKAHEAD(3) ArrayLiteral() 
-    |   LOOKAHEAD(3) <LBRACKET> NestedArrayLiteral() <RBRACKET>
-}
-
-void LiteralField():
-{
-        Token t = null;
-}
-{
-        t=Identifier()     <COLON> AssignmentExpression()
-        {JSParserUtils.annotateToken(t, AnnotationConstants.LITERAL_OBJECT_KEY_IDENTIFIER,null,-1); }
-   |    t=<STRING_LITERAL> <COLON> AssignmentExpression()
-        {JSParserUtils.annotateToken(t, AnnotationConstants.LITERAL_OBJECT_KEY_IDENTIFIER,null,-1); }
-}
-
-void FieldList():
-{}
-{
-        LiteralField() (<COMMA> LiteralField())*
-}
-
-void ObjectLiteral():
-{}
-{
-        LOOKAHEAD(2) <LBRACE> <RBRACE>
-    |   LOOKAHEAD(2) <LBRACE> FieldList() <RBRACE>  
-}
-
-
-Token Program():
-{
-        Token retval = getToken(1);
-}
-{
-        {_contextStack.pushContext(new ProgramContext("root"));}
-        (SourceElement())*  <EOF>
-        {
-            return retval;
-        }
-}
-
-void SourceElement():
-{}
-{
-        LOOKAHEAD(2)    Statement() 
-    |                   FunctionDeclaration()
-}
-
-void StatementList(): 
-{
-//        Token t;
-}
-{
-        (Statement())+
-}
+/*
+ * 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.
+ */
+options {
+  STATIC=false;
+  DEBUG_TOKEN_MANAGER=false;
+  DEBUG_PARSER=false;
+}
+
+PARSER_BEGIN(JSParser15)
+package org.apache.myfaces.trinidadbuild.plugin.javascript.obfuscator.javascript15parser;
+import java.util.Vector;
+import java.io.IOException;
+public class JSParser15 
+{
+    // This is a stack of symbol tables for the JS file
+    protected ProgramContextStack _contextStack = new ProgramContextStack();
+    
+}
+
+PARSER_END(JSParser15)
+
+/////////////////////////////////////////////////////
+// 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 :
+{
+        < BREAK:        "break" >
+    |   < CONTINUE:     "continue" >
+    |   < DELETE:       "delete" >
+    |   < ELSE:         "else" >
+    |   < FOR:          "for" >
+    |   < FUNCTION:     "function" >
+    |   < FUNCTION_:    "Function" >
+    |   < IF:           "if" >
+    |   < IN:           "in" >
+    |   < NEW:          "new" >
+    |   < RETURN:       "return" >
+    |   < THIS:         "this" >
+    |   < TYPEOF:       "typeof" >
+    |   < INSTANCEOF:   "instanceof" >
+    |   < VAR:          "var" >
+    |   < VOID:         "void" >
+    |   < WHILE:        "while" >
+    |   < WITH:         "with" >
+    |   < CASE:         "case" >
+    |   < CATCH:        "catch" >
+    |   < CLASS:        "class" >
+    |   < CONST:        "const" >
+    |   < DEBUGGER:     "debugger" >
+    |   < _DEFAULT:     "default" >
+    |   < DO:           "do" >
+    |   < ENUM:         "enum" >
+    |   < EXPORT:       "export" >
+    |   < EXTENDS:      "extends" >
+    |   < FINALLY:      "finally" >
+    |   < IMPORT:       "import" >
+    |   < SUPER:        "super" >
+    |   < SWITCH:       "switch" >
+    |   < THROW:        "throw" >
+    |   < TRY:          "try" >
+    |   < TRUE:         "true" >    // They are not supposed to be keywords
+    |   < FALSE:        "false" >   // They are not supposed to be keywords
+    |   < NULL:         "null" >    // They are not supposed to be keywords
+}
+/////////////////////////////////////////////////////
+// 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:
+                "\"" ( <ESCAPE_SEQUENCE> | (~["\"","\\","\n","\r"]) )* ( ["\n","\r"] )?
+            |   "'"  ( <ESCAPE_SEQUENCE> | (~["'","\\","\n","\r"])  )* ( ["\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:      "." >
+}
+
+/////////////////////////////////////////////////////
+// OPERATORS 
+/////////////////////////////////////////////////////
+TOKEN :
+{
+        < ASSIGN:               "=" >
+    |   < GT:                   ">" >
+    |   < LT:                   "<" >
+    |   < BANG:                 "!" >
+    |   < TILDE:                "~" >
+    |   < HOOK:                 "?" >
+    |   < COLON:                ":" >
+    |   < EQ:                   "==" >
+    |   < LE:                   "<=" >
+    |   < GE:                   ">=" >
+    |   < NE:                   "!=" >
+    |   < SC_OR:                "||" >
+    |   < SC_AND:               "&&" >
+    |   < 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: ">>>=" >
+    |   < IDENTITYOPER:         "===" >
+    |   < NOTIDENTITYOPER:      "!==" >
+}
+///////////////////////////////////////////////////////////////////
+// GRAMMAR Section
+///////////////////////////////////////////////////////////////////
+
+void Literal():
+{}
+{
+        <DECIMAL_LITERAL> 
+    |   <OCTAL_LITERAL>
+    |   <HEX_LITERAL>
+    |   <FLOATING_POINT_LITERAL> 
+    |   <STRING_LITERAL> 
+    |   <TRUE> 
+    |   <FALSE>
+    |   <REGULAR_EXPRESSION> 
+    |   <NULL>
+}
+
+Token Identifier():
+{
+		Token t;
+}
+{
+    	t = <IDENTIFIER> {return t;}
+}
+
+void PrimaryExpression():
+{
+		Token prefixToken = null;	
+}
+{
+    (
+        prefixToken = <THIS>            (PrimarySuffix())*
+            {
+               JSParserUtils.tagObjectIdentifier(prefixToken, getToken(1));
+            }
+    |   prefixToken=Identifier()        (PrimarySuffix())*
+            {
+               JSParserUtils.tagObjectIdentifier(prefixToken, getToken(1));
+               JSParserUtils.tagMethodInvocation(_contextStack, 
+                                                 (AnnotatedToken)prefixToken, 
+                                                 (AnnotatedToken)getToken(1));
+            }
+    |   LOOKAHEAD(2)  <STRING_LITERAL>  (PrimarySuffix())*  
+    |   LOOKAHEAD(2)  <REGULAR_EXPRESSION>  (PrimarySuffix())*    
+    |   LOOKAHEAD(2)  Literal() 
+    |   FunctionLiteral()
+    |   NestedArrayLiteral()                (PrimarySuffix())*
+    |   ObjectLiteral() 
+    |   <LPAREN> Expression() <RPAREN>      (PrimarySuffix())* 
+    |   AllocationExpression()
+    )
+    {
+        token_source.setRegValid();
+    }
+}
+
+
+void PrimarySuffix():
+{}
+{
+        Arguments() 
+    |   {token_source.setRegInvalid();} <LBRACKET> Expression() <RBRACKET> 
+    |   {token_source.setRegInvalid();} <DOT> Identifier()
+}
+
+void Arguments():
+{}
+{
+        <LPAREN> {token_source.setRegValid();} [ArgumentList()] <RPAREN>
+}
+
+void ArgumentList():
+{}
+{
+        AssignmentExpression() (<COMMA> AssignmentExpression())*
+}
+
+void LiteralArgumentList():
+{}
+{
+        <STRING_LITERAL> (<COMMA> <STRING_LITERAL>)*
+}
+
+void NewSuffix():
+{}
+{
+        <DOT> Identifier()
+}
+
+void AllocationExpression():
+{
+        Token t;
+}
+{
+        LOOKAHEAD(2)  t=<NEW> <THIS>       (NewSuffix())* [Arguments()]
+            {JSParserUtils.annotateToken(t, AnnotationConstants.UNDEFINED, null, 1);}
+    |   LOOKAHEAD(2)  t=<NEW> Identifier() (NewSuffix())* [Arguments()]
+            {JSParserUtils.annotateToken(t, AnnotationConstants.UNDEFINED, null, 1);}
+    |   LOOKAHEAD(2)  t=<NEW> FunctionConstructor() (NewSuffix())*      [Arguments()]
+            {JSParserUtils.annotateToken(t, AnnotationConstants.UNDEFINED, null, 1);}
+}
+
+
+void PostfixOp():
+{}
+{
+        <INCR>
+    |   <DECR>
+}
+
+void PostfixExpression():
+{}
+{
+        PrimaryExpression() [PostfixOp()]
+}
+
+
+void UnaryOp():
+{
+        Token t;
+}
+{
+        t=<DELETE>
+            {JSParserUtils.annotateToken(t, AnnotationConstants.UNDEFINED, null, 1);}
+    |   t=<VOID>
+            {JSParserUtils.annotateToken(t, AnnotationConstants.UNDEFINED, null, 1);}
+    |   t=<TYPEOF>
+            {JSParserUtils.annotateToken(t, AnnotationConstants.UNDEFINED, null, 1);}
+    |   <INCR>
+    |   <DECR>
+    |   <PLUS>
+    |   <MINUS>
+    |   <TILDE>
+    |   <BANG>
+}
+
+void UnaryExpression():
+{}
+{
+        PostfixExpression()
+    |   UnaryOp() UnaryExpression()
+}
+
+void MulOp():
+{}
+{
+        <STAR>
+    |   <SLASH>
+    |   <REM> 
+}
+
+void MultiplicativeExpression():
+{}
+{
+        UnaryExpression() (MulOp() UnaryExpression())*
+} 
+
+void AddOp():
+{}
+{
+        <PLUS>
+    |   <MINUS>
+}
+
+void AdditiveExpression():
+{}
+{
+        MultiplicativeExpression() (AddOp() MultiplicativeExpression())*
+} 
+
+void ShiftOp():
+{}
+{
+        <LSHIFT>
+    |   <RSIGNEDSHIFT>
+    |   <RUNSIGNEDSHIFT>
+}
+
+void ShiftExpression():
+{}
+{
+        AdditiveExpression() (ShiftOp() AdditiveExpression())*
+}
+
+void RelOp():
+{}
+{
+        <LT>
+    |   <GT> 
+    |   <LE> 
+    |   <GE>
+}
+
+void RelationalExpression():
+{
+        Token t;
+}
+{
+        ShiftExpression() 
+            (LOOKAHEAD(3) (  RelOp() 
+                           | t=<INSTANCEOF> 
+                             {JSParserUtils.annotateToken(t, 
+                                                          AnnotationConstants.UNDEFINED, 
+                                                          null, 2);}
+                           | t=<IN> 
+                             {JSParserUtils.annotateToken(t,
+                                                          AnnotationConstants.UNDEFINED,
+                                                          null, 2);})
+             ShiftExpression())*
+}
+
+void RelationalExpressionNoIN():
+{
+        Token t;
+}
+{
+        ShiftExpression() 
+            ( (  RelOp() 
+               | t=<INSTANCEOF>  
+                 {JSParserUtils.annotateToken(t, AnnotationConstants.UNDEFINED, 
+                                              null, 2);})
+              ShiftExpression())*
+}
+
+void EqualOp():
+{}
+{
+        <EQ> 
+    |   <NE> 
+    |   <IDENTITYOPER> 
+    |   <NOTIDENTITYOPER>
+}
+
+void EqualityExpression():
+{}
+{
+        RelationalExpression() (EqualOp() RelationalExpression())*
+}
+
+void EqualityExpressionNoIN():
+{}
+{
+        RelationalExpressionNoIN() (EqualOp() RelationalExpressionNoIN())*
+}
+
+
+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())*
+}
+
+void LogicalANDExpression():
+{}
+{
+        BitwiseORExpression() (<SC_AND> BitwiseORExpression())*
+}
+
+void LogicalANDExpressionNoIN():
+{}
+{
+        BitwiseORExpressionNoIN() (<SC_AND> BitwiseORExpressionNoIN())*
+}
+
+void LogicalORExpression():
+{}
+{
+        LogicalANDExpression() (<SC_OR> LogicalANDExpression())*
+}
+
+void LogicalORExpressionNoIN():
+{}
+{
+        LogicalANDExpressionNoIN() (<SC_OR> LogicalANDExpressionNoIN())*
+}
+
+void ConditionalExpression():
+{}
+{
+        LogicalORExpression() [<HOOK> Expression() <COLON> ConditionalExpression()]
+}
+
+void ConditionalExpressionNoIN():
+{}
+{
+        LogicalORExpressionNoIN() [<HOOK> ExpressionNoIN() <COLON> ConditionalExpressionNoIN()]
+}
+
+Token AssignementOperator():
+{
+        Token t;
+}
+{
+        ( t=<ASSIGN>
+    |     t=<STARASSIGN>
+    |     t=<SLASHASSIGN> 
+    |     t=<REMASSIGN> 
+    |     t=<PLUSASSIGN>
+    |     t=<MINUSASSIGN> 
+    |     t=<LSHIFTASSIGN> 
+    |     t=<RSIGNEDSHIFTASSIGN>
+    |     t=<RUNSIGNEDSHIFTASSIGN>
+    |     t=<ANDASSIGN> 
+    |     t=<XORASSIGN> 
+    |     t=<ORASSIGN> )
+        { return t; } 
+}
+
+void AssignmentExpression():
+{
+        Token tLHS      = getToken(1); 
+		Token tOperator = null; 
+		Token tRHS      = null;
+		Token tEnd      = null;
+}
+{
+        ConditionalExpression() 
+            [ (AssignementOperator() 
+               {tRHS=getToken(1);}
+               AssignmentExpression())
+               {
+                  tEnd = getToken(1);
+                  JSParserUtils.tagAssignmentExpression(_contextStack, null, 
+                                                        (AnnotatedToken)tLHS, 
+                                                        (AnnotatedToken)tOperator,
+                                                        (AnnotatedToken)tRHS, 
+                                                        (AnnotatedToken)tEnd); 
+               }
+            ]
+}
+
+void AssignmentExpressionNoIN():
+{
+        Token tLHS      = getToken(1); 
+		Token tOperator = null; 
+		Token tRHS      = null;
+		Token tEnd      = null;
+}
+{
+        ConditionalExpressionNoIN() 
+            [ (AssignementOperator() {tRHS=getToken(1);}
+               AssignmentExpressionNoIN())
+               {
+                  tEnd = getToken(1);
+                  JSParserUtils.tagAssignmentExpression(_contextStack, null, 
+                                                        (AnnotatedToken)tLHS, 
+                                                        (AnnotatedToken)tOperator,
+                                                        (AnnotatedToken)tRHS, 
+                                                        (AnnotatedToken)tEnd); 
+               }
+            ]
+}
+
+
+void Expression()                     :
+{}
+{
+  AssignmentExpression() ( "," AssignmentExpression() )*
+}   
+
+void ExpressionNoIN()                     :
+{}
+{
+  AssignmentExpressionNoIN() ( "," AssignmentExpressionNoIN() )*
+}   
+
+
+void Statement():
+{}
+{
+        LOOKAHEAD(3)    Block(null)
+    |                   VariableStatement()
+    |                   EmptyStatement()
+    |                   ExpressionStatement()
+    |                   IfStatement()
+    |                   IterationStatement()
+    |                   ContinueStatement()
+    |                   BreakStatement()
+    |                   ReturnStatement()
+    |                   WithStatement()
+    |                   TryStatement()
+    |                   ThrowStatement()
+    |                   SwitchStatement()
+}
+ 
+void Block(ProgramContext context):
+{}
+{
+        LOOKAHEAD(3)    <LBRACE> <RBRACE>   
+    |                   <LBRACE> {
+                                     if (context == null) {
+                                        _contextStack.pushContext(new ProgramContext("block"));
+ 	                                 }
+                                 }
+                                 [StatementList()] 
+                                 <RBRACE>
+                                 {
+                                     _contextStack.popContext();
+                                 }
+}
+ 
+void VariableStatement():
+{
+        Token t;
+}
+{
+        t=<VAR> {JSParserUtils.annotateToken(t, AnnotationConstants.UNDEFINED, null, 1);}
+        VariableDeclarationList(t) Sc()
+}
+ 
+void VariableDeclarationList(Token varToken):
+{}
+{
+        VariableDeclaration(varToken) ( <COMMA> VariableDeclaration(varToken) )*
+}
+
+void VariableDeclaration(Token varToken):
+{
+        Token lhs      = null;
+        Token[] tArray = null;
+}
+{
+        lhs=Identifier() [Initializer()]
+        {
+            JSParserUtils.annotateToken(lhs, AnnotationConstants.VAR_IDENTIFIER, null, -1);
+            JSParserUtils.pushToken(_contextStack, (AnnotatedToken)lhs);      
+      
+            if(tArray != null) {
+      	       Token end = getToken(1);
+               JSParserUtils.tagAssignmentExpression(_contextStack, (AnnotatedToken)varToken, 
+                                                     (AnnotatedToken)lhs, (AnnotatedToken)tArray[0], 
+                                                     (AnnotatedToken)tArray[1], (AnnotatedToken)end); 
+            }
+        }
+}
+
+Token[] Initializer():
+{
+        Token[] tArray = new Token[2];
+}
+{
+        tArray[0]=<ASSIGN> {tArray[1]=getToken(1);} 
+        AssignmentExpression()
+        {return tArray;}
+}
+ 
+void EmptyStatement():
+{}
+{
+        <SEMICOLON>
+}
+
+void ExpressionStatement():
+{}
+{
+        Expression() Sc() 
+}
+
+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;
+  }
+ 
+void IfStatement():
+{
+        Token t;
+}
+{
+        <IF> <LPAREN> Expression() <RPAREN> 
+            Statement() 
+            [ LOOKAHEAD(1) t=<ELSE> {JSParserUtils.annotateToken(t, AnnotationConstants.UNDEFINED,
+                                                                 null, 1);}
+              Statement()
+            ]
+}
+
+
+void IterationStatement():
+{}
+{
+                            WhileStatement()
+    |                       DoStatement()
+    |   LOOKAHEAD(<FOR> <LPAREN> Expression() <SEMICOLON>)                     
+                            ForStatement()
+    |   LOOKAHEAD(<FOR> <LPAREN> <SEMICOLON>)                                  
+                            ForStatement()
+    |   LOOKAHEAD(<FOR> <LPAREN> varToekn=<VAR> VariableDeclarationList(varToken) <SEMICOLON>)  
+                            ForVarStatement()
+    |   LOOKAHEAD(3)        ForInStatement()
+    |   LOOKAHEAD(3)        ForVarInStatement()
+}
+ 
+void DoStatement():
+{}
+{
+        <DO> Statement() <WHILE> <LPAREN> Expression() <RPAREN>
+}
+
+void WhileStatement():
+{}
+{
+        <WHILE> <LPAREN> Expression() <RPAREN> 
+            Statement()
+}
+ 
+void ForStatement():
+{}
+{
+        <FOR> <LPAREN>  [Expression()] <SEMICOLON> 
+                        [Expression()] <SEMICOLON> 
+                        [Expression()] <RPAREN> 
+            Statement()
+}
+
+void ForVarStatement():
+{
+        Token t;
+}
+{
+        <FOR> <LPAREN>  t=<VAR> {JSParserUtils.annotateToken(t, AnnotationConstants.UNDEFINED, 
+                                                             null, 1);}
+                        VariableDeclarationList(t) <SEMICOLON> 
+                        [Expression()]  <SEMICOLON> 
+                        [Expression()]  <RPAREN> 
+            Statement()
+}
+
+void ForInStatement():
+{
+        Token t;
+}
+{
+        <FOR> <LPAREN>  ExpressionNoIN() 
+                        t=<IN> {JSParserUtils.annotateToken(t, AnnotationConstants.UNDEFINED, 
+                                                            null, 2);}
+                        ExpressionNoIN() <RPAREN> 
+            Statement()
+}
+ 
+void ForVarInStatement():
+{
+        Token t;
+}
+{
+        <FOR> <LPAREN>  
+                t=<VAR> {JSParserUtils.annotateToken(t, AnnotationConstants.UNDEFINED, null, 1);}
+                t=Identifier() 
+                  {
+   	                  JSParserUtils.annotateToken(t, AnnotationConstants.VAR_IDENTIFIER, null, 1);
+   	                  JSParserUtils.pushToken(_contextStack, (AnnotatedToken)t);
+                  }
+                [Initializer()] 
+                t=<IN> {JSParserUtils.annotateToken(t, AnnotationConstants.UNDEFINED, null, 2);}
+                ExpressionNoIN() 
+              <RPAREN> 
+            Statement()
+}
+
+void ContinueStatement():
+{}
+{
+        <CONTINUE> Sc()
+}
+
+void BreakStatement():
+{}
+{
+        <BREAK> Sc()
+}
+ 
+void ReturnStatement():
+{
+        Token t;
+}
+{
+        t=<RETURN> {JSParserUtils.annotateToken(t, AnnotationConstants.UNDEFINED, null, 1);}
+        [Expression()] Sc()
+}
+
+void WithStatement():
+{}
+{
+        <WITH> <LPAREN> Expression() <RPAREN>
+            Statement()
+}
+
+void TryStatement():
+{}
+{
+        <TRY> Block(null)
+        (<CATCH> <LPAREN> Identifier() <RPAREN> Block(null))*
+        [<FINALLY> Block(null)]
+} 
+
+void ThrowStatement():
+{
+        Token t;
+}
+{
+        t=<THROW> {JSParserUtils.annotateToken(t, AnnotationConstants.UNDEFINED, null, 1);}
+        [Expression()] Sc()
+}
+
+void CaseGuard():
+{
+        Token t;
+}
+{
+        t=<CASE> {JSParserUtils.annotateToken(t, AnnotationConstants.UNDEFINED, null, 1);}
+        Expression() <COLON>
+    |   <_DEFAULT> <COLON>
+}
+
+void CaseGroup():
+{}
+{
+        CaseGuard() (Statement())*  
+}
+
+void SwitchStatement():
+{}
+{
+        <SWITCH>    <LPAREN> Expression() <RPAREN> 
+                    <LBRACE> (CaseGroup())* <RBRACE>
+}
+
+void NamedFunction():
+{
+        Token  tIdentifier = null;
+        Token  tFunction   = null;
+        Token  blockStart  = null;
+        Token  blockEnd    = null;
+        Vector params      = new Vector();
+}
+{
+        tFunction=<FUNCTION> 
+        tIdentifier=Identifier() 
+           { 
+              JSParserUtils.annotateToken(tIdentifier, AnnotationConstants.FUNCTION_NAME_IDENTIFIER, 
+                                          null, -1); 
+              ProgramContext context = new ProgramContext(tIdentifier.image);
+              _contextStack.pushContext(context);
+           }
+        <LPAREN> 
+           [params=FormalParameterList()] 
+              { 
+                  JSParserUtils.annotateTokens(params,
+                                               AnnotationConstants.FUNCTION_PARAM_IDENTIFIER,
+                                               null, -1); 
+                  JSParserUtils.annotateToken(tFunction, AnnotationConstants.NAMED_FUNCTION,
+                                              params, 1); 
+                  JSParserUtils.pushTokens(_contextStack, params);
+              } 
+
+        <RPAREN>
+        {blockStart = getToken(1);} 
+        Block(context)
+        {
+           blockEnd = getToken(1);
+           JSParserUtils.tagEvalCalls(tFunction, blockStart, blockEnd);
+        }
+}
+
+void AnonymousFunction():
+{
+        Token  tFunction  = null;
+        Token  blockStart = null;
+        Token  blockEnd   = null;
+        Vector params     = new Vector();
+}
+{
+        tFunction=<FUNCTION>
+           { 
+              ProgramContext context = new ProgramContext("anonymous");
+              _contextStack.pushContext(context);
+           } 
+        <LPAREN> 
+           [params=FormalParameterList()] 
+              { 
+                  JSParserUtils.annotateTokens(params,
+                                               AnnotationConstants.FUNCTION_PARAM_IDENTIFIER,
+                                               null, -1); 
+                  JSParserUtils.annotateToken(tFunction,
+                                              AnnotationConstants.ANONYMOUS_FUNCTION,
+                                              params, -1); 
+                  JSParserUtils.pushTokens(_contextStack, params);
+              } 
+        <RPAREN> 
+        {blockStart = getToken(1);}
+        Block(context)
+        {
+           blockEnd = getToken(1);
+           JSParserUtils.tagEvalCalls(tFunction, blockStart, blockEnd);
+        }
+}
+
+void FunctionConstructor():
+{}
+{    
+        <FUNCTION_> <LPAREN> ArgumentList() <RPAREN> 
+}
+
+void FunctionDeclaration():
+{}
+{
+        LOOKAHEAD(2) NamedFunction() 
+    |   LOOKAHEAD(2) AnonymousFunction()
+}           
+
+void FunctionLiteral():
+{}
+{
+        AnonymousFunction()
+}
+                          
+Vector FormalParameterList():
+{
+        Token  t = null;
+        Vector v = new Vector();
+}
+{
+        t=Identifier() {v.add(t);} 
+        (<COMMA> t=Identifier() {v.add(t);})*
+        {return v;}
+}
+
+void LiteralElement() :
+{}
+{
+        AssignmentExpression()
+}
+
+void ElementList():
+{}
+{
+        LiteralElement() (<COMMA> LiteralElement())*
+}
+
+void ArrayLiteral():
+{}
+{
+        LOOKAHEAD(2) <LBRACKET> <RBRACKET>
+    |   LOOKAHEAD(2) <LBRACKET> ElementList() <RBRACKET>
+}
+
+void NestedArrayLiteral():
+{}
+{
+        LOOKAHEAD(3) ArrayLiteral() 
+    |   LOOKAHEAD(3) <LBRACKET> NestedArrayLiteral() <RBRACKET>
+}
+
+void LiteralField():
+{
+        Token t = null;
+}
+{
+        t=Identifier()     <COLON> AssignmentExpression()
+        {JSParserUtils.annotateToken(t, AnnotationConstants.LITERAL_OBJECT_KEY_IDENTIFIER,null,-1); }
+   |    t=<STRING_LITERAL> <COLON> AssignmentExpression()
+        {JSParserUtils.annotateToken(t, AnnotationConstants.LITERAL_OBJECT_KEY_IDENTIFIER,null,-1); }
+}
+
+void FieldList():
+{}
+{
+        LiteralField() (<COMMA> LiteralField())*
+}
+
+void ObjectLiteral():
+{}
+{
+        LOOKAHEAD(2) <LBRACE> <RBRACE>
+    |   LOOKAHEAD(2) <LBRACE> FieldList() <RBRACE>  
+}
+
+
+Token Program():
+{
+        Token retval = getToken(1);
+}
+{
+        {_contextStack.pushContext(new ProgramContext("root"));}
+        (SourceElement())*  <EOF>
+        {
+            return retval;
+        }
+}
+
+void SourceElement():
+{}
+{
+        LOOKAHEAD(2)    Statement() 
+    |                   FunctionDeclaration()
+}
+
+void StatementList(): 
+{
+//        Token t;
+}
+{
+        (Statement())+
+}

Propchange: incubator/adffaces/branches/matzew-repackaging-trinidad/plugins/maven-javascript-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/javascript/obfuscator/javascript15parser/js1.5.jj
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/adffaces/branches/matzew-repackaging-trinidad/plugins/maven-javascript-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/javascript/uixtools/Detokenizer.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/uixtools/Detokenizer.java?rev=425235&r1=425234&r2=425235&view=diff
==============================================================================
--- incubator/adffaces/branches/matzew-repackaging-trinidad/plugins/maven-javascript-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/javascript/uixtools/Detokenizer.java (original)
+++ incubator/adffaces/branches/matzew-repackaging-trinidad/plugins/maven-javascript-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/javascript/uixtools/Detokenizer.java Mon Jul 24 17:24:16 2006
@@ -1,100 +1,100 @@
-/*
- * Copyright 2000,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.uixtools;
-
-import java.io.IOException;
-import java.io.Writer;
-import java.io.PrintWriter;
-
-/**
- * Converts Token Objects into a JavaScript file
- * @version $Name:  $ ($Revision$) $Date$
- * @author Arjuna Wijeyekoon - arjuna.wijeyekoon@oracle.com
- */
-public class Detokenizer
-{
-  private final PrintWriter _out;
-
-  /**
-   * @param out the file to write the output to.
-   */
-  public Detokenizer(PrintWriter out)
-  {
-    this._out = out;
-  }
-
-  /**
-   * Creates a new PrintWriter and calls the other constructor.
-   */
-  public Detokenizer(Writer out)
-  {
-    this(new PrintWriter(out));
-  }
-
-  /**
-   * decodes a token and writes the result
-   * @param tok the token to decode.
-   */
-  public void write(Token tok) throws IOException
-  {
-    int com = tok.code;
-    switch(com)
-      {
-      case Token.NEWLINE :
-        _out.println();
-        break;
-      case Token.WHITESPACE :
-        _out.print(' ');
-        break;
-      case Token.PERIOD :
-        _out.print('.');
-        break;
-      case Token.SEMICOLON :
-        _out.print(';');
-        break;
-      case Token.QUOTED :
-        {
-          char ch = tok.ch;
-          _out.print(ch+tok.string+ch);
-        }
-        break;
-      case Token.CONTROL :
-      case Token.LEFT_BRACE :
-      case Token.RIGHT_BRACE :
-        _out.print(tok.ch);
-        break;
-      case Token.NUMBER :
-      case Token.RESERVED :
-      case Token.NAME :
-        _out.print(tok.string);
-        break;
-      case Token.COMMENT :
-        _out.print("/*"+tok.string+"*/");
-        break;
-      case Token.REGULAR_EXP :
-        _out.print("/"+tok.string+"/");
-        break;
-      case Token.REGULAR_EXP_MODIFIER :
-        _out.print(tok.ch);
-        break;
-      case Token.EOF :
-        _out.close();
-        break;
-      default :
-        throw new RuntimeException("Unknown Token:"+tok);
-      }
-  }
+/*
+ * Copyright 2000,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.uixtools;
+
+import java.io.IOException;
+import java.io.Writer;
+import java.io.PrintWriter;
+
+/**
+ * Converts Token Objects into a JavaScript file
+ * @version $Name:  $ ($Revision$) $Date$
+ * @author Arjuna Wijeyekoon - arjuna.wijeyekoon@oracle.com
+ */
+public class Detokenizer
+{
+  private final PrintWriter _out;
+
+  /**
+   * @param out the file to write the output to.
+   */
+  public Detokenizer(PrintWriter out)
+  {
+    this._out = out;
+  }
+
+  /**
+   * Creates a new PrintWriter and calls the other constructor.
+   */
+  public Detokenizer(Writer out)
+  {
+    this(new PrintWriter(out));
+  }
+
+  /**
+   * decodes a token and writes the result
+   * @param tok the token to decode.
+   */
+  public void write(Token tok) throws IOException
+  {
+    int com = tok.code;
+    switch(com)
+      {
+      case Token.NEWLINE :
+        _out.println();
+        break;
+      case Token.WHITESPACE :
+        _out.print(' ');
+        break;
+      case Token.PERIOD :
+        _out.print('.');
+        break;
+      case Token.SEMICOLON :
+        _out.print(';');
+        break;
+      case Token.QUOTED :
+        {
+          char ch = tok.ch;
+          _out.print(ch+tok.string+ch);
+        }
+        break;
+      case Token.CONTROL :
+      case Token.LEFT_BRACE :
+      case Token.RIGHT_BRACE :
+        _out.print(tok.ch);
+        break;
+      case Token.NUMBER :
+      case Token.RESERVED :
+      case Token.NAME :
+        _out.print(tok.string);
+        break;
+      case Token.COMMENT :
+        _out.print("/*"+tok.string+"*/");
+        break;
+      case Token.REGULAR_EXP :
+        _out.print("/"+tok.string+"/");
+        break;
+      case Token.REGULAR_EXP_MODIFIER :
+        _out.print(tok.ch);
+        break;
+      case Token.EOF :
+        _out.close();
+        break;
+      default :
+        throw new RuntimeException("Unknown Token:"+tok);
+      }
+  }
 }

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

Modified: incubator/adffaces/branches/matzew-repackaging-trinidad/plugins/maven-javascript-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/javascript/uixtools/FileProcessor.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/uixtools/FileProcessor.java?rev=425235&r1=425234&r2=425235&view=diff
==============================================================================
--- incubator/adffaces/branches/matzew-repackaging-trinidad/plugins/maven-javascript-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/javascript/uixtools/FileProcessor.java (original)
+++ incubator/adffaces/branches/matzew-repackaging-trinidad/plugins/maven-javascript-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/javascript/uixtools/FileProcessor.java Mon Jul 24 17:24:16 2006
@@ -1,150 +1,150 @@
-/*
- * Copyright 2000-2002,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.uixtools;
-
-import java.io.File;
-import java.io.FilenameFilter;
-
-/**
- * This utility class can be used to perform some processing on input files,
- * and write the results to corresponding output files. It supports recursing
- * into subdirectories.
- * @version $Name:  $ ($Revision$) $Date$
- * @author Arjuna Wijeyekoon (arjuna.wijeyekoon@oracle.com) */
-public abstract class FileProcessor
-{
-  /**
-   * @param filenameExt the filename extension to accept. If null, all files
-   *  are accepted.
-   * @return a filter that only accepts files with names that end with the
-   *  specified extension. However, the filter accepts all subdirectories.
-   */
-  public static FilenameFilter getExtensionFilter(final String filenameExt)
-  {
-    return new FilenameFilter() {
-        public boolean accept(File dir, String name)
-        {
-          if ((filenameExt==null) || (name.endsWith(filenameExt))) return true;
-          File f = new File(dir, name);
-          return f.isDirectory();
-        }
-      };
-  }
-
-  /**
-   * @param filter used to select files and/or subdirectories.
-   * @param failFast if true, terminates at the first error (otherwise,
-   *  continues with the next file).
-   * @param overwrite if false, will not overwrite existing output files (That
-   *  particular input and output file will be skipped).
-   * @param verbose if true, generates verbose output.  */
-  public FileProcessor(FilenameFilter filter,
-                       boolean failFast, boolean overwrite, boolean verbose)
-  {
-    _filter = filter;
-    _failFast = failFast;
-    _dontOverwrite = !overwrite;
-    isVerbose = verbose;
-  }
-
-  /**
-   * Creates a Fileprocessor that overwrites all output files, and does not
-   * fail fast.
-   * @param filter used to select files and/or subdirectories.  */
-  public FileProcessor(FilenameFilter filter, boolean verbosity)
-  {
-    this(filter, false, true, verbosity);
-  }
-
-  /**
-   * Creates a Fileprocessor that overwrites all output files, and does not
-   * fail fast.
-   * @param extension the file extension to filter for. if this is null, all
-   * files and subdirectories in a directory will be processed recursively.
-   * @see #getExtensionFilter(String extension)
-   */
-  public FileProcessor(String extension, boolean verbosity)
-  {
-    this(getExtensionFilter(extension), verbosity);
-  }
-
-  /**
-   * @param in the input file or directory
-   * @param out if the input is a directory, then this must be the output
-   *  directory. Otherwise, this is the output file.
-   * @return true if there were no errors. false otherwise.  */
-  public boolean process(File in, File out)
-  {
-    if (isVerbose) System.out.println("Processing file:"+in+" to file:"+out);
-
-    if (in.isDirectory())
-    {
-      boolean success = true;
-      String[] names = in.list(_filter);
-      for(int i=0, sz=names.length; i<sz; i++)
-      {
-        File subIn = new File(in, names[i]);
-        File subOut = new File(out, names[i]);
-        success &= process(subIn, subOut);
-        if (_failFast && (!success)) return false;
-      }
-      return success;
-    }
-    else
-    {
-      try
-      {
-        if (_dontOverwrite && out.exists())
-        {
-          if (isVerbose) System.out.println("Skipping file:"+in+
-                                          " as destination file:"+out+
-                                          " already exists.");
-        }
-        else
-        {
-          out.getParentFile().mkdirs();
-          processFile(in, out);
-        }
-        return true;
-      }
-      catch (Exception e)
-      {
-        System.out.println("Error processing file:"+in+" to file:"+out);
-        e.printStackTrace();
-        return false;
-      }
-    }
-  }
-
-  /**
-   * Called to process a single file.
-   * @param in the input file. This is never a directory.
-   * @param out the output file. If this file exists and overwriting is not
-   * permitted, then this method is never called.
-   * @exception Exception if this class is set to <i>fail fast</i> then any
-   * exception thrown will cause all execution to halt. If this class does not
-   * fail fast, then the exception will be reported and execution will
-   * continue with the next file.  */
-  protected abstract void processFile(File in, File out) throws Exception;
-
-  /**
-   * If this is true, verbose output will be generated.
-   */
-  protected final boolean isVerbose;
-
-  private   final boolean _failFast, _dontOverwrite;
-  private   final FilenameFilter _filter;
+/*
+ * Copyright 2000-2002,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.uixtools;
+
+import java.io.File;
+import java.io.FilenameFilter;
+
+/**
+ * This utility class can be used to perform some processing on input files,
+ * and write the results to corresponding output files. It supports recursing
+ * into subdirectories.
+ * @version $Name:  $ ($Revision$) $Date$
+ * @author Arjuna Wijeyekoon (arjuna.wijeyekoon@oracle.com) */
+public abstract class FileProcessor
+{
+  /**
+   * @param filenameExt the filename extension to accept. If null, all files
+   *  are accepted.
+   * @return a filter that only accepts files with names that end with the
+   *  specified extension. However, the filter accepts all subdirectories.
+   */
+  public static FilenameFilter getExtensionFilter(final String filenameExt)
+  {
+    return new FilenameFilter() {
+        public boolean accept(File dir, String name)
+        {
+          if ((filenameExt==null) || (name.endsWith(filenameExt))) return true;
+          File f = new File(dir, name);
+          return f.isDirectory();
+        }
+      };
+  }
+
+  /**
+   * @param filter used to select files and/or subdirectories.
+   * @param failFast if true, terminates at the first error (otherwise,
+   *  continues with the next file).
+   * @param overwrite if false, will not overwrite existing output files (That
+   *  particular input and output file will be skipped).
+   * @param verbose if true, generates verbose output.  */
+  public FileProcessor(FilenameFilter filter,
+                       boolean failFast, boolean overwrite, boolean verbose)
+  {
+    _filter = filter;
+    _failFast = failFast;
+    _dontOverwrite = !overwrite;
+    isVerbose = verbose;
+  }
+
+  /**
+   * Creates a Fileprocessor that overwrites all output files, and does not
+   * fail fast.
+   * @param filter used to select files and/or subdirectories.  */
+  public FileProcessor(FilenameFilter filter, boolean verbosity)
+  {
+    this(filter, false, true, verbosity);
+  }
+
+  /**
+   * Creates a Fileprocessor that overwrites all output files, and does not
+   * fail fast.
+   * @param extension the file extension to filter for. if this is null, all
+   * files and subdirectories in a directory will be processed recursively.
+   * @see #getExtensionFilter(String extension)
+   */
+  public FileProcessor(String extension, boolean verbosity)
+  {
+    this(getExtensionFilter(extension), verbosity);
+  }
+
+  /**
+   * @param in the input file or directory
+   * @param out if the input is a directory, then this must be the output
+   *  directory. Otherwise, this is the output file.
+   * @return true if there were no errors. false otherwise.  */
+  public boolean process(File in, File out)
+  {
+    if (isVerbose) System.out.println("Processing file:"+in+" to file:"+out);
+
+    if (in.isDirectory())
+    {
+      boolean success = true;
+      String[] names = in.list(_filter);
+      for(int i=0, sz=names.length; i<sz; i++)
+      {
+        File subIn = new File(in, names[i]);
+        File subOut = new File(out, names[i]);
+        success &= process(subIn, subOut);
+        if (_failFast && (!success)) return false;
+      }
+      return success;
+    }
+    else
+    {
+      try
+      {
+        if (_dontOverwrite && out.exists())
+        {
+          if (isVerbose) System.out.println("Skipping file:"+in+
+                                          " as destination file:"+out+
+                                          " already exists.");
+        }
+        else
+        {
+          out.getParentFile().mkdirs();
+          processFile(in, out);
+        }
+        return true;
+      }
+      catch (Exception e)
+      {
+        System.out.println("Error processing file:"+in+" to file:"+out);
+        e.printStackTrace();
+        return false;
+      }
+    }
+  }
+
+  /**
+   * Called to process a single file.
+   * @param in the input file. This is never a directory.
+   * @param out the output file. If this file exists and overwriting is not
+   * permitted, then this method is never called.
+   * @exception Exception if this class is set to <i>fail fast</i> then any
+   * exception thrown will cause all execution to halt. If this class does not
+   * fail fast, then the exception will be reported and execution will
+   * continue with the next file.  */
+  protected abstract void processFile(File in, File out) throws Exception;
+
+  /**
+   * If this is true, verbose output will be generated.
+   */
+  protected final boolean isVerbose;
+
+  private   final boolean _failFast, _dontOverwrite;
+  private   final FilenameFilter _filter;
 }

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

Modified: incubator/adffaces/branches/matzew-repackaging-trinidad/plugins/maven-javascript-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/javascript/uixtools/Filter1.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/uixtools/Filter1.java?rev=425235&r1=425234&r2=425235&view=diff
==============================================================================
--- incubator/adffaces/branches/matzew-repackaging-trinidad/plugins/maven-javascript-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/javascript/uixtools/Filter1.java (original)
+++ incubator/adffaces/branches/matzew-repackaging-trinidad/plugins/maven-javascript-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/javascript/uixtools/Filter1.java Mon Jul 24 17:24:16 2006
@@ -1,91 +1,91 @@
-/*
- * Copyright 2000-2001,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.uixtools;
-
-import java.io.IOException;
-
-/**
- * Removes all comments and redundant whitespace
- * @version $Name:  $ ($Revision$) $Date$
- * @author Arjuna Wijeyekoon - arjuna.wijeyekoon@oracle.com
- */
-public class Filter1 implements TokenReader
-{
-
-  /**
-   * blocks until is has read atleast one token from the input reader
-   */
-  public Filter1(TokenReader in) throws IOException, InterruptedException
-  {
-    _in = in;
-    _next = _in.read();
-  }
-
-  /**
-   * @see TokenReader
-   */
-  public Token read() throws IOException, InterruptedException
-  {
-    Token cur = _next;
-    Token res = cur;
-    for(;cur!=null;)
-      {
-        _next = _in.read();
-        res = _filter(_prev, cur, _next) ;
-        if (res!=null)
-          {
-            _prev = res;
-            break;
-          }
-        else cur = _next;
-      }
-    return res;
-  }
-
-  /**
-   * Removes extra spaces/newlines and all comments
-   */
-  private Token _filter(Token prev, Token cur, Token next)
-  {
-    //ystem.out.println("filtering token:"+cur);
-    int ccode = cur.code;
-    if ((ccode==Token.COMMENT) ||   //skip comments
-        ((ccode==Token.WHITESPACE) &&
-         !(_isSpaceSensitive(prev) && _isSpaceSensitive(next))) ||
-        ((ccode==Token.NEWLINE) &&
-         ((prev==null) || (prev.code==Token.NEWLINE))))
-      return null;
-    else return cur;
-  }
-
-  /**
-   * @return true if the given token is affected by whitespace preceding or
-   *  following it.
-   */
-  private boolean _isSpaceSensitive(Token tok)
-  {
-    if (tok==null) return false;
-    int i = tok.code;
-    if ((i == Token.NAME) || (i == Token.NUMBER) || (i == Token.RESERVED) ||
-        (i == Token.PERIOD))
-      return true;
-    else return false;
-  }
-
-  private final TokenReader _in;
-  private Token _prev = null;
-  private Token _next;
+/*
+ * Copyright 2000-2001,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.uixtools;
+
+import java.io.IOException;
+
+/**
+ * Removes all comments and redundant whitespace
+ * @version $Name:  $ ($Revision$) $Date$
+ * @author Arjuna Wijeyekoon - arjuna.wijeyekoon@oracle.com
+ */
+public class Filter1 implements TokenReader
+{
+
+  /**
+   * blocks until is has read atleast one token from the input reader
+   */
+  public Filter1(TokenReader in) throws IOException, InterruptedException
+  {
+    _in = in;
+    _next = _in.read();
+  }
+
+  /**
+   * @see TokenReader
+   */
+  public Token read() throws IOException, InterruptedException
+  {
+    Token cur = _next;
+    Token res = cur;
+    for(;cur!=null;)
+      {
+        _next = _in.read();
+        res = _filter(_prev, cur, _next) ;
+        if (res!=null)
+          {
+            _prev = res;
+            break;
+          }
+        else cur = _next;
+      }
+    return res;
+  }
+
+  /**
+   * Removes extra spaces/newlines and all comments
+   */
+  private Token _filter(Token prev, Token cur, Token next)
+  {
+    //ystem.out.println("filtering token:"+cur);
+    int ccode = cur.code;
+    if ((ccode==Token.COMMENT) ||   //skip comments
+        ((ccode==Token.WHITESPACE) &&
+         !(_isSpaceSensitive(prev) && _isSpaceSensitive(next))) ||
+        ((ccode==Token.NEWLINE) &&
+         ((prev==null) || (prev.code==Token.NEWLINE))))
+      return null;
+    else return cur;
+  }
+
+  /**
+   * @return true if the given token is affected by whitespace preceding or
+   *  following it.
+   */
+  private boolean _isSpaceSensitive(Token tok)
+  {
+    if (tok==null) return false;
+    int i = tok.code;
+    if ((i == Token.NAME) || (i == Token.NUMBER) || (i == Token.RESERVED) ||
+        (i == Token.PERIOD))
+      return true;
+    else return false;
+  }
+
+  private final TokenReader _in;
+  private Token _prev = null;
+  private Token _next;
 }

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



Mime
View raw message