[Templates-cvs] cvs commit: Template2/parser Parser.yp

cvs@template-toolkit.org cvs@template-toolkit.org
Mon, 01 Dec 2003 16:06:37 +0000


cvs         03/12/01 16:06:36

  Modified:    parser   Parser.yp
  Log:
  added file/line info to compiled templates
  
  Revision  Changes    Path
  2.17      +4 -3      Template2/parser/Parser.yp
  
  Index: Parser.yp
  ===================================================================
  RCS file: /template-toolkit/Template2/parser/Parser.yp,v
  retrieving revision 2.16
  retrieving revision 2.17
  diff -u -r2.16 -r2.17
  --- Parser.yp	2003/04/28 17:28:59	2.16
  +++ Parser.yp	2003/12/01 16:06:35	2.17
  @@ -37,7 +37,7 @@
   #
   #------------------------------------------------------------------------
   #
  -# $Id: Parser.yp,v 2.16 2003/04/28 17:28:59 abw Exp $
  +# $Id: Parser.yp,v 2.17 2003/12/01 16:06:35 abw Exp $
   #
   #========================================================================
   
  @@ -74,10 +74,11 @@
   ;
   
   chunk:	    TEXT		    { $factory->textblock($_[1])          }
  -	|   statement ';'
  +	|   statement ';'           { my $line = ${$_[0]->{LINE}};
  +                                      $line =~ s/\-.*$//;
  +                                      "#line $line \"$_[0]->{FILEINFO}->[-1]->{path}\"\n$_[1]" }
   ;
   
  -                          # { "#line ${$_[0]->{LINE} \"template\"\n$_[1]" }
   statement:  directive      
   	|   defblock
   	|   anonblock