You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@velocity.apache.org by ge...@locus.apache.org on 2000/12/11 05:36:04 UTC

cvs commit: jakarta-velocity/src/java/org/apache/velocity/runtime/parser/node ASTDirective.java ASTEscape.java ASTReference.java ASTStringLiteral.java

geirm       00/12/10 20:36:04

  Modified:    src/java/org/apache/velocity/runtime/parser/node
                        ASTDirective.java ASTEscape.java ASTReference.java
                        ASTStringLiteral.java
  Log:
  No functional changes.  Aligned var decls with convention.
  
  Revision  Changes    Path
  1.12      +13 -13    jakarta-velocity/src/java/org/apache/velocity/runtime/parser/node/ASTDirective.java
  
  Index: ASTDirective.java
  ===================================================================
  RCS file: /home/cvs/jakarta-velocity/src/java/org/apache/velocity/runtime/parser/node/ASTDirective.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- ASTDirective.java	2000/12/10 04:49:51	1.11
  +++ ASTDirective.java	2000/12/11 04:36:03	1.12
  @@ -64,7 +64,7 @@
    *
    * @author <a href="mailto:jvanzyl@periapt.com">Jason van Zyl</a>
    * @author <a href="mailto:geirm@optonline.net">Geir Magnusson Jr.</a>
  - * @version $Id: ASTDirective.java,v 1.11 2000/12/10 04:49:51 geirm Exp $ 
  + * @version $Id: ASTDirective.java,v 1.12 2000/12/11 04:36:03 geirm Exp $ 
   */
   
   package org.apache.velocity.runtime.parser.node;
  @@ -81,10 +81,10 @@
   public class ASTDirective extends SimpleNode
   {
       private Directive directive;
  -    private String strDirectiveName_ = "";
  +    private String directiveName = "";
       private boolean isDirective;
   
  -    int iParseDepth_ = 0;
  +    int parseDepth = 0;
   
       public ASTDirective(int id)
       {
  @@ -109,29 +109,29 @@
            *  only do things that are not context dependant
            */
   
  -        if (parser.isDirective( strDirectiveName_ ))
  +        if (parser.isDirective( directiveName ))
           {
               isDirective = true;
               
  -            directive = (Directive) parser.getDirective( strDirectiveName_ )
  +            directive = (Directive) parser.getDirective( directiveName )
                   .getClass().newInstance();
               
               /*
                *  we need to treat #parse differently, alas
                */
  -            if (strDirectiveName_.equals("parse"))
  -                ( (Parse) directive).setParseDepth( iParseDepth_ );
  +            if ( directiveName.equals("parse"))
  +                ( (Parse) directive).setParseDepth( parseDepth );
               
               directive.init(context,this);
           }          
  -        else if (Runtime.isVelocimacro( strDirectiveName_, context.getCurrentTemplateName()  )) 
  +        else if (Runtime.isVelocimacro( directiveName, context.getCurrentTemplateName()  )) 
           {
               /*
                *  we seem to be a Velocimacro.
                */
   
               isDirective = true;
  -            directive = (Directive) Runtime.getVelocimacro( strDirectiveName_, context.getCurrentTemplateName() );
  +            directive = (Directive) Runtime.getVelocimacro( directiveName, context.getCurrentTemplateName() );
               directive.init( context, this );
           } 
           else
  @@ -155,7 +155,7 @@
           }
           else
           {
  -            writer.write( "#" +   strDirectiveName_);
  +            writer.write( "#" + directiveName );
           }
   
           return true;
  @@ -167,7 +167,7 @@
        */
       public void setDirectiveName( String str )
       {
  -        strDirectiveName_ = str;
  +        directiveName = str;
           return;
       }
   
  @@ -176,7 +176,7 @@
        */
       public String getDirectiveName()
       {
  -        return strDirectiveName_;
  +        return directiveName;
       }
   
       /**
  @@ -184,7 +184,7 @@
        */
       public void setParserDepth( int i)
       {
  -        iParseDepth_ = i;
  +        parseDepth = i;
       }
   }
   
  
  
  
  1.2       +6 -5      jakarta-velocity/src/java/org/apache/velocity/runtime/parser/node/ASTEscape.java
  
  Index: ASTEscape.java
  ===================================================================
  RCS file: /home/cvs/jakarta-velocity/src/java/org/apache/velocity/runtime/parser/node/ASTEscape.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ASTEscape.java	2000/11/11 22:41:45	1.1
  +++ ASTEscape.java	2000/12/11 04:36:03	1.2
  @@ -62,7 +62,7 @@
    * what controls the generation of this class.
    *
    * @author <a href="mailto:geirm@optonline.net">Geir Magnusson Jr.</a>
  - * @version $Id: ASTEscape.java,v 1.1 2000/11/11 22:41:45 geirm Exp $ 
  + * @version $Id: ASTEscape.java,v 1.2 2000/12/11 04:36:03 geirm Exp $ 
   */
   
   package org.apache.velocity.runtime.parser.node;
  @@ -75,7 +75,7 @@
   
   public class ASTEscape extends SimpleNode {
   
  -    private String strText_ = "";
  +    private String text = "";
     
       public ASTEscape(int id) {
           super(id);
  @@ -90,16 +90,17 @@
           return visitor.visit(this, data);
       }
       
  -    public Object init(Context context, Object data) throws Exception
  +    public Object init(Context context, Object data) 
  +        throws Exception
       {
  -        strText_ =  getFirstToken().image;
  +        text =  getFirstToken().image;
           return data;
       }
   
       public boolean render(Context context, Writer writer)
           throws IOException
       {
  -        writer.write( strText_);
  +        writer.write( text );
           return true;
       }    
   
  
  
  
  1.14      +14 -14    jakarta-velocity/src/java/org/apache/velocity/runtime/parser/node/ASTReference.java
  
  Index: ASTReference.java
  ===================================================================
  RCS file: /home/cvs/jakarta-velocity/src/java/org/apache/velocity/runtime/parser/node/ASTReference.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- ASTReference.java	2000/12/05 05:01:27	1.13
  +++ ASTReference.java	2000/12/11 04:36:03	1.14
  @@ -64,7 +64,7 @@
    *
    * @author <a href="mailto:jvanzyl@periapt.com">Jason van Zyl</a>
    * @author <a href="mailto:geirm@optonline.net">Geir Magnusson Jr.</a>
  - * @version $Id: ASTReference.java,v 1.13 2000/12/05 05:01:27 geirm Exp $ 
  + * @version $Id: ASTReference.java,v 1.14 2000/12/11 04:36:03 geirm Exp $ 
   */
   
   package org.apache.velocity.runtime.parser.node;
  @@ -90,8 +90,8 @@
       private int referenceType;
       private String nullString;
       private String rootString;
  -    private boolean bIsEscaped_ = false;
  -    private String  strPrefix_ = "";
  +    private boolean escaped = false;
  +    private String  prefix = "";
   
       public ASTReference(int id)
       {
  @@ -176,12 +176,12 @@
            *  2) if not, then \$foo  (its considered shmoo, not VTL)
            */
   
  -        if (bIsEscaped_)
  +        if ( escaped )
           {
               if ( value == null )
  -                writer.write( NodeUtils.specialText(getFirstToken()) + strPrefix_ + "\\" +  nullString );
  +                writer.write( NodeUtils.specialText(getFirstToken()) + prefix + "\\" +  nullString );
               else
  -                writer.write( NodeUtils.specialText(getFirstToken()) + strPrefix_ + nullString );
  +                writer.write( NodeUtils.specialText(getFirstToken()) + prefix + nullString );
           
               return true;
           }
  @@ -196,14 +196,14 @@
                *  write prefix twice, because it's shmoo, so the \ don't escape each other...
                */
   
  -            writer.write(NodeUtils.specialText(getFirstToken()) + strPrefix_ + strPrefix_ + nullString);
  +            writer.write(NodeUtils.specialText(getFirstToken()) + prefix + prefix + nullString);
               
               if (referenceType != QUIET_REFERENCE && Runtime.getBoolean( RuntimeConstants.RUNTIME_LOG_REFERENCE_LOG_INVALID, true) )
                   Runtime.warn(new ReferenceException("reference : template = " + context.getCurrentTemplateName(), this));
           }                    
           else
           {
  -            writer.write(NodeUtils.specialText(getFirstToken()) + strPrefix_ + value.toString());
  +            writer.write(NodeUtils.specialText(getFirstToken()) + prefix + value.toString());
           }                    
       
           return true;
  @@ -258,7 +258,7 @@
            * How many child nodes do we have?
            */
   
  -         int children = jjtGetNumChildren();
  +        int children = jjtGetNumChildren();
   
           for (int i = 0; i < children - 1; i++)
           {
  @@ -308,7 +308,7 @@
            *  as \$foo or $foo later on in render(). Lazyness..
            */
   
  -        bIsEscaped_ = false;
  +        escaped = false;
   
           if ( t.image.startsWith("\\"))
           {
  @@ -317,16 +317,16 @@
                */
   
               int i = 0;
  -            int iLen = t.image.length();
  +            int len = t.image.length();
   
  -            while( i < iLen && t.image.charAt(i) == '\\' )
  +            while( i < len && t.image.charAt(i) == '\\' )
                   i++;
   
               if ( (i % 2) != 0 )                
  -                bIsEscaped_ = true;
  +                escaped = true;
   
               if (i > 0)
  -                strPrefix_ = t.image.substring(0, i / 2 );
  +                prefix = t.image.substring(0, i / 2 );
   
               t.image = t.image.substring(i);
           }
  
  
  
  1.5       +4 -5      jakarta-velocity/src/java/org/apache/velocity/runtime/parser/node/ASTStringLiteral.java
  
  Index: ASTStringLiteral.java
  ===================================================================
  RCS file: /home/cvs/jakarta-velocity/src/java/org/apache/velocity/runtime/parser/node/ASTStringLiteral.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- ASTStringLiteral.java	2000/12/05 05:05:36	1.4
  +++ ASTStringLiteral.java	2000/12/11 04:36:03	1.5
  @@ -59,7 +59,7 @@
    *
    * @author <a href="mailto:geirm@optonline.net">Geir Magnusson Jr.</a>
    * @author <a href="mailto:jvanzyl@periapt.com">Jason van Zyl</a>
  - * @version $Id: ASTStringLiteral.java,v 1.4 2000/12/05 05:05:36 geirm Exp $
  + * @version $Id: ASTStringLiteral.java,v 1.5 2000/12/11 04:36:03 geirm Exp $
    */
   
   package org.apache.velocity.runtime.parser.node;
  @@ -117,19 +117,19 @@
                   /*
                    *  parse the stringlit
                    */
  -                SimpleNode nodeTree_ = Runtime.parse( inStream, context.getCurrentTemplateName() );        
  +                SimpleNode nodeTree = Runtime.parse( inStream, context.getCurrentTemplateName() );        
                   
                   /*
                    *  init with a cloned context
                    */
                   Context ctxt = (Context) context.clone();
  -                nodeTree_.init( ctxt, null );
  +                nodeTree.init( ctxt, null );
                   
                   /*
                    *  now render against the real context
                    */
                   StringWriter writer = new StringWriter();
  -                nodeTree_.render(context, writer );
  +                nodeTree.render(context, writer );
                   
                   /*
                    * and return the result as a String
  @@ -152,4 +152,3 @@
   
       }
   }
  -