geirm       00/12/05 21:57:18

  Modified:    src/java/org/apache/velocity/runtime/parser Parser.jjt
  Log:
  Added support for template name to pass into VM system for logging and other 
nefarious purposes later.
  
  Revision  Changes    Path
  1.37      +12 -2     
jakarta-velocity/src/java/org/apache/velocity/runtime/parser/Parser.jjt
  
  Index: Parser.jjt
  ===================================================================
  RCS file: 
/home/cvs/jakarta-velocity/src/java/org/apache/velocity/runtime/parser/Parser.jjt,v
  retrieving revision 1.36
  retrieving revision 1.37
  diff -u -r1.36 -r1.37
  --- Parser.jjt        2000/12/05 05:00:49     1.36
  +++ Parser.jjt        2000/12/06 05:57:18     1.37
  @@ -120,7 +120,7 @@
    *
    * @author <a href="mailto:[EMAIL PROTECTED]">Jason van Zyl</a>
    * @author <a href="mailto:[EMAIL PROTECTED]">Geir Magnusson Jr.</a>
  - * @version $Id: Parser.jjt,v 1.36 2000/12/05 05:00:49 geirm Exp $ 
  + * @version $Id: Parser.jjt,v 1.37 2000/12/06 05:57:18 geirm Exp $ 
   */
   public class Parser
   {
  @@ -129,6 +129,12 @@
        */
       private Hashtable directives = new Hashtable(0);
     
  +    /**
  +     *  Name of current template we are parsing.  Passed to us in parse()
  +     */
  +
  +    String strCurrentTemplateName = "";
  +
       /** 
        * This constructor was added to allow the re-use of parsers.
        * The normal constructor takes a single argument which 
  @@ -153,6 +159,8 @@
       public SimpleNode parse(InputStream stream, String strTemplateName ) throws 
ParseException
       {
           SimpleNode sn = null;
  +        
  +        strCurrentTemplateName = strTemplateName;
   
           try
           {
  @@ -171,6 +179,8 @@
               Runtime.error ("Parser Error: " + strTemplateName + " : " + 
StringUtils.stackTrace(e));
           }
   
  +        strCurrentTemplateName = "";
  +
           return sn;
       }        
   
  @@ -1155,7 +1165,7 @@
           if (bDoItNow)  
           {
               Macro m = new Macro();
  -            m.processAndRegister( jjtThis );
  +            m.processAndRegister( jjtThis, strCurrentTemplateName );
           }
   
           /*
  
  
  

Reply via email to