texinfo-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[5206] * tp/Texinfo/Parser.pm: use tell to find the position of


From: Patrice Dumas
Subject: [5206] * tp/Texinfo/Parser.pm: use tell to find the position of the
Date: Mon, 25 Feb 2013 21:20:24 +0000

Revision: 5206
          http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=5206
Author:   pertusus
Date:     2013-02-25 21:20:23 +0000 (Mon, 25 Feb 2013)
Log Message:
-----------
        * tp/Texinfo/Parser.pm: use tell to find the position of the 
        beginning of the line.

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/tp/Texinfo/Common.pm
    trunk/tp/Texinfo/Parser.pm

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog     2013-02-24 23:34:39 UTC (rev 5205)
+++ trunk/ChangeLog     2013-02-25 21:20:23 UTC (rev 5206)
@@ -1,3 +1,8 @@
+2013-02-25  Patrice Dumas  <address@hidden>
+
+       * tp/Texinfo/Parser.pm: use tell to find the position of the 
+       beginning of the line.
+
 2013-02-24  Karl Berry  <address@hidden>
 
        * tp/Makefile.am (install-exec-hook): rm old makeinfo,

Modified: trunk/tp/Texinfo/Common.pm
===================================================================
--- trunk/tp/Texinfo/Common.pm  2013-02-24 23:34:39 UTC (rev 5205)
+++ trunk/tp/Texinfo/Common.pm  2013-02-25 21:20:23 UTC (rev 5206)
@@ -1588,6 +1588,12 @@
   } else {
     return length($string);
   }
+  # FIXME is the following required for correct count of end of lines?
+  #if ($encoding) {
+  #  return length(Encode::encode($encoding, $string));
+  #} else {
+  #  return length(Encode::encode('ascii', $string));
+  #}
 }
 
 # TODO

Modified: trunk/tp/Texinfo/Parser.pm
===================================================================
--- trunk/tp/Texinfo/Parser.pm  2013-02-24 23:34:39 UTC (rev 5205)
+++ trunk/tp/Texinfo/Parser.pm  2013-02-25 21:20:23 UTC (rev 5206)
@@ -830,7 +830,7 @@
 }
 
 # parse a texi file
-sub parse_texi_file ($$)
+sub parse_texi_file($$)
 {
   my $self = shift;
   my $file_name = shift;
@@ -844,15 +844,17 @@
   my $line_nr = 0;
   my $line;
   my @first_lines;
+  # FIXME this won't work on pipes
+  my $line_beginning_position = tell $filehandle;
   while ($line = <$filehandle>) {
     if ($line =~ /^ *\\input/ or $line =~ /^\s*$/) {
       $line =~ s/\x{7F}.*\s*//;
       push @first_lines, $line;
       $line_nr++;
+      $line_beginning_position = tell $filehandle;
     } else {
-      # put the line back in the filehandle
-      seek($filehandle, -Texinfo::Common::count_bytes($self, 
-                       $line, $self->{'INPUT_PERL_ENCODING'}), 1);
+      # go back to the beginning of the line
+      seek($filehandle, $line_beginning_position, 0);
       last;
     }
   }
@@ -1784,7 +1786,7 @@
 
 # begin paragraph if needed.  If not try to merge with the previous
 # content if it is also some text.
-sub _merge_text ($$$)
+sub _merge_text($$$)
 {
   my $self = shift;
   my $current = shift;
@@ -1943,7 +1945,7 @@
 }
 
 # collect text and line numbers until an end of line is found.
-sub _new_line ($$$)
+sub _new_line($$$)
 {
   my $self = shift;
   my $line_nr = shift;
@@ -3501,7 +3503,7 @@
   }
 }
 
-sub _check_internal_node ($$$)
+sub _check_internal_node($$$)
 {
   my $self = shift;
   my $parsed_node = shift;




reply via email to

[Prev in Thread] Current Thread [Next in Thread]