You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@locus.apache.org on 2000/03/06 01:33:54 UTC

cvs commit: jakarta-tomcat/src/share/org/apache/jasper/compiler MappedCharDataGenerator.java Parser.java

mandar      00/03/05 16:33:53

  Modified:    src/share/org/apache/jasper/compiler
                        MappedCharDataGenerator.java Parser.java
  Log:
  Generating correct line number mappings for
  compile-time includes and user-defined tags.
  This is useful for debugging (for tools).
  
  Revision  Changes    Path
  1.2       +5 -9      jakarta-tomcat/src/share/org/apache/jasper/compiler/MappedCharDataGenerator.java
  
  Index: MappedCharDataGenerator.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/jasper/compiler/MappedCharDataGenerator.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- MappedCharDataGenerator.java	2000/02/23 02:23:44	1.1
  +++ MappedCharDataGenerator.java	2000/03/06 00:33:51	1.2
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/jasper/compiler/MappedCharDataGenerator.java,v 1.1 2000/02/23 02:23:44 mandar Exp $
  - * $Revision: 1.1 $
  - * $Date: 2000/02/23 02:23:44 $
  + * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/jasper/compiler/MappedCharDataGenerator.java,v 1.2 2000/03/06 00:33:51 mandar Exp $
  + * $Revision: 1.2 $
  + * $Date: 2000/03/06 00:33:51 $
    *
    * ====================================================================
    * 
  @@ -71,14 +71,10 @@
    *
    * @author Mandar Raje
    */
  -public class MappedCharDataGenerator 
  -    extends GeneratorBase
  -    implements ServiceMethodPhase
  -{
  -    char[] chars;
  +public class MappedCharDataGenerator extends CharDataGenerator {
       
       public MappedCharDataGenerator(char[] chars) {
  -	this.chars = chars;
  +	super(chars);
       }
   
       public void generate(ServletWriter writer, Class phase) {
  
  
  
  1.17      +19 -1     jakarta-tomcat/src/share/org/apache/jasper/compiler/Parser.java
  
  Index: Parser.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/jasper/compiler/Parser.java,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- Parser.java	2000/02/25 19:45:38	1.16
  +++ Parser.java	2000/03/06 00:33:52	1.17
  @@ -96,6 +96,13 @@
       Mark tmplStart;
       Mark tmplStop;
   
  +    /*
  +     * Name of the current file.
  +     * Useful to preserve the line number information in
  +     * case of an include.
  +     */
  +    String currentFile;
  +
       public interface Action {
           void execute(Mark start, Mark stop) throws JasperException;
       }
  @@ -111,6 +118,7 @@
                                                          }
                                                      });
   	this.caw = new CharArrayWriter();
  +	this.currentFile = reader.mark().getFile();
       }
   
       static final Vector coreElements = new Vector();
  @@ -828,7 +836,8 @@
                                   // it is JSP body content, so accept all core elements
                                   parser.parse(tagEnd);
                               reader.advance(tagEnd.length());
  -                            listener.handleTagEnd(bodyStart, reader.mark(), prefix, 
  +			    listener.setTemplateInfo(parser.tmplStart, parser.tmplStop);
  +                            listener.handleTagEnd(parser.tmplStop, reader.mark(), prefix, 
                                                     shortTagName, attrs, tli, ti);
                           } else
                               throw new ParseException(start, 
  @@ -1037,6 +1046,14 @@
               if (until != null && reader.matches(until)) 
                   return;
   
  +	    // If the file has changed because of a 'push' or a 'pop'
  +	    // we must flush the character data for the old file.
  +	    if (!reader.mark().getFile().equals(currentFile)) {
  +		flushCharData(tmplStart, tmplStop);
  +		currentFile = reader.mark().getFile();
  +		tmplStart = reader.mark();
  +	    }
  +	    
   	    Enumeration e = coreElements.elements(); 
   
               if (accept != null) {
  @@ -1081,3 +1098,4 @@
   	flushCharData(tmplStart, tmplStop);
       }
   }
  +